Vous êtes sur la page 1sur 3

With SIMATIC WinCC (TIA Portal) on a panel, how do you access proce... https://support.industry.siemens.com/cs/print/document/59604194/with-...

support.industry.siemens.com | Product Support | Monday, 24. June 2019

1 of 3 24-06-2019, 10:28
With SIMATIC WinCC (TIA Portal) on a panel, how do you access proce... https://support.industry.siemens.com/cs/print/document/59604194/with-...
Entry type: FAQ, Entry ID: 59604194, Entry date: 04/07/2015

With SIMATIC WinCC (TIA Portal) on a panel, how do you access process data in a file via a
script?
VB scripts permit you to store any data on the operator panel on a USB removable medium. This FAQ response
explains how to program such scripts.
This FAQ response describes how you can write data from SIMATIC WinCC (TIA Portal) Runtime to a file or read data from the file. VBScript (Visual Basic Scripting) is
used for implementing these functions. In order to save or read out information in a text file, it must be possible to access the file system of Microsoft Windows CE. The
access is made via the "File System Object".
This FAQ response applies for SIMATIC WinCC (TIA Portal) in the Comfort, Advanced and Professional versions for the following operator panels: Comfort Panels and
Panels of the 277 series and higher.
Notes
Only use scripts for saving data if the WinCC standard mechanisms (saving of data archives, etc.) are not sufficient for you application!
The mechanism presented depends on the operating system of your operator panel and on the configuration software used. Refer to the notes at the end of
the entry for information about handling other configurations.
Documentation of VBScript commands in WinCC (TIA Portal)
Information about the separate VBScript commands is available in the WinCC (TIA Portal) help system in the "Content" tab and in the WinCC Advanced manual (Entry ID:
109755202 ), under the chapter 13 "Visualize processes > chapter 9 "Working with system functions and Runtime scripting".

Fig. 01
Entry contents
Example of saving information in a text file or csv file
Example of reading out data from a text file or csv file
Sample project
Instructions
The table below describes how to configure saving to and reading from files, in WinCC (TIA Portal).
The file formats below are used:
csv
txt
Note
Only internal tags are used in this example. Alternatively, you can also use tags with controller connection.
In this example we demonstrate writing to and reading from files on a memory card. If you use a different storage medium, this must be changed accordingly in the script.

No. Procedure
1 Create tags
Open the tag editor by means of "Project navigation > HMI_1 > HMI tags > Show all tags".
Add four internal tags with the following designations:

Tag
Data type
bExtension Bool
szMaterial WString
nPressure Int
nTemperature Int

Fig. 02
2 Add objects
Add a new screen named "ImportExportData" under "Project navigation > Screens".
Insert two rectangles in the screen.
Add a symbolic IO field and three conventional IO fields.
Add a button and nine text fields.
Position all the objects and enter the following texts:
"Process values"
"Pressure"
"Temperature"
"Material"
"Text file"
"mbar"
"°C"
"Settings"
"Extension"
Create a text list named "Extension" of the "Value/Range" type
Add the following entries:
0 => ".txt"
1 => ".csv"

Fig. 03
3 Incorporating script, text list and tags
Create a script with the designation "Write_data". For this you go to the project navigation and click "Scripts > VBScripts > Add new VB functions".
Link the "Write_data" script to the "Save file" button under "Properties > Events > Click".
2 of 3 24-06-2019, 10:28
With SIMATIC WinCC (TIA Portal) on a panel, how do you access proce... https://support.industry.siemens.com/cs/print/document/59604194/with-...
© Siemens AG 2009-2019 - Imprint Privacy policy Cookie policy Terms of use Digital ID

3 of 3 24-06-2019, 10:28

Vous aimerez peut-être aussi