×
Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 9829529, Entry date: 09/26/2003
(0)
Rate

controlling Runtime objects via external file information

  • Entry
  • Associated product(s)

QUESTION:
How can I retrieve information from a text file to influence objects in the WinCC Runtime?

ANSWER:
The following example describes how picture windows of different picture types can be displayed based on the data of a text file. First configure your picture type pictures in the Graphics Designer (WinCC V5.0 SP2):



The second step is to define the internal tags for controlling your picture windows. Define, for example, a structure tag of the "Picture" type in which you store the information required for each picture. The structure tag shown in the following figure consists of the elements "type", "state" and "valid". They are needed to control the display of the picture windows.



The "type" element contains the name of the picture type picture to be displayed. The "state" element displays and hides the information. Via "valid" you display the validity of the information read from the file. Create a control tag of the structure type Picture for each picture window.



Then in the Graphics Designer you configure the picture in which you want to have you picture windows displayed. Connect the properties of the picture windows with the tags you have already created as shown in the following figure.



Now, using the Global Script editor, you can write an action that reads information from a file and provides the tags accordingly with values.



The download contains a WinCC V5 project consisting of nine type pictures with associated control tags, one master picture with nine picture windows, one cyclic action (only use for demonstration purposes for the sake of performance) and one text file. The nine type pictures are either displayed or hidden depending on the information from the text file.



The structure in the text file consists of nine lines. Each line contains two values separated by a comma. The first value stands for the picture type (1..9) displayed in the picture windows. The second value indicates whether the picture window is displayed (2) or hidden (1).


If any values more than the two values separated by a comma are entered in a line, they are ignored. Non-permissible values are not evaluated and are marked as "FALSE" at the bottom of the picture window. Likewise, any more than the nine lines are also ignored.

Note:
Below is a sample project each for SIMATIC WinCC V5.x and SIMATIC WinCC V6.0. The functionality of both sample projects is identical.

pict_view.exe

Copy the "pict_view.exe" file into a separate directory and then start the file with a double-click. The WinCC V5.x project and the text file unpack with all the associated subdirectories. Then you can open and process the unpacked project with the Windows Control Center. Before activating Runtime, please change the computer name in the project and also change the path to the text file accordingly in the global action "gsccs1.pas".

pict_view_V6.exe

Copy the "pict_view_V6.exe" file into a separate directory and then start the file with a double-click. The WinCC V6.0 project and the text file unpack with all the associated subdirectories. Then you can open and process the unpacked project with the Windows Control Center. Before activating Runtime, please change the computer name in the project and also change the path to the text file accordingly in the global action "gsccs1.pas".

Keywords:
File operations


Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.