controlling Runtime objects via external file information
How can I retrieve information from a text file to influence objects in the WinCC Runtime?
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.
Below is a sample project each for SIMATIC WinCC V5.x and SIMATIC WinCC V6.0. The functionality of both sample projects is identical.
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".
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".
- You have a technical question / problem: Ask the Technical Support
- You want to discuss in our forum and exchange experiences with other users
- You want to create CAx data for one or more products
- You would like to send us feedback on this Entry