Beruflich Dokumente
Kultur Dokumente
Industry Automation und Drives Technologies Service & Support Portal This article is taken from the Service Portal of Siemens AG, Industry Automation and Drives Technologies. The following link takes you directly to the download page of this document. http://support.automation.siemens.com/WW/view/en/39863979
If you have any questions about this document, please contact us at the following e-mail address: online-support.automation@siemens.com Please also use our technical forum in the Service & Support Portal on this topic. Share your questions, suggestions or problems and discuss them with our strong forum community. http://www.siemens.de/forum-applikationen
We accept no liability for 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 in 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.
Table of Contents
Table of Contents
Warranty and Liability ................................................................................................. 4 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.6.1 2.6.2 Remote station sends process data to central station, trigger: S7-1200 controller............................................................................................... 8 The central station fetches data from the remote station, trigger: SINAUT Micro SC ................................................................................ 8 Central station fetches data from the remote station, trigger: OPC client ..................................................................................................... 9 Remote station sends data to remote station, trigger: S7-1200 .......... 9 Remote station fetches data from a remote station, trigger: S7-1200 10 Comparison of trigger mechanisms ................................................... 10 Process values and time stamp ......................................................... 11 Send value and measured value acquisition cycle ............................ 12 Measured value buffer........................................................................ 12 Behavior at disconnection .................................................................. 13 Tasks of the functions in the user program in detail .......................... 13 Remote station ................................................................................... 20 Central station .................................................................................... 20
1 Automation Task
1
1.1
Automation Task
Application environment
In this configuration example the functions and features are explained using the application example of a waste water treatment plant. A continuous filling level measurement takes place in the inspection shaft. Furthermore, the status of pump P1 installed in the inspection shaft is detected. This information shall be sent in defined time intervals (send cycle) and be visualized in the central station. The central station must be a decentralized PC connected to the INTERNET. Apart from visualization an option of archiving with date and time stamp must be realized. The state of pump P1 and the send cycle of the remote station shall be controlled via the user interface of the central station.
Figure 1-1
Inspection Shaft
S GPR
Remote Station 1
RS GP
P1
GPRS
Central Station
WinCC flexible SINAU T Micro SC
*2 *2
Real-time stamp 22.02.2010 15:10:00 22.02.2010 15:09:00 Value 1 123 789
*1 *1
CSV file
Wert 2 456 193
DSL
*1) Actual value visualization *2) Archiving
...
...
...
The following requirements apply for archiving the filling level or pump status in a csv.-file in the central station.
Table 1-1 No. 1. 2. Function The system time of the remote station must be synchronized using the central station, where the central station gives the system time. In normal mode (GPRS connection active) the process values with the local system time of the remote station shall be acquired and sent to the central station. These system times must be adopted in the archive file. In buffer mode (GPRS connection cancelled) the process values with the local system time shall be filed non-volatile in the controller. After restoring the GPRS connection, the process values + historic system time stamps shall be sent to the central station in correct sequence.
3.
1 Automation Task
1.2
Product-related environment
A GSM/GPRS modem SINAUT MD720-3 (4) shall be coupled with a SIMATIC S71200 controller (3) using a RS232 communication module (2). A SINAUT ST7 connecting cable (7) is used for the connection. In SINAUT MD720-3 a SIM card (6) has been inserted and a quadband antennae ANT 794-4MR (5) is used for signal reception. The power supply of all components is provided via a SIMATIC PM1207 Power module (1).
Figure 1-2
Line protection switch
L1 N PE DC24V+ DC24V-
Remote Station
3 7
Central station The central station consists of a SIMATIC MicroBox 427B (2). The software components SINAUT Micro SC (3) and the visualization system WCC flexible (4) have been installed on the MicroBox. The power supply is provided via a SIMATIC PM1207 Power module (1). The MicroBox is connected to the internet via a router (5).
Figure 1-3
4 3
2 Automation Solution
2
2.1
Automation Solution
Please also note the documents listed in Table 6-1.
2.1.1
Remote station sends process data to central station, trigger: S7-1200 controller
The remote station actively sends process data to the central station. The trigger for this action occurs event-controlled or cyclical through the user program.
Figure 2-1
Central Station OPC-Server SINAUT MICRO SC OPC-Client WinCC oder WinCC flexible
Remote Station
send
Trigger
2.1.2
The central station fetches data from the remote station, trigger: SINAUT Micro SC
The central station actively fetches process data from the remote station using the SINAUT Micro SC software. This action is triggered cyclically.
Figure 2-2
Central Station OPC Server SINAUT MICRO SC
Properties RS001 RS001 1
fetch
Remote Station
modem1 secret1
15
Minutes
Kommentare
Trigger
In the example on hand all tags created in the OPC client are updated every 15 minutes. At the same time the connection status of S7-1200 controller and MD7203 modem is reevaluated. This mechanism works since the OPC server SINAUT Micro SC automatically creates an OPC item for each tag created in the OPC client. Therefore the current tag management is always known to SINAUT Micro SC and the tag update can be performed.
2 Automation Solution
2.1.3
Central station fetches data from the remote station, trigger: OPC client
The central station actively fetches process data from the remote station using the OPC client. The trigger of this action is the operator of the visualization software or a script. The script or the operator (using a configured interface) set a systemgenerated BOOL-type tag. Process data are fetched from the remote station analog to the process described in chapter 2.1.2.
Figure 2-3
Central Station OPC Server SINAUT MICRO SC OPC Client WinCC or WinCC flexible MSC:[RS001]GPRSConnected MSC:[RS001]PLCConnected MSC:[RS001]BytesReceived MSC:[RS001]BytesTransmitted MSC:[RS001]RefreshValues . . . .
fetch
Remote Station
Trigger
Copyright Siemens AG 2010 All rights reserved
2.1.4
fetch
SINAUT MICRO SC
Trigger
Remote Station n
Note
2 Automation Solution
2.1.5
fetch
Trigger
Remote Station n
Copyright Siemens AG 2010 All rights reserved
Note
2.1.6
2.
SINAUT Micro SC
3.
OPC client
10
2 Automation Solution
2.2
2.2.1
The process data listed here are in this document referred to as data record. The time stamp is automatically written to the data record at the time of measured data acquisition.
Copyright Siemens AG 2010 All rights reserved
The time stamp used is always the UTC system time of the S7-1200 controller. This system time is synchronized in 15 minute intervals using SINAUT Micro SC.
Figure 2-6
Central Station OPC Server SINAUT MICRO SC
Properties RS001 RS001 1
modem1 secret1
15
Minutes
Kommentare
11
2 Automation Solution
2.2.2
Read m. values
P1
Send m. values
Acquisition cycle
xx seconds Send cycle yy seconds Data record 50 . Data record 2 Data record 1
Using a FIFO(First In First Out) measured value buffer, differences between both cycles are polled. If the send cycle is slower than the measured value acquisition cycle, more than one process value frame can be sent at the planned sending time. The correct order on message frame level is guaranteed due to the FIFO buffer. If the send cycle is faster than the measured value acquisition cycle, the planned time of sending is cancelled and the send cycle starts fresh. This should be prevented on a conceptual level beforehand send cycle <= measured value acquisition cycle If the send cycle is equal to the measured value acquisition cycle, precisely one process value frame is always sent at the planned sending time.
2.2.3
The size of the array fields can be adjusted and is only limited by the size of the memory in the S7-1200 controller. Should the size be changed, the respective parameters should be entered in function B_add_record[FC8] in network 3.
12
2 Automation Solution
If the send cycle has expired, the oldest data record is fetched from the measured value buffer and copied to the global data block data_DB[DB144] (see library description chapter 1.5). This data record is only deleted from the measured value buffer if the send process has been terminated successfully with this data record.
2.2.4
Behavior at disconnection
A cancellation of the GPRS connection or a server failure is irrelevant for the measured value acquisition cycle. The send cycle is processed as usual. While the measured value buffer fills up it is repeatedly tried to successfully process a send process. If this is the case, all data records in the measured value buffer are sent successively until it is empty. Now the send cycle reassumes its normal operation.
2.2.5
1
Copyright Siemens AG 2010 All rights reserved
2 3 4 5 6 7 8
Folder with all startup code relevant blocks. This function processes the following tasks: Setting triggers for mode initialization Incrementing and terminating the send cycle Incrementing and terminating the measured value acquisition cycle Simulating the inspection shaft Performing data exchange with user program and data buffer data_DB[DB144] After calling the measured value buffer the function B_add_record[FC8] adds a data record. A data record consists of simulated process values and the UTC time stamp (see chapter 2.1.1). This function copies the oldest data record from the measured value buffer and enters the information in the data buffer data_DB[DB144]. Then the send job to the central station is started with this data record. If the last data record has been transferred successfully to the central station this function deletes the oldest data record from the measured value buffer. During a pending alarm this function disrupts the current send cycle and immediately sends an alarm message to the central station.
4 5 6
13
2 Automation Solution
No. 7 8
Explanation This global data block contains the measured value buffer. All tags in this DB are declared non-volatile. All tags required for the simulation of the inspection shaft are configured in this DB.
2.3
RS001 RS002
1 2
Modem tags
Table 2-4 No. 1. Address assignment
MSC:[<stationname>]GPRSConnected
Description BOOL, Read only MD720-3 is connected with the central station (GPRS connection active, login parameters correct) BOOL, Read only S7-1200 controller connected with the central station (connection between controller and modem is OK, controller reacts to message frame of the central station) BYTE, Read only, values 0 to 31 Receive intensity of GSM antenna at the MD720-3 DWORD, Read only Counter value in MD720-3 for the total of all received bytes DWORD, Read only Counter value in MD720-3 for the total of all sent bytes DWORD, Read only Counter value in MD720-3 for the total of sent and received data STRING, Read only Firmware version of the modem MD720-3 (e.g. 1.7.7)
2.
MSC:[<stationname>]PLCConnected
3.
MSC:[<stationname>]SignalQuality
4.
MSC:[<stationname>]BytesReceived
5.
MSC:[<stationname>]BytesTransmitted
6.
MSC:[<stationname>]BytesTotal
7.
MSC:[<stationname>]Firmware
14
2 Automation Solution
No. 8.
Address assignment
MSC:[<stationname>]DeviceID
Description STRING, Read only Device identification number of the modem MD720-3 BOOL, Write only Updates all tags configured in the OPC client (see also chapter 2.1.3 Trigger in OPC client) After it has been set it is automatically reset to FALSE BOOL, Write only Checks the connection with the S7-1200 controller Feedback is provided by the modem tag PLCConnected and GPRSConnected After it has been set it is automatically reset to FALSE
9.
MSC:[<stationname>]RefreshValues
10.
MSC:[<stationname>]RefreshStatus
No 1 to 2: these tags are updated for all possible data transmissions No 3 to 6. These tags are updated every hour. This given interval cannot be influenced. No 7 to 8: these tags are transmitted only once when the remote station logs in at the central station No 9 to 10: these variables can only be written. A READ-command to these tags always returns the value 0.
In the Item Names column you see the OPC-conform addressing of the modem tags as it would have to be selected in other OPC clients as well. Station RS001 had previously been created in SINAUT Micro SC. Control tags Tags from the S7-1200 controller are addressed in the OPC client as follows: MSC:[<station_name>]DB1,<data_type><memory_address>.
15
2 Automation Solution
The following OPC-conform address must be used for a floating point value at address DBD0 in the S7-1200: MSC:[RS001]DB1,REAL0 The abbreviation DB1 does not mean that the information origins from or has to be written to the data block with the number 1. The following data types can be addressed: B (bytes) W (word) D (doubleword) CHAR (byte) INT (word, signed) DINT (word, signed) REAL (floating point value) STRING (string with fixed length), example: MSC:[RS001]DB1,STRING30.12 DT (date and time BCD format)
Figure 2-11
In the Item Names column you see the OPC-conform address of the control tag as it would have to be selected in other OPC clients as well. Station RS001 had previously been created in SINAUT Micro SC.
16
2 Automation Solution
2.4
Archiving
Apart from the actual value visualization in the OPC client WinCC flexible it is possible to archive the actual values using a VBA script. For this reason the current time stamp at the time of measured value acquisition is sent as well as the process values filling level and pump status. In WinCC flexible the following script has been implemented.
Table 2-5 No. Explanation
2
Copyright Siemens AG 2010 All rights reserved
5 6
1 2 3 4 5 6 For the path for each tag to be archived later on is saved in WinCC flexible. This enables the SmartTags to access the tag values later on. Now the tag values are accessed. These values are saved in separate script tags. The names for the *.csv-file are generated. Elements comprise the current data and the station name to be able to assign the archive data records later on. The generated file name is now compared with the already existing file names in the storage path. If the file does not yet exist it is created. In each case the csv-file is opened afterwards in order to enable the succeeding write process. The data record separated by semi-colons containing the values station, date, time, FillLevel and PumpState is now created. In the last step the data record is written to the opened file and the file is closed.
This script is called at every value update of the seconds counter (part of the transmitted time stamp). Thereby the script is informed of the folder structure and possible prefixes in the name of the tags. This makes it possible to use the same script for various tags and/or stations.
17
2 Automation Solution
Figure 2-12
2.5
Note
Remote station (RS) actively sends process values to the central station (CS)
Table 2-6 No. 1. Action Send data (RS CS) Process values (user data) OPC frame IP frame TCP frame Receive acknowledgement (CS RS) OPC frame IP frame TCP frame Total Volume (Bytes) 12 17 20 20 6 20 20 115
2.
3.
18
2 Automation Solution
Central station (CS) actively fetches data from the remote station (RS)
Table 2-7 No. 1. Action Send the request (CS RS) OPC frame IP frame TCP frame Send process data (RS CS) Process values (user data) OPC frame IP frame TCP frame Total Volume (bytes) 9 20 20 12 17 20 20 118
2.
3.
Central station (CS) synchronizes time with the remote station (RS)
Table 2-8 No.
Copyright Siemens AG 2010 All rights reserved
Action Send the time frame (CS RS) OPC frame IP frame TCP frame Send the acknowledgement (RS CS) OPC frame IP frame TCP frame Total
1.
2.
3.
Cross-communication During cross-communication, i.e. communication from remote station to remote station, the total of the respective table (Table 2-6) or (Table 2-7) must be multiplied with the factor 2, because the data volume on both SIM cards of the modems is taken into account.
19
2 Automation Solution
2.6
2.6.1
Hardware components
Table 2-9 No. 1. 2. 3. 4. 5. 6. 7. 8.
Copyright Siemens AG 2010 All rights reserved
Ordering number 6EP1332-1SH71 6ES7211-1AD30-0XB0 6ES7241-1AH30-0XB0 6NH9720-3AA00 6NH9860-1AA00 6NH7701-5AN 6XV1870-3QH20 5SX2116-6 6ES5 710-8MA11 Available at your mobile services provider.
Qty. 1 1 1 1 1 1 1 1 1 1
Component SIMATIC S7-1200, PM 1207, 2,5A SIMATIC S7-1200 CPU 1211C SIMATIC S7-1200 CM 1241, RS232 SINAUT MD720-3, GSM/GPRS Modem as of HW3.4, FW1.7.4 SINAUT ANT 794-4MR, antenna SINAUT ST7 connecting cable, RS232, 1:1, or comparable cable modem cable For configuration, 2 meter, or comparable cable Line protection switch, 1 pole B, 16A Standard 35mm DIN rail SIM card (check whether special M2M tariffs with included data volume are available)
9. 10.
Software components
Table 2-10 No. 1. Ordering number 6ES7822-0AA00-0YA0 Qty. 1 Component STEP 7 Basic 10.5 as of Service Pack 2
2.6.2
Central station
Hardware components
Table 2-11 No. 1. 2. 3. 4. Ordering number 6EP1332-1SH71 6ES7647-7BE20-0DB0 6ES5 710-8MA11 Specialist dealer Qty. 1 1 1 1 Component SIMATIC S7-1200, PM 1207, 2,5A SIMATIC IPC427C Standard 35mm DIN rail Router with port forwarding
Note
The listed order number of the SIMATIC IPC427C covers the following system configuration: Processor: CORE2 SOLO 1.2 GHZ, memory: 1 GBYTE DDR3 SODIMM, hard disk: 32 GB SSD Disk, operating system: WINXP PROF MULTI-LANGUAGE View/adjust system data in detail: https://mall.automation.siemens.com Instead of the IPC427C, a standard Windows PC may be used for testing.
20
2 Automation Solution
Software components
Table 2-12 No. 1. 2. Ordering number 6NH9 910-0AA10-0AA3 6AV6613-1BA51-3CA0 Qty. 1 1 Component SINAUT MICRO SC 8 stations (available license: for 8, 64 and 256 stations) WinCC flexible 2008 Runtime for 128 tags
Note
The WinCC flexible version specified here enables you to start and operate the Runtime file (*.fwx). Should it become necessary to also edit the project file (*.hmi), other licenses are required. For example, WinCC flexible 2008 Engineering (6AV6613-0AA51-3CA5)
Services of a provider
Table 2-13 No. 1.
Copyright Siemens AG 2010 All rights reserved
Qty . 1 1
Component Internet connection with static IP address If no static IP address is available (e.g. http://www.dyndns.com)
2.
21
3 Configuration
3
3.1
Configuration
Networking plan
Figure 3-1
Internet Internet
Interner Port (LAN) Externer Port (WAN)
IP-Adresse Providerabhngig IP-Adresse Subnet Maske 192.168.0.1 255.255.255.0
DSL Modem/Router
Bronetzwerk Bronetzwerk
192.168.2.100 255.255.255.0
Programmiergert
3.2
Table 3-1 No. 1.
2.
Wire and connect all required components for the remote station and for the central station as described. Please watch the ground connections of the components and only
22
3 Configuration
No.
Instruction activate the power supply for the SIMATIC PM 1207 at the very end.
Note/picture
3.3
Table 3-2 No. 1. 2.
3.
Central Station
IP-Adresse 192.168.0.2
4.
Copy file m2mopc.xml (see Table 5-1 no 4) into the installation directory of SINAUT Micro SC. Terminate the SINAUT MICRO SC Server Use the right mouse-button to click the icon in the info area of Windows and select Exit. Restart SINAUT Micro SC. Open the file from Table 5-1 no 3 with WinCC flexible 2008.
5.
6.
3.4
Table 3-3 No. 1.
2.
23
3 Configuration
No. 3.
Instruction Configure the instance data block com[FB144] which is called in Main[OB1] as described in the library description from chapter 3 on. Note these particularities: The SMS receiver (parameter cmd_sms_TARGET_NUMBER) is later transferred via WinCC flexible The SMS text (Parameter cmd_sms_MESSAGE_TEXT) is transferred in network 5 of the function A_demo[FC1]
Note/picture
4.
Select the program folder of the S7-1200 and transfer the program into the controller Online/Download to device. Ensure that the LED of the S7-1200 controller displays the status RUN.
CE-X21_StartupProject_V10
CE-X21_Startup
24
3 Configuration
3.5
Table 3-4 No.
7 4
5 4
3
Measure Cycle (ms)
1 6 2 8
1 2 3 4
Here you set the measured data acquisition as well as the send cycle. The process values (2) and (4) are updated following the interval of the send cycle. See also chapter 2.2 The filling level of the inspection shaft simulated in the S7-1200 controller is displayed here The modem tags are displayed. From a filling level of 100 units on, the pump is automatically activated in the S7-1200 controller. Alternatively, you can also control the pump manually. Use the Actualize Status button to evaluate the connection quality to modem MD720-3 and to the S7-1200 controller. The result is displayed in (3) Modem connected and Controller connected. The Actualize variables button fetches all control tags, which are configured in WinCC flexible, from the S7-1200 controller. Enter a mobile phone number (e.g.: +49123456789) in the SMS receiver field and press ENTER. Pressing the Send SMS button now sends an SMS from the remote station to the given receiver. The GPRS connection is temporarily interrupted for this. If the pump is manually activated in (4) and the filling level drops under 10 units, an alarm message is sent from the remote station to the central station. This alarm message (Dry run of the pump) is signaled in the alarm window. This error message is deactivated if the filling level of the inspection shaft rises to over 10 units again, i.e. the pump is switched off again (4). This graphic display visualizes the course of the process values FillLevel and PumpState over a period of approx. 2 minutes. For this display the FillLevel tag is scaled from 0=0 and 1=100 units.
25
3 Configuration
3.6
Table 3-5 No. 1.
2.
In the demo monitoring table of the STEP 7 Basic project in Table 5-1 no 1 it can be checked how values are written to the measured value buffer in the interval of the measured data acquisition cycle. Restore the wiring between S7-1200 controller and modem MD720-3.
3.
4.
Copyright Siemens AG 2010 All rights reserved
At the next run of the send cycle counter all data records are sent individually from the measured value buffer to the central station. A script is executed in WinCC flexible which writes a data record to a csv-file at each value update. The csv-file is filed in the C:\Program Files\Siemens.
Stationsname;Datum;Zeit;Fllstand;Pumpenstatus
26
Table 4-1 No. 1. Action Supplement the settings for the port forwarding to your router by an entry for port no 80. Comment
Central Station
IP-Adresse 192.168.0.2
2.
Open the file from Table 5-1 no 2 and activate the runtime service Sm@rtAccess: SIMATIC HMI HTTP Server. This option is available in the Device Settings folder.
3. 4.
Now generate your own Runtime. Save and close the project. Now start your Runtime at the central station PC. Open the file from Table 5-1 no 5 and enter the external IP address of your router. This is the IP address which you have also used in the projects for the remote stations.
5.
Now generate your own Runtime. Save and close the project. Now start your Runtime at the remote PC.
Note
Operation via Sm@rtAccess requires acquiring and installing the license with the order number 6AV6618-7AD01-3AB0 for central station and remote PC.
27
5 Code Elements
Code Elements
Table 5-1 No. 1. 2. Component CE-X21_StartupProject_Vxx.ap10 CE-X21_S71200_GPRS_control_centre.hmi CE-X21_S71200_GPRS_control_centre.fwx m2mopc.xml CE-X21_S71200_GPRS_remote_project.hmi Note Startup project of the remote station for the development environment STEP 7 Basic V10.5. WinCC flexible configuration file. Only relevant if changes shall be made using the software WinCC flexible 2008 Engineering. WinCC flexible Runtime file. Runnable as of WinCC flexible Runtime 128 Tags. Configuration file for SINAUT MICRO SC WinCC flexible configuration file. This file is required exclusively in combination with chapter 4.
3. 4. 5.
6
Copyright Siemens AG 2010 All rights reserved
http://support.automation.siemens.com/WW/view/en/36932465
2
S7-200 based remote control solution http://support.automation.siemens.com/WW/view/en/22537809 S7-300 based remote control solution http://support.automation.siemens.com/WW/view/en/27038105 SINAUT MD720-3 GSM/GPRS Modem Manual http://support.automation.siemens.com/WW/view/en/23117745
History
Table 7-1 Version V1.0 Date 17.05.2010 First issue Changes
28