Vous êtes sur la page 1sur 46

Application Example 08/2015

Long-Term Data Archiving on


SIMATIC HMI Operator Panels
with WinCC (TIA Portal)
WinCC (TIA Portal) V13 SP1

https://support.industry.siemens.com/cs/ww/de/view/109477071

Warranty and Liability

Warranty and Liability


Note

The application examples are not binding and do not claim to be complete with
regard to configuration, equipment or any contingencies. The application
examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for the correct
operation of the described products. These application examples do not relieve
you of the responsibility of safely and professionally using, installing, operating
and servicing equipment. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
application examples at any time and 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.

Siemens AG 2015 All rights reserved

Any claims against us based on whatever legal reason resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of fundamental contractual obligations (wesentliche
Vertragspflichten). The compensation for damages due to a breach of a
fundamental contractual obligation is, 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 of the
burden of proof to your detriment.
Any form of duplication or distribution of these application examples or excerpts
hereof is prohibited without the expressed consent of Siemens AG.

Security
information

Siemens provides products and solutions with industrial security functions that
support the secure operation of plants, solutions, machines, equipment and/or
networks. They are important components in a holistic industrial security
concept. With this in mind, Siemens products and solutions undergo continuous
development. Siemens recommends strongly that you regularly check for
product updates.
For the secure operation of Siemens products and solutions, it is necessary to
take suitable preventive action (e.g. cell protection concept) and integrate each
component into a holistic, state-of-the-art industrial security concept. Third-party
products that may be in use should also be considered. For more information
about industrial security, visit http://www.siemens.com/industrialsecurity.
To stay informed about product updates as they occur, sign up for a productspecific newsletter. For more information, visit
https://support.industry.siemens.com.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

Table of Contents

Table of Contents
Warranty and Liability ................................................................................................. 2
1

Task ..................................................................................................................... 4

Solution............................................................................................................... 5
2.1
2.2
2.2.1
2.2.2

Mode of Operation ............................................................................................. 8


3.1
3.2

Siemens AG 2015 All rights reserved

Principles of configuration .................................................................... 8


Overview............................................................................................... 9

Configuration and Settings............................................................................. 11


4.1
4.1.1
4.1.2
4.1.3
4.2
4.3
4.4
4.4.1
4.4.2
4.4.3
4.5
4.5.1
4.5.2
4.5.3
4.5.4
4.5.5
4.5.6
4.6

Overview............................................................................................... 5
Hardware and software components ................................................... 6
Validity .................................................................................................. 6
Components used ................................................................................ 7

Tag archives ....................................................................................... 11


Names of the long-term archives ....................................................... 11
Creating tag archive ........................................................................... 12
Long-term tag archiving...................................................................... 15
Tags used ........................................................................................... 16
Text lists ............................................................................................. 17
Configured screens ............................................................................ 17
Screen 1 ............................................................................................. 19
Screen 2 ............................................................................................. 21
Screen 3 ............................................................................................. 26
Scripts................................................................................................. 27
Overview............................................................................................. 27
Short description ................................................................................ 27
Copy_Archive script ......................................................................... 28
Load_Archive script ......................................................................... 31
Request_Load_Archive script .......................................................... 36
Create_Storage_Path script ............................................................ 36
Other functions used .......................................................................... 37

Operating the Application ............................................................................... 38


5.1
5.2

Configured plant screens ................................................................... 38


Error detection .................................................................................... 43

Links & Literature ............................................................................................ 46

History............................................................................................................... 46

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

1 Task
2.1 Overview

Task

Long-term archiving of process variables


Storing process tags in the form of data archives on internal drives or removable
storage media of HMI operator panels allows later evaluation of the process
sequence at any time.
However, the method is limited because system-related, data archives can only
reach a certain size depending on the operator panel used. For example, a single
archive can comprise a maximum of 20000 values for a TP1200 Comfort Panel. If
10 process tags are to be acquired in intervals of one second, the first old values
are already overwritten by new ones after 2000 seconds or approx. half an hour in
a short-term archive. (Detailed specifications regarding the quantity structures of
the individual SIMATIC operator panels can be found in \3\.)
However, often large data quantities are supposed to be recorded over a longer
period of time.

Siemens AG 2015 All rights reserved

Displaying the data archives via trend views


The data archives are furthermore to be displayed on the operator panels for
analyzing and checking. However, a trend view that can be configured by default
on the operator panels, only allows the display of one single data archive, meaning
it is bound to the same quantity structures as that one and therefore can only
reproduces a limited period of time.
Trend views should also be able to reproduce the data archives whose extent is
not limited by the default quantity structures.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

2 Solution
2.1 Overview

Solution

2.1

Overview

Short description of the application


In order to bypass the limitation of the maximum archive size (and therefore the
recording time of the archives) two configurations, identical in function have been
created for the WinCC PC Runtime and TP1200 Comfort Panel in the present
WinCC (TIA Portal) application. The scheduler cyclically calls a script that copies
the existing data archive after the lapse of a certain amount of time and provides it
with a new name. Apart from a user-defined root, this name also includes the time
1
of the current archive.
After that the data archive is empty and it is rewritten until a further copy process
takes place after the lapse of an hour. This way, data archiving is only restricted by
the free space on the storage medium but no longer by the quantity structures of
the operator panels.

Siemens AG 2015 All rights reserved

Note

The archive names can be individual adjusted.

Other scripts allow it to read out certain archive sections of data archives again
from groups saved that way and to display them via a trend view.
Configured runtime screens
Two screens each are included in the configurations:

Screen 1 includes the trend view of the current values of a configured tag.

An archive can be selected with selection fields via screen 2. In this case the
archive was read into the trend archive with the data 22.05.2015 and the time
10 oclock (see below).

Details on the composition of the archive name can be found in chap. 4.1.1

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

2 Solution
2.2 Hardware and software components

Siemens AG 2015 All rights reserved

Figure 2-1

A precise function description and configuration instruction will follow in the next
chapters.
Advantages
This application example on hand has the following advantages:

The effective size of data archives is only limited by the available space on the
storage medium,

no additional hardware or software expense required,

easy adaptation to own requirements,

no significant burden on computing performance or band width.

2.2

Hardware and software components

2.2.1

Validity
This application is valid for

WinCC (TIA Portal) Advanced V13 SP1 and above,

All operator panels that support archive and script functions.


An overview of the functions of the different operator panels can be found in
\3\.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

2 Solution
2.2 Hardware and software components
Note

2.2.2

Please note that the VBS syntax (script commands) of an operator panel differs
from that of the PC Runtime system. This is why the scripts stored in the TP1200
Comfort project cannot be used in the RT simulation and vis-a-versa.

Components used
This application was created with the following components:

Hardware components
Table 2-1
Component
SIMATIC HMI
TP1200 Comfort

Qty
1

Article number

Note

6AV2124-0MC01-0AX0

Software components
Table 2-2
Siemens AG 2015 All rights reserved

Component

Qty

Article number

Note

WinCC (TIA Portal)


Advanced

6AV2102-0AA03-0AA5

V13 SP1 or higher

SIMATIC WinCC
Logging for Runtime
Advanced, option f.
WinCC (TIA Portal)

6AV2107-0GA00-0BH0

Or comparable

Example files and projects


The following list includes all files and projects that are used in this example.
Table 2-3
Component
109477071_LongTermDataArchives_
Project_PC_Runtime.zip
109477071_LongTermDataArchives_
Project_TP1200_Comfort.zip
109477071_LongTermDataArchives_
en_v10.pdf

Note

Zipped WinCC (TIA Portal) project for PC


Runtime
Zipped WinCC (TIA Portal) project for
TP1200 Comfort Panel
This document.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

3 Mode of Operation
3.1 Principles of configuration

Mode of Operation

3.1

Principles of configuration

Long-term archiving of process values


In order to be able save more process values then specified in the quantity
structures, the configuration copies the current archive each time into a new file
after a fixed period (in this case: one hour).
The date and the time are encrypted in the name and in the storage path of the
new file. (See Copy_Archive script) After the lapse of the copy process the
original archive can therefore be rewritten again.
The duration of the possible long-term archiving is therefore only limited by the
available storage space.
Displaying archived process values in a trend view
Trend views are intended for the display of data archives, however, the archive
name cannot be configured. The archive name has to be fixed in the configuration.

Siemens AG 2015 All rights reserved

In order to display the values of long-term archives which are actually saved in a
number of different files, the following procedure is required:
At first the trend view is configured with a constant file name. The real archive
name is then reconstructed from the user inputs at runtime. This archive is then
copied into the file that was configured in the trend view. (See Load_Archive
script)
The user can select the time and date of the period desired to be displayed via the
runtime screens.
Locking the archive files
Runtime itself cannot copy the files. Instead, an according process of the operating
system has to be triggered from the runtime script.
However, due to operating system conditions, it is always only one process that
can access a certain file at any time. This means that it is not possible to
simultaneously log to a file while it is copied. Instead, a certain sequence of the
procedure has to be adhered to:
1. Interrupt logging, buffer arriving values to be archived
2. Start copying file
3. Wait until the copy process is completed
4. Write buffer into archive
5. Resume logging
Each of these steps requires a period of time that is not precisely defined and the
respective subsequent step may only start when the previous one has been
completed. To guarantee this, it is required to lock the individual operations against
each other.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

3 Mode of Operation
3.2 Overview
For the trend view of the long-term archived values this is done by using two tag
archives:

Archive_01 for the current archiving of the TEST_Var_01 process tag

Data_Logs_Trend_View for displaying the long-term archived values in the


trend view

Data_Logs_Trend_View has been configured in a way that a subsequent


Data_Logs_Trend_View1 archive is already created from the second archive
entry onward. From this time on, runtime does no longer access
Data_Logs_Trend_View but Data_Logs_Trend_View1, and
Data_Logs_Trend_View can be overwritten on operating system level by the copy
process.
In this application example the data from Archive_01 is copied into the
Data_Logs_Trend_View archive for the trend view.

3.2

Overview
The following figure provides an overview of the individual functional sequences.
Details on the configuration can be found in chapter Configuration and Settings
Figure 3-1
"TEST_Var_01"
tag

Siemens AG 2015 All rights reserved

"Archive_01" archive

"Data_Logs_Trend_View" archive

Runtime Start

"TempTag_Data_Logs_Trend_View
tag

"Archive_01" is started

"TEST_Var_01" tag is archived every second in


"Archive_01"
Hour
lapsed

Copy_Archive
script is started

Data of "Archiv_01" is copied in a new archive.


New name: machine + time

"Load Archive"
button
is pressed

"Load_Archive" script is
started

"Data_Logs_Trend_View" archive is started


"TempTag_Data_Logs_Trend_View" tag is
archived every second in the
"Data_Logs_Trend_View" archive
Number of entries > 1 => subsequent archive is
created
Archiving of "Data_Logs_Trend_View" archive is
stopped

Data of the selected archive is copied in the


"Data_Logs_Trend_View" archive

Long-term archiving of process values, red marking

The TEST_Var_01 is assigned to Archiv_01.

Archiv_01 is started with the start of runtime. The values of the


TEST_Var_01 tag are archived every second in this archive.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

3 Mode of Operation
3.2 Overview

The content of Archiv_01 is copied every hour into a new archive via the
Copy_Archive script. The name of the new archive is made up of Name of
the machine + time. The date of the archive is encrypted in the storage path.

Siemens AG 2015 All rights reserved

Displaying the long-term archived values, green marking

The TempTag_Data_Logs_Trend_View tag is assigned to the


Data_Logs_Trend_View archive that is used for the output of values in the
trend view.

The Data_Logs_Trend_View archive is not yet started.

By pressing the Load Archive button the Load_Archive script is started. This
is to be copied into the Data_Logs_Trend_View archive by the user-selected
archive for the trend view.

The Data_Logs_Trend_View archive is now started via the Load_Archive


script.

The TempTag_Data_Logs_Trend_View tag is configured in a way so that


it is archived every second into the Data_Logs_Trend_View archive.
The archive is configured in a way so that a subsequent archive is created
as soon as the archive size exceeds one entry.
This means that the subsequent Data_Logs_Trend_View1 archive is
already created as soon as archiving starts and the first archive entry is
made. Then archiving is stopped again.

As an effect runtime no longer accesses the Data_Logs_Trend_View


archive and the selected long-term archive can be copied into the
Data_Logs_Trend_View archive. Its content is output via the trend view.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

10

4 Configuration and Settings


4.1 Tag archives

Configuration and Settings


This chapter includes the main configuration steps in order to create the used

Archives,

Tags,

Text lists,

Screens,

Scripts.

Details can be found in the attached project.

Notes

Siemens AG 2015 All rights reserved

The configuration steps described below are valid for working with PC Runtime.
Operator panels have to configured slightly different in some sections. If required, this
is also explained in the respective steps.
In the enclosed configuration all described settings have already been made.
If there are no specifications for a configuration parameter, the default specifications
are accepted.

4.1

Tag archives

4.1.1

Names of the long-term archives


Every hour a new file for the long-term archiving of process tags is created. In this
example the name assignment of the archives is dynamic, this means the name
is only created at runtime.
The archive name is made up of:
Archive name + time

For a better overview, the archives are stored in a folder structure that reflects the
respective storage date:
Storage location \ Year_ \ Month_ \ Day_ \ archive name + time.csv

Remark:
The system always automatically adds a 0 (zero) at the end of the archive name.
Example1:

Press_01_70.csv

The archive contains the data from 7 oclock.


The screen below shows the view of the newly created archives on an example.
The values are from the PC runtime.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

11

4 Configuration and Settings


4.1 Tag archives
Figure 4-1

Archive entries
Archive name + time

Storage path
C:\Storage_Data\Year_2015\Month_5\Day_22

4.1.2

Creating tag archive


Below, two tag archives are created. Please particularly note the properties of the
Data_Logs_Trend_View data log.

Siemens AG 2015 All rights reserved

Table 4-1
No.
1.

Description

Screens

Creating tag archive

First of all create two new archives.

Archive_01: Long-term archiving of process values

Data_Logs_Trend_View: For the output of the archived values in a trend view.


Double click Data logs in the Historical data group in the project window in order to open the
editor.
Note
The name of the archives is used in the scripts among other uses. If you are changing the name
of the archive here, update the changes in the scripts (see "Copy Archive script).

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

12

4 Configuration and Settings


4.1 Tag archives
No.
2.

Description
Assigning properties for the
Archive_01 archive

Screens
General:

Open the properties of the Archive_01


archive.

Siemens AG 2015 All rights reserved

General section
Data records per archive entry
In this application a value is
archived every second over a
period of approx. one hour.
Specify a min. of 4500 values.
Storage location entry
Use the drop-down box to select
the
File - CSV (ASCII) storage
location.
Specify a path, in this case
C:\Storage_Data or
\Storage Card MMC\
Logging method section
Select Circular log.
Restart behavior section
Here you can select the options
Enable logging at runtime start and
Append data to existing log.

Properties Logging method:

Properties Restart behavior:

Thus the settings for the first archive are


completed.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

13

4 Configuration and Settings


4.1 Tag archives
No.
3.

Description
Specifying properties for the
Data_Logs_Trend_View archive

Screens
General:

Open the properties of the


Data_Logs_Trend_View archive

Siemens AG 2015 All rights reserved

General section
Data records per archive entry
Specify a number of 1.
Storage location
Use the drop-down box to select
the File - CSV (ASCII) storage
location.
Specify a path. In this case
C:\Storage_Data or
\Storage Card MMC\
Logging method section
Here, select the Segmented circular
log option and specify 1 for the
number of segments.
Restart behavior section
Here, select the Append data to
existing log option.

Properties Logging method:

Properties Restart behavior

Thus the settings for the second archive


are completed.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

14

4 Configuration and Settings


4.1 Tag archives

4.1.3

Long-term tag archiving


In the configuration the TEST_Var_01 tag is archived every second into the
Archive_01 archive.
The second TempTag_Data_Logs_Trend_View tag is used to create a
subsequent archive from the Data_Logs_Trend_View archive.

Specifying the archiving properties


Table 4-2
No.

Siemens AG 2015 All rights reserved

1.

Description

Screens

TEST_Var_01 tag
Open the Logging tags tabular area of
the Archive_01 data logs.
Specify via the Add new entry that the
TEST_Var_01 tag is to be logged into
this archive.
Specify the following parameters via the
drop-down lists or via the Properties ->
General -> Logging type area
navigation:

Acquisition mode: Cyclic (1)

Logging cycle: 1s (2)


1
2

2.

Tag
TempTag_Data_Logs_Trend_View
Repeat step 1 in the Data_Logs_Trend
archive for the
TempTag_Data_Logs_Trend_View tag

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

15

4 Configuration and Settings


4.2 Tags used

4.2

Tags used
Apart from the tags for archiving, other tags are also used in the configuration.
Below, only those tags are listed where supplementary properties configured.

Table 4-3
No.
3.

Description

Screens

Overview
In Screen 2 a date can be specified via
text lists.
The tags listed below are assigned with a
start value.

Selection_Day

Selection_Hour

Selection_Month

Selection_Year

Siemens AG 2015 All rights reserved

On the example of the Selection_Day


the following setting is shown.
Note:
You can adjust the default setting to your
wishes or omit it.
4.

Adjusting the start values for the


Selection_Day tag
Open the properties of the
Selection_Day tag.

Properties
Values entry
Specify a value in the Start value
input field.
In this case 15.
At the first Runtime Start the value of
the tags is preassigned with 15.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

16

4 Configuration and Settings


4.3 Text lists

4.3

Text lists
A date for accessing the archive data can be specified via text lists. The date
specified here is processed further in the scripts.

Table 4-4
No.
1.

Description

Screens

Overview
Four text lists are used in the enclosed
configuration.

Text_List_Day

Text_List_Hour

Text_List_Month

Text_List_Year

Siemens AG 2015 All rights reserved

Below, the setting is shown on the


example of the Text_List_Day text list.
Note
You can adjust the text lists to your
wishes.
2.

Creating text lists


Open the Text and Graphics lists editor.
Add a new text list by double-clicking the
first empty row in the editor.

General
Settings entry
Enter a name for the text list in the
Name column. In this case
Text_List_Day.
Click the Selection column.
Select Value/Range... via the
drop-down list.

The respective values can now be


specified below the list entries. In this
case 31 entries can be made for each
day one.
The configuration of other text lists is the
same.

4.4

Configured screens
In the configuration included three screens have been created:

Screen 1 is used for the display of current values of the process values that are
to be saved long-term (TEST_Var_01),

Screen 2 is used for the trend view of the long-term archived process values,

Screen 3 is used to avoid access conflicts during the loading of screen 2.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

17

4 Configuration and Settings


4.4 Configured screens
The functions configured in the screens are described below.
Permanent window
Table 4-5
No.
1.

Description
Permanent window

Siemens AG 2015 All rights reserved

Four buttons are configured in the


permanent window.
Via these button you can

access individual screens directly.

changes the language of the user


interface (English/German).

terminate Runtime.

Screens
Permanent window:

Animation Appearance:

An animation is configured on the


Screen 1 and Screen 2 buttons.
When the respective screen is loaded,
the background color of the button is
displayed in green.
The tag is set when the screen is loaded
and is reset when the screen is cleared
(see Table 4-6).

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

18

4 Configuration and Settings


4.4 Configured screens

4.4.1

Screen 1

Table 4-6
No.
1.

Description

Screens

Screen 1 Screen properties


Open the properties of
Screen 1.

Siemens AG 2015 All rights reserved

Events tab
Entry loaded/cleared
SetBit
The background color of the
Screen 1 button is changed
through an animation. When
loading the screen, the bit of the
Screen_1_Activ tag is set and
when clearing the screen it is
reset (see Description of
permanent window).
SimulateTag
The values for the TEST_Var_01
tag are created via the
SimulateTag function.

2.

Screen 1 tag output


The current value of the TEST_Var_01
tag is output via an I/O field in the screen.
The value of the tags is archived in
Archiv_01 and output via the trend view.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

19

4 Configuration and Settings


4.4 Configured screens
No.
3.

Description

Screens

Screen 1 - trend view


In Screen 1 a trend view is configured.
The archived entries of the
TEST_Var_01 tag are output via the
trend view.
In order to output the values from an
archive, proceed as follows.
Open the properties of the trend view.
"Properties" tab
Trend entry
"Trend type:
Here, select the Data log type
via the drop-down list.
Select Archiv_01 in the data log
and the TEST_Var_01 tag for
the process value for the Source
settings.

Siemens AG 2015 All rights reserved

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

20

4 Configuration and Settings


4.4 Configured screens

4.4.2

Screen 2

Table 4-7
No.
1.

Description
Screen 2 Screen properties

Screens
Events - Loaded/Cleared:

Open the Events in the Properties of


Screen 2.

Siemens AG 2015 All rights reserved

2.

Loaded entry: SetBit;


Cleared entry: ResetBit
The background color of the
Screen 2 button is changed
through an animation. When
loading the screen, the bit of the
Screen_2_Activ tag is set and
when clearing the screen it is
reset (see Description of
permanent window).
SimulateTag
The values for the TEST_Var_01
tag are created via the
SimulateTag function.

Screen 2 Visibility of warning


message and trend view

Warning message:

Always only the trend view is to be


displayed or the warning message
indicating that no long-term archive could
be found for the selected date. This is
controlled via the Visibility animation of
the two screen objects:

Warning message
Open the dialog for the screen
object of the warning message in
Properties, Animations.
Combine the parameters in
Visibility as follows:
Tag: TrendView_Visible
Range From: 1
Range To: 1
Visibility: Visible
"OK" button
Repeat the steps for the warning
message.
Trend view
Repeat the steps for the warning
message, however, set the value
for Range From and Range To
to 0 respectively.

Trend view:

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

21

4 Configuration and Settings


4.4 Configured screens
No.
3.

Description
Screen 2 - symbolic I/O fields

Screens
General:

In Screen 2 four symbolic I/O fields


have been configured with which the user
can specify the date and the time of the
long-term archive to be loaded and
displayed via the trend view.
The configuration is explained on the
example of the symbolic I/O field for the
year.
Open the properties of the symbolic I/O
field.

General tab

Siemens AG 2015 All rights reserved

Process entry.

4.

Select the appropriate tag, in this


case Selection_Year. The tag is
processed in a script.
Contents entry
Select the appropriate text list via
the drop-down list, in this case
Text_List_Year.
Animations tab
Control enable entry
The symbolic I/O field can only be
operated when the manually
created message is not displayed.
(The message is triggered via a
script).
For this, enable the Enabled
option and specify an appropriate
tag, in this case
TrendView_Visible.

Animation Control enable:

Screen 2 - time output


There is a Date time field in
screen 2.
The system time of the operator panel is
output.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

22

4 Configuration and Settings


4.4 Configured screens
No.
5.

Description
Screen 2 Load Archive button

Screens
Events Press:

The Load Archive button accesses a


screen from which in turn the
Request_Load_Archive script can be
accessed.
The reason for this procedure is
described in the documentation of the
script.
Open the properties of the button.

Siemens AG 2015 All rights reserved

6.

Events tab
Press entry.
Screen_3 is accessed via the
EnableScreen function.
Animations tab
Control enable entry
The button can only be operated
when the manually created
message is not displayed. (The
message is triggered via a script).
For this, enable the Enabled
option and specify an appropriate
tag, in this case
TrendView_Visible.

Animation Control enable:

Screen 2 - message
In Screen 2 a message is configured.
The message is triggered via a script.
Open the properties of the text field.

Animations tab
Visibility entry

The text field is only displayed


when the trend view is hidden.
For this, enable the Enabled
option and specify an appropriate
tag, in this case
TrendView_Visible.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

23

4 Configuration and Settings


4.4 Configured screens
No.
7.

Description
Screen 2 - OK button

Screens
Properties button:

In Screen 2 a message is configured.


The message is acknowledged via the
"OK" button.
Open the properties of the text field.

Siemens AG 2015 All rights reserved

Events tab
Press entry.
The ResetBit function
successfully resets the
TrendView_Visible tag.
Animations tab
Visibility entry
The button is only displayed when
the trend view is hidden.
For this, enable the Enabled
option and specify an appropriate
tag, in this case
TrendView_Visible.

Animations Visibility:

Note
Instead of the manually generated
message, a system message can also be
configured in the Load_Archive script.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

24

4 Configuration and Settings


4.4 Configured screens
No.
8.

Description
Screen 2 - trend view

Screens
Properties - Trends:

In Screen 2 a trend view is configured.


The long-term archived entries of the
TEST_Var_01 tag are output via the
trend view.
Unlike Screen 1, the existing archives
here are copied via script in
Data_Logs_Trend_View archive and
output via the trend view.
To do this, proceed as follows:
Open the properties of the trend view.

Siemens AG 2015 All rights reserved

"Properties" tab
Trends, "Trend type entry:
Here, select the Data log type
via the drop-down list.
Source settings:
Select Data_Logs_Trend_View
in the data log and the
TEST_Var_01 tag for the
process values.
Time axis entry
In this example a tag is used for
the External time, in this case
TrendView_ExternalTime. This is
the time stamp of the long-term
archive that is to be displayed.
The time for the tag is made up in
the "Load_Archive script.
Animations tab
Display, Visibility entry
The trend view is only visible
when the manually created
message is not displayed. (The
message is triggered via a script).
To do this, enable the Visible
option in Visibility and specify an
appropriate tag, in this case
TrendView_Visible.

Properties - Time axis:

Animations Visibility:

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

25

4 Configuration and Settings


4.4 Configured screens

4.4.3

Screen 3

Table 4-8
No.
1.

Description

Screens

Screen 3 - screen properties


Screen 3 is used to access a script and
to display a message.
The reason for this procedure is
described in the description of the
Request_Load_Archive script.
Open the properties of Screen 3.

Siemens AG 2015 All rights reserved

2.

Events tab
Loaded entry
SimulateTag
The values for the TEST_Var_01
tag are created via the
SimulateTag function.
Call Script
The Request_Load_Archive
script is executed with the loading
of the page.

Screen 3 - message
Executing the Request_Load_Archive
script requires a certain amount of time.
The message informs the user about the
delay.
At the end of the script processing the
configuration automatically goes back to
Screen 2.
Note
If script processing fails and Screen 2 is
not automatically accessed, there is the
option to manually access Screen 2 via
the -- Screen 2 -- button.
(This is recommended in the
configuration phase or when the page
cannot be accessed via the permanent
window.)

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

26

4 Configuration and Settings


4.5 Scripts

4.5

Scripts

4.5.1

Overview
In this chapter you will receive information on the following scripts.

Note

Copy_Archive

Load_Archive

Request_Load_Archive

Create_Storage_Path

In the main, the structure of scripts for the TP1200 Comfort Panel and the PC
Runtime are the same. Please note that the VBS syntax between an operator
panel and a PC Runtime system are different.
You cannot use the TP1200 Comfort Panel project on a PC in runtime
simulation.

Siemens AG 2015 All rights reserved

4.5.2

Short description

Copy_Archive
The script copies the Archive_01 archive (see Creating tag archive) and provides
the archive thus generated with a new name. The name is created at runtime and
is made up of:
Archive name + time

The storage location for the new archive is transferred to the script as parameter
and can therefore be quickly adjusted.
The script is accessed hourly via the scheduler.
In the chapters below you will find notes regarding the script configuration.
Load_Archive
The user specifies the data and time of the archive to be loaded via Screen 2.
The script evaluates this specification and copies the selected archive into the
archive for the trend view.
The storage location of the archive files is transferred to the script as parameter.
The script is accessed from the Request_Load_Archive script.
Request_Load_Archive
The Load_Archive script is called from the Request_Load_Archive script.
Accessing the Request_Load_Archive is carried out when Screen 3 is loading.
Load_Archive loads an existing archive into the trend view. If the Load_Archive
script is carried out whilst Screen 2 is active with the trend view, there may be
access errors (simultaneous write and read access to the trend view). In order to
prevent this, the Request_Load_Archive script is executed via Screen 3.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

27

4 Configuration and Settings


4.5 Scripts
Create_Storage_Path
The script checks whether a default directory is available.
If the default directory is not available, the script automatically creates the missing
folder.
The script is accessed from the Copy_Archive script.

4.5.3

Copy_Archive script

Detailed description
Table 4-9
No.
1.

Description

Screens

Script, row 7

Siemens AG 2015 All rights reserved

In row 7 the name of the archive is


specified that is to be copied in the further
course, in this case Archive_01.
Note
The name has to match the name of the
archive you used for Creating the tag
archive .
2.

Script, row 12 to 17
The name of the new archive includes,
among others, the current date and time.
The copy process is executed via the
scheduler always at the full hour.
For the name of the archive it is
necessary to generate the hour value of
the previous hour.
This is implemented in rows 12 to 17.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

28

4 Configuration and Settings


4.5 Scripts
No.
3.

Description

Screens

Script, row 22

In row 22 the new name of the storage path is generated.


The storage path is made up of storage location and a path in which the storage date is encrypted.
Storage location \ Year \ Month \ Day
The values of the tags are from rows 14 to 17.
The storage location can be adapted as desired.
In row 22 the StoragePath parameter is used. When accessing the script the storage location is
specified via this parameter, in this case: \Storage Card MMC\ or C:\Storage_Card\.
Alternatively, you can specify a fixed storage path in row 22.
Notes
The StoragePath parameter has to match the storage location that was specified in the
Properties of the Archive_01 archive.
Please note the spelling and the characters used such as, for example, a \. Otherwise
misinterpretations may take place.
4.

Script, row 27

Siemens AG 2015 All rights reserved

In row 27 the Create_Storage_Path


script is accessed.
If the specified storage path includes
several sub folder and they are not yet
available on the operator panel, the script
will generate the required folders.
The storage path is transferred to the
script as parameter.
In this example the name of the storage
path is written in the
Name_StoragePath tag.
5.

Script, row 32
In row 32 the new file name is generated.
The name is made up of archive name +
time.
The archive name is fixed here with
Press_01.
The time is evaluated at runtime and
passed on the Variable_Hour tag.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

29

4 Configuration and Settings


4.5 Scripts
No.
6.

Description
Script, row 37

Screens
Syntax PC Runtime

Data access is via row 37.


Please note the command syntax of the
operator panel used.

7.

Syntax operator panel (TP1200 Comfort Panel)

Script, row 42
The archive is copied in row 42.
The required contents have already been assigned to the tags so that you do not need to make
any changes here.
Please note the command syntax of the operator panel used.

Siemens AG 2015 All rights reserved

Syntax PC Runtime

Syntax operator panel (TP1200 Comfort Panel)

Note
The StoragePath parameter is transferred to the script when accessing it. It includes the storage
path of the archive.
8.

Script, row 47
The storage used is freed again in row
47.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

30

4 Configuration and Settings


4.5 Scripts

4.5.4

Load_Archive script

Table 4-10
No.
1.

Description

Screens

Script, row 8 to 16

The date for the archive to be loaded is specified via Screen 2 These values are first transferred
to internal tags in rows 8 to 11.
In row 16 the storage path of the archive is made up of the specified period of time.

Siemens AG 2015 All rights reserved

Note
The StoragePath parameter is transferred to the script when accessing it. It includes the storage
path of the archive.
2.

Script, row 21
In row 21 the name of the archive to be
accessed is made up of the root archive
name and the time.
The root archive name is fixed here with
Press_01.
The time is specified via Screen 2
(symbolic I/O fields).

3.

Script, row 26

Syntax PC Runtime

Data access is via row 26.


Please note the command syntax of the
operator panel used.

4.

Syntax operator panel (TP1200 Comfort Panel)

Script, row 31
Via row 31 it is checked whether the
specified archive name is available.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

31

4 Configuration and Settings


4.5 Scripts
No.
5.

Description
Script, row 34 to 43

Screens
Syntax PC Runtime

In row 34 to 43 it is evaluated whether the


selected archive is available.
If the selected archive is not available, a
bit is set via row 41 and a manually
created system message appears (see
Message Description). The trend view
is hidden.

Syntax operator panel (TP1200 Comfort Panel)

Siemens AG 2015 All rights reserved

Please note the command syntax of the


operator panel used.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

32

4 Configuration and Settings


4.5 Scripts
No.
6.

Description

Screens

Script, row 47 to 74

Siemens AG 2015 All rights reserved

For the function of the script, please also observe the notes on the configuration of the
Data_Logs_Trend_View archive.

Row 47
The Data_Logs_Trend_View archive is started in row 46.
Note the configuration of the archive.
The archive is a Segmented circular log and is not automatically started at the start of
runtime.
For a data record number > 1 a subsequent archive is automatically created via runtime with
the name Data_Logs_Trend_View1.
Row 52 to 54
Script processing is interrupted until the Data_Logs_Trend_View1 archive is created.
Row 58
If the Data_Logs_Trend_View1 archive is available, the content of the long-term archive is
copied into the Temp_Data_Logs_Trend_View archive.
Row 63 to 65
Script processing is interrupted until the copy process is completed.
Row 69
The archiving of the Data_Logs_Trend_View archive is stopped.
Row 74
All archives are closed.

This process prevents access conflicts on the Data_Logs_Trend_View archive.


Please note the command syntax of the operator panel used.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

33

4 Configuration and Settings


4.5 Scripts
No.
7.

Description
Script, row 81 to 103

Siemens AG 2015 All rights reserved

Screens

Row 81 to 85
The previously described functions require a certain amount of time. In order to prevent
access conflicts, a waiting period is configured.
Row 92 to 94
Once all archives are closed, the previous temporarily created archives are deleted.
Row 99 to 103
In order to prevent access conflicts, a waiting period is configured.

Note
The configured waiting period is too short if there any messages regarding access errors during
the processing of the script. In this case increase the upper limit of the While loop.
8.

Script, row 108

Copy of the selected archive into the archive for the trend view.
Please note the command syntax of the operator panel used.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

34

4 Configuration and Settings


4.5 Scripts
No.
9.

Description

Screens

Script, row 113 to 118


After the copy process all archives are
reopened and the Archive_01 archive is
restarted.
Notes

The values for Archive_01 are


saved internally between
CloseAllLogs and StartLogging
via the operator panel and are
therefore not lost.

If you are using other archives, they


also need to be restarted via the
StartLogging system function.

Siemens AG 2015 All rights reserved

10.

Script, row 123 to 127

In the trend view in Screen 2 an External time" is specified for the x axis, this is the time stamp
of the long-term archive to be displayed. Its value is made up of rows 123 to 127.
Background
The trend view shows values over a period of one hour. If a long-term archive is accessed, the
time axis (X axis) of the trend view is adjusted to its time stamp.
It is not necessary to scroll or enter the time axis manually.
11.

Script, row 132


The storage used is freed.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

35

4 Configuration and Settings


4.5 Scripts

4.5.5

Request_Load_Archive script

Table 4-11
No.
1.

Description

Screens

Script, row 15 to 29
In row 14 the Load_Archive script is
accessed.
Enter the storage location as parameter,
in this case: C:\Storage_Data\.

Siemens AG 2015 All rights reserved

Row 20 to 24
The previously described functions
require a certain amount of time. In
order to prevent access conflicts, a
waiting period is configured.
Row 29
After the configured waiting period,
Screen 2 is accessed again with
the trend view.

Note
Also observe the note for Configuring
screen 3.

4.5.6

Create_Storage_Path script

Table 4-12
No.
1.

Description

Screen

Script, row 15
Data access is via row 14.
Please note the command syntax of the
operator panel used.
Script, row 20 to 42
The specified storage location is
transferred with the StoragePath (row
25) parameter.
Based on the \ separator the script
detects the individual folders and then
creates them independently.
Row 47
The storage used is freed again in row
47.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

36

4 Configuration and Settings


4.6 Other functions used

4.6

Other functions used


The scheduler is used for the hourly execution of the Copy_Archive script.

Table 4-13
No.
1.

Description

Screen

Scheduler

Siemens AG 2015 All rights reserved

Access the scheduler in the project tree.


Create new tasks

Double click the first free row of the


task table. A new Task is created.
Open the Properties tab in the area
navigation. Make the following settings:

Task, Name: Job_1

Starting time, Trigger: 1 hour

at minute 00
=> The task is carried out every hour
at minute 0.
Go to the Events tab.

Select the Copy_Archive script in


the VB functions column in Add
function.

Transfer the desired storage location


of the archives to the script as
StoragePath parameter, e.g.
C:\Storage_Data\

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

37

5 Operating the Application


5.1 Configured plant screens

Operating the Application


This chapter explains the operation of the application.
Prerequisite

Note

5.1

PC station
Access to drive C:\ for the archives.

TP1200 Comfort Panel


MMC or SD memory card for the archives.

If you require a different storage location, adjust the storage location accordingly
in the configuration.

Configured plant screens

Siemens AG 2015 All rights reserved

The operation of the screens is described below on the example of WinCC (TIA
Portal) runtime. The operation for the TP1200 Comfort Panel is the same.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

38

5 Operating the Application


5.1 Configured plant screens
Table 5-1
No.

Siemens AG 2015 All rights reserved

1.

Description

Screens

Screen 1

Screen 1 is used to display the current values of the short-term Archiv_01 archive.
The current value of the TEST_Var_01 tag is output via an I/O field and can also be changed
manually here.
The buttons have the following functions:

Screen 2: goes to Screen 2 (display of long-term archived values)

German/English: Changes the interface language of runtime

RT Stop: Exits Runtime

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

39

5 Operating the Application


5.1 Configured plant screens
No.

Siemens AG 2015 All rights reserved

2.

Description

Screens

Screen 2

In Screen 2 the long-term archives are accessed and displayed via the trend view.
Select the desired date and time via the respective drop-down window.

Year

Month

Day

Hour
In this example the archive was accessed from 22.5.2015 and 10:00 oclock.
(The values correspond to a period from 10:00 oclock to 11:00 oclock.)
Once you have set the desired date, click the Load Archive button. The archive is loaded.
Navigate through the archive by means of the buttons of the trend view.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

40

5 Operating the Application


5.1 Configured plant screens
No.

Siemens AG 2015 All rights reserved

3.

Description

Screens

Screen 2: Message

If you click the Load Archive button and the above message appears, there is no archive file
for the set date. Check your settings if this is case.
To confirm the message, click the OK button.
Note
As long as the message is active, the other operating elements are blocked.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

41

5 Operating the Application


5.1 Configured plant screens
No.

Siemens AG 2015 All rights reserved

4.

Description

Screens

Screen 3 (cannot be accessed directly)

If the Load Archive button is clicked, Screen 3 is accessed.


The Request_Load_Archive script is accessed via screen 3, this starts the Load_Archive
script that loads the selected archive in the trend view before it is automatically returned to
screen 2.
Note
If it is not possible to automatically return due to an error during the script processing, you can
force the return to screen 2 via the Screen 2 button.
Please observe the Note on the configuration of the Request_Load_Archive script.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

42

5 Operating the Application


5.2 Error detection

5.2

Error detection
Below is a list of some possible error causes.

Data is not archived on the memory card or there are access errors in the program
sequence
Make sure that the storage location of the data archives (USB, SD card, MMC card
etc.) is consistently configured. Three storage paths specified in the configuration
have to match:

The Path parameter of the Archive_01 archive,

The StoragePath parameter when accessing the Copy_Archive script in


Job_1 of the scheduler, and

the parameter with which Load_Archive is accessed from the


Request_Load_Archive script (row 15).

If you are archiving the data via a network, check the network connection.
Please also note the FAQ entries \4\ (Network Connection) and \5\ (Availability of
removable storage media).

Siemens AG 2015 All rights reserved

No archive data can be accessed


Compare the configured archive name with the name to be accessed. The names
are generated at runtime via scripts.
Check e.g. the storage location in the Copy_Archive script, step no.6.
Have the name out that is generated via the script through an additional configured
system message.
There will be access errors during the processing of the scripts
Access errors occur when several processes try to access the same file. In order to
prevent this, waiting loops are configured in the scripts that may possibly be too
short depending on the operator panel type used and the working speed of the
operator panels (see "Load_Archive script).
Gradually increase the number of loop cycles.
The debugger script is accessed during script processing
This is a runtime error in one of the scripts. Check the commands used in the
scripts.
Please note that the VBS syntax between an operator panel and a PC Runtime
system differs.
The present TP1200 Comfort Panel configuration cannot be tested in PC Runtime.
The configured archives behave differently than described in the documentation.
Check the configuration of the archives in detail. For this purpose, see chapter
4.1.1.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

43

5 Operating the Application


5.2 Error detection
Screen 1 view
In the trend view of Screen 1 there are areas where no values are displayed.
Figure 5-1

Siemens AG 2015 All rights reserved

In Screen 1 the values of Archiv_01 are output via a trend view. Within this trend
view gaps (1) can be detected where no values (2) are output.
Background
Long-term archive files are read in via Screen 2 During this procedure all
archives have to be briefly closed and are then automatically reopened, also
Archiv_01
The closing of an archive is also logged in the archive by runtime with the
$RT_DIS$ entry. (see Figure 5-2) This message cannot be output via the trend
view and it is shown highlighted instead as displayed in Figure 5-1.
Note
During the time that the archive is shut, the values arising are not lost. Instead the
system buffers the process values over a short period of time and enters them
subsequently in the archive file, as soon as the archive is restarted.

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

44

5 Operating the Application


5.2 Error detection
Detail of the Archiv_010.csv archive file.

Siemens AG 2015 All rights reserved

Figure 5-2

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

45

6 Links & Literature

Links & Literature


Table 6-1

Siemens AG 2015 All rights reserved

Topic

Title

1.

Siemens Industry
Online Support

https://support.industry.siemens.com

2.

Download page of
the entry

https://support.industry.siemens.com/cs/ww/de/view/109477071

3.

SIOS Portal entry


What are the
functional
differences between
the different
SIMATIC panels?

https://support.industry.siemens.com/cs/ww/en/view/40227
286

4.

SIOS Portal entry


How do you
integrate an HMI
operator panel into
a local network?

https://support.industry.siemens.com/cs/ww/en/view/13336
639

5.

SIOS Portal entry


How do you use a
script to determine
whether a storage
drive with
removable media
(USB stick, SD/MM
card) is ready for
writing on an HMI
device?

https://support.industry.siemens.com/cs/ww/en/view/89855
157

History
Table 7-1
Version

Date

V1.0

06/2015

Modifications
First version

Langzeitarchivierung auf Bediengerten mit WinCC (TIA Portal)


Entry ID: 109477071, V1.0, 08/2015

46

Vous aimerez peut-être aussi