Connecting Modbus and Lonworks Networks
Total Page:16
File Type:pdf, Size:1020Kb
ConnectingConnecting ModbusModbus andand LonWorksLonWorks NetworksNetworks PresentedPresented by:by: GordonGordon MacLachlanMacLachlan (Mac)(Mac) PresentationPresentation HighlightsHighlights ¾Properties of a Modbus Network Data Types and formats Data Transfer methodologies ¾Properties of a LonWorks Network Data Types and formats Data Transfer methodologies ¾Matching up the networks: Dealing with the challenges Data Resolution Engineering Units Simple vs Structured variables Single vs Block Data Transfer Master/Slave vs Peer/Peer communications Multiple vs single node representation LonMark vs Modbus-IDA ¾Resources ¾Questions and Answers TheThe ModbusModbus StandardStandard ¾ A truly open standard. ¾ Based on Master/Slave poll and response topology. ¾ An integer protocol, i.e: floating point is not supported by the protocol ¾ Supports 4 basic data types: ¾ Analog Inputs ¾ Analog Outputs (Registers) ¾ Digital Inputs ¾ Digital Outputs (Coils/Flags) ¾ Supports 65535 addresses per data type ¾ Builds NO intelligence into what it is sending, i.e: it does not care what the data in the registers represent. ¾ Worldwide use as the most supported protocol. ModbusModbus MemoryMemory MapMap Address Address Format 1 Format 2 (Modicon style) Data Type (PDU Addressing) Offsets in each data type:0-65535 000 001 Read: Function Code 1, 065 536 Flags (Read/Write) Write Single: Use Function Code 5 Write Multiple: Use function Code 15 100 001 165 536 Digital Inputs (Read Only) Read: Function Code 2, Write Single: N/A Write Multiple: N/A 300 001 Read: Function Code 4 Analog Inputs (Read Only) 365 536 Write Single: N/A Write Multiple: N/A 400 001 Read: Function Code 3 Registers (Read/Write) 465 536 Write Single: Use Function Code 6 Write Multiple: Use function Code 16 ModbusModbus MemoryMemory MapMap Address Address Format 3 New in 2004 modbus Format 2 ADU Addressing spec. (PDU Addressing) Data Type 00001 Read: Function Code 1, Offsets 0-9998 65536 Flags (Read/Write) Write Single: Use Function Code 5 Write Multiple: Use function Code 15 00001 Read: Function Code 2, Offsets 0-9998 65536 Digital Inputs (Read Only) Write Single: N/A Write Multiple: N/A 00001 Read: Function Code 4, Offsets 0-9998 65536 Analog Inputs (Read Only) Write Single: N/A Write Multiple: N/A 00001 Read: Function Code 3, Offsets 0-9998 65536 Registers (Read/Write) Write Single: Use Function Code 6 Specify Data type Write Multiple: Use function Code 16 & address for complete address. ModbusModbus VariationsVariations Variations due to difference in connection medium: ¾ Modbus RTU: Most common Modbus variation. Communication medium is RS-232 or RS-485. Data transferred in hexadecimal format. Only one master allowed. ¾ Modbus ASCII: Uses RS-232 or RS-485. Data is transferred in ASCII format. Only one master allowed. ¾ Modbus TCP: Ethernet. Data transferred in hexadecimal format using the TCP/IP transport protocol. Allows multiple masters ¾ Modbus Plus: Uses a proprietary medium. Special hardware needed. Allows multiple masters. ¾ All of the above protocols support Modbus in its true format. ModbusModbus VariationsVariations Variations resulting from protocol restrictions: The following FieldServer drivers are Modbus variants: Modbus Tekair Modbus Daniels Modbus OmniFlow The manufacturer compensated for Modbus being a 16 bit integer protocol by providing a method for sending 32 bit values. Many other vendors do this too. Additionally, FieldServer has a special move function that can assist in decoding these 32 bit variants for use by other protocols. ModbusModbus VariationsVariations Variations resulting from protocol restrictions (JBus): ¾ JBus is no different from extended Modbus, with legal data type addressing from 1-65535 ModbusModbus TCPTCP ¾ Modbus RTU vs Modbus TCP: ¾ Modbus RTU: ¾ Serial protocol using RS-232 or RS-485 as a medium ¾ Devices are addressed by Station Address (Node_ID) ¾ Modbus TCP: ¾ Uses Ethernet. ¾ Modbus RTU + TCP/IP Layer = Modbus TCP ¾ Devices are addressed by IP address and Station address. TCP/IP Modbus RTU string TCP/IP Modbus TCP ModbusModbus TCPTCP Dealing with Ethernet and Modbus TCP: ¾ User needs to understand subnetting and IP addressing ¾ Using Modbus TCP across subnets requires the use of IP gateways. Gateway address setting in IP configuration becomes important ¾ Modbus TCP uses port 502 to communicate. Important if punching a hole in any firewall for communications. ¾ Modbus TCP uses TCP/IP connection management to allow multiple communications connections making multiple masters on a Modbus TCP Network possible. ModbusModbus TCPTCP ––TroubleshootingTroubleshooting onon EthernetEthernet ¾ Use a good Ethernet capture tool such as Ethereal (free at www.ethereal.com) ¾ For testing, Modscan32 or similar is recommended (www.win-tech.com). Use to emulate a Client on the network and test communications. ¾ Know the network layout, including all subnets, Modbus TCP devices, routers, and firewalls which can influence communications. A detailed network layout diagram is essential. ¾ IP Addressing – does your device ¾ Support IP addressing in conjunction with variable Unit identifier (Node_ID)? ¾ Fix the unit identifier and work with IP addressing only? ¾ Know which variant involved - FieldServer will need to fix its Node_ID to the correct address if the latter is in use. LonWorksLonWorks OverviewOverview LonWorks Addressing ¾ DSN – Domain, Subnet, Node ¾ Typically, the Network Manager assigns the domain address for a network, following which the required subnets for a domain are determined by routers needed in the system. Node addresses on each subnet are then allocated by the Network Manager. ¾ The LNS report utility prints out all DSN addresses for a Domain. LonWorksLonWorks OverviewOverview Network Managers ¾ LonMaker, LonWatcher, and others… ¾ Traditional LonWorks setup requires a network manager ¾ Network manager “binds” data points together, and can then be removed. LonWorksLonWorks OverviewOverview Network Managers ¾ Network Managers allocate addressing on the network ¾ A LonWorks network can be commissioned without a Network Manager, but this requires more advanced techniques. LonWorksLonWorks OverviewOverview Network Variable Types ¾¾ SNVTSNVT –– StandardStandard NetworkNetwork VariableVariable TypeType ¾¾ UNVTUNVT –– UserUser NetworkNetwork VariableVariable TypeType ¾¾ SCPTSCPT –– StandardStandard ConfigurationConfiguration ParameterParameter TypeType ¾¾ UCPTUCPT –– UserUser ConfigurationConfiguration ParameterParameter TypeType LonWorksLonWorks OverviewOverview Data Transfer – Update vs Polled ¾ Update variables send data to a remote device using an event driven mechanism ¾ Event driven mechanisms include: Continuous update, Update on change, and Throttling mode ¾ Polled variables wait to be queried for data, and then respond when queried. ¾ Typically, polled variables operate on a continuous update methodology LonWorksLonWorks OverviewOverview Data Transfer – Implicit vs Explicit ¾ Implicit addressing - network manager assigns addresses for communication and ensures (via address tables in the devices) that communication connections are known. ¾ Explicit addressing - device knows the address of the point in the remote device, and communicates directly without the assistance of the Network Manager. LonWorksLonWorks OverviewOverview XIF files ¾ XIF (external File generated by TAC Menta version 4.0, XIF Version 3 interface) files contain Copyright (c) 2002 by TAC AB interface) files contain All Rights Reserved.Run on 2004-06-08 15:49 information about the 80:00:13:52:00:06:04:6E variables on a device, 2 15 1 31 2 5 2 0 0 2 6 11 13 13 11 3 0 16 11 5 9 13 28 0 0 15 5 3 113 and all the necessary 1 7 1 0 4 4 4 15 200 0 Program_ID 78125 0 0 0 0 0 0 0 0 0 0 0 variable properties. 90 0 240 0 0 0 40 40 0 5 8 5 12 14 15 * "&3.0@0,5 ¾ XIF files go a long way VAR SNVT_ObjReq 0 0 0 0 0 1 63 0 0 0 0 0 0 0 0 0 0 to providing all the "@0|1 92 * 2 SNVT_ID information needed 2 0 0 0 0 1 0 0 1 0 for FieldServer VAR SNVT_ObjState 1 0 0 0 configuration, but do 0 1 63 1 0 0 0 0 0 0 0 0 0 configuration, but do "@0|2 not contain DSN 93 * 26 SNVT_Type 2 0 0 0 0 information. 3 0 1 0 0 LonWorksLonWorks OverviewOverview Neuron ID’s vs Program ID’s ¾ Neuron ID - Uniquely defines the Neuron chip on the network. No two Neuron chips in the world have the same ID. ¾ Program ID - defines an application on a hardware platform, and is possible for two hardware platforms to have the same Program ID because they are running the same application. ¾ If an application changes, then its Program ID must change too. This means when Lon variables are modified in the FieldServer configuration, the Program ID must change. ¾ If the Program ID changes for a device, then that device needs to be removed from a network, and then recommissioned. ¾ The Lesson to be learned: Plan your variable list carefully before commencing with binding. LonWorksLonWorks ConfigurationConfiguration Basic Configuration File (General Parameters): Define Title and Data Array: //===================================================== =========================== // FieldServer Information Bridge Title EC001 FieldServer v1.00a //===================================================== =========================== // Data Arrays Data_Arrays Data_Array_Name Data_Format Data_Array_Length DA_Temps FLOAT 10 LonWorksLonWorks ConfigurationConfiguration Basic Configuration File (Connection Information): Define Connection and Node: //===================================================== ===========================