Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU FCG TS62769-115-2 Edition 1.2.0 23 Jul 2019 RELEASED S P E C I F I C A T I O N Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2 , Ed. 1.2.0, 23 Jul 2019 Page 1 of 11 Document Distribution / Maintenance Control / Document Approval To obtain information concerning document distribution control, maintenance control, and document approval please contact FieldComm Group at the address shown below. Copyright © 2019 (2017) FieldComm Group, PROFIBUS Nutzerorganisation e. V., OPC Foundation, FDT Group FieldComm Group, PROFIBUS Nutzerorganisation e.V, OPC Foundation, and FDT Group are the joint publishers of this document. The information in this document is subject to change without notice and should not be construed as a commitment by the publishers. The publishers assume no responsibility for any errors that may appear in this document. In no event shall the publishers be liable for direct, indirect, special, incidental or consequential damages of any nature or kind arising from the use of this document. This document and parts thereof must not be reproduced or copied without written permission from the publishers, and the contents thereof must not be imparted to a third party nor used for any unauthorized purpose. All rights to copyrights, registered trademarks or applications, utility models and registered patents or applications reside with their respective owners. Trademark Information FieldComm Group ™ , F OUNDATION ™ Fieldbus and HART-IP ™ are trademarks, and HART ® , WirelessHART ® , ROM ® and SIF ® are registered trademarks of FieldComm Group, Austin, Texas, USA Any use of these terms hereafter in this document, or in any document referenced by this document, implies the trademark/registered trademark. All other trademarks used in this or referenced documents are trademarks of their respective companies. For more information, contact: FDT Group 5 Industrieweg 3001 Heverlee Belgium Phone: +32 (0)10 22 22 51 fdtgroup.org FieldComm Group 9430 Research Boulevard Suite 1-120 Austin, TX 78759, USA Phone: (512) 792-2300 Fax: (512) 792-2310 fieldcommgroup.org OPC Foundation Presidential Office 8455 Infirmary Rd., Ravenna, OH 44266 P.O. Box 808 (mailing address) Mantua, Ohio 44255 Phone: (330) 839-8718 opcfoundation.org PROFIBUS Nutzerorganisation e. V. (PNO) PROFIBUS & PROFINET International (PI) Haid-und-Neu-Str. 7 76131 Karlsruhe Germany Phone: +49 721 96 58 590 Fax: +49 721 96 58 589 profibus.com profinet.com Intellectual Property Rights The FieldComm Group (the Group) does not knowingly use or incorporate any information or data into the HART, F OUNDATION Fieldbus and FDI protocol standards, which the Group does not own or have lawful rights to use. Should the Group receive any notification regarding the existence of any conflicting private IPR, the Group will review the disclosure and either (A) determine there is no conflict; (B) resolve the conflict with the IPR owner; or (C) modify the standard to remove the conflicting requirement. In no case does the Group encourage implementers to infringe on any individual's or organization's IPR. Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2, Ed. 1.2.0, 23 Jul 2019 Page 2 of 11 Revision Log Version Date Change Note / History / Reason 0.0.0 20 Nov 2015 Initial Version 0.1.0 08 Feb 2016 Changed addressing to Strings in HEADER 0.2.0 24 Feb 2016 Changed to FCG format and minor changes to HEADER format 0.2.1 06 May 2016 Added chapter 7 explaining how scanning works without function 43. 1.1.0.1 11 May 2016 Updated to new version number 1.1.0.2 26 July 2016 Adapted document to changes in generic protocol annex: Handling of ProfileId and changes to data type of address. 1.1.0.3 19 Dec 2016 New document template 1.1.0.4 24 Feb 2017 New cover page and trademark information 1.2.0.1 17 Oct 2018 Editorial Changes 1.2.0.2 23 July 2019 Editorial Changes Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2 , Ed. 1.2.0, 23 Jul 2019 Page 3 of 11 TABLE OF CONTENTS 1 Scope ........................................................................................................................................................... 4 2 Normative References .................................................................................................................................. 4 3 Terms, definitions, abbreviated terms and Acronyms ................................................................................... 4 3.1 Terms and definitions .................................................................................................................... 4 3.2 Abbreviations ................................................................................................................................ 4 4 Conventions ................................................................................................................................................. 4 4.1 EDDL syntax .................................................................................................................................. 4 4.2 Capitalizations .............................................................................................................................. 5 5 PSDs for ModbusRTU ................................................................................................................................... 5 5.1 General ......................................................................................................................................... 5 5.2 Header .......................................................................................................................................... 5 5.3 ProtocolIdentifier .......................................................................................................................... 7 5.4 Address ......................................................................................................................................... 7 5.5 Manufacturer ................................................................................................................................ 7 5.6 DeviceModel ................................................................................................................................. 7 5.7 DeviceRevision .............................................................................................................................. 7 5.8 SerialNumber ................................................................................................................................ 8 5.9 Tag ................................................................................................................................................ 8 5.10 ProfileId ........................................................................................................................................ 8 5.11 Version ......................................................................................................................................... 8 5.12 ProtocolSupportFile ...................................................................................................................... 8 6 Example for ModbusRTU .............................................................................................................................. 8 6.1 Called functionality (success) ........................................................................................................ 8 6.2 Called Functionality (Error) ........................................................................................................... 9 6.3 EDD Command .............................................................................................................................. 9 7 Scanning .................................................................................................................................................... 10 Bibliography ...................................................................................................................................................... 11 Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2, Ed. 1.2.0, 23 Jul 2019 Page 4 of 11 1 Scope This document defines the protocol-specific definitions (PSDs) as defined in IEC 62769-7 (annex on generic protocol extensions) for the ModbusRTU protocol. 2 Normative References The following documents, in whole or in part, are normatively referenced in this document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. IEC 61804 (all parts), Function blocks (FB) for process control and Electronic Device Description Language (EDDL) IEC 61804-3, Function blocks (FB) for process control and Electronic Device Description Language (EDDL) – Part 3: EDDL syntax and semantics IEC 62541-100:–, OPC Unified Architecture – Part 100: OPC UA for Devices IEC 62769-2, Field Device Integration (FDI) – Part 2: FDI Client IEC 62769-4, Field Device Integration (FDI) – Part 4: FDI Packages IEC 62769-5, Field Device Integration (FDI) – Part 5: FDI Information Model IEC 62769-7, Field Device Integration (FDI) – Part 7: FDI Communication Devices MOD06, Modbus.org: MODBUS over serial line specification and implementation guide V1.02 MOD12, Modbus.org: MODBUS APPLICATION PROTOCOL SPECIFICATION, V1.1b3 3 Terms, definitions, abbreviated terms and Acronyms 3.1 Terms and definitions For the purposes of this document, the terms and definitions given in IEC 61784-1, IEC 61804 series, IEC 62541- 100, IEC 62769-4, IEC 62769-5, and IEC 62769-7 apply. 3.2 Abbreviations For the purposes of this specification, the following abbreviations apply. EDD Electronic Device Description EDDL Electronic Device Description Language (see IEC 61804) FDI Field Device Integration FCG FieldComm Group XML Extensible markup language (see REC-xml-20081126) 4 Conventions 4.1 EDDL syntax This part of IEC 62769 specifies content for the EDD component that is part of FDI Communication Packages. The specification content using EDDL syntax uses the font Courier New . The EDDL syntax is used for method signature, variable, data structure and component declarations. Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2 , Ed. 1.2.0, 23 Jul 2019 Page 5 of 11 4.2 Capitalizations The IEC 62769 series use capitalized terms to emphasize that these terms have a FDI specific meaning. Some of these terms using an acronym as a prefix for example • FDI Client, or • FDI Server. Some of these terms are compound terms such as: • Communication Servers, or • Profile Package. Parameter names or attributes are concatenated to a single term, where the original terms start in this term with a capital letter such as: • ProtocolSupportFile or • ProtocolType. Parameter names or attributes can also be constructed by using an underscore character to concatenate two or more terms such as: • DEVICE_REV or • DEVICE_MODEL 5 PSDs for ModbusRTU 5.1 General The next sections define the protocol-specific definitions for ModbusRTU, more precise the Modbus over serial line protocol using the transmission method RTU (Remote Terminal Unit) [MOD06]. 5.2 Header The HEADER string used to define EDD commands contains the information about what Modbus function is called and what is addressed by the function. It shall contain the attribute FUNCTION and may, depending on the FUNCTION, contain the attribute SUBFUNCTION, READ_ADDRESS, READ_COUNT, WRITE_ADDRESS and WRITE_COUNT. The syntax is <attribute> = “<value>” per attribute, attributes are separated by a space. The value is provided as decimal value, not as hexadecimal value. For example, to read the device identification (function 43 (0x2B) and sub-function 14 (0x0E)) the HEADER string is “FUNCTION=\”43\” SUBFUNCTION=\”14\”” 1 . The values for READ_ADDRESS, READ_COUNT, WRITE_ADDRESS, WRITE_COUNT are restricted to numeric values between 0 and 65536. Table 1 specifies the allowed Modbus FUNCTION values and the usage of the attributes, as well as the used EDD COMMAND OPERATION. 1 NOTE that \ is used as escape character allowing “ in the HEADER string Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2, Ed. 1.2.0, 23 Jul 2019 Page 6 of 11 Table 1 Modbus Functions and their representation in an EDD HEADER Functionality FUNCTION SUBFUNCTION READ_ADDRESS READ_COUNT WRITE_ADDRESS WRITE_COUNT Operation (in EDD) 2 Request (in EDD) Response (in EDD) Read Coils 01 - Starting address Quantity of coils - - R - Coil Status Read Discrete Inputs 02 - Starting Address Quantity of Inputs - - R - Input Status Read Holding Registers 03 - Starting Address Quantity of Reg. - - R - Reg. Value Read Input Registers 04 Starting Address Quantity of Input Reg. - - R - Input Reg. Write Single Coil 05 - - - Output Address - W Output Value Output Value Write Single Reg. 06 - - - Reg. Address W Reg. Value Reg. Value Read Exception Status 07 - - - - - R - Output Data Diagnostics 08 2 Byte - - - - R, C 3 Data Data Get Comm Event Counter 11 - - - - - R - Status + Event Count Get Comm Event Log 12 - - - - - R - Status + Event Count + Message Count + Events Write Multiple Coils 15 - - - Starting Address Quantity of Outp. W Outp. Values - Write Multiple registers 16 - - - Starting Address Quantity of Reg. W Reg. Value - Report Server ID 17 - - - - - R - Server ID + Run Indicator Status + Additional Data Read File Record 20 - - - - - R Sub-Req … Sub-Req … Write File Record 21 - - - - - W Sub-Req … Sub-Req … 2 R = READ, W = WRITE, C = COMMAND 3 Depending on the SUBFUNCTION, either READ or COMMAND (e.g. for 01 - Restart Communication Options) Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2 , Ed. 1.2.0, 23 Jul 2019 Page 7 of 11 Mask Write Register 22 - - - Ref. Address - W And_Mask + Or_Mask - Read/Write Multiple registers 23 - Read Starting Address Quantity to Read Write Starting Address Write Starting Quality R, W, C 4 Write Reg. Value Read Reg. value Read FIFO Queue 24 - FIFO Pointer Address - - - R - FIFO Count + FIFO Value Register Read Device Identification 43 14 Read Device Id code + Object Id 5 - - - R - Conformity Level + More Follows + Next Object Id + Number of Objects + List of Object Id, Object Length, Object Value The table also identifies what data shall be provided in the REQUEST of an EDD command. The CRC information is never included in the REQUEST or RESPONSE and need to be handled by the communication infrastructure (FDI Gateway or FDI Communication Server). Also length information (e.g. Byte count) is excluded from REQUEST or RESPONSE and need to be handled by the communication infrastructure. 5.3 ProtocolIdentifier The ProtocolIdentifier for ModbusRTU shall be “urn:fdipsd:ModbusRTU”. 5.4 Address The Address shall be a value between 1 and 247. It shall be represented in the string as decimal number without leading zeros (e.g. using the regular expression “ (1\d?\d?)|((24[0-7]?)|(2[0-3]\d?)|2\d?)|([1-9]\d?) ”. The Address maps to the slave node address [MOD06]. SetAddress is not supported. 5.5 Manufacturer The Manufacturer is mapped to the VendorName (ObjectId 0x00) received with Function 43 in Modbus. For FDI Gateways the EDD data type EUC of length 256 shall be used and therefore the length of the string is limited to 256. For devices providing a longer string the string is truncated at the end of the string. 5.6 DeviceModel The DeviceModel is mapped to the ProductCode (ObjectId 0x01) received with Function 43 in Modbus. For FDI Gateways the EDD data type EUC of length 256 shall be used and therefore the length of the string is limited to 256. For devices providing a longer string the string is truncated at the end of the string. 5.7 DeviceRevision Modbus does contain a place managing a device revision in MajorMinorRevision (ObjectId 0x02) received with Function 43. As this is an ASCII string there is no mapping defined to DeviceRevision and DeviceRevision shall not be used. 4 Depending on intention of the function EDD has to choose between READ, WRITE, or COMMAND, since this function allows independent READ and WRITE operations. 5 Those two byte values need to be combined to get a numeric value. For example, when Read Device ID code 0x04 is chosen together with ObjectId 0x00 the value is 0x0400 = 1024. Field Device Integration (FDI) – Part 115-2: PSD for ModbusRTU RELEASED FCG TS62769-115-2, Ed. 1.2.0, 23 Jul 2019 Page 8 of 11 5.8 SerialNumber No mapping is defined for SerialNumber and SerialNumber shall not be used. 5.9 Tag No mapping is defined for Tag and Tag shall not be used. 5.10 ProfileId No mapping is defined for ProfileId and ProfileId shall not be used. 5.11 Version The ModbusRTU Protocol Version 1.02 shall be mapped to Version “1.02.00”. 5.12 ProtocolSupportFile There shall be no use of ProtocolSupportFiles. 6 Example for ModbusRTU In order to illustrate how the PSDs can be used to create EDDs for ModbusRTU in the following the definition of an EDD command is given and the corresponding resulting Modbus Serial Line PDU is provided, as well as a successful return as and an error returned and how this affects the EDD. 6.1 Called functionality (success) To illustrate the usage of EDD commands we consider the case that the EDD developer wants to read some data from the MODBUS device in the Input Registers. Via a scan the FDI application has already identified the device address as 1. So the actual PDU that should be generated is 0x 01 04 00 08 00 01 C2 95 (reading Input Register 9) and the response would be 0x 01 04 02 00 0A D3 20 (value 10) (see also Table 2) Table 2 Example Modbus PDU Request Response Field Hex Field Hex Device Address 01 Device Address 01 Function 04 Function 04 Starting Address Hi 00 Byte Count 02 Starting Address Lo 08 Input Req. 9 Hi 00 Quantity of Input Req. Hi 00 Input Register 9 Lo 0A Quantity of Input Req. Lo 01 CRC Hi D3 CRC Hi C2 CRC Lo 20 CRC Lo 95 Next >