How-to
HMI line color animation logic for pipe flow displays
Short answer
Yes, but put the logic in the PLC: compute each pipe segment's flow state as a Boolean AND of its valve bits and the pump-run bit, publish one result tag per segment, and bind that tag to the line's Appearance color animation in WinCC. A panel script can do the same job but adds cyclic script load, while the PLC route leaves the panel running no scripts at all.

On this page
- Can WinCC run small logic for a line color animation on a Comfort Panel?
- Which condition should drive each pipe segment's color?
- Should the AND logic live in the PLC or in a WinCC script?
- How do you bind the result tag to the line color animation?
- What does a Bool tag equal inside a WinCC script?
- What does the AND logic cost on a twelve-segment display?
- How fast does the line color follow the field devices?
- How do you prove the flow display before it goes live?
- Questions asked
Yes, WinCC can run small logic for a line color animation, and the version that holds up on a machine puts that logic in the PLC. Compute each pipe segment's flow state as a Boolean AND of the pump-run bit and every valve bit upstream of it, publish one result tag per segment, and bind each tag to the line's Appearance color animation on the panel. A cyclic script can evaluate the same condition, but scripts add load the panel feels as screens grow, and they duplicate a decision the PLC already owns. Below are the condition each segment needs, the binding steps in WinCC, the Bool conversion values inside a script, a worked example with the arithmetic shown, and the bench test that proves the display points an operator at the trouble spot.
Can WinCC run small logic for a line color animation on a Comfort Panel? #
Yes: the panel can evaluate the condition in a VB script, but the design that holds up on a machine is simpler - compute each segment's flow state in the PLC as one Boolean tag and bind that tag to the line's color animation.
WinCC supports property animations on screen objects, and the animation that recolors a line from a tag is the Appearance animation, so the question is never whether the panel can do it but where the condition is evaluated. Both routes exist: a cyclic VB script can read the valve and pump tags and drive the color, or the PLC can compute the state and hand the panel a finished bit. Everything below commits to the second route, and the script route returns only where it earns its keep.
Which condition should drive each pipe segment's color? #
A segment is flowing only while the pump is running and every valve upstream of it is open, so its condition is the pump-run bit ANDed with all upstream valve bits, not just the nearest valve.
The two-input AND - valve open and pump running - is correct only for the first segment after the pump. Further downstream, a closed valve anywhere upstream must turn the line off, or the far end of the header keeps showing flow that cannot exist. That cumulative condition is what makes the picture a fault finder: when something stops, the first idle segment sits at the trouble spot and everything after it agrees.
Give every condition one owner. If the PLC computes the bit, bind that bit directly and do not re-derive it in a script. The visible result is the same one-bit-drives-one-property pattern as showing an HMI button only when a PLC bit is high; the property here is line color instead of visibility.
For the first segment, in example tag names, the whole logic is:
Valve01 : BOOL; // valve open feedback, already in the PLC
Pump01 : BOOL; // pump run feedback, already in the PLC
ExitPump01 : BOOL; // computed every scan, one result tag per segment
ExitPump01 := Valve01 AND Pump01;
Example names and example structured-text style; keep your controller's own syntax.
Should the AND logic live in the PLC or in a WinCC script? #
Put it in the PLC: a script can do the job, but every cyclic script spends the panel's budget on every update cycle, while a PLC AND costs the display nothing and leaves one owner for the condition.
| Script on the panel | AND in the PLC | |
|---|---|---|
| Where it runs | Every panel update cycle, on the panel's own budget | Inside the PLC scan, before the panel ever asks |
| Tags on the wire | Script reads the source tags and writes the color | One Boolean result tag per segment |
| How it fails | Script load grows with every segment and screen until the panel feels slow | Nothing is added to the panel at all |
| Choose it when | The condition mixes in data the PLC never sees, such as operator entries or panel-local settings | The inputs are PLC tags, which they are for every pipe segment |
Decision: compute the AND in the PLC for this display. The color still reaches the object through the animation, and when a color value must be picked inside a script, the handoff works the way how WinCC runtime color selection reaches a VBScript describes. The same call repeats on other platforms: FactoryTalk View ME pipe color animation fix covers the Rockwell side of the same symptom, on the same principle of driving the color from a tag instead of piling work onto the terminal.
How do you bind the result tag to the line color animation? #
Select the line, open its Properties > Animations list in the Inspector window, add the Appearance animation, assign the segment's Boolean result tag, and fill two range rows so the true state draws the flow color and the false state draws the idle color.
The steps, once per segment:
- Publish one Boolean result tag per segment from the PLC, computed as the condition section above defines it.
- Draw each pipe segment as its own line object, so every segment carries its own animation and its own tag.
- Select a segment and, in the Inspector window, open
Properties > Animations. - Add the Appearance animation and assign that segment's result tag to it.
- Fill the range rows: for example, the true row draws green for flowing and the false row draws dark gray for idle. The colors are yours to choose; the rows simply map tag state to appearance.
- Repeat for every segment, compile, download, and watch each line answer only its own condition.
The screen-side settings for exactly this picture, the Appearance animation bound to flow logic on a pipe display, are walked through in WinCC pipe flow animation color configuration guide.
What does a Bool tag equal inside a WinCC script? #
Inside a WinCC script a Bool tag arrives through the CBool conversion as -1 for true and 0 for false, so a comparison written against 1 never matches even while the screen shows the tag as true.
The conversion is documented in the WinCC property-animation reference for the Bool type: a Boolean tag is implicitly converted with the VB script function CBool, giving -1 for true and 0 for false. Two consequences follow. A script test written as an equality against 1 fails while the screen itself treats the bit as true, which reads like an animation fault but is only the conversion. And it is one more argument for the PLC route, because the Appearance animation consumes the raw tag and never passes through the conversion. If a script is unavoidable, test the value as true or false rather than comparing it to 1.
What does the AND logic cost on a twelve-segment display? #
On a worked example with one pump and twelve zone valves, chaining the conditions computes all twelve segment states with 12 AND operations, while writing every segment's full condition separately needs 78.
Worked example: one pump with feedback Pump01, twelve zone valves Valve01 through Valve12, twelve pipe segments, and a color animation on each segment. Example names; any convention works.
Written out per segment, the segment after valve n needs the pump bit plus valves 1 through n, so it costs n two-input ANDs. The whole header then costs 1 + 2 + ... + 12 = 78 AND operations.
Chain them instead: ExitPump01 := Pump01 AND Valve01, then ExitPump02 := ExitPump01 AND Valve02, and so on to ExitPump12 := ExitPump11 AND Valve12. The same twelve results now cost 12 ANDs, which is 78 - 12 = 66 fewer operations, and a thirteenth zone is one new rung rather than a rewrite of every condition.
On the panel side, this design binds 12 Boolean tags and runs 0 cyclic scripts for the animation. The script route written the naive way reads two source tags per segment, 12 x 2 = 24 tag reads every cycle, plus the script execution itself on top.
How fast does the line color follow the field devices? #
The color follows at the tag acquisition cycle, not at the PLC scan, so an example 500 ms cycle behind an example 10 ms scan puts the worst-case display delay at about 510 ms.
The chain is: the PLC writes the bit inside its scan, the panel reads it at the acquisition cycle configured for the tag, and the screen redraws on the next frame. With those example settings the bound is 10 ms + 500 ms = 510 ms; set the acquisition cycle to 250 ms and the same arithmetic gives about 260 ms. For a flow overview that is already faster than an operator's eye needs, so take the cycle your plant already uses and spend the effort on the logic. When a line never changes at all, the tag is the suspect, not the speed: confirm it toggles at the panel, then work through the poll-side causes in why HMI indicators stay off over Modbus RTU polling.
How do you prove the flow display before it goes live? #
Prove the display on a bench or with the machine stopped: set the pump and valve bits to known combinations and confirm that each segment shows the flow color only when its whole upstream chain is true.
- All valves open and the pump feedback true: every segment shows the flow color.
- Pump feedback false: every segment shows the idle color, whatever the valves do.
- Only the first valve open: only the first segment is colored; the other eleven stay idle.
- Everything open, then the third valve's feedback drops: segments one and two stay colored, segments three through twelve go idle, so the break reads at the third segment, exactly where an operator looks first.
That last case is the whole point of the design: the picture shows not just that flow stopped, but where it stopped. Force bits only with the machine stopped and people clear, because a forced pump-run bit makes the display claim flow while the real pipe may be dead.
Questions asked
How do I show a fault color instead of just flow and no flow?
Move from a Bool to a small integer tag computed in the PLC: for example 0 for idle, 1 for flowing and 2 for fault. Bind the same Appearance animation to that integer and define one color row per value, with the flash option on the fault row. The PLC still decides which value applies, so the panel stays a pure display and every segment keeps exactly one tag.
Can one cyclic script update all twelve segments instead of one script per segment?
Yes. A single cyclic script can loop across the segment tags and set each color in one pass, which is lighter than one script per segment. It still executes on every panel cycle, though, so it costs runtime the PLC-tag approach does not. Keep scripts for values only the panel knows, such as operator entries or panel-local settings, and let the PLC own everything derived from field devices.
What happens to the colors if the panel loses its connection to the PLC?
The tags stop updating, so every line freezes at its last color and can pass for a live display that is actually stale. Add a heartbeat bit that toggles in the PLC, read it as a tag, and raise a connection alarm on the panel when it stops toggling. Any line color shown while the heartbeat is dead should be treated as unproven.
Do the valve and pump bits still need to be HMI tags?
Only if the screen uses them for something else, such as showing each device's own state or letting an operator start it. For the flow animation alone, one computed result tag per segment is enough, which keeps the tag list short and the update predictable. If a device sits on a separate node, its state has to reach the computing PLC first, because an AND can only be taken where both inputs already live.


