1、NEMA Standards PublicationNational Electrical Manufacturers AssociationANSI C12.18-2006 (R2016)Protocol Specification for ANSI Type 2 Optical PortANSI C12.18-2006 (R2016) American National Standard for Protocol Specification for ANSI Type 2 Optical Port Secretariat: National Electrical Manufacturers
2、 Association Approved August 23, 2016 American National Standards Institute, Inc. 2016 National Electrical Manufacturers Association 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 d
3、ocument at the time it was developed. Consensus does not necessarily mean that there is unanimous agreement among every person participating in the development of this document. ANSI standards and guideline publications, of which the document contained herein is one, are developed through a voluntar
4、y consensus standards development 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 to promote fairness in the development of consensus, it does not write the docume
5、nt and 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, w
6、hether 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, expressed or implied, as to the accuracy or completeness of any information published
7、herein, and 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 publish
8、ing and making 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 indepe
9、ndent judgment 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 f
10、or additional 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 certificatio
11、n or other statement of compliance with any health- or safety-related 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 (R2016) Page i 2016 National Electrical Manufacturers Association AMERICA
12、N NATIONAL STANDARD Approval of an American National Standard requires verification by The American National Standards Institute, Inc. (ANSI) that the requirements for due process, consensus, and other criteria for approval have been met by the standards developer. An American National Standard impl
13、ies a consensus of those substantially concerned with its scope and provisions. Consensus is established when, in the judgment of the ANSI Board of Standards Review, substantial agreement has been reached by directly, and materially affected interests. Substantial agreement means much more than a si
14、mple 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 existence of an American National Standard does not in any respect preclude anyone, whether s/he has approved the standard or
15、 not, from manufacturing, marketing, purchasing, or using products, processes, or procedures not conforming to the standards. It is intended as a guide to aid the manufacturer, the consumer, and the general public. The American National Standards Institute, Inc. does not develop standards and will i
16、n no 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, Inc. Requests for interpretations should be address
17、ed to the secretariat or sponsor whose name appears on this title page. CAUTION NOTICE: This American National Standard may be revised or withdrawn at any time. The procedures of the American National Standards Institute, Inc., require that action be taken periodically to reaffirm, revise, or withdr
18、aw this standard. Purchasers of American National Standards may receive current information on all standards by calling or writing the American National Standards Institute, Inc. Published by National Electrical Manufacturers Association 1300 North 17thStreet, Suite 900 Rosslyn, Virginia 22209 2016
19、National Electrical Manufacturers Association All rights, 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 th
20、is publication may be reproduced in any form, in an electronic retrieval system or otherwise, without prior written permission of the publisher. Printed in the United States of America ANSI C12.18-2006 (R2016) Page ii 2016 National Electrical Manufacturers Association Foreword (This foreword is not
21、part of American National Standard C12.18) This American National Standard provides an open-platform 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 ANS
22、I C12.18 will discover many editing changes to this version of the standard. The Working Group 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 cont
23、ext of the so-called “protocol suite” of ANSI standards: C12.18, C12.19, C12.21 and C12.22 (draft). 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 origina
24、l standard: the impossibility of using index-count for table access. Other concepts addressed include 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 per
25、formed to meet the goal of producing a coherent suite of protocol standards. Suggestions for improvement to this standard are welcome. They should be sent to: National Electrical Manufacturers Association Senior Technical Director 1300 North 17thStreet Suite 900 Rosslyn, VA 22209 This standard was p
26、rocessed and approved for submittal to ANSI by Accredited Standards Committee for Electricity Metering C12. At the time the committee approved this standard, the C12 Committee had the following members: Tom Nelson, Chairman Paul Orr, Secretary Organization Represented Name of Representative Organiza
27、tion Represented Name of Representative General Interest Elevate Energy L. Kotewa NIST T. Nelson ERCOT EnerNex LLC D. Tucker A. Snyder Power Measurements, LLC W. Hardy Future DOS R e.g.,1.2.840.10066.0.,encoded as described in ISO/IEC8825-1 (2002), Basic Encoding Rules(BER). The last 4 bytes of this
28、identifier shall be identical to thevalues delivered in the C12.19 Tableelements MANUFACTURER as defined inTable 00 of ANSI C12.19-1997 or theDEVICE_CLASS as defined by Version 2of ANSI C12.19.:= 0DH The relative encoding of the C12.19Device Class relative to theuniversal identifier1.2.840.10066.0,
29、encoded asdescribed in ISO/IEC 8825-1 (2002),Basic Encoding Rules (BER).Theshall range between 00H to 04H resulting in up to 4 bytes being transmitted. These 4 bytes shall be identical to the C12.19 Table elements MANUFACTURER as defined in Table 00 of ANSI C12.19-1997 or the DEVICE_CLASS as defined
30、 by Version 2 of ANSI C12.19, with assumed 00H trailing pad. := Length of number of bytes that follow. This value shall range between 00H to 7FH. := +Absolute object identifier encoded as described in ISO/IEC 8825-1 (2002), Basic Encoding Rules (BER). The size of this field shall not exceed 127 byte
31、s. := +Relative object identifier encoded as described in ISO/IEC 8825-1 (2002), Basic Encoding Rules (BER). The size of this field shall not exceed 4 bytes. := 07H An Identifier that uniquelyidentifies a C12.19 Device in theapplication space of the C12.19Device. This provides for earlydetection of
32、the deviceidentification element as perIDENTIFICATION of Table 05,DEVICE_IDENT_TBL, or DEVICE_ID foundin Table 06 of ANSI C12.19. TheANSI C12.18-2006 (R2016) Page 9 2016 National Electrical Manufacturers Association C12.19 featureshall be supplied when the C12.19Device Table 05 or Table 06 arereadab
33、le immediately following theLogon Service. When C12.19 Deviceidentification is provided, it shallnot be preceded by features withcodes that are less than 07H.:= Length of number of bytes that follow in . This value shall range between 00H to 7FH. := Provides for disclosure of theC12.19 Device identi
34、fication.:= The character encoding format of the bytes which make up. Itsinterpretation shall be according tothe relevant ANSI C12.19 Standarddata model referenced by the C12.19registered Device Class feature.When the feature is not supplied in this response, the value of shall be set to 01H, and sh
35、all be encoded according to ISO 7-bit coded character set for information interchange, per ISO/IEC 646 (1991). := * The C12.19 Device identification string encoded and transmitted according to . If the C12.19 Device ID_FORM in Table 00 is set to BCD, then the BCD digits shall be transmitted as their
36、 text equivalent also encoded as per char- format. For example, assuming that the C12.19 Device GEN_CONFIG_TBL.ID_FORMis BCD and the Device GEN_CONFIG_TBL.CHAR_FORMAT is ISO 7bit ASCII, as per ISO/IEC 646(1991), then the BCD digits 00H 01H 02H 03H 0AH 04H 0DH 05H 06H 07H shallbe transmitted as the c
37、haractersequence “123-4.567”.The C12.19application shall logically pad thisstring with trailing spaces asneeded to fill the identificationfield width of the C12.19 Device.ANSI C12.18-2006 (R2016) Page 10 2016 National Electrical Manufacturers Association 4.2.2.4 Read Service The Read Service is used
38、 to transfer table data to the requesting device and shall be initiated only during a session that was successfully established using the logon service. At least one (1) form of the Read Service is required to be supported by a C12.18 Device. Request: The Read Service request supports both complete
39、and partial table transfers. The retrieval of a portion of a table is possible through the use of both index/element-count and offset/octet-count methods. The complete rule set for using these methods is enumerated in Sections 4.2.2.12, Partial Table Access Using the Index/element-count Method, and
40、4.2.2.14, Partial Table Access Using the Offset/octet-count Method, respectively. Codes 30H39H, 3EH and 3FH are the Read Service request codes. Request code 30H specifies a complete table transfer. Request codes 31H through 39H specify a partial table transfer using 1 to 9 indices. Request code 3EH
41、specifies a default table transfer. Request code 3FH specifies a partial table transfer using the offset/octet-count method. := | | | := 30H := +:= 31H | 1 included in request 32H |2includedinrequest33H |3includedinrequest34H |4includedinrequest35H |5includedinrequest36H |6includedinrequest37H |7inc
42、ludedinrequest38H |8includedinrequest39H 9includedinrequest:= 3EH Transfer default Table as defined by the C12.19 Device. := 3FH := Table identifier as defined in ANSI C12.19. := Offset into data Table in bytes. Offset 0000H is the offset to the first table element of the Table selected by .:= Index
43、 value used to locate start of data. Index 0000H is the index of the first Table element of the Table selected by .:= Number of Table elements to read starting at the requested index.:= Length of Table data requested starting at Table , in bytes.ANSI C12.18-2006 (R2016) Page 11 2016 National Electri
44、cal Manufacturers Association Response: Responses of type indicate a problem with the received Read Service request. The response indicates the Read Service was accepted and the data is part of the response. := | := := Length of returned, in bytes. := *The returned Table data including the optional
45、pending header as per ANSI C12.19, when requested. := 2s compliment checksum computed only on the portion of .The checksum is computed by summing the bytes (ignoring overflow) and negating the result. 4.2.2.5 Write Service The Write Service is issued to transfer table data to the target device and s
46、hall be initiated during a session that was successfully established using the logon service. The Write Service is an optional service. Request: The Write Service request allows both complete and partial table transfers. The modification of a portion of a table is possible through the use of both in
47、dex/element-count and offset/octet-count methods. The complete rule set for using these methods is enumerated in Sections 4.2.2.12 and 4.2.2.14, respectively. Codes 40H49H and 4FH are the Write Service request codes. Request code 40H specifies a complete table transfer. Request codes 41H through 49H
48、 specify a partial table transfer using 1 to 9 indices. Request code 4FH specifies a partial table transfer using the offset/octet-count method. := | | := := 40H +:= 41H | 1 included in request 42H |2includedinrequest43H |3includedinrequest44H |4includedinrequest45H |5includedinrequest46H |6included
49、inrequest47H |7includedinrequest48H |8includedinrequest49H 9includedinrequest:= 4FH ANSI C12.18-2006 (R2016) Page 12 2016 National Electrical Manufacturers Association := Table identifier, as defined in ANSI Standard C12.19.:= Offset into data Table, in bytes. Offset 0000H is the offset to the first element of the Table selected by .:= Index value used to locate start of data. Index 0000H is the index of the first element of the Table selected by .:= :