How-to
How to Simulate a Rising Liquid Level in WinCC Runtime
Short answer
A WinCC tank level rises gradually only when its numeric tag changes through intermediate values. Create an internal 0-100% tag, bind it to the object's fill level property, then drive it with the Tag Simulator's continuous pattern or a cyclic script adding 5% every 0.5 s - a full 10 s sweep from empty to full, verified at 0, 50 and 100%.
On this page
A WinCC tank level rises or falls gradually in runtime only when the numeric tag behind it changes through intermediate values. Binding the tag is the easy half: the graphic sits still, or snaps between empty and full, until something actually writes 0, 5, 10 ... 100 to that tag. The working setup is an internal 0-100% tag, that tag connected to the object's fill level property, and a value generator - the Tag Simulator for a quick visual test, a cyclic script when you set the rate, limits and direction. Both generators are built below, with the arithmetic and the runtime checks that prove them.
Why the level will not move by itself #
The fill level property is a dynamic property: on every update it reads a numeric tag and draws a fraction of the object's height, worked out as (value - lower limit) / (upper limit - lower limit). With limits 0 and 100%, a tag value of 62 draws (62 - 0) / (100 - 0) = 0.62, so 62% of the tank height. Hold the tag at one value and the picture holds one level; feed it only two values and the level shows only two positions.
So a liquid-level simulation is a value-generation problem before it is a drawing problem. Prove the tag changes first - a numeric display field on the same tag shows the value independent of the tank drawing - then prove the graphic follows.
Use one engineering quantity throughout. Percent of height, measured height in millimetres, and volume are different quantities; a linear fill level animation represents height, and it does not calculate volume for a tank whose cross-section changes with height.
Configure the tag and the animation #
- Create an internal numeric tag -
Level_simin these examples, a name you choose - with limits 0 and 100 and start value 0. Internal means the demonstration writes nothing outside the visualization. - Draw the tank object, open its fill level property, and assign
Level_simwith the range 0 to 100 and the fill direction bottom-up. The graphic-side procedure in general is covered in how to animate a tank level graphic on an HMI screen. - Place a numeric display field next to the tank and connect it to the same tag. This is the reference instrument for every check that follows.
- Pick the generator: the Tag Simulator when you only need to see the object follow a changing value, the script when the fill must be timed, bounded and reversible. Both are below.
Generate the ramp with the Tag Simulator #
In WinCC RT Professional, search the task bar for "WinCC Runtime Professional Tag Simulator" and start it; the tag simulation editor opens with no simulation running, so you add the tag, choose its pattern and start the simulation yourself. In classic WinCC V7.x, the WinCC simulator is used the same way while runtime is running. The documented purpose of the RT Professional tool is simulating internal tags and process tags. WinCC Unified projects use the separate SIMATIC WinCC Unified Tag Simulator, which takes variables from the project and offers five simulation types.
Pick a pattern that steps continuously upward while you test filling, and set its period so one full sweep takes the time you want. A random pattern proves the object reacts to a changing value, but it does not fill a tank the way liquid does.
One safety line: the simulator can also drive process tags, and it must never be pointed at a tag a running PLC also writes - two writers on one tag is a fault, and a simulated value can travel on to real outputs.
Ramping an internal tag is a display demonstration; checking a whole project against a real controller is a different job, covered in testing HMI simulation against a live PLC.
Generate the ramp with a cyclic script #
The script - a small Visual Basic routine - wins when you own the rate, the limits and the direction. Fix the numbers first, as a worked example for a 0-100% tag:
- Sweep time: empty to full in 10 s.
- Rate: 100% / 10 s = 10% per second.
- Cyclic trigger: every 0.5 s.
- Increment per execution: 10%/s x 0.5 s = 5%.
- Executions to full: 100% / 5% = 20, and 20 x 0.5 s = 10 s, which closes the arithmetic.
The generator itself is deliberately small:
' Pseudocode - Level_sim is the illustrative internal tag
Dim level As Integer
level = 0 ' percent, start empty
level = level + 5 ' 10%/s at a 0.5 s trigger
If level >= 100 Then level = 100 ' hold at full; subtract to drain
' write level to Level_sim through the documented tag access of your runtime
The final line is the runtime's documented scripting call for setting a tag value - take the exact interface from the installed help rather than from an example. Base the increment on the trigger period, or on measured elapsed time if your scripting environment supplies it. Draining is the same step with the sign reversed; at each limit, hold or reverse.
Trigger this from a cyclically scheduled action, never from a tight loop in a screen script: a loop that does not yield blocks the runtime, the mechanism behind why an HMI screen freezes until a script finishes.
The test that proves the generator: with the 0.5 s trigger active, the reference display reads 0, 5, 10 ... 100 and holds at 100 after 10 s, and the tank surface follows the same sequence. On a symbol 200 pixels high, each 5% step is 10 pixels of travel - visible motion, not a jump.
Verify the ramp in runtime #
- Empty: write 0. The display reads 0% and the tank is empty.
- Midpoint: write 50. The fraction is (50 - 0) / (100 - 0) = 0.5, so a linearly mapped tank stands half full.
- Full: write 100. The display reads 100% and the tank is full.
- Direction: run the generator up, then down. The display moves monotonically each way and the surface follows without unexplained reversals.
- Stop: stop the generator. Both the value and the surface hold their last state, proving the animation tracks the tag rather than the clock.
Symptoms and what they point to #
| Runtime observation | Meaning | Next check |
|---|---|---|
| Display and fill both stationary | Generator stopped, tag never written, or names mismatched | Confirm the generator is running and the tag name matches everywhere |
| Display changes, fill does not | Generator works; the animation binding or limits are wrong | Re-check the tag on the fill level property and the 0/100 limits |
| Level jumps empty to full | Endpoints or a bit command reaching the property; no intermediate values | Drive a 0-100% numeric tag with a stepping generator |
| Level moves the wrong way | Fill direction or limit order reversed | Swap the empty/full limits or the direction setting |
| Motion is visibly steppy | Increment or refresh cadence too coarse for the object size | Halve the step or double the trigger rate, using the same arithmetic |
The decision, case by case: a quick visual test on the bench - Tag Simulator with a continuous pattern on an internal tag. A fill that must be timed and bounded - the cyclic script, 5% per 0.5 s for a 10 s sweep, scaled to whatever range and time you actually need. Anything feeding a live controller - only after the ramp is proven on internal tags, and with the PLC as the single writer.
Questions asked
Can the Tag Simulator be used on a commissioned line?
Only on an isolated copy of the project. The tool documents simulation of internal and process tags, and on a running machine a process tag already has a writer: the PLC. Two writers on one tag produce values nobody ordered, and a simulated write to a tag feeding outputs can move equipment. Run demonstration ramps on internal tags, or take an offline project copy for process-tag tests.
Why does my tank jump straight from empty to full?
The property is receiving two states instead of a range. Typical causes: a Boolean tag assigned where the analog was intended, a start command bit wired to the fill level property, or a simulator pattern that toggles endpoints. The value never passes 50, so the drawing never shows a middle level. Assign the 0-100% numeric tag and a stepping generator, and the surface will travel.
Should the level tag be in percent or engineering units?
Either, as long as the animation limits match the tag. Percent, 0 to 100, is the least error-prone for a demonstration. Engineering units work the same way: a level transmitter scaled 0 to 2.0 m drives the fill level property with limits 0 and 2.0, and a reading of 1.2 m draws (1.2 - 0) / (2.0 - 0) = 0.6 of the height. Keep one quantity per animation.
When is a random simulation pattern the right choice?
When you are testing reactions, not filling. Random values exercise alarm thresholds, color changes and scripts that trigger on arbitrary levels, because they visit values you would not pick by hand. For a liquid surface that rises and falls, random is the wrong tool: it jumps. Pair random with threshold tests, and keep the continuous ramp for level motion.
Is this the same simulator in WinCC Unified?
No. Unified projects use the SIMATIC WinCC Unified Tag Simulator, a separate tool documented on Siemens Industry Online Support, which takes variables from the project and offers five simulation types. Searching the task bar for the Runtime Professional Tag Simulator is the RT Professional procedure and will not get you the Unified tool.