Cover sheet
Process Data Acquisition and Monitoring SIMATIC S7-1200 Application Descrip Description tion January 2013
Applications & Tools Answers for for industry. industry.
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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
2
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
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 t he Application
4
Operation of the Application
5
Links & Literature
6
History
7
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3
Warranty and Liability
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 against us – based based on whatever whatever legal reason – resulting from from the use of 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 (“Produkthaftungsge (“Produkthaftungsgesetz”), setz”), in case of intent, gross negligence, negligence, or injury of 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.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
It is not permissible to transfer or copy these application examples or excerpts thereof without express authorization from Siemens Industry Sector.
4
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
Table of Contents
Table of Contents Conten ts Warrant Warranty y and Liability Liability ................................................................................. .............................................................................................. ............. 4 Table of Contents Contents ................................................. ................................................................................... .................................................... .................. 5 1
Task................................. Task................................................................... ................................................................... .............................................. ............. 6 1.1
2
Solution Solution................................. ................................................................... ................................................................... ........................................ ....... 7 2.1 2.2 2.3
3
t h g i r y p o C
5
T_simulati T_simulation on [FB148] [FB148]....................................................................... ....................................................................... 14 DataLog DataLog [FB143] [FB143] ............................................................... ............................................................................. .............. 15 DataLog_NewFile [FB145] ............................................................... 17 TmMail TmMail [FB149] [FB149] .............................................................. ............................................................................... .................20 Remote access to the controller ....................................................... 22 TM_MAIL TM_MAIL functiona functionality lity ................................................................ ..................................................................... ..... 23
Startup Startup of the Applicatio Application n ............................................................................ ............................................................................ 24 4.1 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Overview of the general solution ........................................................ 7 Description of the core functionality................................. functionality.................................................... ................... 9 Hardware and and software components.............. ....... ............... ............... .............. ............... ............ .... 11
Function Mechanisms Mechanisms of this Application Application.............. ....... .............. ............... ............... .............. ............... ........ 13 13 3.1 3.2 3.3 3.4 3.5 3.6
4
Overview Overview .................................................................. ........................................................................................... ......................... 6
Hardware Hardware adaptatio adaptation n .............................................................. ....................................................................... ......... 24 PG/PC system system settings settings ........................................................ .................................................................... ............ 26 Date and time ..................................................... .................................................................................. ............................. 27 Network Network connection connections s ................................................................. ....................................................................... ...... 27 Regional and language options options .............. ....... ............... ............... .............. .............. ............... ............. ..... 29 Schedule Scheduled d tasks.............................................................................. ..............................................................................30 Set PG/PC interface interface ................................................................. ........................................................................ ....... 34 CSV files ......................................................................................... ......................................................................................... 34 Microso Microsoft ft Excel Excel ................................................................... ................................................................................ .............36 Project adaptation............................... adaptation................................................................ ............................................. ............ 37 TM_MAIL................ TM_MAIL................................................. ................................................................... ........................................ ...... 37 CPU properti properties es................................................................................ ................................................................................39 Project Project downloa download d ................................................................. ............................................................................. ............ 40 Internet browser settings................................ settings................................................................. ................................... 41 Internet Internet Explore Explorerr 8 ........................................................................... ........................................................................... 41 Firefox Firefox ................................................................ ............................................................................................. ............................. 44 Handling Handling of CSV files............................................................... ....................................................................... ........ 45
Operatio Operation n of the Applicat Application ion ............................................ ........................................................................ ............................ 47 5.1 5.2 5.3 5.4 5.5
Overview Overview ................................................................ ......................................................................................... ......................... 47 Remote maintena m aintenance nce.............................. ................................................................ ......................................... ....... 47 Manual download of the DataLog file ............................................... 49 Automatic download download of of the DataLog file .............. ....... .............. ............... ............... .............. ....... 51 Alarm generation generation by sending sending an e-mail e-mail ............... ....... ............... .............. ............... ............... ....... 52
6
Links & Literatur Literature e ........................................................................... ......................................................................................... .............. 55
7
History History ................................................................ .................................................................................................. .......................................... ........ 55
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
5
1 Task
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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Discounter
Data Logging
t h g i r y p o C
ALARM
Description of the automation task The automation solution shall fulfill the following requirements:
6
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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
2 Solution
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 t he 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 (SimpleMailTransfer Protocol). 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 d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
The following illustration provides a schematic overview of the most important components involved in this solution: Figure 2-1
t h g i r y p o C
The cooling temperature can be acquired via thermocouples or resistance thermometers. For connection, SIMATIC S7-1200 offers special signal expansion
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
7
2 Solution
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 VPNcapable 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 email 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 d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
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.
t h g i r y p o C
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.
8
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
2 Solution
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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
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”.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
9
2 Solution
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". d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
DataLogWrite [SFB142] Figure 2-5
t h g i r y p o C
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.
10
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
2 Solution
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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
2.3
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\.
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 t hermocouple)
Programming device
1
Ethernet line TP CORD RJ45/RJ45 2M
3
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
With Ethernet connector 6XV1870-3QH20
11
2 Solution
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
---
DSL modem
1-2
---
As VPN gateway (tunnel endpoint) Depending on the specific provider / router
Standard software components Table 2-2 Component
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
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 VPN Client software VPN01L
1 1
Microsoft Excel 2003 SP3 Task Scheduler
1
VPN01L (single license) / VPN05L (5 licenses)
Web browser VPN01L included in the delivery of FVS 338 Included in Microsoft Office 2003 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
12
Note
64396156_S7-1200_DataLogging_CODE_v1d0.zip
64396156_ S7-1200_DataLogging_DOCU_v1d0_en.pdf
This document.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
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 T_simulation [FB148] T_simulation_DB [DB148]
DataLog [FB143] DataLog_DB [DB143] DataLogCreate [SFB140] DataLogOpen [SFB141] DataLogWrite [SFB142]
Main [OB1]
TmMail [FB149] TmMail_DB [DB149] TM_MAIL [FB349]
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
DataLog_NewFile [FB145] DataLogCreate [SFB140] DataLogOpen [SFB141] DataLogWrite [SFB142] DataLogClose [SFB144] DataLogNewFile [SFB146]
t h g i r y p o C
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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
13
3 Function Mechanisms of this Application
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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Table 3-1 Name Input
t h g i r y p o C
Output
Data type
Description
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)
Temperature
Real
Simulated temperature
Calculation of the output value is based on the following formula:
2 t Period
Temperatur e Offset Amplitude sin t(Trigger) = t -1 + 1
With the default setting, the temperature simulation describes a sine oscillation with an offset of -22°C and an amplitude of +/- 6°C over a period of 1 minute (see Figure 3-3) at a resolution of 10 Hz.
14
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
Figure 3-3 15
30
45
60
t [s]
Offset = -22 °C
Amplitude = 6 °C
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
periodic time = Period/Trigger = 600/(10 Hz) = 60 s T [°C]
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).
t h g i r y p o C
Figure 3-4
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
15
3 Function Mechanisms of this Application
Table 3-2 Name Input
Data type
Description
RECORDS
UDInt
Number of data records in the data log
Timestamp
Bool
Time stamp: 0: No time stamp
NAME
String
Name of the data log
Mode
Bool
Mode to open the data log:
Output
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
InOut
1: Date and time
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
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
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 th e “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”).
t h g i r y p o C
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.
16
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
Figure 3-5
Data log already exists
0 DataLogCreate DONE
Data log does not exist
10 DataLogOpen DONE
Data log does not exist
20 DataLogWrite
Data log not open
DONE
INC NumberRecords
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
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 f unctions for data logging. The following example refers to the recording of e-mail send jobs in this application. Figure 3-6
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
17
3 Function Mechanisms of this Application
Table 3-3 Name Input
Data type
Description
RECORDS
UDInt
Number of data records in the data log
Timestamp
Bool
Time stamp: 0: No time stamp
NAME
String
Name of the data log
Mode
Bool
Mode to open the data log:
Output d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
InOut
1: Date and time
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
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
DATA
Variant
Pointer to the structure or array of the data to be written
The block is implemented as a chain of sequential steps.
t h g i r y p o C
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. .
18
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
Figure 3-7
Data log already exists
0 DataLogCreate
DONE 5 Open_NAME = NAME
8 Open_ID = 0 NAME Open_NAME = ?
Data log does not exist
NewFile_NAME
10 DataLogOpen
DONE NewFile_ID = Open_ID
20 DataLogWrite
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Data log not open
DONE INC NumberRecords
N
NumberRecords >= RECORDS
Y
t h g i r y p o C
30 DataLogClose
DONE 35 Create NewFile_NAME
NewNumber > NewFile_max
Y
NumberRecords = 0 NewNumber = 1
N Data log already exists
40 DataLogNewFile
DONE 50 NumberRecords = 0
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
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
19
3 Function Mechanisms of this Application
(“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 f unction 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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Table 3-4 Name Input
Output
20
Data type
Description
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.
State
USInt
Status of the function (identical with the step)
ErrorStatus
Word
Status parameter in case of an error feedback from SFB TM_MAIL
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
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
INC DoneCounter
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
DONE
2 ERROR_STATUS = 0
1 Set TM_MAIL.REQ
DataLog_NewFile
ERROR
INC ErrorCounter
3 ERROR_STATUS = TM_MAIL.STATUS
DELAY Temperature < Temperature_max
TON
100ms
t h g i r y p o C
4 Reset TM_MAIL.REQ
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 v alue 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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
21
3 Function Mechanisms of this Application
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“:
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Chapter 3.1.2: Client – Gateway VPN
Chapter 5: DynDNS Setup
Chapter 8: Client – Gateway VPN Router
Chapter 9: Client – Gateway VPN PC Client
t h g i r y p o C
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.
22
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
3 Function Mechanisms of this Application
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 i nstance 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.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
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.
t h g i r y p o C
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 T M_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\).
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
23
4 Startup of the Application
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 project’s 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\).
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
24
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
Hardware installation The figure below illustrates the hardware structure of this application. Figure 4-1 L1 N PE DC24V+ DC24V-
IP-Adresse 17.6.0.1 Subnetzmaske 255.255.0.0 NETGEAR FVS338
PM 12 07
CPU 1211 C
IP-Adresse 17.6.23.2 Subnetzmaske 255.255.0.0 Router-Adresse 17.6.0.1
DSL Modem
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Wi-Fi
DSL Modem ISDN
s
Note
The “Guidelines for the installation and wiring of S7-1200 devices ” always have to be observed (S7-1200 Manual \1\, Chapter 3, Installation).
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
25
4 Startup of the Application
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
1.
Select “Start > Settings > Control Panel” to open the Control Panel.
2.
The following settings are described in the following: Date and Time
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
Network Connections Regional and Language Options Scheduled Tasks Set PG/PC Interface
t h g i r y p o C
26
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
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. 3.
Action Open the Date and Time Properties dialog window.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
4.2.2
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.
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 W LAN connection which retrieves your IP address via the dynamic host configuration protocol (DHCP) server from the Internet service provider.
t h g i r y p o C
Configuration of the LAN connection is described in the following. Table 4-3 No. 1.
Action
Remarks
Open the Network Connections window.
Select your network connection. Open the Properties dialog box with a click on your right mouse button.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
27
4 Startup of the Application
No.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Action
2.
Open the “General” tab, select the item “Internet Protocol (TCP/IP)” and then open the relevant Properties box.
3.
Remarks
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.
t h g i r y p o C
28
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
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. 4.
Action
Remarks
Open the Regional and Language Options dialog. In the Regional Options tab, select “English (USA)” as language. Click “OK” to confirm your settings.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
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\).
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
29
4 Startup of the Application
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
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.
Select “Mozilla Firefox” as the program to be run.
Click the “Next>” button.
Remarks
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
3.
30
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
No.
Action
4.
5.
Use the current date as start date.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Select “daily” performance of the task. Click the “Next>” button.
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.
t h g i r y p o C
Remarks
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
31
4 Startup of the Application
No. 8.
Action
Remarks
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 bl ank between “…exe” and „17…”. Adjust the IP address “17.6.23.2” to your S7-1200 CPU address.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
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.
t h g i r y p o C
32
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
No. 11.
Action
Remarks
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 a nd then “OK”. For any further changes you must enter th e user password again.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
12.
After completion, the scheduled task will be activated. To deactivate the task, proceed as follows: Select the “Properti es” 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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
33
4 Startup of the Application
4.2.5
Set PG/PC interface
Table 4-6 No. 1.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Action
Remarks
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. 2.
34
Action
Remarks
Open the “Windows Explorer”. Select “Tools” and then “Folder Options…”.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
No. 3.
Action
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
4.
Remarks
Select the "File Types" tab. Search and select the file extension “CSV”. Click the “Change..” button.
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.
t h g i r y p o C
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
35
4 Startup of the Application
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. 1.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
2.
Action
Remarks
Open “Microsoft Excel”. Select “Tools” and then the menu item “Add-Ins…”.
Activate the add-in “Analysis ToolPak – VBA”. Click “OK” to confirm your settings.
t h g i r y p o C
36
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
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
1
Use STEP 7 V11 to open the function block 149 “TmMail” in the project.
2
In the parameter “TO_S”, enter the recipient’s e-mail address in the form of a string.
Remarks
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Example: ‘TO: ,’ 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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
37
4 Startup of the Application
No.
Action
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’
Remarks
If you know the name of the outgoing mail server you can retrieve its IP address under ‘Command Prompt’ in Windows:
At the parameter “FROM” enter your sender e-mail address for authentication in the form of a string. Example: ‘FROM: [email protected]’ Please note: The characters “FROM:” must be entered.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
38
Each address must be preceded by a blank and an arrow bracket ("<"). Each address must be followed by an arrow bracket (">").
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
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
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.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Action
1
Select the PLC and choose the menu item “Properties” with your right mouse button.
2
Remarks
Select “PROFINET interface > Ethernet addresses > IP protocol“ and activate the option “Use IP router”. Enter the IP address of your VPNcapable router (on the controller side). Adjust the IP address and the subnet mask to your router network.
t h g i r y p o C
3
Activate the web server.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
39
4 Startup of the Application
No. 4
Action
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 t he recorded values.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
4.3.3
Finally, click “OK” to confirm all your settings.
Project download
Table 4-11 No.
Action
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 opti on “Show all accessible devices”.
t h g i r y p o C
3.
40
Remarks
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”.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
No.
Action
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 d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
4.4
Remarks
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”.
Internet browser settings To enable manual access to the web server also during automatic downloading, two Internet browsers are used.
t h g i r y p o C
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:
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
41
4 Startup of the Application
Table 4-12 No. 1
Action
Remarks
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”.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
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 th e Certificate Import Wizard.
t h g i r y p o C
42
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
No.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Action
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.
Select the certificate store “Trusted Root Certification Authorities”. Click “Yes”, “Next” and “Finish” to confirm your selection and to install the certificate.
6
t h g i r y p o C
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
Remarks
43
4 Startup of the Application
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. 1
Action
2
Remarks
Call the startup page of the web server and log in: – Name: admin – Password: Click “Log in”.
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”.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
3
Thereupon the option “Add Exception” appears.
44
Click the option “Add Exception..”.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
4 Startup of the Application
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
No.
Action
4
Then click the “Confirm Security Exception” button and accept the next windows.
Remarks
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. 1
Action
t h g i r y p o C
2
Remarks
Enter the IP address of your CPU in the address field in Firefox to open the web server. Click “ENTER”.
The start page of the web server with CPU information opens. Select the menu item “Data Logs”.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
45
4 Startup of the Application
No.
Action
3
A list with all available DataLog files opens, including date and UTC time stamp of t he 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 f ield “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 l ast 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”.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
Remarks
Activate the option “Do this automatically for files like this from now on”. You can change these settings in Firefox under “Tools > Options > Applications”.
46
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
5 Operation of the Application
5
Operation of the Application
5.1
Overview The functions of this application include:
5.2
Remote maintenance
Manual download of the DataLog file
Manual download of the DataLog file
Alarm generation by sending an e-mail
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.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Access to the CPU via STEP 7 V11 is explained here by the example of clock synchronization. Table 5-1 No. 1.
t h g i r y p o C
2.
Action
Select the program folder of the S71200 in the project.
Select “Online” and “Online & diagnostics” to activate the diagnosis functions.
Remarks
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).
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
47
5 Operation of the Application
No. 3.
Action
4.
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.
Find and select the controller in the list of accessible devices.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
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 th e “NETGEAR ProSafe VPN Client” starts flashing green/red (symbol in the info area of Windows XP) with the letters “On” in the foreground.
7.
t h g i r y p o C
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.
48
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
5 Operation of the Application
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. 1
2 d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Action
Start the Internet Explorer. Use the IP address of the CPU as address, here: http://17.6.23.2
Click “ENTER”.
Remarks
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”.
t h g i r y p o C
Note: If a message warns you about a problem with the security certificate for th is 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.
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
49
5 Operation of the Application
No.
Action
4
A list with all available DataLog files opens, including date and UTC time stamp of t he last access. In the option f ield “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 l ast 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.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
Click the “Open” button.
t h g i r y p o C
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
50
“Record” number “Date” “UTC Time” time stamp “Temperature”
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
5 Operation of the Application
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. 1
Action
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
2
Remarks
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.
Activate the task “Mozilla Firefox” and confirm your selection with “Yes”.
t h g i r y p o C
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
51
5 Operation of the Application
No. 3
Action
As a result, the Firefox browser will be opened at every even-numbered minute and the fil e “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
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
Remarks
Alarm generation by sending an e-mail The generation of alarms is effected via the block “TmMail”. If the maximum cooling temperature of -20°C 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 f ollows.
Table 5-4 No. 1
Action
t h g i r y p o C
2
Remarks
Open the Internet Explorer. Use the IP address of the CPU as address, here: http://17.6.23.2 Click “ENTER”.
To enable the writing of variables, you must log in to t he 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 th is website, change over to the start page via “Introduction” and download the Siemens security certificate as described in chapter 4.4.1.
52
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
5 Operation of the Application
No. 3
Action
Remarks
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”.
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
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 -20°C at 1minute intervals, the block “TM_MAIL” issues a command to send an e-mail to the predefined recipient. Open the recipient’s 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.
t h g i r y p o C
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156
53
5 Operation of the Application
No.
Action
7
In the record file you can see the status feedbacks with the time stamp of t he block “TM_MAIL”. If the “ERROR_STATUS” column shows “0”, the job has been successfully completed (sent to the output server of the sender’s 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.
Remarks
d e v r e s e r s t h g i r l l A 3 1 0 2 G A s n e m e i S
t h g i r y p o C
54
Process Data Acquisition and Monitoring 1.0, Entry ID: 64396156