You are on page 1of 7

2 Automation Solution

2.2 Measured value acquisition and send management


2.2.1 Process values and time stamp

Table 2-2
No. Tag Explanation
1. filllevel Filling level of the inspection shaft
2. pump_state Status of the pump of the inspection shaft
3. year Date at the time of the measured data acquisition
4. month
5. day
6. hour Time at the time of the measured data acquisition
7. minute
8. second
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.
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.
Copyright ¤ Siemens AG 2011 All rights reserved

Figure 2-6

Central Station
OPC Server
SINAUT MICRO SC
Properties – RS001

RS001

modem1
secret1

15 Minutes

Kommentare

S7-1200 and GPRS


V1.1, Entry ID: 39863979 11
2 Automation Solution

2.2.2 Send value and measured value acquisition cycle

The send and measured value acquisition cycle in this application example is
realized separately in order to prevent changing the sampling time of the measured
values in the send cycle during delays, e.g. through disconnection. This ensures
that on the server side a proof of the measured variables can be provided in the
correct temporal sequence.
Figure 2-7

Read Send
m. values m. values
P1

xx seconds
Acquisition cycle
Send cycle
yy seconds
Data record 50

….
Data record 2
Data record 1
Copyright ¤ Siemens AG 2011 All rights reserved

Measured value buffer

Using a FIFO(First In First Out) measured value buffer, differences between both
cycles are polled.
x 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.
x 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
x 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 Measured value buffer

Up to 50 data records can be filed in the measured value buffer. These data
records are stored non-volatile.
Figure 2-8

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.

S7-1200 and GPRS


12 V1.1, Entry ID: 39863979
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 Tasks of the functions in the user program in detail

Table 2-3
No. Explanation

1
2
Copyright ¤ Siemens AG 2011 All rights reserved

3
4
5
6
7
8

1 Folder with all startup code relevant blocks.


This function processes the following tasks:
x Setting triggers for mode initialization
x Incrementing and terminating the send cycle
2 x Incrementing and terminating the measured value acquisition cycle
x Simulating the inspection shaft
x 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
3 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
4 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
5
function deletes the oldest data record from the measured value buffer.
During a pending alarm this function disrupts the current send cycle and
6
immediately sends an alarm message to the central station.

S7-1200 and GPRS


V1.1, Entry ID: 39863979 13
2 Automation Solution

No. Explanation
This global data block contains the measured value buffer. All tags in this DB are
7
declared non-volatile.
8 All tags required for the simulation of the inspection shaft are configured in this DB.

2.3 Visualizing process values at the OPC client


For each remote station created in the SINAUT Micro SC software system-
generated modem tags are available in the OPC server. Furthermore, the tags of
the representing S7-1200 controller can be accessed for each created remote
station.
Figure 2-9

RS001 1 Kommentar zu RS001


RS002 2 Kommentar zu RS002

1. Modemvariablen (automatisch angelegt)


2. Steuerungsvariablen (manuell anlegen)
Copyright ¤ Siemens AG 2011 All rights reserved

Modem tags
Table 2-4
No. Address assignment Description
1. MSC:[<stationname>]GPRSConnected x BOOL, Read only
x MD720-3 is connected with the central
station (GPRS connection active, login
parameters correct)
2. MSC:[<stationname>]PLCConnected x BOOL, Read only
x S7-1200 controller connected with the
central station (connection between
controller and modem is OK, controller
reacts to message frame of the central
station)
3. MSC:[<stationname>]SignalQuality x BYTE, Read only, values 0 to 31
x Receive intensity of GSM antenna at
the MD720-3
4. MSC:[<stationname>]BytesReceived x DWORD, Read only
x Counter value in MD720-3 for the total
of all received bytes
5. MSC:[<stationname>]BytesTransmitted x DWORD, Read only
x Counter value in MD720-3 for the total
of all sent bytes
6. MSC:[<stationname>]BytesTotal x DWORD, Read only
x Counter value in MD720-3 for the total
of sent and received data
7. MSC:[<stationname>]Firmware x STRING, Read only
x Firmware version of the modem
MD720-3 (e.g. 1.7.7)

S7-1200 and GPRS


14 V1.1, Entry ID: 39863979
2 Automation Solution

No. Address assignment Description


8. MSC:[<stationname>]DeviceID x STRING, Read only
x Device identification number of the
modem MD720-3
9. MSC:[<stationname>]RefreshValues x BOOL, Write only
x Updates all tags configured in the
OPC client (see also chapter 2.1.3
“Trigger in OPC client”)
x After it has been set it is automatically
reset to FALSE
10. MSC:[<stationname>]RefreshStatus x BOOL, Write only
x Checks the connection with the
S7-1200 controller
x Feedback is provided by the modem
tag PLCConnected and
GPRSConnected
x After it has been set it is automatically
reset to FALSE

Updating the modem tags


x No 1 to 2: these tags are updated for all possible data transmissions
Copyright ¤ Siemens AG 2011 All rights reserved

x No 3 to 6. These tags are updated every hour. This given interval cannot be
influenced.
x No 7 to 8: these tags are transmitted only once when the remote station logs in
at the central station
x No 9 to 10: these variables can only be written. A READ-command to these
tags always returns the value “0”.

Access to modem tags at the example of the OPC client OPC-Scout


Figure 2-10

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:
x MSC:[<station_name>]DB1,<data_type><memory_address>.

S7-1200 and GPRS


V1.1, Entry ID: 39863979 15
2 Automation Solution

The following OPC-conform address must be used for a floating point value at
address DBD0 in the S7-1200:
x 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:
x B (bytes)
x W (word)
x D (doubleword)
x CHAR (byte)
x INT (word, signed)
x DINT (word, signed)
x REAL (floating point value)
x STRING (string with fixed length), example: MSC:[RS001]DB1,STRING30.12
x DT (date and time BCD format)

Access to control tags at the example of the OPC client OPC-Scout


Figure 2-11
Copyright ¤ Siemens AG 2011 All rights reserved

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.

S7-1200 and GPRS


16 V1.1, Entry ID: 39863979
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 2011 All rights reserved

6
For the path for each tag to be archived later on is saved in WinCC flexible. This
1
enables the “SmartTags” to access the tag values later on.
2 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
3
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
4 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”,
5
“time”, “FillLevel” and “PumpState” is now created.
6 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.

S7-1200 and GPRS


V1.1, Entry ID: 39863979 17

You might also like