How to organize flashing of a graphic object on WinCC Unified
Published in the light of WinCC Unified hooked immediately. Possessing, from the point of view of an application programmer, functionality close to WinCC Professional, it is sold for a price comparable to WinCC Advanced.
Full-fledged work with scripts, a full-fledged alarm subsystem, an out-of-the-box client-server architecture that does not require an additional license, as well as much more – it’s great. However, as is often the case with completely new software, some things are a little bewildering at first.
And just the organization of visualization of “blinking”, in which the color of a graphic object changes with a certain frequency (for example, from gray to green when visualizing an engine start), causes this very bewilderment. The fact is that the color of an object can be dynamized by a tag, script or “blink”, but, despite the fact that Flashing refers to dynamization from the point of view of the editor, it is set statically.
In this dynamization, the main and “alternative” colors are set, the blinking frequency, and the conditions are “never”, “always”, and “range violation” (range violation). What kind of violation is unclear. In general, at the moment there is some very annoying limitation in the system, which has to be bypassed with the help of good old crutches.
To simplify, we present the display of the state of the technological unit in the following colors:
-disabled: gray (StateRunning tag comes from the controller, if true, then enabled, if false, then disabled)
– on: green
– enabled (Starting tag from the controller) or disabled (Stopping tag): blinking gray and green.
Yes, I know that we still need to add an accident and, possibly, unavailability and the “maintenance” mode, and the on / off state can be displayed with two tags, but this is a training, not a combat example.
For the pump mnemonic, I use the Dynamic Widget “Pumps → HeavyDutyPlasticCentrifugalPump” from the standard library, I really like it.
Objects of this type allow you to set the main color
The first way to solve the problem is simpler to implement and came to mind right away. It is necessary to create several copies of one object, set its color or blinking by static, and show only the most relevant one at a time on the mnemonic diagram. Well, for example, if the motor starts, then we must display a copy with the configured BasicColor = flashing, and hide the rest by playing with the Visible property.
Here are the configured three objects.
Next, the visibility property of each object must be dynamized using the following scripts.
For each of the scripts, do not forget to specify triggers for triggering.
Place all three graphical objects on top of each other and you can start checking:
The second way is less obvious, but it seems to me more beautiful. It consists in using an additional variable, the value of which changes at regular intervals (from true to false and vice versa). The task scheduler (aka scheduler, aka “scheduler”) in WinCC Unified allows you to execute tasks with a period of 100 milliseconds, but a second cycle is also suitable for us. We set up an internal variable of type BOOL
We create a script that runs every second.
We take one instance of the SVG used in the first example and dynamicize the BasicColor property with the following script.
The trigger for this script is:
This method has both advantages and disadvantages. The advantages include, of course, the use of just one graphical object instead of several copies with different static properties. Disadvantages – extra computational load. Given that the “second” tag is a trigger for the script, the entire script will be executed every second, regardless of whether the actual state of the equipment has changed or not.