Rules / timer-rearmed-by-own-branch
TOF never switches off: the timer input is re-armed in the same branch
An off-delay counts while its input stays FALSE. If the input is set back to TRUE on every path further down the same branch, the count restarts every scan and the output never drops.
Severity: Critical
Rule id: timer-rearmed-by-own-branch
Off-delay never expires
What the rule checks
The mirror case of the previous rule, and worse in its consequences. An off-delay (TOF) counts while its input stays FALSE: drop the command, the delay runs, the output goes off after the setpoint. If the input is re-armed to TRUE on every path further down the same branch, the count restarts every scan, the output never goes off, and the equipment never stops: the pump keeps coasting, the purge never ends, the fan stays on. An on-delay defect takes the delay away; this one takes the shutdown away. The rule tells the types apart: for TON the defect is clearing the input, for TOF re-arming it, and TP and BLINK are left alone entirely, because there the input acts as an edge and has nothing to do with the delay.
What it does to the plant
Equipment never stops: a run-on pump keeps running, a purge never ends, a fan never switches off.
Example
FUNCTION_BLOCK FB_PurgeVAR_INPUT xAirOk : BOOL;END_VARVAR_OUTPUT xFan : BOOL;END_VARVAR tofPurge : TOF; xFanCmd : BOOL;END_VARIF xAirOk THEN tofPurge(IN := xFanCmd, PT := T#3M); IF tofPurge.Q OR xFanCmd THEN xFan := TRUE; xFanCmd := TRUE; ELSE xFan := FALSE; xFanCmd := TRUE; END_IFEND_IF
FUNCTION_BLOCK FB_PurgeVAR_INPUT xAirOk : BOOL; xDemand : BOOL;END_VARVAR_OUTPUT xFan : BOOL;END_VARVAR tofPurge : TOF; xFanCmd : BOOL;END_VARIF xAirOk THEN xFanCmd := xDemand; tofPurge(IN := xFanCmd, PT := T#3M); xFan := tofPurge.Q;END_IF
Both listings are run through the linter by an automated test: the rule fires on the first and stays silent on the second.
How to fix
- Drop the command once and do not re-assert it in the same branch: an off-delay only counts while its input stays dropped.
- Test the stop, not the start: the defect only shows at shutdown, and on site it looks like equipment ignoring the stop command.
Upload a PLCopen XML or CODESYS .export file: the report is free and the code is not stored.
The same linter without uploading a file: command line and GitHub Action.
Related rules
2026-11-26