Académique Documents
Professionnel Documents
Culture Documents
https://support.industry.siemens.com/cs/ww/de/view/109477071
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.
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.
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
Overview............................................................................................... 5
Hardware and software components ................................................... 6
Validity .................................................................................................. 6
Components used ................................................................................ 7
History............................................................................................................... 46
1 Task
2.1 Overview
Task
2 Solution
2.1 Overview
Solution
2.1
Overview
Note
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
2 Solution
2.2 Hardware and software components
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,
2.2
2.2.1
Validity
This application is valid for
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
6AV2102-0AA03-0AA5
SIMATIC WinCC
Logging for Runtime
Advanced, option f.
WinCC (TIA Portal)
6AV2107-0GA00-0BH0
Or comparable
Note
3 Mode of Operation
3.1 Principles of configuration
Mode of Operation
3.1
Principles of configuration
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.
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:
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
"Archive_01" archive
"Data_Logs_Trend_View" archive
Runtime Start
"TempTag_Data_Logs_Trend_View
tag
"Archive_01" is started
Copy_Archive
script is started
"Load Archive"
button
is pressed
"Load_Archive" script is
started
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.
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.
10
Archives,
Tags,
Text lists,
Screens,
Scripts.
Notes
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
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
11
Archive entries
Archive name + time
Storage path
C:\Storage_Data\Year_2015\Month_5\Day_22
4.1.2
Table 4-1
No.
1.
Description
Screens
12
Description
Assigning properties for the
Archive_01 archive
Screens
General:
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.
13
Description
Specifying properties for the
Data_Logs_Trend_View archive
Screens
General:
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.
14
4.1.3
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:
2.
Tag
TempTag_Data_Logs_Trend_View
Repeat step 1 in the Data_Logs_Trend
archive for the
TempTag_Data_Logs_Trend_View tag
15
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
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.
16
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
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.
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,
17
Description
Permanent window
terminate Runtime.
Screens
Permanent window:
Animation Appearance:
18
4.4.1
Screen 1
Table 4-6
No.
1.
Description
Screens
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.
19
Description
Screens
20
4.4.2
Screen 2
Table 4-7
No.
1.
Description
Screen 2 Screen properties
Screens
Events - Loaded/Cleared:
2.
Warning message:
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:
21
Description
Screen 2 - symbolic I/O fields
Screens
General:
General tab
Process entry.
4.
22
Description
Screen 2 Load Archive button
Screens
Events Press:
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.
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
23
Description
Screen 2 - OK button
Screens
Properties button:
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.
24
Description
Screen 2 - trend view
Screens
Properties - Trends:
"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.
Animations Visibility:
25
4.4.3
Screen 3
Table 4-8
No.
1.
Description
Screens
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.)
26
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.
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.
27
4.5.3
Copy_Archive script
Detailed description
Table 4-9
No.
1.
Description
Screens
Script, row 7
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.
28
Description
Screens
Script, row 22
Script, row 27
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.
29
Description
Script, row 37
Screens
Syntax PC Runtime
7.
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.
Syntax PC Runtime
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.
30
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.
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
4.
Script, row 31
Via row 31 it is checked whether the
specified archive name is available.
31
Description
Script, row 34 to 43
Screens
Syntax PC Runtime
32
Description
Screens
Script, row 47 to 74
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.
33
Description
Script, row 81 to 103
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.
Copy of the selected archive into the archive for the trend view.
Please note the command syntax of the operator panel used.
34
Description
Screens
10.
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.
35
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\.
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.
36
4.6
Table 4-13
No.
1.
Description
Screen
Scheduler
at minute 00
=> The task is carried out every hour
at minute 0.
Go to the Events tab.
37
Note
5.1
PC station
Access to drive C:\ for the archives.
If you require a different storage location, adjust the storage location accordingly
in the configuration.
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.
38
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:
39
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.
40
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.
41
4.
Description
Screens
42
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:
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).
43
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.
44
Figure 5-2
45
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.
https://support.industry.siemens.com/cs/ww/en/view/40227
286
4.
https://support.industry.siemens.com/cs/ww/en/view/13336
639
5.
https://support.industry.siemens.com/cs/ww/en/view/89855
157
History
Table 7-1
Version
Date
V1.0
06/2015
Modifications
First version
46