Sunteți pe pagina 1din 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

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

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

S7-319 PN

TCP/IP

SENTRON

OB1

FB ModbusTCP uses FB63;64;65;66

Parameter DB

Value DB

3/9

Explanation of programmable logic arrays


FB10
The FB have following Parameters: Para_DBNo Timeset Reset FB_Status Number of Parameter-DB Trigger for setting connected PAC4200 with CPU Date/Time Trigger for Reset (newstart) of FB 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

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 : Zeitzone : IPaddr_1a : IPaddr_1b : IPaddr_1c : IPaddr_1d : Zustand_1 : switchover delaytime in ms (500ms minimum) Timezone +/- in Minutes, if PAC4200 should by set with date/time different from S7-CPU 1st Device IP-Adress i.e. 192 168 219 103 Status 1st 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 Tasks for 1st Device Bit 0 = Reset MIN/MAX Values Bit 1 = Reset Energy counters Bit 2 = Reset Load runtime counter Bit 3 = set date/time Measurement storage DB for 1st Device 2nd Device IP-Adress

Auftrag_1 :

DBnr_1

IPaddr_2a : IPaddr_2b : IPaddr_2c : IPaddr_2d : Zustand_2 : Auftrag_2 : DBnr_2 : : : : IPaddr_30a : IPaddr_30b : IPaddr_30c : IPaddr_30d : Zustand_30 : Auftrag_30 : DBnr_30 :

Status 2nd Device Tasks for 2nd Device Measurement storage DB for 2nd Device

30te Device IP-Adress

Status 30st Device Tasks for 30st Device Measurement storage DB for 30st Device

The Device -Blocks must filled gaplessly in succession. Following not used blocks have to be fill with zero.

5/9

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 1st DWORD corresponts to UNIXTIME (Seconds since 01.01.1970), The 2nd DWORD correspont to parts of second (fix zero). For more detail see manual PAC4200 or DB13 in Step7 Projectfile.

6/9

FB Statusword
Meaning of Bits 0 7 (one CPU cycle set only, except Bit 1) Status output: Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit 9 I I Newstart of FB Parameter wrong Floating point conversion fail Error in poll cycle (Device do not respond) actual connection fail

Bit 10 I Bit 11 I Bit 12 I actual connection 1..30 Bit 13 I Bit 14 I Bit 15 I

7/9

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 PACs 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 S M2.0 In OB1 do input: A M2.0 R M2.0 = M2.1 // process time flag and reset // set timeflag

// PAC Data read CALL FB 10 , DB10

Para_DBNo :=DB11 Timeset Reset :=M2.1 :=M2.2

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

8/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.

9/9

S-ar putea să vă placă și