Application Note 007 Version 001 26 January 2010
Configuring EtherMeter™ – Koyo DL06 Communications Using MODBUS®/TCP. (Note: This document or portions thereof may also apply to other DL Series PLC’s from Koyo / Automation Direct.) The purpose of this document is to provide assistance to the Koyo PLC user who wishes to connect to an EtherMeter using the MODBUS/TCP protocol. This document assumes that the user is well‐versed in Koyo PLC’s and the DirectSOFT Programming Environment. When creating a MODBUS/TCP client/server connection between a Koyo PLC (client) and an EtherMeter™ (server), no special setup is generally required within the EtherMeter’s Setup Menu. The EtherMeter features an “always‐on” MODBUS/TCP server on TCP logical port 502; and it is configured to auto‐detect and service incoming client requests from Modbus‐compatible PLC’s. To simplify integration into a MODBUS/TCP network, the EtherMeter implements MODBUS according to the published Modicon standard without proprietary extensions. In this sample application, the Koyo PLC used was a Model DL06 (Part No. D0‐06DR‐D), equipped with an Ethernet/MODBUS Communication Module (Part No. H0‐ECOM100), and an LCD Display Module (Part No. D0‐06LCD). The PLC programming software used for this project was DirectSOFT5 (Vers. 5.2), and the ECOM100 Ethernet Module setup software was NetEdit 3 (Vers. 3.7c). 1. Wiring Configuration. In this example, the Ethernet ports of the DL06 and EtherMeter are wired directly to each other, without an Ethernet switch, using a single Ethernet crossover cable. Alternatively, the Ethernet ports of both the DL06 and EtherMeter could be connected to a common Ethernet switch if expanded network connectivity is desired. For reference, the wiring and hardware configuration is illustrated in Figure 1. 2. EtherMeter Configuration. The EtherMeter was configured with the following setup commands: SET EXP1 ‐1 SET EXP2 ‐1 3. Meter Registers. The connected meters are Sensus “ICE” encoder‐type registers. Both were pre‐programmed to transmit eight (8) totalization digits.
Page 1 of 5
Figure 1. Koyo MODBUS/TCP Communication Demonstration Panel. DL06 PLC / EtherMeter Hardware and Wiring Configuration. Notes: 1. The DL06 and EtherMeter are both powered by a single AC/DC Converter (24VDC output). 2. The DL06 is equipped with an LCD Display Module (D006LCD). 3. The DL06 is equipped with an Ethernet/ModbusTCP Module (H0ECOM100)
Page 2 of 5
Figure 2. Closeup of the two Sensus “ICE” Meter Registers. 4.
HO‐ECOM100 Ethernet Module Initial Configuration. Initially, both the EtherMeter and the DL06 were powered up and both were connected to an office LAN network with 192.168.1.nnn addressing. The EtherMeter defaults to a static IP address of 192.168.1.140, and this address was not modified. The DL06 defaults to an automatically‐obtained IP address using DHCP. A configuration workstation was connected to the LAN, and which contained NetEdit 3 and DirectSOFT software. NetEdit 3 was started and and “Scan Network” command was used to locate the IP address of the DL06 and to configure the ECOM100 module. (See Figure 3.)
Figure 3. NetEdit 3 Network Scan Display.
Page 3 of 5
Using NetEdit3 and within the “ECOM Settings>General” submenu, static IP addressing and valid network addresses were specified. (See Figure 4.) Module ID: 0 IP Address: 192.168.1.240 (static) Subnet Mask: 255.255.255.0 Gateway: 192.168.1.1
Figure 4. NetEdit 3: General Settings Menu. 5. HO‐ECOM100 Ethernet Module Peer‐to‐Peer Configuration. Using NetEdit3 and within the “ECOM Settings>Peer‐to‐Peer Config” submenu, the EtherMeter’s MODBUS/TCP server properties were specified. (See Figure 5.) RW/WX Device Number: 1 MODBUS/TCP IP Address: 192.168.1.140 Port: 502 Unid ID: 255
Figure 5. Ethernet Port Configuration Dialog Boxes
Page 4 of 5
6.
Ladder Logic. In this example, ladder logic was created using the DirectSOFT PLC programming software. (See Figure 6.)
Figure 6. DirectSOFT 5 PLC Programming Environment. In this example, logic was entered that performs the following tasks: a. Polls the EtherMeter for data using the MODBUS/TCP protocol at 200 msec intervals. In practice, a shorter or longer polling interval could be selected, depending upon the application. b. Displays the data on the DL06’s LCD Display module. The complete ladder logic program, including descriptive comments, is appended to this document.
Page 5 of 5
1/26/2010
06
DL06_ETHERMETER_001
Path: c:\directsoft5\projects\dl06_ethermeter_001.prj Save Date: 01/26/10 02:00:50 Creation Date: 01/24/10 23:41:30 PLC Type: 06 Class ID: DirectLogic 06 Series Link Name: 06 KSeq Description: A Sample Project for a DL06 CPU connected to an EtherMeter. In this example, the DL06 requests meter totalization and flow from an EtherMeter via Modbus/TCP. The data is processed and displayed on the LCD display. Company: SCADAmetrics Programmer: Jim Mimlitz
Page 1
1/26/2010
06
DL06_ETHERMETER_001
Timer 0 : 0.1 sec Hi, 0.1 sec Lo TMR
Low Timer T1
High Timer T0
1
K1 Timer 1: 0.1 sec Lo, 0.1 sec Hi TMR
High Timer T0
Low Timer T1
2
K1 Scan EtherMeter Registers Via Modbus/TCP every 0.2 seconds. The scan rate can be increased or decreased. For most municipal flow applications, a fast scan rate is not required. LD K0101 : 0=CPU Base, 1=ECOM Slot No., 01=Server Node LD K16 : 16 Bytes (Meter 1, Meter 2, Flow 1, Flow 2) LDA O10000 : DL06 Target Memory RX TA0 : EtherMeter Source Memory (40001) High Timer T0
LD
ECOM1_BUSY SP120
K101
3 _FirstScan SP0
LD K16 LDA O10000 RX TA0
LCD Display Split Into 5 States (Change display every 2 secs): 1. Splash Screen 2. Meter 1 Total 3. Meter 2 Total 4. Meter 1 Flow 5. Meter 2 Flow
CNT
High Timer T0
State Mgr CT0
4
K100
State Mgr CT0
Page 2
1/26/2010
06
DL06_ETHERMETER_001
CTA0
K20
SplashScreen C0 PD
CTA0
K40
M1Screen C1 PD
CTA0
K60
M2Screen C2 PD
CTA0
K80
F1Screen C3 PD
CTA0
K100
F2Screen C4 PD
5
6
7
8
9 Splash Screen Display
LCD Line Number : K1 "ETHERMETER DEMO"
SplashScreen C0 10 _FirstScan SP0
LCD Line Number : "MODBUS TCP"
Page 3
K2
1/26/2010
06
DL06_ETHERMETER_001
Meter 1 Total stored in one 32 bit long register (2 contiguous 16 bit registers). DL06 requires that the two 16 bit registers be swapped. M1_WORDSWAP: Meter 1 Total (32 bit binary format) M1_BCD: Meter 1 Total (32 bit BCD format)
LDD
M1Screen C1
M1_RAWDATA V10000
11 OUTD
M1_WORDSWAP V10100 LD K1 LDA O10100 SWAP V10101 LDD M1_WORDSWAP V10100 BCD OUTD M1_BCD V11000
Page 4
1/26/2010
06
DL06_ETHERMETER_001
Meter 2 Total stored in one 32 bit long register (2 contiguous 16 bit registers). DL06 requires that the two 16 bit registers be swapped. M2_WORDSWAP: Meter 2 Total (32 bit binary format) M2_BCD: Meter 2 Total (32 bit BCD format)
LDD
M2Screen C2
M2_RAWDATA V10002
12 OUTD
M2_WORDSWAP V10102 LD K1 LDA O10102 SWAP V10103 LDD M2_WORDSWAP V10102 BCD OUTD M2_BCD V11002 Meter 1 Flow stored in one 32 bit long register (2 contiguous 16 bit registers). DL06 requires that the two 16 bit registers be swapped. F1_WORDSWAP: Meter 1 Flow x 1000 (32 bit binary format)
LDD
F1Screen C3
F1_RAWDATA V10004
13 OUTD
F1_WORDSWAP V10104 LD K1 LDA O10104 SWAP V10105
Page 5
1/26/2010
06
DL06_ETHERMETER_001
When Meter 1 Flow is positive or zero (>=0), then convert value to Real (floating point), and multiply by 0.001. F1_REAL : Meter 1 Flow (Floating Point Format) F1Screen C3
LDD
FLOW1_NEGATIVE B10105.15
F1_WORDSWAP V10104
14
BTOR MULR R0.001 OUTD F1_REAL V11004 When Meter 1 Flow is negative (