70131_76

9
Ethernet Modbus TCP communication SENTRON PAC3200 and PAC4200 to Simatic S7-300/400. Question How can be measured values transferred over Ethernet Modbus TCP communication by SENTRON PAC3200 and PAC4200 to a Simatic S7-300/400 Answer By use of a provided Simatic Modbus driver component can be measured values of a SENTRON PAC3200 and PAC4200 transferred via Modbus TCP to a Simatic S7-300/400 communication. Description: This Step7 FB allowed more PAC via TCP/IP connections to a SIMATIC as open IE connections of the CPU are available. The FB constructs a ModbusTCP connection to one or in sequence to several PAC3200/4200 cyclically and read all voltage, current and energy values. These values are stored into parametrizable DB's. By set of an input bit timeset of connected PAC4200 are possible. Delete of the MAX/MIN-value and/or of the energy- / load runtime counter also. FB and DB numbers can be modified. Hardwarevoraussetzung: The programmable logic arrays can be uses with a S7-300/ S7-400 with integrated PN interface. The appropriation of a S7-300 / S7-400 without PN interface use over CP is not supported! The programmable logic array are released for S7-300 CPU 315-2 PN/DP, CPU 317-2 PN/DP, 319-3 PN/DP and S7-400 CPU 414-3PN/DP and CPU 416 3PN/DP. 1/9

description

cm

Transcript of 70131_76

Page 1: 70131_76

Ethernet Modbus TCP communication SENTRON PAC3200 and PAC4200 to Simatic S7-300/400. Question How can be measured values transferred over Ethernet Modbus TCP communication by SENTRON PAC3200 and PAC4200 to a Simatic S7-300/400 Answer By use of a provided Simatic Modbus driver component can be measured values of a SENTRON PAC3200 and PAC4200 transferred via Modbus TCP to a Simatic S7-300/400 communication. Description:

This Step7 FB allowed more PAC via TCP/IP connections to a SIMATIC as open IE connections of the CPU are available. The FB constructs a ModbusTCP connection to one or in sequence to several PAC3200/4200 cyclically and read all voltage, current and energy values. These values are stored into parametrizable DB's. By set of an input bit timeset of connected PAC4200 are possible. Delete of the MAX/MIN-value and/or of the energy- / load runtime counter also. FB and DB numbers can be modified. Hardwarevoraussetzung: The programmable logic arrays can be uses with a S7-300/ S7-400 with integrated PN interface. The appropriation of a S7-300 / S7-400 without PN interface use over CP is not supported! The programmable logic array are released for S7-300 CPU 315-2 PN/DP, CPU 317-2 PN/DP, 319-3 PN/DP and S7-400 CPU 414-3PN/DP and CPU 416 3PN/DP.

1/9

Page 2: 70131_76

Used Blocks The Step7-Software consists of:

• FB10 Create and administrate the ModbusTCP connection to the PAC and do read measured values. Convert energy values of PCA3200 from Double to Float.

• DB10 Instance-DB of FB10.

• DB11 Parameter-DB for FB10. Contains the IP Adresses and Data request function codes.

• DB12 Target-DB for voltage, current and energy values. The DB corresponds to the PAC3200 measured values.

• DB13 Target-DB for voltage, current and energy values. The DB corresponds to the PAC4200 measured values.

• FB63/64/65/66 of Step7 Standard Library.

• UDT65; UDT30

The numbering of the FB and the DB can be changed.

2/9

Page 3: 70131_76

Funktionsprinzip

• Per S7-CPU there can be only 1 connection to an PAC3200 or PAC4200 developed • S7-CPU develops an active connectionf • The values are polling by block transmission • The connection is again closed • Procedure repeats cyclic

OB1

FB ModbusTCP uses FB63;64;65;66

Parameter DB

Value DB

S7-319 PN

TCP/IP

SENTRON

3/9

Page 4: 70131_76

Explanation of programmable logic arrays

FB10 The FB have following Parameters:

Para_DBNo Number of Parameter-DB

Timeset Trigger for setting connected PAC4200 with CPU Date/Time

Reset Trigger for Reset (newstart) of FB

FB_Status Output FB-Status Word

The FB do polling data from the IP addresses paramtrized in the parameter DB in sequence. The delaytime for switchover to the next IP address is parametrizeable. This time essentially determines the total rotation period i.e. the update time of the measured values.

The TCP/IP connection only becomes the necessary time for the data exchange active.

During restart of the SIMATIC or reset by FB input, the FB do read with the first poll cycle the device ID and store it. Dependent on this ID, data volumes PAC3200/PAC4200 or with unknown device identification no data required.

The energy values read from the PAC3200 (floating point 64Bit) will be convert to Simatic REAL format (floating point 32Bit). The accuracy is reduced from 16 to 7 decimal places then. Both formats are stored in the measuring DB of PAC3200.

By a positive flank on entry "timeset" the corresponding bit in the task word of all recognized PAC4200 will be set. Reference time is the current S7-CPU date/time. The transferred time can be adjust by the minute value "Zeitzone" in the parameter DB, if between system and local time is distinguished.

A winter/summer time adaptation is not supported.

MAX/MIN-Values; energy counters and load runtime counter of a PAC can reset by setting the corresponding bit in the task word of the parameter DB.

A new start of the FB is caused with a positive flank on entry "reset".

The state of the poll cycle is announced in a status word.

4/9

Page 5: 70131_76

DB11 Parameter-DB The DB contain following Parametes to be adjust:

TCP_IP.id : Connection ID for Simatic interface i.e. 1 TCP_IP.local_device_id : Interface type 2 = PN Interface CPU 315/317 3 = PN Interface CPU 319 TCP_IP.local_tsap_id[1]: local Port No(preset 2000) TCP_IP.local_tsap_id[2] Wartezeit : switchover delaytime in ms (500ms minimum) Zeitzone : Timezone +/- in Minutes, if PAC4200 should by set with date/time different from S7-CPU IPaddr_1a : 1’st Device IP-Adress i.e. 192 IPaddr_1b : 168 IPaddr_1c : 219 IPaddr_1d : 103 Zustand_1 : Status 1’st Device, not operable !

Bit 0 = Device in poll cycle Bit 1 = TCP/IP connection active Bit 2 = Modbus function failed Bit 3 = I Device typ: 0 = unknown Bit 4 = I 1 = PAC3200 Bit 5 = I 2 = PAC4200

Auftrag_1 : Tasks for 1’st Device Bit 0 = Reset MIN/MAX Values Bit 1 = Reset Energy counters Bit 2 = Reset Load runtime counter Bit 3 = set date/time

DBnr_1 : Measurement storage DB for 1’st Device IPaddr_2a : 2’nd Device IP-Adress IPaddr_2b : IPaddr_2c : IPaddr_2d : Zustand_2 : Status 2’nd Device Auftrag_2 : Tasks for 2’nd Device DBnr_2 : Measurement storage DB for 2’nd Device : : : IPaddr_30a : 30’te Device IP-Adress IPaddr_30b : IPaddr_30c : IPaddr_30d : Zustand_30 : Status 30’st Device Auftrag_30 : Tasks for 30’st Device DBnr_30 : Measurement storage DB for 30’st Device The Device -Blocks must filled gaplessly in succession. Following not used blocks have to be fill with zero.

5/9

Page 6: 70131_76

DB12 PAC3200 Measurements The DB contain the actual measured values from PAC3200 : Register 1 - 222 111 Measurands Register 501 - 520 10 Counters / Period values Register 801 - 840 10 Energy counters (floating point 64Bit) Energy counters convert to Simatic REAL

For more detail see manual PAC3200 or DB12 in Step7 Projectfile.

DB13 PAC4200 Measurements The DB contain the actual measured values from PAC4200 : Register 1 - 118 59 Measurands Register 119 - 236 59 Measurands Register 237 - 354 59 Measurands Register 355 - 367 7 Measurands Register 483 - 544 29 Measurands Register 797 - 840 11 Measurands Register 2799 - 2820 11 Measurands Register 3001 - 3120 20 Measurands + Timestamp Register 3121 - 3234 19 Measurands + Timestamp Register 3234 - 3372 20 Measurands + Timestamp Register 3373 - 3492 20 Measurands + Timestamp Register 3493 - 3576 14 Measurands + Timestamp Register 6001 - 6120 20 Measurands + Timestamp Register 6121 - 6240 20 Measurands + Timestamp Register 6241 - 6360 20 Measurands + Timestamp Register 6361 - 6480 20 Measurands + Timestamp Register 6481 - 6486 1 Measurands+ Timestamp Register 9001 - 9096 48 Measurands Register 11001 – 11096 48 Measurands Register 22001 – 22096 48 Measurands Register 12999 - 13118 20 Measurands + Timestamp Register 13119 – 13238 20 Measurands + Timestamp Register 13239 - 13268 5 Measurands + Timestamp Register 19001 – 19120 20 Measurands + Timestamp Register 19121 - 19240 20 Measurands + Timestamp Register 19241 - 19288 8 Measurands + Timestamp In the Timestamp the 1’st DWORD corresponts to UNIXTIME (Seconds since 01.01.1970), The 2’nd DWORD correspont to parts of second (fix zero). For more detail see manual PAC4200 or DB13 in Step7 Projectfile.

6/9

Page 7: 70131_76

FB Statusword Meaning of Bits 0 – 7 (one CPU cycle set only, except Bit 1)

Status output:

Bit 0 Newstart of FB

Bit 1 Parameter wrong

Bit 2 Floating point conversion fail

Bit 3 Error in poll cycle (Device do not respond)

Bit 4 actual connection fail

Bit 5

Bit 6

Bit 7

Bit 8 I

Bit 9 I

Bit 10 I

Bit 11 I

Bit 12 I— actual connection 1..30

Bit 13 I

Bit 14 I

Bit 15 I

7/9

Page 8: 70131_76

SIMATIC Example Two PAC should be poll by SIMATIC 317PN via ModbusTCP protocol.

• one PAC3200, IP-Adress 192.168.219.103, Measurement storage DB 12 • one PAC4200, IP-Adress 192.168.219.156, Measurement storage DB 13

SIMATIC and PAC’s are in the same subnet, Switchover delaytime 1 second. The SIMATIC is synchonized to GMT date/time. Once a day PAC4200 should by timeset. For Parameter-DB, No. 11 is chosed. In HW-Configuration for SIMATIC the IP-Adress of the SIMATIC CPU will be set. Additionaly in Register “Time-of-day Interrupts” OB10 will be activate every day.

In OB10 do set the timeset flag:

AN M2.0 // set timeflag S M2.0 In OB1 do input:

A M2.0 // process time flag and reset R M2.0 = M2.1 // PAC Data read CALL FB 10 , DB10

Para_DBNo :=DB11

Timeset :=M2.1

Reset :=M2.2

FB_Status :=MW0

Input to Parameter-DB11:

TCP_IP.local_device_id : B#16#02 Wartezeit : 1000 Zeitzone : 0 IPaddr_1a : 192 IPaddr_1b : 168 IPaddr_1c : 219 IPaddr_1d : 103 Zustand_1 : 0 Auftrag_1 : 0 DBnr_1 : 12 IPaddr_2a : 192 IPaddr_2b : 168 IPaddr_2c : 219 IPaddr_2d : 156 Zustand_2 : 0 Auftrag_2 : 0 DBnr_2 : 13 IPaddr_3a : 0 IPaddr_3b : 0 IPaddr_3c : 0 IPaddr_3d : 0

8/9

Page 9: 70131_76

9/9

Download the Modbusdriver components The Modbus download is available for free. Open Communication Wizard The SIMATIC Freeware „Open Communication Wizard“ can not use for parametrizing.