Troubleshooting
Why an alarm logs a zero fault process value
Short answer
The HMI records fault code 0 because alarm processing sees the trigger transition before the independently acquired process-value tag refreshes. Verify the tag mapping and acquisition settings first, then test a faster process-value cycle, and if the stale capture persists, move the code into a coordinated alarm mechanism instead of shrinking cycles further.
On this page
The fault code logs as 0 because the alarm trigger and the process-value tag travel to the HMI as two independent updates. The PLC writes both in the same scan, but alarm processing sees the trigger transition first, snapshots the fault-code tag while it still holds its previous value, and records 0. Fix the mapping and acquisition settings first, then test a faster process-value cycle, and if stale capture survives repeated tests, move the code into a coordinated alarm mechanism rather than shrinking the cycle again.
Confirm which failure you have #
Work through these checks before touching any timing setting. Each one points at a different cause:
- Compare the value at the PLC with the value at the exact tag assigned as the alarm's process value. If the PLC shows a nonzero code and the tag never does, the problem is mapping, address, data type or communication quality, not timing. The isolation procedure in the HMI value diagnosis article covers this separation.
- Watch the trigger and the code together across a fault transition in the HMI runtime. If the alarm records 0 and the displayed code becomes nonzero a moment later, the trigger beat the tag update: a timing problem.
- If the wrong code appears only sometimes, relative acquisition offsets or communication load are deciding which update lands first. Repeat the fault at different points in the cycle and under normal network load to see how often it bites.
- If the same alarm logic runs correctly on a Comfort Panel but fails on this runtime, treat the runtimes as separate consumers. The panel result proves the PLC produces a usable code; it proves nothing about this runtime's acquisition ordering.
- Check that the process-value tag is a real process tag with its own connection cycle. Internal variables with no independent update path are the usual source of permanently stale associated values.
Why same-scan writes do not arrive as one event #
A PLC scan is one pass through the controller logic. Setting the diagnostic code and the trigger bit in that scan fixes their order inside the controller and nowhere else. The connection delivers the two values as separate updates, and the HMI runtime has two independent consumers: the tag acquisition that refreshes the process-value tag on its cycle, and the alarm processor that evaluates the trigger and captures the associated value when it fires.
The failure sequence is therefore mechanical. The runtime still holds the previous code, the trigger becomes visible, alarm processing snapshots the still-old code into the event record, and the code update arrives afterwards. The live display is then correct while the recorded alarm is wrong, and no later refresh repairs an event already written.
Equal nominal periods do not fix this. A 1 s acquisition cycle and a 1 s alarm evaluation period run at their own offsets, and communication scheduling can separate their completion. Two values that must be recorded as one event need a defined transfer and capture relationship, not matching numbers on two settings.
Worked example: timing window for a 1 s process value against an on-change trigger #
Inputs, all from the project settings discussed for this case: the alarm-variable acquisition is on-change with a 1 s evaluation period, the fault-code process-value tag has a 1 s acquisition cycle, and the code steps from 0 to a nonzero fault number in the same PLC scan that sets the trigger.
Rule in words: the worst-case staleness of the captured code equals the longest time the code update can still be in flight after the alarm processor has already acted on the trigger. With an immediate on-change evaluation, that time is bounded by the process-value acquisition cycle, because the newest possible code sample arrives one full cycle after the sample the alarm captured.
Arithmetic: worst-case stale window = 1 cycle = 1 s. Halving the cycle gives 500 ms per acquisition, which is 2 acquisitions per second instead of 1, and the worst-case stale window falls to 500 ms, half of 1 s.
Result: at a 1 s cycle the alarm can capture a code up to 1 s old; at 500 ms the worst case halves to 500 ms. The change is a 2 times higher acquisition rate for that tag, so the added communication demand depends on the driver's request grouping and the rest of the tag load, not on a fixed multiplier of total network traffic.
Decision: if 500 ms is short enough that the captured code has become correct before any downstream consumer reads the alarm record, and communication load measurements show headroom, adopt the faster cycle. If faults still capture stale codes in repeated tests, stop shrinking cycles: 500 ms to 250 ms halves the window again but never closes it, because the trigger can always arrive just before the next acquisition. Escalate to event coordination as described below.
Testing the faster cycle without touching the PLC #
Leave the trigger path alone and change only the process-value tag's acquisition cycle to 500 ms. Run repeated fault injections across the whole acquisition period, including faults raised immediately after a cycle boundary, and read the recorded process value from the alarm log, not the live tag display. Measure runtime responsiveness and communication diagnostics during the test so the higher acquisition rate is paid for knowingly.
If the records come out correct under representative load, you have a configuration-only fix. If any test still captures the old code, the residual window is structural and further reduction is not a substitute for ordering.
When cycles are not enough: coordinate the event #
Two mechanisms put the code and the alarm into one path instead of two. A controller alarm block such as Alarm8P carries the alarm and its associated values through the alarm mechanism itself, so the event record is assembled where the values are produced; verify the controller supports the block, wire its interface, and confirm the runtime displays the associated values. The other route is script insertion, where application code creates the alarm record only after it has read a validated, nonzero code, handles duplicates, and defines recovery when communication drops. A script triggered off the same alarm bit that reads the same runtime tag reproduces the original race exactly, so the readiness check is the whole point.
Both change event architecture, so decide them once and test them the way you would test any alarm path: writes, disconnects and restarts on an isolated bench with verified test tags. A timestamped capture of the trigger and the code across the transition is the proof either way. The registry-level adjustment of the alarm-variable acquisition cycle that the vendor documents for this editor changes when the trigger is evaluated; it does not order the code ahead of the trigger, and a tag acquisition period is not a delayed-capture parameter.
The decision #
Mapping wrong or the tag never updates: fix the tag, not the timing, using the HMI value diagnosis article. Code correct but arrives late: test the process-value tag at 500 ms and adopt it if repeated fault injections capture correctly under measured load. Stale codes persist at any cycle: stop tuning cycles and move the code into a controller alarm block or a script insertion with an explicit data-readiness check. Same-scan PLC writes stay untouched except where the standard fault blocks can emit the code before the trigger bit, and only with a delay justified by measured behavior, not by assumption.
Questions asked
Why does the same alarm logic work on a Comfort Panel but record zero on the PC runtime?
The panel runtime and the PC runtime acquire tags and evaluate alarm transitions through different mechanisms with their own scheduling. Writing the code and the trigger in the same PLC scan guarantees order only inside the controller, not across the connection. Each runtime is a separate communication consumer, so a result on one does not validate the other; check the acquisition setting and the recorded event on the runtime that shows the problem.
Does setting the alarm variable acquisition mode to on-change with a 1 second cycle guarantee a fresh process value?
No. On-change governs when the trigger is evaluated, and a cycle sets only how often a tag is read. Two settings with the same nominal period can execute at different offsets, so nothing in them orders the code update ahead of the trigger evaluation. If the alarm fires between the trigger arriving and the next process-value read, the event still captures the previous code.
When are internal HMI variables acceptable as alarm process values?
Internal variables have no connection cycle of their own, so their freshness depends entirely on what writes them and when. With process tags read from the PLC the value usually arrives with the communication cycle; the reported problems with stale or zero process values concentrate on internally calculated tags. If an internal tag must carry the fault code, write it under application control with an explicit readiness check before the alarm record is created.


