You are on page 1of 55

Applications & Tools

Answers for industry.


Cover sheet
Process Data Acquisition and
Monitoring
SIMATIC S7-1200
Application Description January 2013


2
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


Siemens Industry Online Support
This document originates from the Siemens Industry Online Support. The following
link takes you directly to the download page of this document:
http://support.automation.siemens.com/WW/view/en/64396156


Caution:
The functions and solutions described in this document are mainly limited to the
realization of the automation task. In addition, please note that suitable security
measures in compliance with the applicable Industrial Security standards must be
taken, if your system is interconnected with other parts of the plant, the company's
network or the Internet. More information can be found under the entry ID
50203404.
http://support.automation.siemens.com/WW/view/en/50203404



Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 3

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


s







SIMATIC S7-1200
Process Data Acquisition and
Monitoring

DataLogging / TM_MAIL

























Task

1

Solution

2

Function Mechanisms of
this Application

3

Startup of the Application

4

Operation of the
Application

5

Links & Literature

6

History

7



Warranty and Liability

4
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Warranty and Liability

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 your responsibility to use sound practices in application,
installation, operation and maintenance. When using these application examples,
you recognize that we will not be 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 this application example and other
Siemens publications (e.g. catalogs), the contents of the other documents shall
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 violation of fundamental contractual obligations (wesentliche
Vertragspflichten). The damages for a breach of a substantial contractual
obligation are, however, limited to the foreseeable damage, typical for the type of
contract, except in the event of intent or gross negligence or injury to 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

Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 5

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Table of Contents
Warranty and Liability .............................................................................................. 4
Table of Contents ..................................................................................................... 5
1 Task................................................................................................................. 6
1.1 Overview ........................................................................................... 6
2 Solution........................................................................................................... 7
2.1 Overview of the general solution ........................................................ 7
2.2 Description of the core functionality .................................................... 9
2.3 Hardware and software components ................................................ 11
3 Function Mechanisms of this Application ................................................... 13
3.1 T_simulation [FB148] ....................................................................... 14
3.2 DataLog [FB143] ............................................................................. 15
3.3 DataLog_NewFile [FB145] ............................................................... 17
3.4 TmMail [FB149] ............................................................................... 20
3.5 Remote access to the controller ....................................................... 22
3.6 TM_MAIL functionality ..................................................................... 23
4 Startup of the Application ............................................................................ 24
4.1 Hardware adaptation ....................................................................... 24
4.2 PG/PC system settings .................................................................... 26
4.2.1 Date and time .................................................................................. 27
4.2.2 Network connections ....................................................................... 27
4.2.3 Regional and language options ........................................................ 29
4.2.4 Scheduled tasks .............................................................................. 30
4.2.5 Set PG/PC interface ........................................................................ 34
4.2.6 CSV files ......................................................................................... 34
4.2.7 Microsoft Excel ................................................................................ 36
4.3 Project adaptation ............................................................................ 37
4.3.1 TM_MAIL......................................................................................... 37
4.3.2 CPU properties ................................................................................ 39
4.3.3 Project download ............................................................................. 40
4.4 Internet browser settings .................................................................. 41
4.4.1 Internet Explorer 8 ........................................................................... 41
4.4.2 Firefox ............................................................................................. 44
Handling of CSV files ....................................................................... 45
5 Operation of the Application ........................................................................ 47
5.1 Overview ......................................................................................... 47
5.2 Remote maintenance ....................................................................... 47
5.3 Manual download of the DataLog file ............................................... 49
5.4 Automatic download of the DataLog file ........................................... 51
5.5 Alarm generation by sending an e-mail ............................................ 52
6 Links & Literature ......................................................................................... 55
7 History .......................................................................................................... 55
1 Task


6
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

1 Task
1.1 Overview
Introduction
In supermarkets and discount stores, the continuous cooling of specific foods must
be ensured at any time. If the cooling chain has been interrupted, the food can no
longer be sold and must be disposed.
For this reason, the cooling temperature shall be continuously recorded, archived
and monitored (including an alarm signaling function).
Overview of the automation task
The following illustration provides an overview of the automation task.
Figure 1-1
Discounter
Data Logging
ALARM

Description of the automation task
The automation solution shall fulfill the following requirements:
- Remote access to the data log.
- When required, program changes shall also be possible via remote
maintenance.
- The recorded data shall be transmitted to the remote station and archived
automatically at fixed intervals.
- If the maximum temperature is exceeded, a message shall be issued to
inform a maintenance technician who will then trace the cause of the
problem.


2 Solution


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 7

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2 Solution
2.1 Overview of the general solution
Since firmware version V2.0, the development environment for SIMATIC S7-1200
includes the data logging function Data log. With these instructions, the process
data can be stored in the flash memory (CPU or memory card) in CSV format. The
files are then accessible via the integrated PLC web server and available for
analysis, e.g. using Microsoft Excel.
The SIMATIC S7-1200 controller is suitable for routing operations and enables
remote access via the Internet. To ensure secure communication we recommend
the use of suitable hardware components and connection over a VPN tunnel
(VirtualPrivateNetwork).
With the TM_MAIL instruction, e-mails can be sent via an account at an e-mail
provider with SMTP server (SimpleMailTransferProtocol). This function is used to
issue alarm messages.
The application is implemented with the STEP 7 V11 SP2 Update 5 software and
the S7-1200 CPU firmware version V2.2.
Schematic layout
The following illustration provides a schematic overview of the most important
components involved in this solution:
Figure 2-1
The cooling temperature can be acquired via thermocouples or resistance
thermometers. For connection, SIMATIC S7-1200 offers special signal expansion
2 Solution


8
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

modules (TC and RTD).
The Data Log instruction effects that the temperature will be written to a CSV file
in the load memory of the CPU at defined intervals. You can access the CPU's web
server via a web browser and download the CSV file to your computer.
Remote connection between PC/PG and CPU is realized via the Internet. A VPN
tunnel is established to ensure safe data transfer. This requires the use of a VPN-
capable modem router on the CPU side. On the PG/PC side, connection to the
Internet only requires a suitable VPN software. On both sides, the IP addresses are
allocated dynamically by the relevant Internet Service Provider (ISP). The CPU,
however, can only be addressed with a static IP address. Allocation between
dynamic and static IP address is effected with the help of a dynamic DNS provider
(DomainNameSystem).
The cooling temperature is continuously monitored. If the predefined maximum
temperature is exceeded, the TM_MAIL function will send an e-mail command to
the outgoing server of an e-mail provider (provided an account is available). The e-
mail recipient then receives an alarm message from the mail provider, informing
him about a critical temperature rise so that he can react correspondingly.
If one of the e-mail providers (sender or recipient) offers the service Mail2SMS,
SMS alarm messages may also be sent to a mobile phone.
Advantages
The use of this application offers the following advantages:
- Introduction to data logging with all functions
- Issue of alarms via e-mail
- Fundamentals on remote maintenance via a VPN tunnel
Topics not covered by this application
Regarding the establishment of a VPN tunnel, this application description only
provides some basic information.
For a detailed description on WAN access methods, please refer to \8\.
The following system function blocks are called and described according to their
specific function:
- for data logging:
DataLogCreate [SFB140]
DataLogOpen [SFB141]
DataLogOpen [SFB142]
DataLogClose [SFB144]
DataLogNewFile [SFB146]
- and TM_MAIL [SFB349] for the sending of e-mails.
Further details on these instructions are available in the online help of the TIA
portal V11, where you can select the relevant block and press the F1 key for further
information, or see \1\ and \4\.
Assumed knowledge
Basic knowledge in the field of network communication is required.
2 Solution


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 9

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.2 Description of the core functionality
This application focuses on the recording of process data by means of the data
logging function.
Figure 2-2

In the user program, the data log instructions are used to store process values in
log files. These data log files can be stored on the memory card (MC) or in the
internal load memory of the CPU. The data log files are stored in CSV format. If a
memory card is used, these CSV files can be accessed with the help of a card
reader, or if accessed via web server, they can be downloaded via a web browser.
The Data Log instruction consists of the following 5 elements:
DataLogCreate [SFB140]
Figure 2-3

The instruction "DataLogCreate" is used to create a data log file under the directory
\DataLogs in the load memory, whereby the NAME and the maximum number of
data records (Parameter RECORDS) is predefined.
With the TIMESTAMP parameter you can decide whether date and time stamp
shall also be registered for each data record.
The data to be recorded is specified by the parameter DATA.
2 Solution


10
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The parameter HEADER is used to define the headers (column headings) in the
data log for the data to be recorded.
When creating the data log file with name allotment, a number (parameter ID) for
file identification will be created.
DataLogOpen [SFB141]
Figure 2-4

The instruction DataLogOpen is used to open a previously created data log file.
New data records can be written only, if a data log file is open. With the parameter
"MODE" you can decide whether the existing data log entries shall be overwritten
or not.
When opening the data log file via the parameter "NAME", the ID" will be returned
and can so be used for access to this file via "DataLogWrite" and "DataLogClose".
DataLogWrite [SFB142]
Figure 2-5

The instruction DataLogWrite is used to write a data record into the specified data
log. The DataLogWrite instruction can be executed only, if the previously created
target data log has been opened.
Use the parameter ID to select the data log.
DataLogClose [SFB144]
Figure 2-6

The instruction DataLogClose is used to close a previously opened data log.
Use the parameter ID to select the data log.
2 Solution


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 11

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

DataLogNewFile [SFB146]

The instruction DataLogNewFile is used to create a new data log with the same
properties as a previously created data log file, but under a new name. Use the
parameter RECORDS to define the maximum number of data records.
The model file is defined by the parameter ID. After having created the new data
log file under a new name (parameter NAME), a new ID will be generated and
issued for this file.

Note
Further details are available in the online help of the TIA portal V11, where you
can select the relevant block and press the F1 key for further information, or see
\1\ and \4\.


2.3 Hardware and software components
This application has been generated using the following components:
Hardware components
Table 2-1
Component Qty. Order number Note
STROMVERSORGUNG
S7-1200 PM1207
1 6EP1332-1SH71
CPU 1211C, DC/DC/DC,
6DI/4DO/2AI
1 6ES7211-1AD30-0XB0 Firmware V2.2 (\2\)
Temperature sensor

1 Electrical goods retailer Either as analog
signal generator,
thermocouple or
resistance
thermometer
SIGNAL BOARD SB
1231, 1 AI, (12-bit
resolution)
1 6ES7231-4HA30-0XB0 As an option (if used
with a temperature
sensor with a current
output of 0 to 20 mA)
SIGNAL BOARD SB
1231 RTD
1 6ES7231-5PA30-0XB0 As an option (if used
with a resistance
thermometer)
SIGNAL BOARD SB
1231 TC, 1 AI
1 6ES7231-5QA30-0XB0 As an option (if used
with a thermocouple)
Programming device 1 With Ethernet
connector
Ethernet line
TP CORD RJ45/RJ45
2M
3 6XV1870-3QH20
2 Solution


12
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Component Qty. Order number Note
Circuit-breaker 1 5SX2116-6 1-pin B, 16A
Standard mounting rail 1 6ES5 710-8MA11 35mm
NETGEAR FVS338 1 --- As VPN gateway
(tunnel endpoint)
DSL modem 1 - 2 --- Depending on the
specific provider /
router
Standard software components
Table 2-2
Component Qty. Order number Note
SIMATIC STEP 7 Basic
V11
1 6ES7822-0AA01-0YA0 - Includes WinCC;
- With Service Pack 2
(\5\) Update 5 (\6\)
SIMATIC STEP 7 Basic
Upgrade V11
1 6ES7822-0AA01-0YE0 (As an option) Only for
upgrade from STEP 7
Basic V10.5
Mozilla Firefox 1 Web browser
VPN Client software
VPN01L
1 VPN01L (single
license) / VPN05L (5
licenses)
VPN01L included in
the delivery of FVS
338
Microsoft Excel 2003
SP3
1 Included in
Microsoft Office 2003
Task Scheduler Included in the
Windows XP
operating system
Sample files and projects
The following list shows all files and projects used in this application example.
Table 2-3
Component Note
64396156_S7-1200_DataLogging_CODE_v1d0.zip <This zip file contains the
STEP 7 project>
64396156_ S7-1200_DataLogging_DOCU_v1d0_en.pdf This document.




3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 13

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

3 Function Mechanisms of this Application
General overview
Figure 3-1 shows the sequence of block calls in the control unit of the application
project.
Figure 3-1
Main
[OB1]
T_simulation [FB148]
T_simulation_DB [DB148]
DataLog [FB143]
DataLog_DB [DB143]
TmMail [FB149]
TmMail_DB [DB149]
DataLogOpen [SFB141]
DataLogWrite [SFB142]
DataLogCreate [SFB140]
TM_MAIL [FB349]
DataLog_NewFile [FB145]
DataLogOpen [SFB141]
DataLogWrite [SFB142]
DataLogCreate [SFB140]
DataLogClose [SFB144]
DataLogNewFile [SFB146]

The following function blocks are called from the main organization block (OB1):
- T_simulation [FB148] simulates the freezing temperature in the form of a sine
curve.
- DataLog [FB143] records the freezing temperature. This is effected by calling
the following system function blocks:
DataLogCreate [SFB140] creates the DataLog file.
DataLogOpen [SFB141] opens the DataLog file.
DataLogOpen [SFB142] describes the DataLog file.
When the maximum number of data log entries is reached, recording starts
again at the beginning by overwriting the first data record.
- TmMail [FB149] calls the instruction TM_MAIL [FB349] in order to send an
alarm e-mail, if the specified maximum temperature has been exceeded. In
addition, the function DataLog_NewFile [FB145] records all send jobs and their
result. Apart from the above-stated DataLog system functions, the following
SFBs are called via DataLog_NewFile:
DataLogClose [SFB144] closes the DataLog file.
DataLogNewFile [SFB146] creates a new DataLog file on the basis of a
previously created one.
When the maximum number of data records is reached, the current DataLog
file will be closed and an identical one will be created under a new name.
3 Function Mechanisms of this Application


14
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The tags for the interface configuration of the functions are located in the Tags
data block [DB147].
3.1 T_simulation [FB148]
With the help of the block T_simulation, the temperature profile is simulated in the
form of a sine curve.
Figure 3-2


Table 3-1
Name Data type Description
Input Trigger Bool Trigger signal (positive edge)
- increases the sine argument by 2*/repetend
Offset Real Sine offset
Amplitude Real Sine amplitude
Period Real Number of period subdivisions (0 is not permitted)
Output Temperature Real Simulated temperature

Calculation of the output value is based on the following formula:
|
.
|

\
|

+ = t
Period
Amplitude Offset e Temperatur
t 2
sin
t(Trigger) = t
-1
+ 1

With the default setting, the temperature simulation describes a sine oscillation with
an offset of -22C and an amplitude of +/- 6C over a period of 1 minute (see
Figure 3-3) at a resolution of 10 Hz.

3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 15

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 3-3
Offset = -22 C
Amplitude = 6 C
periodic time = Period/Trigger = 600/(10 Hz) = 60 s
15 45 30 60
T [C]
t [s]

3.2 DataLog [FB143]
The DataLog function is used to create, open and describe a DataLog file as
defined. If the maximum number of entries is exceeded, the oldest entries will be
overwritten (ring buffer).

Figure 3-4

3 Function Mechanisms of this Application


16
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Table 3-2
Name Data type Description
Input RECORDS UDInt Number of data records in the data log
Timestamp Bool Time stamp:
- 0: No time stamp
- 1: Date and time
NAME String Name of the data log
Mode Bool Mode to open the data log:
- MODE= "0"
The data records of the data log are retained
- MODE= "1"
The data records of the data log are deleted
Write Bool Execution of the instruction DataLogWrite at a
positive edge
HEADER String Header of the CSV file
Reset Bool Reset input
Output State USInt Status of the function (identical with the step)
ErrorStatus Word Status parameter if an error occurs (in combination
with State, the corresponding data log SFB can be
identified)
NumberRecords UDInt Current number of written data records
InOut DATA Variant Pointer to the structure or array of the data to be
written

The block is implemented as a chain of sequential steps.
When enabled (EN), the block starts with step 0.
In the CPU load memory, a data log file defined by NAME, RECORDS,
Timestamp, HEADER and DATA is created in CSV format.
After a positive DONE feedback or a message that the file already exists, the file
will be opened in step 1 in MODE status. If the file does not exist, the block
returns to step 0. After a positive DONE feedback and if the Write input is
activated, the file can be written in step 20. If the error messages Data log does
not exist or Data log not open appear, the block will return to the relevant step,
so as to correct the error. After a positive DONE feedback for the write process,
the number of written data records (NumberRecords) will be incremented and the
block waits for the next write request ("Write).
If another error than stated above occurs, the sequence will remain in the current
step. An error description can be determined on the basis of State and
ErrorStatus.
The step sequencer and counter of the written data records is reset via the Reset
input.

3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 17

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 3-5
0
DataLogCreate
DONE
Data log already exists
20
DataLogWrite
10
DataLogOpen
INC NumberRecords
DONE
Data log does not exist
DONE
Data log not open
Data log does not exist


3.3 DataLog_NewFile [FB145]
The function DataLog_NewFile is used to create, open and write a data log file as
defined. If the maximum number of entries is exceeded, a new data log file with an
extended name will be created and written following the example of the previous
one (clone). Only if the maximum number of clone files is exceeded, the oldest files
will be overwritten (ring buffer).
This function uses all available system functions for data logging. The following
example refers to the recording of e-mail send jobs in this application.

Figure 3-6

3 Function Mechanisms of this Application


18
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Table 3-3
Name Data type Description
Input RECORDS UDInt Number of data records in the data log
Timestamp Bool Time stamp:
- 0: No time stamp
- 1: Date and time
NAME String Name of the data log
Mode Bool Mode to open the data log:
- MODE= "0"
The data records of the data log are retained
- MODE= "1"
The data records of the data log are deleted
Write Bool Execution of the instruction DataLogWrite at a
positive edge
HEADER String Header of the CSV file
NewFile_max USInt Maximum number of clone files
Reset Bool Reset input
Output State USInt Status of the function (identical with the step)
ErrorStatus Word Status parameter if an error occurs (in combination
with State, the corresponding data log SFB can be
identified)
NumberRecords UDInt Current number of written data records
CurrentName String Name of the file to be currently written
InOut DATA Variant Pointer to the structure or array of the data to be
written

The block is implemented as a chain of sequential steps.
When enabled (EN), the block starts with step 0.
In the CPU load memory, a data log file defined by NAME, RECORDS,
Timestamp, HEADER and DATA is created in CSV format.
After a positive DONE feedback or a message that the file already exists, the
name of the created file will be transferred to the specified name of the SFB
DataLogOpen in step 5. In step 8, the default ID will be deleted, so as to ensure
that the file to be opened will be identified by its name, not by the ID.
In step 10, the file Open_NAME is opened with MODE. If a message appears
that this file does not exist, the block will jump to the original file (step 0) or the
clone file (step 40), depending on the name of the file to be opened. After a
positive DONE feedback, the ID of the opened file will be passed on to the SFB
DataLogNewFile.
If the Write input is activated, the file will be written in step 20. If an error message
Data log not open appears, the process will jump back to step 10, so as to correct
the error. After a positive DONE feedback for the write process, the number of
written data records (NumberRecords) will be incremented. As long as
NumberRecords is smaller than the number of data records defined in the data
log file (RECORDS), the process will wait for the next write request ("Write).
Otherwise, the currently written file (CurrentName) will be closed in step 30. After
successful execution of the function DataLogClose, the numerical extension
_NewNumber for the new file name will be created.
.

3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 19

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


Figure 3-7
5
Open_NAME = NAME
0
DataLogCreate
DONE
Data log already exists
20
DataLogWrite
N
10
DataLogOpen
INC NumberRecords
NumberRecords
>=
RECORDS
Y
35
Create NewFile_NAME
NewFile_ID = Open_ID
DONE
Data log does not exist
DONE
Data log not open
DONE
N
NewNumber
>
NewFile_max
Y
50
NumberRecords = 0
40
DataLogNewFile
DONE
Data log already exists
8
Open_ID = 0
30
DataLogClose
Open_NAME = ?
NAME
NewFile_NAME
NumberRecords = 0
NewNumber = 1
INC NewNumber
Open_NAME = NewFile_NAME

If NewNumber exceeds the maximum number of clone files, the number of written
data records will be set to 0, the numerical name extension will be reset to the
starting value 1 and the process jumps back to the start of the step sequencer.
If NewFile_max has not yet been reached, a new clone file will be created in step
40, using the system function DataLogNewFile. After a positive DONE feedback
or a message that this file already exists, the number of written data records
3 Function Mechanisms of this Application


20
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

(NumberRecords) will be reset in step 50, NewNumber will be incremented for
the name extension of the next clone file and the name of the newly created file will
be passed on to the defined name of the SFB DataLogOpen. Then the sequence
jumps to step 8.
If another error than stated above occurs, the sequence of steps will remain in the
current step. An error description can be determined on the basis of State and
ErrorStatus.
The step sequencer and counter of the written data records are reset via the
Reset input.
3.4 TmMail [FB149]
The function TmMail is used to call the system function block (SFB) 349
TM_MAIL for alarm generation by e-mail, and it logs these calls including a time
stamp and return value via FB 145 DataLog_NewFile.

Figure 3-8

Table 3-4
Name Data type Description
Input Temperature Real Actual temperature value
Temperature_max Real Temperature limit value
- If this value is exceeded, the block TM_MAIL
will be executed.
- Default value = -20 C

Reset Bool Reset input
- Resets the sequencer and all output tags.
Output State USInt Status of the function (identical with the step)
ErrorStatus Word Status parameter in case of an error feedback from
SFB TM_MAIL
3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 21

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Name Data type Description
ErrorCounter UDInt Current number of erroneous TM_MAIL calls
DoneCounter UDInt Current number of problem-free TM_MAIL calls

Figure 3-9
0
Temperature
>=
Temperature_max
Y
1
Set TM_MAIL.REQ
INC DoneCounter
DONE
INC ErrorCounter
ERROR
DataLog_NewFile
2
ERROR_STATUS = 0
3
ERROR_STATUS = TM_MAIL.STATUS
Temperature
<
Temperature_max
TON
100ms
4
Reset TM_MAIL.REQ
DELAY
The block is implemented as a chain of sequential steps.
When enabled (EN), the block starts with step 0.
The actual temperature value Temperature is compared with the limit value
Temperature_max.
If this limit value is violated, the request REQ of the block TM_MAIL will be set.
Depending on the relevant feedback (DONE or ERROR), the corresponding
counter will be incremented (DoneCounter or ErrorCounter) and, if errors occur,
the status information ERROR_STATUS will be present in step 3.
After having received a feedback, the block DataLog_NewFile will be called to log
the function TM_MAIL. In doing so, the parameter ERROR_STATUS will be
recorded with a time stamp.
After successful generation of an alarm, step 2 will continue only after the value
falls below the limit temperature, so as to issue the next alarm, if the limit value is
violated again.
After a delay of 100 ms, the request of the block TM_MAIL will be reset in step 4
and the process returns to step 0.
This delay time is required to write the log data to the load memory of the CPU.
The step sequencer, the counters and the error status are reset via the Reset
input.
3 Function Mechanisms of this Application


22
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


3.5 Remote access to the controller
Secured remote access to the controller is effected via a VPN tunnel. The virtual
private network (VPN) is a data network which is used to transport private data
through a public network (e.g. the Internet). It enables the safe transmission of data
over an insecure network.
The use of a VPN tunnel depends on a control system with a VPN-capable router.
On the PC side you only need a suitable VPN client software which is used to
establish a connection to the controller, as well as any type of Internet access
(DSL, ISDN, analog or mobile).
In this application, a WLAN router with Internet access via DSL is used, including a
WLAN network interface card for the PC.
In most cases, the Internet users have dynamic IP addresses. In addition, a
dynamic domain name system (DynDNS) provider is required for the allocation of
the communication participants (PC and controller). It is used to define a fixed host
name as a pseudonym for the dynamically changing IP address of the participants.
This enables to identify the controller by the host name.
The VPN connection described here is a client gateway connection.
All required settings are described in the documentation "WAN Access Methods"
(\8\), especially in the in the following chapters of the document
26662448_VPN_Gateway_and_Client_V10_d.pdf:
- Chapter 3.1.2: Client Gateway VPN
- Chapter 5: DynDNS Setup
- Chapter 8: Client Gateway VPN Router
- Chapter 9: Client Gateway VPN PC Client

Remote access to the controller via the Internet is not an obligatory requirement for
the manual or automatic download of the recorded data log files. For demonstration
purposes a local access is sufficient.
For the TM_MAIL function, however, access to the Internet is obligatory.

3 Function Mechanisms of this Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 23

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

3.6 TM_MAIL functionality
The instruction TM_MAIL uses the SMTP (Simple Mail Transfer Protocol) to send
an e-mail via TCP/IP over the industrial Ethernet connection of the CPU.
If no Ethernet-based Internet connection is available, an optional teleservice
adapter may be used for connection with the fixed telephone network lines.
TM_MAIL is executed asynchronously and the transmission job involves several
calls of TM_MAIL. If you call TM_MAIL, you must allocate an instance DB. This
instance DB must not be defined as remanent.
This is to ensure that the instance DB will be initialized when the CPU changes
from STOP to RUN and that TM_MAIL can be initiated anew.

Note
Requirements to be met by the e-mail server
TM_MAIL can communicate with an e-mail server only over SMTP via port 25.
The allocated port number cannot be changed.
Today, most IT departments and external e-mail servers decide to block this port
25, so as to prevent that a virus-infected PC may turn into a hazardous e-mail
generator.
You can establish a connection with an internal e-mail server via SMTP and use
the internal server to manage the current security expansions which are
necessary to forward e-mails to an external e-mail server via the Internet.

When activated, TM_MAIL logs into an outgoing e-mail server (defined by the IP
address at the parameter ADDR_MAIL_SERVER) with the access data (user
name and password) and sends a predefined text e-mail to the address of a
predefined recipient.
Tested e-mail servers
The TM_MAIL function has been tested with the following e-mail servers:

Table 3-5
Name Function Output server IP address ADDR_MAIL_SERVER
GMX Yes mail.gmx.net 213.165.64.21 16#D5A54015
WEB.DE Yes smtp.web.de 213.165.67.108 16#D5A5436C
Google Mail No SMTP via Port 25 not supported

Program details on the block TM_MAIL
Further program details on the TM_MAIL block are available in the online help of
the TIA portal V11, where you can select the relevant block and press the F1 key
for further information, or in \1\ and \4\.
In this application the block TM_MAIL version 1.1 is used.
How to update the library version of the block is described in the document entry
After compilation in STEP 7 V11, why is the message displayed indicating that the
PID and USS library elements are defective or out of date? (\10\).
4 Startup of the Application


24
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4 Startup of the Application
4.1 Hardware adaptation
This application has been realized with a CPU 1211C.
If another type of CPU is used, you must change the CPU in the projects device
view. Please remind that the web server will be deactivated in this case. For this
reason, open the CPU properties dialog and activate the web server anew after
having defined a different CPU.
The application simulates the temperature profile with the help of the block
T_simulation (see chapter 3.1).
If a real temperature sensor is used, some further hardware components may be
required. Each S7-1200 CPU offers 2 integrated analog inputs for the receipt of
voltage signals between 0 and 10 V.
Furthermore, the SIMATIC S7-1200 controller offers analog input modules for the
direct connection of thermocouples and resistance thermometers.
Note
Further information on the selection and wiring of peripheral components is
available in Chapter A Technical Specifications of the S7-1200 manual (\1\).
For the integration of the CPU 1215C in STEP 7 V11 SP2 Upd 5 you require the
Hardware Support Package 0026 (\3\).

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 25

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Hardware installation
The figure below illustrates the hardware structure of this application.

Figure 4-1
L1
N
DC24V+
DC24V-
PE
s
255.255.0.0 Subnetzmaske
17.6.0.1 IP-Adresse
PM 1207 CPU 1211C
255.255.0.0 Subnetzmaske
17.6.0.1 Router-Adresse
17.6.23.2 IP-Adresse
DSL Modem
NETGEAR FVS338
DSL Modem
Wi-Fi
ISDN


Note
The Guidelines for the installation and wiring of S7-1200 devices always have
to be observed (S7-1200 Manual \1\, Chapter 3, Installation).


4 Startup of the Application


26
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.2 PG/PC system settings
This application has been realized with the operating system Microsoft Windows
XP Professional Version 2002 Service Pack 3.
In the operating system, the following system settings are to be defined:
Table 4-1
No. Action Remarks
1. Select Start > Settings > Control Panel to
open the Control Panel.

2. The following settings are described in the
following:
- Date and Time
- Network Connections
- Regional and Language Options
- Scheduled Tasks
- Set PG/PC Interface

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 27

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.2.1 Date and time
Date and time must be defined so that later, when synchronizing CPU module
times, the correct system time (UTC) will be transferred.
Table 4-2
No. Action Remarks
3. Open the Date and Time Properties dialog
window.
- Select your time zone.
- If necessary, enable the checkbox to
automatically adjust the clock for
daylight saving changes.
- Set your local clock time.
- Click OK to accept your settings.


4.2.2 Network connections
The programming devices used in this application provide two types of network
access.
One is a LAN connection with a static IP address for local controller configuration.
Remote connection via VPN tunnel is established by means of a WLAN connection
which retrieves your IP address via the dynamic host configuration protocol
(DHCP) server from the Internet service provider.
Configuration of the LAN connection is described in the following.
Table 4-3
No. Action Remarks
1. Open the Network Connections window.
- Select your network connection.
- Open the Properties dialog box with a
click on your right mouse button.

4 Startup of the Application


28
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
2. Open the General tab, select the item
Internet Protocol (TCP/IP) and then open
the relevant Properties box.

3. - Select the option Use the following IP
address.
- Select an IP address that belongs to
the subnet mask of the CPU.
- Click OK and close the dialog to
accept your settings.

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 29

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.2.3 Regional and language options
By USA standards, the individual columns are separated by commas.
This setting is required here, so as to ensure that the CSV files can be opened
correctly and directly from Microsoft Excel.
Table 4-4
No. Action Remarks
4. Open the Regional and Language Options
dialog.
- In the Regional Options tab, select
English (USA) as language.
- Click OK to confirm your settings.



Note
How data logs in CSV format can be imported to non-USA/UK versions of
Microsoft Excel is described in chapter 11.4.4 of the S7-1200 System Manual
(\1\).


4 Startup of the Application


30
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.2.4 Scheduled tasks
The automatic download of data log files is effected with the help of a scheduled
task created under Windows XP. This scheduled task calls the Mozilla Firefox
Internet browser at 2-minute intervals, so that the CSV file DataLog can be
downloaded and saved via the web server of the S7-1200 controller.
Table 4-5
No. Action Remarks
1. Select Scheduled Tasks from the
Windows Control Panel and add a new
scheduled task.


2. The Scheduled Task Wizard opens.
- Click the Next> button.

3. - Select Mozilla Firefox as the program
to be run.
- Click the Next> button.

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 31

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4. - Select daily performance of the task.
- Click the Next> button.

5. Use the current date as start date.
- Select the start time 00:00.
- Select daily performance of the task.
- Click the Next> button.

6. The user name of the logged in user is
shown.
- Enter and confirm the password for this
user.
- Click the Next> button.
The password is required for the use of
advanced task properties.

7. - Activate the option Open advanced
properties for this task when I click
Finish.
- Click the Finish button.

4 Startup of the Application


32
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
8. The advanced properties dialog box for this
task opens.
- Extend the Run entry field as follows:
17.6.23.2/DataLog.html?FileNam
e=DataLog.csv
The Run entry field should now show
the following:
C:\PROGRA~1\MOZILL~1\firefox.exe
17.6.23.2/DataLog.html?FileName=D
ataLog.csv
There must be a blank between exe and
17.
- Adjust the IP address 17.6.23.2 to
your S7-1200 CPU address.
- Activate the option Enabled
(scheduled task runs at specified time).

9. - Open the Schedule tab.
- Click the Advanced.. button.

10. - Activate the Repeat task option.
- Set the interval to Every 2 minutes
until 11:59 PM.
- Activate the option If the task is still
running, stop it at this time.
- Click OK to confirm your settings.

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 33

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
11. - Open the Settings tab.
- Activate the option Stop the task if it
runs for:
- Select 1 minute(s).
- Activate the option Wake the computer
to run this task.
- Accept the settings for the scheduled
task by clicking the Apply button and
then OK.
For any further changes you must enter the
user password again.

12. After completion, the scheduled task will be
activated. To deactivate the task, proceed
as follows:
- Select the Properties for the
scheduled task Mozilla Firefox with a
click on your right mouse button.

13. - Deactivate the task Mozilla Firefox
and confirm your selection with Yes.
The scheduled task is now disabled, but the
specified settings remain unchanged and
the task can be reactivated at a later point.

4 Startup of the Application


34
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


4.2.5 Set PG/PC interface
Table 4-6
No. Action Remarks
1. Open the Set PG/PC Interface dialog
where you can define the type of access in
STEP 7 V11.
- Select S7ONLINE (STEP 7) as the
access point of the application.
- Select the interface parameter
assignment TCP/IP(Auto) -> with
your network card.
If the controller shall be accessible over
more than one network cards (here LAN
and WLAN), just select one of the two
network cards.
When establishing connection to the
controller, the network card to be used will
be queried again.

4.2.6 CSV files
To enable the direct opening of CSV files from Microsoft Excel the following
settings are to be made.
Table 4-7
No. Action Remarks
2. - Open the Windows Explorer.
- Select Tools and then Folder
Options.

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 35

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3. - Select the "File Types" tab.
- Search and select the file extension
CSV.
- Click the Change.. button.

4. - In the Open With window, select the
program Microsoft Office Excel.
- Activate the option Always use the
selected program to open this kind of
file.
- Click OK to confirm your settings and
then use Close button.

4 Startup of the Application


36
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.2.7 Microsoft Excel
If an error occurs during e-mail transmission via the block TM_MAIL, the
corresponding status information will be written to the relevant DataLog file.
By Microsoft Excel standards only numerical values in decimal notation will be
displayed. In order to convert this parameter (ERROR_STATUS) into a
hexadecimal notation for interpretation of the documentation, the following default
settings must be defined.
Table 4-8
No. Action Remarks
1. - Open Microsoft Excel.
- Select Tools and then the menu item
Add-Ins.

2. - Activate the add-in Analysis ToolPak
VBA.
- Click OK to confirm your settings.


4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 37

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.3 Project adaptation
4.3.1 TM_MAIL
To enable the TM_MAIL function for the transmission of alarm messages via
e-mail, you have to specify your e-mail account and the e-mail address of the
recipient.

Table 4-9
No. Action Remarks
1 Use STEP 7 V11 to open the function block
149 TmMail in the project.

2 In the parameter TO_S, enter the
recipients e-mail address in the form of a
string.
Example:
TO: <wenna@mydomain.com>,

Please note:
- The characters TO: must be entered.
- Each address must be preceded by a
blank and an arrow bracket ("<").
- Each address must be followed by an
arrow bracket (">").
- Set a comma after each address.

4 Startup of the Application


38
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3 Open the static parameters of the instance
TM_MAIL_Instance in the interface of the
FB 149 TmMail.
Define the access data for your e-mail
account as default values:
- At the parameter
ADDR_MAIL_SERVER enter the IP
address of the mail output server in the
form of a data word in HEX format.
Example: the IP address 192.168.0.200
corresponds to DW#16#C0A800C8
- At the parameter USERNAME, enter
your user name for authentication to
your e-mail account in the form of a
string, for example username
- At the parameter PASSWORD enter
your password for authentication to
your e-mail account in the form of a
string, for example password
- At the parameter FROM enter your
sender e-mail address for
authentication in the form of a string.
Example:
FROM: admin@mydomain.com
Please note:
- The characters FROM: must be
entered.
- Each address must be preceded by a
blank and an arrow bracket ("<").
- Each address must be followed by an
arrow bracket (">").

If you know the name of the outgoing mail server
you can retrieve its IP address under Command
Prompt in Windows:

Use a ping to the name.
The outgoing server will respond with the IP
address. The IP address then only needs to be
converted into a hexadecimal format, for example:
Name: mail.gmx.net
IP address: 213.165.64.20
HEX format: DW#16#D5A54014

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 39

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.3.2 CPU properties
The CPU properties Ethernet addresses and Time must be adjusted individually.
In addition, the web server must be activated, so that the DataLog files can be
downloaded via remote access.

Table 4-10
No. Action Remarks
1 Select the PLC and choose the menu item
Properties with your right mouse button.

2 - Select PROFINET interface > Ethernet
addresses > IP protocol and activate
the option Use IP router.
- Enter the IP address of your VPN-
capable router (on the controller side).
- Adjust the IP address and the subnet
mask to your router network.

3 Activate the web server.


4 Startup of the Application


40
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4 - Select Time of day > Local time and
enter your time zone.
- If required, select the option "Activate
daylight saving time" and specify the
start of daylight saving and standard
time.
These settings are important for local time
calculation and the system time settings for
correct time stamping of the recorded
values.
- Finally, click OK to confirm all your
settings.



4.3.3 Project download
Table 4-11
No. Action Remarks
1. - Save the project.
- Select the S7-1200 program folder and
transfer the program to the controller by
selecting Online and Download to
device.

2. - Define the type of PG/PC interface
PN/IE.
- Define your LAN card as PG/PC
interface.
- If your controller is not displayed as an
accessible partner, activate the option
Show all accessible devices.

3. The PG/PC may possibly require a further
IP address in the same subnetwork as the
CPU for downloading.
- Click Yes to confirm assignment of
the IP address and then OK.

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 41

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4. - Press the Load button to
acknowledge the load preview.

5. - In the Load results window, activate
the option Start all.
- Finally acknowledge the download
process with a mouse click on the
Finish button.


Note
If the loading process is terminated, accompanied by the message An error
occurred while data was written to the internal or external memory, correct this
error by loading the project once more or by setting the CPU manually to
STOP.


4.4 Internet browser settings
To enable manual access to the web server also during automatic downloading,
two Internet browsers are used.
Manual downloading of the data log files is performed with Microsoft Internet
Explorer 8.
Automatic downloading of data log files via the Scheduled Task function is
effected with the Mozilla Firefox browser in which once defined settings ("Open" or
"Save") remain effective and which, in the case of identical file names, adds an
extension to the file name.

4.4.1 Internet Explorer 8
For write access to the web server the certificate of your S7-1200 CPU must be
installed as follows:
4 Startup of the Application


42
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Table 4-12
No. Action Remarks
1 - Start the Internet Explorer.
- Use the IP address of the CPU as
address, here:
http://17.6.23.2

The introductory screen opens.
- Click download certificate.

2 The dialog window File Download
Security Warning opens.
- Click the Open button in the dialog
window File Download Security
Warning to open the file.

3 The dialog window Certificate opens.
- Click the Install Certificate button
to activate the Certificate Import
Wizard.


4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 43

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4 - Follow the dialog instructions of the
Certificate Import Wizard to import
the certificate.


5 - Select the option Place all certificates
in the following store.
- Click the Browse button.

6 - Select the certificate store Trusted
Root Certification Authorities.
- Click Yes, Next and Finish to
confirm your selection and to install the
certificate.


4 Startup of the Application


44
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.4.2 Firefox
For secured access (https) to the S7-1200 web server, Mozilla Firefox must be
registered as a trusted connection as follows:
Table 4-13
No. Action Remarks
1 - Call the startup page of the web server
and log in:
Name: admin
Password:
- Click Log in.



2 When you log in to the web server for the
first time, the message This Connection is
Untrusted will appear.
.
- Select the option I Understand the
Risks.



3 Thereupon the option Add Exception
appears.
- Click the option Add Exception...

4 Startup of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 45

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4 Then click the Confirm Security Exception
button and accept the next windows.


Handling of CSV files
To enable the automatic downloading of CSV files in Mozilla Firefox, the default
settings for the handling of these files must be defined.
Table 4-14
No. Action Remarks
1 - Enter the IP address of your CPU in the
address field in Firefox to open the web
server.
- Click ENTER.



2 The start page of the web server with CPU
information opens.
- Select the menu item Data Logs.



4 Startup of the Application


46
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3 A list with all available DataLog files opens,
including date and UTC time stamp of the
last access.
40 DataLog files can be displayed at the
maximum. Actually, more than 40 files can
be recorded, but only the first 40 will be
shown.
In the option field Number of recent entries
to view you can select how many entries
per DataLog file shall be displayed in the
Recent Entries column.
In this example setting, the last 25 entries
will be downloaded / displayed when
clicking on a DataLog file in the "Recent
Entries" column.
Use the Download column to download
and display the complete DataLog file
including all entries.
- Click the floppy disc symbol of the first
DataLog file in the Download
column.

4 When the file DataLog.csv opens, Firefox
will ask you how to proceed with this file.
- Select the option Save File.
- Activate the option Do this
automatically for files like this from now
on.
You can change these settings in Firefox
under Tools > Options > Applications.


5 Operation of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 47

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5 Operation of the Application
5.1 Overview
The functions of this application include:
- Remote maintenance
- Manual download of the DataLog file
- Manual download of the DataLog file
- Alarm generation by sending an e-mail

5.2 Remote maintenance
Based on the configuration of the VPN client software, a request to the controller
over its IP address automatically initiates the establishment of a VPN tunnel. So
you can communicate with the controller via STEP V11 in the same way as over a
direct LAN connection.
Access to the CPU via STEP 7 V11 is explained here by the example of clock
synchronization.

Table 5-1
No. Action Remarks
1. - Select the program folder of the S7-
1200 in the project.
- Select Online and Online &
diagnostics to activate the diagnosis
functions.

2. Before connection build-up, the status
display of the NETGEAR ProSafe VPN
Client starts flashing yellow/red (symbol in
the info area of Windows XP).

5 Operation of the Application


48
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3. - Select PN/IE as the type of the
PG/PC interface.
- Define your Internet connection as
PG/PC interface.
- Select the Go online button to
establish a connection with the CPU.


4. Find and select the controller in the list of
accessible devices.
- Click the Go online button to confirm
your selection.


5. Answer the Assign IP address prompt with
Yes.

6. When the connection has been established,
the status display of the NETGEAR
ProSafe VPN Client starts flashing
green/red (symbol in the info area of
Windows XP) with the letters On in the
foreground.

7. - Select the function Set time of day.
- Click "Apply" to synchronize the
module time with the PC/PC time.
This procedure requires the correct setting
of date and time in the CPU and the PC/PC.



5 Operation of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 49

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.3 Manual download of the DataLog file
Manual downloading of the DataLog file is demonstrated using the Microsoft
Internet Explorer 8.

Table 5-2
No. Action Remarks
1 - Start the Internet Explorer.
- Use the IP address of the CPU as
address, here:
http://17.6.23.2
- Click ENTER.

2 On the start page you can log in to the web
server so as to have a write access (e.g. to
delete DataLog files).
- Enter the name admin and leave the
Password field free.
- Then click Log in.

Note: If a message warns you about a problem with the security certificate for this website,
change over to the start page via Introduction and download the Siemens security certificate as
described in chapter 4.4.1.
3 The logged in status can be identified by:
- the user name admin and the Log
out being displayed
- the option of a flashing CPU via the
button Flash LEDs
- the option of changing the operating
mode using the Go to RUN and Go
to STOP buttons

Use the menu item Data Logs to open the
list of recorded files.

5 Operation of the Application


50
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
4 A list with all available DataLog files opens,
including date and UTC time stamp of the
last access.
In the option field Number of recent entries
to view you can select how many entries
per DataLog file shall be displayed in the
Recent Entries column.
In this example setting, the last 25 entries
will be downloaded / displayed when
clicking on a DataLog file in the "Recent
Entries" column.
Using the Download column you can
download and display the complete
DataLog file including all entries.
If logged in, you can also download
DataLog files and delete entries by clicking
Download & Clear or delete selected
DataLog files by using the Delete button.
Click the floppy disc symbol of a DataLog
file in the Download column.

5 In the File Download dialog window you
can open the CSV file directly with a
selected program or save it first.

- Click the Open button.

6 Due to the previously defined default and
format settings (see chapter 4.2.3) the CSV
file will be correctly displayed in Microsoft
Excel with the columns
- Record number
- Date
- UTC Time time stamp
- Temperature

5 Operation of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 51

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.4 Automatic download of the DataLog file
The automatic downloading of DataLog files via the Scheduled Task function
requires the use of an Internet browser which can save the loaded files without
further prompting.
This is offered by the Mozilla Firefox browser where you can predefine how to
proceed with the loaded files (save or open).
Furthermore, a newly downloaded file will be provided with a name extension, if it
is identical with a previously used file name.
The automatic downloading of DataLog files is thus secured.

Table 5-3
No. Action Remarks
1 - Open the Windows Control Panel and
select the folder Scheduled Tasks.
- Click Mozilla Firefox with your right
mouse button to open the properties of
the previously defined task.


2 Activate the task Mozilla Firefox and
confirm your selection with Yes.

5 Operation of the Application


52
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3 - As a result, the Firefox browser will be
opened at every even-numbered
minute and the file DataLog.csv will
be downloaded from the controller.
- At every odd-numbered minute,
Firefox will be closed again.
- The files will be stored in the folder
specified in Firefox under Tools >
Options > General > Downloads.
- For each newly stored file, the name
extension number in the brackets will
be incremented. This ensures that not
data will be overwritten.

5.5 Alarm generation by sending an e-mail
The generation of alarms is effected via the block TmMail.
If the maximum cooling temperature of -20C is exceeded, an e-mail will be sent to
a predefined recipient with the help of the system function TM_MAIL. The function
block TmMail will be deactivated after initialization. It can be activated via the web
server as follows.

Table 5-4
No. Action Remarks
1 - Open the Internet Explorer.
- Use the IP address of the CPU as
address, here:
http://17.6.23.2
- Click ENTER.

2 To enable the writing of variables, you must
log in to the web server.
- Enter the name admin and leave the
Password field free.
- Then click Log in.


Note: If a message warns you about a problem with the security certificate for this website,
change over to the start page via Introduction and download the Siemens security certificate as
described in chapter 4.4.1.
5 Operation of the Application


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 53

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
3 The logged-in status can be identified by:
- the display of the user name admin
and the Log out
- the option Flash LEDs for CPU
flashing
- the option of changing the operating
mode using the Go to RUN and Go
to STOP buttons

Select the menu item Variable Status.

4 A table with variables opens.
- Go to the Address column, enter the
symbolic tag name
Tags.TmMail.Enable and press the
RETURN key.
The Monitor Value is 2#0.
- Enter the value 1 in the Modify
Value column and click the Go
button in the column Modify.
Note: When changing the page, the
selected variables will not remain. Specify
the URL (e.g. as favorite) and call it again
to retrieve the defined variables table
again.

5 When the simulated cooling temperature
exceeds the maximum limit of -20C at 1-
minute intervals, the block TM_MAIL
issues a command to send an e-mail to the
predefined recipient.
- Open the recipients inbox to check the
receipt of the e-mail.

6 If the alarm e-mail has not been received
successfully, check the logs of the block
TM_MAIL as follows:
- Select the menu item Data Logs to
open the list of data logs.
Find the last written file by comparing the
times in the columns Date and UTC
time.
- Open the last written log file for the call
of the TM_MAIL block.


5 Operation of the Application


54
Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

No. Action Remarks
7 In the record file you can see the status
feedbacks with the time stamp of the block
TM_MAIL.
If the ERROR_STATUS column shows
0, the job has been successfully
completed (sent to the output server of the
senders e-mail account). Any recipients
with unspecified e-mail addresses cannot
be identified!
You can convert the ERROR_STATUS
into a hexadecimal value by using the
formula =DEC2HEX and uncode its
meaning according to the description of the
TM_MAIL block.

8 If, instead of the hexadecimal value, the
text #NAME? is displayed, proceed as
described in chapter 4.2.7.


6 Links & Literature


Process Data Acquisition and Monitoring
1.0, Entry ID: 64396156 55

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

6 Links & Literature
The following list is by no means complete and only provides a selection of
appropriate information.
Table 6-1
Topic Title
\1\ S7-1200 Process Controller
System Manual
http://support.automation.siemens.com/WW/view/e
n/36932465
\2\ CPU Firmware 2.2 http://support.automation.siemens.com/WW/view/e
n/41886031/133100
\3\ Hardware Support Package (HSP)
0026
http://support.automation.siemens.com/WW/view/e
n/54164095
\4\ STEP 7 Basic V11.0 SP2
System Manual
http://support.automation.siemens.com/WW/view/e
n/57199536
\5\ Service Pack 2 for STEP 7 V 11 http://support.automation.siemens.com/WW/view/e
n/56750498
\6\ Updates 4 for STEP 7 V 11 SP2 http://support.automation.siemens.com/WW/view/e
n/58112582
\7\ SIMATIC S7-1200 Easy Book http://support.automation.siemens.com/WW/view/e
n/39710145
\8\ WAN Access Methods http://support.automation.siemens.com/WW/view/e
n/26662448
\9\ Why is the Certificate error
message shown in the address
line when downloading the web
page of an S7-300/400/1200-CPU
over "https://..."?
http://support.automation.siemens.com/WW/view/e
n/63314183
\10\ After compilation in STEP 7 V11,
why is the message displayed
indicating that the PID and USS
library elements are defective or
out of date?
http://support.automation.siemens.com/WW/view/e
n/59421832
\11\ How do you parameterize the
"TM_MAIL" instruction to send e-
mails with the SIMATIC S7-1200?
http://support.automation.siemens.com/WW/view/e
n/67262019



7 History

Table 7-1
Version Date Revisions
V1.0 01/2013 First issue

You might also like