Cover sheet
GPRS/ Modbus Gateway SIMATIC S7-200, GSM/GPRS Modem MD720-3 Configuration Example CE-X1 October 2009
Applications & Tools Answers for industry.
Warranty, liability and support
Warranty, liability and support Note
The application examples are not binding and do not claim to be complete regarding configuration, equipment and any eventuality. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use sound practices in application, installation, operation and maintenance. When using these application examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these application examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority. We do not accept any liability for the information contained in this document. Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). However, claims arising from a breach of a condition which goes to the root of the contract shall be limited to the foreseeable damage which is intrinsic to the contract, unless caused by intent or gross negligence or based on mandatory liability for injury of life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. It is not permissible to transfer or copy these application examples or excerpts thereof without express authorization from Siemens Industry Sector. For questions about this document, please use the following e-mail address:
[email protected]
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
2
Preface
Preface Industry Automation and Drives Technologies Service & Support Portal This entry is taken from the Internet Service Portal of Siemens AG, Industry Automation and Drives Technologies. Clicking the link below directly displays the download page of this document. http://support.automation.siemens.com/WW/view/en/39026334
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
3
Table of Contents
Table of Contents Warranty, liability and support .................................................................................... 2 Preface........................................................................................................................... 3 1 1.1 1.2
Automation Task ........................................................................................ 5 Technical task description ................................................................................ 5 Component lists ................................................................................................ 6
2 2.1 2.2 2.3 2.4
Automation Solution.................................................................................. 7 Modbus communication.................................................................................... 7 GPRS communication ...................................................................................... 8 Data transmission ............................................................................................. 8 Plausibility and data consistency .................................................................... 10
3 3.1 3.2 3.3 3.4 3.5
Configuration............................................................................................ 12 Structure ......................................................................................................... 12 Installing and wiring hardware ........................................................................ 13 Configuring the S7-200 CPU 224XP and downloading the user program ...... 14 Configuring the S7-221 CPU and downloading the user program.................. 15 Start WinCC flexible configuration .................................................................. 15
4
Code Elements ......................................................................................... 16
5
History....................................................................................................... 17
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
4
Automation Task
1
Automation Task
Application Several modbus nodes, consisting of S7-200 controller and PCs, are to communicate with a modbus master in a production area of a plant. A PC-based control center is to allow visualization and logging of process values of the production area. The decentralized production area is to be analogously linked to the control center with the Micro Automation Set 21, using a GPRS network. Figure 1-1
Ethernet
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
s
Modbus Master Production area
RS485/Modbus
D V D
Modbus Slaves
D V D
s
1.1
s
Technical task description
How can the following services be implemented in a S7-200 CPU: –
Modbus master
–
GPRS remote station
How does the data transfer from the control center to modbus slave devices work, using GPRS and visa versa?
Figure 1-2 s
Data transfer to/from modbus nodes
GPRS data transfer to/from control center
Connection to GSM/GPRS modem. Connection to modbus network.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
5
Automation Task
1.2
Component lists
Products Table 1-1
Components
No.
MLFB / order number
Note
LOGO! Power 24V/1.3A
1
6EP1331-1SH02
SIMATIC S7-200 CPU 224XP
1
6ES7214-2AD23-0XB0
DC
SIMATIC S7-200 CPU 221
1
6ES7211-0AA23-0XB0
DC
SINAUT MD720-3
1
6NH9720-3AA00
Antenna ANT 794-4MR
1
6NH9860-1AA00
Accessory Table 1-2 Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
Components
No.
MLFB / order number
Note
PROFIBUS cable 830-2 F
1
6XV1830-2AH30
3m
PC/PPI cable
1
6ES7901-3CB30-0XA0
COM
Miniature circuit-breaker
1
5SX2116-6
1 pole B, 16A
Top hat rail
1
6ES5710-8MA11
483 mm
Simulator module SIM274
1
6ES7274-1XF00-0XA0
USB/PPI cable
1
6ES7901-3DB30-0XA0
Only for configuring. The PC/PPI cable can also be used.
SIM card
1
Mobile communications provider
GPRS enabled
Configuration software/tools Table 1-3
Components
Note
No.
MLFB / order number
STEP 7 Micro/WIN
1
6ES7810-2CC03-0YX0
STEP 7 Micro/WIN Add On (function libraries)
1
6ES7830-2BC00-0YX0
Note
On the part of the remote peer of the MD720-3, the components for the SINAUT Micro SC center are still needed. For more information, please refer to Micro Automation Set 21: http://support.automation.siemens.com/WW/view/en/22537809
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
6
Automation Solution
2
Automation Solution
2.1
Modbus communication For the S7-200, modbus master and modbus slave library blocks are offered for port 0 and port 1. Using these blocks, communication is from S7-200 CPU 224XP (modbus master) to S7-200 CPU 221 (representative for all modbus slaves). In this automation solution the modbus master functionality is to be operated via port 1 of the CPU 224XP. Figure 2-1
CPU 224XP modbus master
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
V variable section
V variable section
Analog inputs
Digital outputs
Digital inputs
CPU 221 modbus slave
Modbus master devices can actively access (read and/or write) different areas of modbus slave devices. The sections from the view of the slave consist of:
digital outputs
digital inputs
analog inputs
holding register (V variable memory area)
This division does not exist for the modbus master. All information read is stored in a section in the own V memory. All information to be written is taken from a section in the own V memory. The modbus slave cannot actively trigger actions. Note
Further explanations can be found in the S7-200 manual from chapter 12 onwards. http://support.automation.siemens.com/WW/view/en/1109582
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
7
Automation Solution
2.2
GPRS communication For the S7-200 WDC library blocks are available for port 0. Using these blocks, the communication of the S7-200 CPU 224XP is realized in combination with the GSM/GPRS modem MD720-3 to the control room. Further explanations of the system can be found in Micro Automation Set 21.
Note
http://support.automation.siemens.com/WW/view/en/22537809
2.3
Data transmission
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
Function Principle Figure 2-2 Visualization SINAUT Micro SC
1
1
2
Internet
1
In this automation solution data transmission is divided and monitored in the following subareas:
GPRS data transfer (1)
modbus data transfer (2)
However, there is no mechanism for the entire communication path that automatically guarantees the complete data transmission and which informs the nodes if there are data transmission errors. Data transmission in subarea GPRS tranfer (1) The GPRS data transmission is monitored by acknowledgement routines in both directions (CPU SINAUT Micro SC and visa versa).
Data transmission in the subarea modbus transfer (2) The modbus data transmission is monitored by acknowledgement routine for read and write jobs.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
8
Automation Solution
In addition there is a CRC checksum calculation which helps detect data corruption.
Reliability of data transmission over the entire communication path To ensure data transmission over the entire communication path, the acknowledgement routines have to be evaluated on the part of the GPRS system and the modbus network. This done in the modbus master CPU 224XP. Figure 2-3
Modbus system
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
GPRS system
Internet
1 0
!
2 3
Table 2-1
No.
Explanation
1.
The incoming GPRS data traffic is recognized with the aid of the WDC_RECEIVE block. This information is present for only one CPU cycle after receipt of the message and is therefore monitored and evaluated instantly in each CPU cycle.
2.
After confirmed receipt of the message (incoming data packet length > 0), the data can be passed on to the modbus slaves, using the MBUS_MSG_P1 block.
3.
Successful processing of the modbus data transmission is also signaled in the MBUS_MSG_P1 block. This information is available for only one CPU cycle after receipt of the acknowledgement from the node.
n.
This is where a message can be sent to the control center (SINAUT Micro SC) if the sending of data via modbus (output "Error" > 0) was faulty. This is not implemented in this automation solution.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
9
Automation Solution
2.4
Plausibility and data consistency In addition, to the secure data transmission it is necessary to check the incoming values for completeness and plausibility. Inconsistent data can no longer be recognized by modbus slaves and may cause undesired system statuses. Figure 2-4
Modbus system
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
GPRS system
1
!
2 ∑ > 0 ^∑ < x
Internet
!
3 4
Table 2-2
No.
Explanation
4.
It has to be ensured that the time between two successively incoming GPRS data packets is never shorter that the processing of the thus triggered modbus command. Transmission time of modbus system The net transmission time between modbus master and modbus slave can be controlled via the "MBUS_CTRL_P1" block ("Baud"). Processing time of modbus system Information on the actual process time of modbus commands (reading or writing/master and slave) can be found in the S7-200 manual chapter 12). http://support.automation.siemens.com/WW/view/en/1109582 Comparison value of GPRS system As comparison value on the side of the GPRS communication a minimal value of 1000ms is to be assumed. This value represents the transmission time from control room to GPRS remote station.
5.
Apart from the actual detection of GPRS data packets that have been received, the "WDC_RECEIVE" block will check whether the received data is plausible. To do this, the size of the send buffer "x" for the modbus write job is
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
10
Automation Solution
No.
Explanation compared with the size of the received GPRS data packet. "x" stands for the precise number of bytes to by sent (via modbus). The actual modbus job will be triggered if the plausibility check produces a positive result.
7.
Successful processing of the modbus data transmission is signaled in the MBUS_MSG_P1 block. This information is available for only one CPU cycle after receipt of the acknowledgement from the node.
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
6.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
11
Configuration
3
Configuration
3.1
Structure Figure 3-1 Miniture circuit-breaker L1 N DC24V+ DC24V-
s
s
:
Input Output: DC 24V/1,3A Claus 2 AC 100-240V
s
SIMATIC S7-200
s SIMATIC S7-200
SF/DIAG RUN
SF RUN
CPU 224XP AC/DC/RLY
STOP
CPU 222 DC/DC/DC
STOP
LOGO!Power 6EP1331-1SH02
212-1AB22-0XB0 214-2BD23-0XB0
1
2
PORT 1
SINAUT MD 720-3
4
3
8 Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
5 6
7
Table 3-1
No.
Note
Device
1.
LOGO! Power 24V/1.3A
2.
SIMATIC S7-200 CPU 224XP
3.
SINAUT MD720-3
4.
SIMATIC S7-200 CPU 221
5.
PC/PPI cable
6.
PROFIBUS cable 830-2 F
7.
Simulator module SIM274
8.
SIM card of your provider
On the part of the remote peer of the MD720-3 a functional SINAUT Micro SC system is assumed. For more information, please refer to Micro Automation Set 21: http://support.automation.siemens.com/WW/view/en/22537809
Note
The interfaces of the controllers are switched to "Freeport mode", as described below, by uploading the code elements. In order to access the controller again via PG/PC the CPU in to be set to "STOP".
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
12
Configuration
3.2
Installing and wiring hardware
Table 3-2
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
No.
Instruction
1.
Mount all necessary components on the top-hat rail.
2.
Attach the simulator for the digital inputs at the S7-200 CPU 221.
3.
Connect the S7-200 CPU 224XP with the S7-200 CPU 221; using the PROFIBUS cable. CPU 224XP
4.
Note/picture
s
s
SIMATIC S7-200 SIMATIC S7-200
SF/DIAG RUN STOP
CPU 221
Port 1
Port 0
Terminating resistor: on
Terminating resistor: on
Connect the S7-200 CPU 224XP with the MD720-3, using the PC/PPI cable. Modem MD720-3
Port 0
RS232 Interface
CPU 222 DC/DC/DC
212-1AB22-0XB0
PORT 1
PROFIBUS cable 830-2 F
s
s SIMATIC S7-200
SF/DIAG RUN
CPU 224XP AC/DC/RLY
214-2BD23-0XB0
Use the following switch positions: 1 2 3 4 5 6 7 8
STOP
214-2BD23-0XB0
STOP
CPU 224XP
SF RUN
CPU 224XP AC/DC/RLY
SINAUT MD 720-3
PC/PPI cable
1 1 1 0 0 1 1 0 5.
Connect the controllers and the MD720-3 modem to the DC 24V supply voltage of LOGO! Power
See chapter 3.1.
6.
Connect all ground connections to earth and install the voltage supply of LOGO! Power
See chapter 3.1.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
13
Configuration
3.3
Configuring the S7-200 CPU 224XP and downloading the user program
Table 3-3
No. 1.
Instruction Connect a free COM port of the PC to port 0 of the S7-200 controller CPU 224XP, using a PC/PPI cable. Use the following switch positions:
Note/picture s
SIMATIC S7-200
SF/DIAG RUN STOP
CPU 224XP AC/DC/RLY
214-2BD23-0XB0
s
1 2 3 4 5 6 7 8
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
0 0 0 0 1 0 0 0
2.
Make the following settings in the “PG/PC Interface” under “Start/Settings/Control Panel”. Access point of the application Micro/WIN -> PC/PPI cable (PPI) Transmission rate: 19.2 Kbit/s Local connection: COM Advanced PPI disabled Multi Master network deactivated
3.
Open the file from Table 4-1 no. 1 using STEP 7 Micro/WIN.
4.
Navigate to the "GPRSparam" data block and adjust your settings to your SINAUT Micro SC system.
5.
Transfer the project via "File/Load to CPU" to S7-200
6.
Set the S7-200 controller to “RUN” mode
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
PC/PPI cable
14
Configuration
3.4
Configuring the S7-221 CPU and downloading the user program
Table 3-4
No. 1.
Instruction
Note/picture
Connect a free COM port of the PC to port 0 of the S7-200 controller CPU 221, using a PC/PPI cable. Use the following switch positions: s
1 2 3 4 5 6 7 8
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
0 0 0 0 1 0 0 0
PC/PPI cable
2.
Make the following settings in the “PG/PC Interface” under “Start/Settings/Control Panel”. Access point of the application Micro/WIN -> PC/PPI cable (PPI) Transmission rate: 19.2 Kbit/s Local connection: COM Advanced PPI disabled Multi Master network deactivated
3.
Open the file from Table 4-1 no. 2 using STEP 7 Micro/WIN.
4.
Transfer the project to the S7-200 controller via "File/Load to CPU".
5.
Set the S7-200 controller to the “RUN“ mode.
3.5
Start WinCC flexible configuration
Table 3-5
No.
Instruction
1.
Make sure that the CPU 224XP controller is connected to the SINAUT Micro SC system via GPRS.
2.
Exit all running WinCC flexible runtime projects.
3.
Open file from Table 4-1 no 1 using WinCC flexible.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
Note/picture
15
Code Elements
4
Code Elements The software examples are available on the HTML page from which you have downloaded this document. Table 4-1
No.
File name
Contents
Modbus_Master_GPRS_VxDy_en.mwp
STEP 7 Micro/WIN project for CPU 224XP.
2.
Modbus_Slave_VxDy_en.mwp
STEP 7 Micro/WIN project for CPU 221.
3.
Modbus_GPRS_VxDy_en.hmi
WinCC flexible project
4.
Modbus_GPRS_VxDy_en.fwx
WinCC flexible runtime
5.
m2mopc.xml
Configuration file for SINAUT MICRO SC C:\Program Files\Siemens\SINAUT MICRO SC.
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
1.
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
16
History
5
History Table 5-1 History
Version
27.09.2009
Modifications First version
Copyright Siemens AG 2009 All rights reserved 39026334_CE-X1_S7-200_GPRS_Modbus_DOKU_V10_e.doc
V1.0
Date
GPRS/ Modbus Gateway V1.0, Entry ID: 39026334
17