64396156_S7-1200_DataLogging_DOCU_v1d0_en

download 64396156_S7-1200_DataLogging_DOCU_v1d0_en

of 55

description

64396156_S7-1200_DataLogging_DOCU_v1d0_en

Transcript of 64396156_S7-1200_DataLogging_DOCU_v1d0_en

  • Applications & Tools

    Answers for industry.

    Cover sheet

    Process Data Acquisition and Monitoring SIMATIC S7-1200

    Application Description y January 2013

  • 2 Process Data Acquisition and Monitoring

    1.0, Entry ID: 64396156

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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:

    x Remote access to the data log. x When required, program changes shall also be possible via remote

    maintenance. x The recorded data shall be transmitted to the remote station and archived

    automatically at fixed intervals. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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: x Introduction to data logging with all functions x Issue of alarms via e-mail x 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: x for data logging:

    DataLogCreate [SFB140] DataLogOpen [SFB141] DataLogOpen [SFB142] DataLogClose [SFB144] DataLogNewFile [SFB146]

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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): x T_simulation [FB148] simulates the freezing temperature in the form of a sine

    curve. x 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.

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    PeriodAmplitudeOffseteTemperatur S2sin

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Figure 3-3

    Offset = -22 C

    Amplitude = 6 C

    periodic time = Period/Trigger = 600/(10 Hz) = 60 s

    15 4530 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Table 3-2

    Name Data type Description

    Input RECORDS UDInt Number of data records in the data log Timestamp Bool Time stamp:

    x 0: No time stamp x 1: Date and time

    NAME String Name of the data log Mode Bool Mode to open the data log:

    x MODE= "0" The data records of the data log are retained

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Figure 3-5

    0DataLogCreate

    DONE

    Data log already exists

    20DataLogWrite

    10DataLogOpen

    INC NumberRecords

    DONE

    Data log does not exist

    DONE

    Data log not openData 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Table 3-3

    Name Data type Description

    Input RECORDS UDInt Number of data records in the data log Timestamp Bool Time stamp:

    x 0: No time stamp x 1: Date and time

    NAME String Name of the data log Mode Bool Mode to open the data log:

    x MODE= "0" The data records of the data log are retained

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Figure 3-7

    5 Open_NAME = NAME

    0DataLogCreate

    DONE

    Data log already exists

    20DataLogWrite

    N

    10DataLogOpen

    INC NumberRecords

    NumberRecords>=

    RECORDS

    Y

    35Create NewFile_NAME

    NewFile_ID = Open_ID

    DONE

    Data log does not exist

    DONE

    Data log not open

    DONE

    N

    NewNumber>

    NewFile_max

    Y

    50NumberRecords = 0

    40DataLogNewFile

    DONE

    Data log already exists

    8Open_ID = 0

    30DataLogClose

    Open_NAME = ?

    NAME

    NewFile_NAME

    NumberRecords = 0NewNumber = 1

    INC NewNumberOpen_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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    (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

    x If this value is exceeded, the block TM_MAIL will be executed.

    x Default value = -20 C

    Reset Bool Reset input x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    0Temperature

    >=Temperature_max

    Y

    1Set TM_MAIL.REQ

    INC DoneCounterDONE

    INC ErrorCounterERROR

    DataLog_NewFile2

    ERROR_STATUS = 03

    ERROR_STATUS = TM_MAIL.STATUS

    Temperature Settings > Control Panel to open the Control Panel.

    2. The following settings are described in the

    following: x Date and Time x Network Connections x Regional and Language Options x Scheduled Tasks x Set PG/PC Interface

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x Select your time zone. x If necessary, enable the checkbox to

    automatically adjust the clock for daylight saving changes.

    x Set your local clock time. x 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. x Select your network connection. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

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

    3. x Select the option Use the following IP

    address. x Select an IP address that belongs to

    the subnet mask of the CPU. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x In the Regional Options tab, select

    English (USA) as language. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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.

    x Click the Next> button.

    3. x Select Mozilla Firefox as the program

    to be run. x Click the Next> button.

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    4. x Select daily performance of the task. x Click the Next> button.

    5. Use the current date as start date.

    x Select the start time 00:00. x Select daily performance of the task. x Click the Next> button.

    6. The user name of the logged in user is

    shown. x Enter and confirm the password for this

    user. x Click the Next> button. The password is required for the use of advanced task properties.

    7. x Activate the option Open advanced

    properties for this task when I click Finish.

    x Click the Finish button.

  • 4 Startup of the Application

    32 Process Data Acquisition and Monitoring

    1.0, Entry ID: 64396156

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    8. The advanced properties dialog box for this task opens. x Extend the Run entry field as follows:

    17.6.23.2/DataLog.html?FileName=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=DataLog.csv There must be a blank between exe and 17. x Adjust the IP address 17.6.23.2 to

    your S7-1200 CPU address. x Activate the option Enabled

    (scheduled task runs at specified time).

    9. x Open the Schedule tab.

    x Click the Advanced.. button.

    10. x Activate the Repeat task option.

    x Set the interval to Every 2 minutes until 11:59 PM.

    x Activate the option If the task is still running, stop it at this time.

    x Click OK to confirm your settings.

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    11. x Open the Settings tab. x Activate the option Stop the task if it

    runs for: x Select 1 minute(s). x Activate the option Wake the computer

    to run this task. x 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: x Select the Properties for the

    scheduled task Mozilla Firefox with a click on your right mouse button.

    13. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x Select S7ONLINE (STEP 7) as the

    access point of the application. x 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. x Open the Windows Explorer. x Select Tools and then Folder

    Options.

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    3. x Select the "File Types" tab. x Search and select the file extension

    CSV. x Click the Change.. button.

    4. x In the Open With window, select the

    program Microsoft Office Excel. x Activate the option Always use the

    selected program to open this kind of file.

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x Open Microsoft Excel. x Select Tools and then the menu item

    Add-Ins.

    2. x Activate the add-in Analysis ToolPak

    VBA. x Click OK to confirm your settings.

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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: , Please note: x The characters TO: must be entered. x Each address must be preceded by a

    blank and an arrow bracket (""). x Set a comma after each address.

  • 4 Startup of the Application

    38 Process Data Acquisition and Monitoring

    1.0, Entry ID: 64396156

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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: x 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

    x At the parameter USERNAME, enter your user name for authentication to your e-mail account in the form of a string, for example username

    x At the parameter PASSWORD enter your password for authentication to your e-mail account in the form of a string, for example password

    x At the parameter FROM enter your sender e-mail address for authentication in the form of a string. Example: FROM: [email protected]

    Please note: x The characters FROM: must be

    entered. x Each address must be preceded by a

    blank and 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 x Select PROFINET interface > Ethernet

    addresses > IP protocol and activate the option Use IP router.

    x Enter the IP address of your VPN-capable router (on the controller side).

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    4 x Select Time of day > Local time and enter your time zone.

    x 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. x Finally, click OK to confirm all your

    settings.

    4.3.3 Project download

    Table 4-11

    No. Action Remarks

    1. x Save the project. x Select the S7-1200 program folder and

    transfer the program to the controller by selecting Online and Download to device.

    2. x Define the type of PG/PC interface

    PN/IE. x Define your LAN card as PG/PC

    interface. x 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. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    4. x Press the Load button to acknowledge the load preview.

    5. x In the Load results window, activate

    the option Start all. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    Table 4-12

    No. Action Remarks

    1 x Start the Internet Explorer. x Use the IP address of the CPU as

    address, here: http://17.6.23.2

    The introductory screen opens. x Click download certificate.

    2 The dialog window File Download

    Security Warning opens. x Click the Open button in the dialog

    window File Download Security Warning to open the file.

    3 The dialog window Certificate opens.

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    4 x Follow the dialog instructions of the Certificate Import Wizard to import the certificate.

    5 x Select the option Place all certificates

    in the following store. x Click the Browse button.

    6 x Select the certificate store Trusted

    Root Certification Authorities. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 x Call the startup page of the web server and log in: Name: admin Password:

    x Click Log in.

    2 When you log in to the web server for the

    first time, the message This Connection is Untrusted will appear. . x Select the option I Understand the

    Risks.

    3 Thereupon the option Add Exception

    appears. x Click the option Add Exception...

  • 4 Startup of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 x Enter the IP address of your CPU in the address field in Firefox to open the web server.

    x Click ENTER.

    2 The start page of the web server with CPU

    information opens. x Select the menu item Data Logs.

  • 4 Startup of the Application

    46 Process Data Acquisition and Monitoring

    1.0, Entry ID: 64396156

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x 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. x Select the option Save File. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    5 Operation of the Application 5.1 Overview

    The functions of this application include: x Remote maintenance x Manual download of the DataLog file x Manual download of the DataLog file x 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. x Select the program folder of the S7-1200 in the project.

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    3. x Select PN/IE as the type of the PG/PC interface.

    x Define your Internet connection as PG/PC interface.

    x Select the Go online button to establish a connection with the CPU.

    4. Find and select the controller in the list of

    accessible devices. x 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. x Select the function Set time of day. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 x Start the Internet Explorer. x Use the IP address of the CPU as

    address, here: http://17.6.23.2

    x 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). x Enter the name admin and leave the

    Password field free. x 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: x the user name admin and the Log

    out being displayed x the option of a flashing CPU via the

    button Flash LEDs x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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. x 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 x Record number x Date x UTC Time time stamp x Temperature

  • 5 Operation of the Application

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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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 x Open the Windows Control Panel and select the folder Scheduled Tasks.

    x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    3 x 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.

    x At every odd-numbered minute, Firefox will be closed again.

    x The files will be stored in the folder specified in Firefox under Tools > Options > General > Downloads.

    x 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 x Open the Internet Explorer. x Use the IP address of the CPU as

    address, here: http://17.6.23.2

    x Click ENTER.

    2 To enable the writing of variables, you must

    log in to the web server. x Enter the name admin and leave the

    Password field free. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    No. Action Remarks

    3 The logged-in status can be identified by: x the display of the user name admin

    and the Log out x the option Flash LEDs for CPU

    flashing x 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.

    x Go to the Address column, enter the symbolic tag name Tags.TmMail.Enable and press the RETURN key.

    The Monitor Value is 2#0. x 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. x 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: x 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. x 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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    013

    All

    right

    s re

    serv

    ed

    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/en/36932465

    \2\ CPU Firmware 2.2 http://support.automation.siemens.com/WW/view/en/41886031/133100

    \3\ Hardware Support Package (HSP) 0026

    http://support.automation.siemens.com/WW/view/en/54164095

    \4\ STEP 7 Basic V11.0 SP2 System Manual

    http://support.automation.siemens.com/WW/view/en/57199536

    \5\ Service Pack 2 for STEP 7 V 11 http://support.automation.siemens.com/WW/view/en/56750498

    \6\ Updates 4 for STEP 7 V 11 SP2 http://support.automation.siemens.com/WW/view/en/58112582

    \7\ SIMATIC S7-1200 Easy Book http://support.automation.siemens.com/WW/view/en/39710145

    \8\ WAN Access Methods http://support.automation.siemens.com/WW/view/en/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/en/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/en/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/en/67262019

    7 History Table 7-1

    Version Date Revisions

    V1.0 01/2013 First issue

    Process Data Acquisition and Monitoring 1 Task1.1 Overview

    2 Solution2.1 Overview of the general solution2.2 Description of the core functionality2.3 Hardware and software components

    3 Function Mechanisms of this Application3.1 T_simulation [FB148]3.2 DataLog [FB143]3.3 DataLog_NewFile [FB145]3.4 TmMail [FB149]3.5 Remote access to the controller3.6 TM_MAIL functionality

    4 Startup of the Application4.1 Hardware adaptation4.2 PG/PC system settings4.2.1 Date and time4.2.2 Network connections4.2.3 Regional and language options4.2.4 Scheduled tasks4.2.5 Set PG/PC interface4.2.6 CSV files4.2.7 Microsoft Excel

    4.3 Project adaptation4.3.1 TM_MAIL4.3.2 CPU properties4.3.3 Project download

    4.4 Internet browser settings4.4.1 Internet Explorer 84.4.2 Firefox

    5 Operation of the Application5.1 Overview5.2 Remote maintenance5.3 Manual download of the DataLog file5.4 Automatic download of the DataLog file5.5 Alarm generation by sending an e-mail

    6 Links & Literature7 History