IMDTouchKnowledge BaseShop main store

How-to

Monitoring a PLC Lifebit Heartbeat in WinCC With an Alarm

HMI and touchscreens Published 8 min read

Short answer

Build the stale-data alarm as a cyclic watchdog script: a 5 s low / 5 s high lifebit gives an edge every 5 s, so alarm when no edge is seen for 15 s. Evaluate on a time trigger, because a change-triggered script stops exactly when the data stops, and require a good-quality edge to clear.

On this page
  1. Does WinCC have a built-in lifebit monitoring function?
  2. Where should the PLC generate the lifebit?
  3. How fast should WinCC acquire the lifebit tag?
  4. Why can't the watchdog script trigger on the lifebit changing?
  5. What timeout catches a frozen 5-second lifebit?
  6. What does the watchdog script have to do?
  7. How should the alarm trip, clear, and recover?
  8. How do I test the lifebit alarm before trusting it?
  9. Questions asked

A lifebit alarm in WinCC is a cyclic watchdog, not a tag you display: your 5 s low / 5 s high signal changes state every 5 s, so the alarm condition is no observed edge for 15 s, evaluated by a script action that runs on a fixed cycle. WinCC's built-in Lifebeat Monitoring answers a different question — is the connection up — and cannot catch the failure you actually have, a crashed soft PLC whose OPC connection stays readable while every value on the panel sits frozen. Below: the timeout, the trigger choice, the logic, and the bench test.

Does WinCC have a built-in lifebit monitoring function? #

Yes — WinCC ships a built-in Lifebeat Monitoring editor you open by double-clicking Lifebeat Monitoring in the WinCC Explorer navigation area, but Siemens documents its configurable scope as Industrial Ethernet and PROFIBUS connections of the SIMATIC S7 PROTOCOL SUITE and OPC connections.

The WinCC V8.1 Information System, entry 109975568, describes opening the editor from the navigation area of WinCC Explorer. Support FAQ 9918678 limits the configurable scope to Industrial Ethernet and PROFIBUS connections of the "SIMATIC S7 PROTOCOL SUITE" and OPC connections, and the configuration is done on the server: no Lifebeat Monitoring configuration is possible on a WinCC client.

Commit to this split: keep Lifebeat Monitoring where its channel types fit, as the connection-level monitor, and always run the tag watchdog as the stale-data alarm. LBM reports that a connection stopped; it does not time the edges of a PLC-generated bit, so it cannot distinguish a running controller from a frozen one behind a healthy connection — which is exactly your failure mode.

Where should the PLC generate the lifebit? #

Toggle it inside the soft PLC task whose continued execution you are supervising — equal low and high times of five seconds each — never inside an independent communications component that keeps running after the application task has stopped.

A heartbeat is a periodically changing value produced by the execution path being supervised. If a communications component toggles it, the bit keeps changing after the application task dies, and the alarm is silent at the exact moment you built it for. In the soft PLC, toggle a Boolean on that timer inside the task that collects data from your 150 downstream controllers.

Know what it proves: that one task runs. A changing lifebit says nothing about whether every downstream controller still answers; if you need per-controller staleness, each one needs its own toggled bit or counter that the soft PLC checks.

How fast should WinCC acquire the lifebit tag? #

Acquire the tag on a continuous fixed one-second cycle: the lifebit changes state every five seconds, so that sampling gives about five looks at each state and a running PLC can never look frozen.

The signal's full cycle is 10 s, but consecutive edges are half that, and the watchdog times edges, not cycles. Polling at 10 s or slower can land on the same state every pass while the PLC runs perfectly, manufacturing a false stale alarm. The rule is at least two samples per shortest state — 2.5 s or faster — and one second is the practical choice: about five looks at each state, and one Boolean tag is negligible load on any OPC server.

Set the tag to continuous cyclic acquisition rather than on-demand, so collection continues no matter which picture is open. A display refresh cannot rescue an acquisition that misses the underlying transitions.

Why can't the watchdog script trigger on the lifebit changing? #

Because the trigger dies with the data: the instant the lifebit stops changing, a change-triggered action stops firing, so the one script that must raise the alarm is the one that never runs again.

A change-triggered action is the natural instinct, and it is fine for resetting a clock — but detection has to live in an action scheduled on time. The cyclic action keeps running when the data stops, notices the elapsed time, and raises the alarm. Build everything into that one cyclic action: comparing the current read against the stored state detects the edges by itself, and no second, change-triggered script is required.

What timeout catches a frozen 5-second lifebit? #

Set 15 s, which is three times the edge interval: with the acquisition cycle above and 0.8 s of measured delivery jitter the worst healthy gap is 6.8 s, so the timeout keeps 8.2 s — about 2.2 times — of margin.

Worked example, with the jitter value as an illustrative measurement you replace with your own:

  • Edge interval: five seconds low plus five high = a 10 s cycle with edges 5 s apart.
  • Worst healthy gap you should ever log: that edge interval + the acquisition cycle + 0.8 s delivery jitter = 6.8 s.
  • Timeout: three times the edge interval.
  • Margin: 15 s − 6.8 s = 8.2 s, about 2.2 times the worst healthy gap.
  • Detection: the 15 s timeout plus the one-second evaluation cycle = 16 s from the last observed edge, plus up to one further second of observation lag = 17 s after the soft PLC actually froze.

Every scheduled acquisition stretches under load — one documented case of 3-second interval timing jitter in a scheduled acquisition group — so measure your worst logged gap instead of trusting the nominal cycle. The sizing rule: timeout at three times the edge interval, and never less than twice your measured worst gap. A timeout equal to the edge interval itself guarantees false alarms; 60 s leaves an operator steering on stale data for a full minute. Fifteen seconds is the decision.

What does the watchdog script have to do? #

Store the last accepted state and the time of its last change, then on every cyclic pass either record a new edge and reset the clock, or compare elapsed time against the timeout and set the alarm bit.

  1. At runtime start, mark the monitor uninitialized and claim nothing from cached values; wait for the first good-quality read, store its state, and start a grace interval equal to the timeout.
  2. Every cyclic pass (the acquisition cycle), read the lifebit together with its quality.
  3. On bad quality, leave the stale judgment unchanged and let the separate communication alarm carry it.
  4. On good quality with a value different from the stored state, store the new state and timestamp the edge.
  5. On good quality with elapsed time past 15 s, set the stale alarm bit; clearing it requires a later observed edge, not the passage of time.
  6. Log every edge with a timestamp during commissioning; those logged gaps are the measured jitter the timeout is built on.
' WinCC watchdog pseudocode - variable names are illustrative; map the
' tag accesses and the time source to your WinCC script environment.
Dim lifebitNow As Boolean    ' current tag value, read each pass
Dim lifebitState As Boolean  ' last accepted state, starts False
Dim lastEdgeS As Long        ' seconds of the last observed edge, starts 0
Dim started As Boolean       ' set True at the first good-quality read
Dim stale As Boolean         ' alarm bit written back, starts False

' cyclic action, runs on the acquisition cycle:
' read lifebitNow together with its quality
If quality <> good Then
    ' communication loss: separate alarm, hold stale unchanged
ElseIf Not started Then
    lifebitState = lifebitNow
    lastEdgeS = clockS()
    started = True              ' grace period begins here
ElseIf lifebitNow <> lifebitState Then
    lifebitState = lifebitNow
    lastEdgeS = clockS()        ' edge seen: reset the clock
    stale = False               ' recovery requires this edge
ElseIf clockS() - lastEdgeS > 15 Then
    stale = True                ' frozen low and frozen high alarm alike
End If

Two implementation notes: write the stale result to a tag your alarm system evaluates, using your script environment's read and write functions; and use a time source unaffected by operator clock corrections where the runtime provides one, so a clock change can neither fabricate nor postpone a timeout.

How should the alarm trip, clear, and recover? #

Trip one stale-data alarm at the timeout, clear it only on a good-quality observed edge, and keep operator acknowledgement separate from clearing — exactly the ISA-18.2 discipline of one alarm, one cause, one defined operator response.

What the panel observes Verdict Alarm behavior
Alternating 0 and 1, good quality Supervised task is advancing None
Constant 0 or constant 1, good quality Data is stale, task frozen Stale-data alarm, set at the timeout
Bad quality Delivered value not dependable Separate comm-loss alarm; hold the stale judgment

Acknowledgement records that the operator saw the alarm; it must not clear the condition. The condition clears only when a good-quality read shows an edge — a connection that comes back readable with a frozen value has not recovered, and clearing on quality alone hides the failure the watchdog exists to catch.

Keep two alarms with two causes: the stale-data alarm from this watchdog, and a communication alarm from bad OPC quality. They can share one operator response, but the event log has to say which failure you had. Log the raw tag and its quality beside the alarm — reading raw PLC tags as diagnostics over OPC turns that log into the post-mortem. Treat bad quality as its own event: faults like WinCC OPC data access failing despite DCOM settings reach the panel as quality flags, not as a frozen heartbeat.

One limit: this is a diagnostic alarm, not a safety function — if frozen data can let a machine do something hazardous, the watchdog belongs in the controller or the safety system, not only on the HMI.

How do I test the lifebit alarm before trusting it? #

Freeze the lifebit on an isolated bench and time the result: with the timeout and evaluation cycle already sized, the alarm must appear within 16 s of the last observed edge, and it must not clear until an edge returns.

  1. Run it on an isolated bench with verified test tags and a timestamped log of every read; never commission a watchdog on the running line.
  2. Ten minutes of normal running: every logged gap stays under your measured ceiling (6.8 s in the example) and no alarm appears.
  3. Freeze the lifebit — stop the PLC task or force the bit constant: the alarm sets within 16 s of the last logged edge.
  4. Restore the connection with the value still frozen: the alarm stays set.
  5. Resume toggling: the alarm clears within about 7 s (up to the edge interval to the next edge + acquisition + evaluation).
  6. Restart the runtime: no stale alarm before the first good-quality read, and the grace interval holds for one full timeout.

If step 3 runs long, your evaluation action is not getting its scheduled slot under load — shorten the cycle or add the measured delay to your latency budget.

Questions asked

Can Lifebeat Monitoring watch a third-party OPC server connection?

Partly. Siemens documents the Lifebeat Monitoring editor for Industrial Ethernet and PROFIBUS connections of the SIMATIC S7 PROTOCOL SUITE and for OPC connections, configured on the server OS with nothing configurable on a WinCC client. Even where it applies, it reports connection status, not whether the controller's application task still executes, so keep the cyclic tag watchdog for the frozen-value alarm.

How do I size the timeout for a faster heartbeat?

Use three times the edge interval, then check it against your measured worst gap. A bit toggling every 2 s produces edges 2 s apart; with a 1 s acquisition cycle and 0.5 s of measured jitter the worst healthy gap is 3.5 s, so a 6 s timeout (3 × 2 s) holds 2.5 s of margin and alarms within about 7 s of the last observed edge.

Why did my stale-data alarm clear when the connection came back?

Because the clear condition was quality, not progress. Recovery must require an observed edge with good quality: a connection that returns readable while the controller value stays frozen has not recovered, and clearing on quality alone hides the exact failure the watchdog exists to catch. Keep acknowledgement separate so the operator's response is still recorded.

What if I cannot change the PLC program to add a lifebit?

Monitor any value that must keep changing, with the same edge logic: a scan-cycle counter, a millisecond clock, a running total. The watchdog compares consecutive reads instead of Boolean states, and everything else stays the same — fast cyclic acquisition, a timeout of three times the minimum change interval, quality handling, and recovery only on an observed change.

Keep reading

  • How-to

    How to Show Only a PLC Connection Alarm in WinCC Flexible

    Yes, but on WinCC flexible 2005 you do it with a dedicated application alarm driven by the connection status, not by filtering the system-alarm stream: the 2005 alarm view selects whole alarm classes, not single messages. Decide first whether the operator must see communication loss or a CPU in STOP, since a stopped PLC can still communicate, and keep the unfiltered system-alarm view on a maintenance screen.

    HMI and touchscreens

  • Troubleshooting

    Why WinCC Flexible Logging Fails to Create Oracle Tables

    Oracle is not among the databases tested and released for WinCC flexible, so the table-definition and insert statements the runtime generates were never validated there. The startup message covers only initialization. Archive to a released database and transfer committed records to Oracle with a separate, restart-safe service.

    HMI and touchscreens

  • Explainer

    Reading raw PLC tags as diagnostics in WinCC over OPC

    No. An OPC server does not limit WinCC to slave diagnostics: WinCC reads every item the server publishes, process tags included. A raw tag is only an undecoded value — match its type to the server item, decode packed words at the tag level, and drive configured alarms and displays instead of C scripts in each graphic object.

    HMI and touchscreens

WinCC PLC Connection Loss Alarm and NO Connect Display