1、NEMA Standards PublicationNational Electrical Manufacturers AssociationANSI C12.18-2006Protocol Specification for ANSI Type 2 Optical PortANSI C12.18-2006 Revision of ANSI C12.18-1996 American National Standard Protocol Specification for ANSI Type 2 Optical Port Secretariat: National Electrical Manu
2、facturers Association Approved May 2, 2006 American National Standards Institute, Inc. ANSI C12.18-2006 NOTICE AND DISCLAIMER The information in this publication was considered technically sound by the consensus of persons engaged in the development and approval of the document at the time it was de
3、veloped. Consensus does not necessarily mean that there is unanimous agreement among every person participating in the development of this document. NEMA standards and guideline publications, of which the document contained herein is one, are developed through a voluntary consensus standards develop
4、ment process. This process brings together volunteers and/or seeks out the views of persons who have an interest in the topic covered by this publication. While NEMA administers the process and establishes rules to promote fairness in the development of consensus, it does not write the document and
5、it does not independently test, evaluate, or verify the accuracy or completeness of any information or the soundness of any judgments contained in its standards and guideline publications. NEMA disclaims liability for any personal injury, property, or other damages of any nature whatsoever, whether
6、special, indirect, consequential, or compensatory, directly or indirectly resulting from the publication, use of, application, or reliance on this document. NEMA disclaims and makes no guaranty or warranty, express or implied, as to the accuracy or completeness of any information published herein, a
7、nd disclaims and makes no warranty that the information in this document will fulfill any of your particular purposes or needs. NEMA does not undertake to guarantee the performance of any individual manufacturer or sellers products or services by virtue of this standard or guide. In publishing and m
8、aking this document available, NEMA is not undertaking to render professional or other services for or on behalf of any person or entity, nor is NEMA undertaking to perform any duty owed by any person or entity to someone else. Anyone using this document should rely on his or her own independent jud
9、gment or, as appropriate, seek the advice of a competent professional in determining the exercise of reasonable care in any given circumstances. Information and other standards on the topic covered by this publication may be available from other sources, which the user may wish to consult for additi
10、onal views or information not covered by this publication. NEMA has no power, nor does it undertake to police or enforce compliance with the contents of this document. NEMA does not certify, test, or inspect products, designs, or installations for safety or health purposes. Any certification or othe
11、r statement of compliance with any health or safetyrelated information in this document shall not be attributable to NEMA and is solely the responsibility of the certifier or maker of the statement. ANSI C12.18-2006 i AMERICAN NATIONAL STANDARD Approval of an American National Standard requires veri
12、fication by ANSI that the requirements for due process, consensus, and other criteria for approval have been met by the standards developer. Consensus is established when, in the judgment of the ANSI Board of Standards Review, substantial agreement has been reached by directly and materially affecte
13、d interests. Substantial agreement means much more than a simple majority, but not necessarily unanimity. Consensus requires that all views and objections be considered, and that a concerted effort be made toward their resolution. The use of American National Standards is completely voluntary; their
14、 existence does not in any respect preclude anyone, whether he has approved the standards or not, from manufacturing, marketing, purchasing, or using products, processes, or procedures not conforming to the standards. The American National Standards Institute does not develop standards and will in n
15、o circumstances give an interpretation of any American National Standard. Moreover, no person shall have the right or authority to issue an interpretation of an American National Standard in the name of the American National Standards Institute. Requests for interpretations should be addressed to th
16、e secretariat or sponsor whose name appears on the title page of this standard. Caution Notice: This American National Standard may be revised or withdrawn at any time. The procedures of the American National Standards Institute require that action be taken periodically to reaffirm, revise, or withd
17、raw this standard. Purchasers of American National Standards may receive current information on all standards by calling or writing the American National Standards Institute. Published by National Electrical Manufacturers Association 1300 North 17th Street, Rosslyn, VA 22209 Copyright 2006 by Nation
18、al Electrical Manufacturers Association All rights reserved including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention for the Protection of Literary and Artistic Works, and the International and Pan American Copyright Conventions. No part of
19、this publication may be reproduced in any form, in an electronic retrieval system or otherwise, without the prior written permission of the publisher. Printed in the United States of AmericaANSI C12.18-2006 ii This page intentionally left blank.ANSI C12.18-2006 iii Contents Page 1 Scope1 2 Reference
20、s .1 3 Definitions and Syntax1 3.1 Definitions.1 3.1.1 C12.18 Client.1 3.1.2 C12.18 Device .1 3.1.3 Point-to-point Communications .1 3.1.4 Table2 3.2 Document Syntax .2 4 Protocol Details 2 4.1 Order of Transmission3 4.2 Layer 7Application Layer 3 4.2.1 Data Structure .3 4.2.2 Protocol Specification
21、s for Electric Metering.3 4.2.2.1 Request Codes.4 4.2.2.2 Response Codes4 4.2.2.3 Identification Service 6 4.2.2.4 Read Service 9 4.2.2.5 Write Service 11 4.2.2.6 Logon Service.12 4.2.2.7 Security Service13 4.2.2.8 Logoff Service.13 4.2.2.9 Negotiate Service .14 4.2.2.10 Wait Service .15 4.2.2.11 Te
22、rminate Service 15 4.2.2.12 Partial Table Access Using the Index/element-count Method .16 4.2.2.13 Index Count Access Method Examples .17 4.2.2.14 Partial Table Access Using the Offset/octet-count Method18 4.3 Layer 6Presentation Layer19 4.4 Layer 5Session Layer .19 4.5 Layer 4Transport Layer.19 4.6
23、 Layer 3Network Layer.19 4.7 Layer 2Data Link Layer.19 4.7.1 Basic Data .19 4.7.1.1 Default Settings 20 4.7.2 Packet20 4.7.3 Duplicate packets 21 4.7.4 CRC selection22 4.7.5 Acknowledgment .22 4.7.6 Retransmission22 4.7.7 Time-out.22 4.7.7.1 Channel Traffic Time-out22 4.7.7.2 Inter-character Time-ou
24、t.22 4.7.7.3 Response Time-out 23 4.7.8 Delays23 4.7.8.1 Turn-around Delay23 4.8 Layer-1Physical Layer 23 4.8.1 Physical .23 4.8.2 Basic Data .24 4.8.3 Light Levels .24 4.8.3.1 Optical Characteristics .24 4.8.3.2 Transmitter Characteristics 24 ANSI C12.18-2006 iv 4.8.3.3 Receiver Characteristics 25
25、4.8.3.4 Environmental Lighting Condition.26 5 Compliance.26 Annex A - Communication Example (Layer 7 and Layer 2) .27 Annex B - Packet Transmission Example.29 Annex C - Service Sequence State Control31 Annex D Compatibility33 D.1 Backward compatibility with previous versions of the Standard 33 D.2 F
26、orward compatibility with next versions of the Standard33 Annex E - Historical Background 35 E.1 Foreword of C12.18-1996 and C12.18-1996 (R2002) .35 ANSI C12.18-2006 v Foreword (This Foreword is not part of American National Standard C12.18-2006.) This American National Standard provides an open-pla
27、tform communications protocol for two-way communication with a metering device through an ANSI Type 2 Optical Port. The protocol is written to conform to the OSI seven-layer stack. Long-time readers of ANSI C12.18 will discover many editing changes to this version of the Standard. The Working Group
28、chose to improve the clarity of the text as an aid to the reader while retaining the Normative elements in the manner of previous publications. The 2006 revision of this Standard was considered in the context of the so-called “protocol suite” of ANSI standards: C12.18, C12.19, C12.21 and C12.22 (dra
29、ft). Changes made were included only after assuring that existing devices implementing C12.18 would continue to remain compatible with the 2005 revision. This revision has corrected an error in the original standard: the impossibility of using index-count for table access. Other concepts addressed i
30、nclude compliance, backward and forward compatibility, the use of reserved fields, the Identification Service, packet size and the toggle bit. Finally, some alignment with the draft C12.22 standard was performed to meet the goal of producing a coherent suite of protocol standards. Suggestions for im
31、provement to this Standard are welcome. They should be sent to: National Electrical Manufacturers Association Vice President of Engineering 1300 North 17th Street Suite 1752 Rosslyn, VA 22209 This Standard was processed and approved for submittal to ANSI by Accredited Standards Committee for Electri
32、city Metering C12. At the time the committee approved this Standard, the C12 Committee had the following members: Tom Nelson, Chairman Paul Orr, Secretary Michael Anderson Ed Beroset Ron Breschini Curt Crittenden David Ellis Cruz Gomez Bob Hughes Lawrence Kotewa Francis Marta John McEvoy Herman Mill
33、ican James Mining Avygdor Moise Tim Morgan Roy Moxley D. Young Nguyen Lauren Pananen Aaron Snyder Richard Tucker Scott Weikel ANSI C12.18-2006 vi Working Group 4 of Subcommittee 17 that developed the Standard consisted of: Aaron Snyder, Chairman Peter Martin, Vice Chairman Norbert Balko, Editor Mich
34、ael Anderson Ed Beroset Martin Burns Janice Jennings Lawrence Kotewa Robert McMichael Avygdor Moise Vuong Nguyen Terry Penn Bin Qiu Richard Tucker Michel Veillette Virginia Zinkowski 1 AMERICAN NATIONAL STANDARD ANSI C12.18-2006 Protocol Specification for ANSI Type 2 Optical Port 1 Scope This Standa
35、rd details the criteria required for communications between a C12.18 Device and a C12.18 Client via an optical port. The C12.18 Client may be a handheld reader, a portable computer, a master station system or some other electronic communications device. This Standard provides details for a complete
36、implementation of an OSI 7-layer model. The protocol specified in this document was designed to transport data in Table format. The Table definitions are in ANSI C12.19 Utility Industry End Device Data Tables. 2 References ANSI C12.19, Utility Industry End Device Data Tables ANSI C12.21, Protocol Sp
37、ecification for Telephone Modem Communication ISO/IEC 646 (1991), Information Technology - ISO 7-Bit Coded Character Set For Information Interchange ISO/IEC 7498-1 (1994), Information Technology - Open Systems Interconnection - Basic Reference Model: The Basic Model ISO/IEC 8825-1 (2002), Informatio
38、n Technology - ASN.1 Encoding Rules: Specification Of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) And Distinguished Encoding Rules (DER) ISO/IEC 13239 (2002), Information Technology - Telecommunications And Information Exchange Between Systems - High-Level Data Link Control (HDLC) Pro
39、cedures 3 Definitions and Syntax 3.1 Definitions For the purposes of this Standard, the following definitions are made. 3.1.1 C12.18 Client An electronic communication apparatus that attaches to the ANSI Type 2 Optical Port of a C12.18 Device and implements communication according to the protocol sp
40、ecification of this Standard. 3.1.2 C12.18 Device An electronic communication apparatus that implements an ANSI Type 2 Optical Port for communication according to the protocol specification of this Standard. 3.1.3 Point-to-point Communications Point-to-point communications is defined as communicatio
41、n between two devices through a single optical interface. ANSI C12.18-2006 2 3.1.4 Table Functionally related data elements, grouped together into a single data structure for transport as defined by ANSI C12.19. 3.2 Document Syntax Describing data definitions is usually accomplished within the confi
42、nes of a given language and the grammar rules of that language. Since the data definitions embodied within this Standard are meant to be independent of specific language and, hopefully, capable of being implemented within the confines of any language, a method for describing the data definitions mus
43、t be developed. A modified form of the Backus-Naur Form (BNF) will serve as the basis for building the descriptions used to construct the data definitions. The modified form of BNF has the following definitions: Symbol Meaning A string contained inside angle brackets is called a non-terminal. That i
44、s, while it may be viewed as a single unit, it can and should be redefined as consisting of one (1) or more simpler elements. := This symbol is read as “is defined as.” The non-terminal which occurs on the left hand side (LHS) of this symbol consists of the elements (non-terminals, terminals, or a c
45、ombination of the two) found on the right hand side (RHS). A line containing an LHS, :=, and an RHS is known as a production rule. | The vertical bar is an “OR” symbol. The OR symbol always occurs on the right hand side of a production where the left hand side can be defined in more than one way. Th
46、e OR bar separates valid alternative right hand sides. A symbol enclosed in square brackets is optional. The production is valid whether or not it is included. *The superscript asterisk is known as the Kleene star. A symbol followed by the Kleene star may occur zero (0) or more times without violati
47、ng the grammar. +The superscript plus sign is known as the Kleene cross. A symbol followed by the Kleene cross must occur one (1) or more times. +nA symbol followed by the Kleene cross and any number “n” represents “n” occurrences of the symbol. The curly braces are used to enclose comments within t
48、he descriptions. Comments have no impact on the productions. 4 Protocol Details Following the guidelines established by the OSI seven-layer model, the protocol described in this Standard provides three (3) functions: 1) Establishment and modification of the communication channel 2) Transport of info
49、rmation to and from the C12.18 Device 3) Orderly closure of the communication channel when communications are complete ANSI C12.18-2006 3 Three (3) layers are used to provide these communication capabilities. These are the Physical, Data Link and Application layers. With the default conditions established by this Standard, the communication channel is considered always available once the physical connection has been completed. The required Identification Service is used to obtain the protocol version and revision in use by the C12.18 Device. Certain communication paramet