free quality report for PLCopenXML exports

Rules / self-enable

Pump never starts: the start command depends on its own feedback

The start permissive is computed in the same scan from an input that carries the running feedback of the same equipment. It is stopped, so there is no permissive, so there is no command, so it stays stopped.

Severity: Critical Rule id: self-enable Command depends on its own feedback

What the rule checks

A start command is derived from a function block output that is computed from its own input within the same scan, while that input is fed with the equipment's own feedback: pump rotation, valve position, “unit running”. The result is a deadlock: the equipment is stopped, so there is no permission, so there is no command, so it stays stopped. The loop never starts, and on a bench with the drive spun by hand everything looks fine. The phrase “within the same scan” is what matters: an output that depends on the input through memory (a start counter, a timer, an edge trigger) is perfectly legitimate in the command chain, and the rule leaves it alone.

What it does to the plant

The loop never starts at all, while on a bench with a manually turned drive everything looks fine.

Example

Bad: the rule fires
VAR_GLOBAL    work_pump1 : BOOL;    run_pump1 : BOOL;    reset_alarm : BOOL;END_VARFUNCTION_BLOCK FB_StartGuardVAR_INPUT    bStartCmd : BOOL;    bReset : BOOL;END_VARVAR_OUTPUT    bBlocked : BOOL;    bStartAllow : BOOL;END_VARVAR    nStarts : INT;    trigStart : R_TRIG;END_VARtrigStart(CLK := bStartCmd);IF trigStart.Q THEN nStarts := nStarts + 1; END_IFIF bReset THEN nStarts := 0; END_IFbBlocked := nStarts > 20;bStartAllow := bStartCmd AND NOT bBlocked;PROGRAM PumpCtrlVAR    fbGuard1 : FB_StartGuard;    xAllow1 : BOOL;    xRequest1 : BOOL;END_VARfbGuard1(bStartCmd := gvl.work_pump1, bReset := gvl.reset_alarm, bStartAllow => xAllow1);gvl.run_pump1 := xAllow1 AND xRequest1;
Fixed: the rule is silent
VAR_GLOBAL    work_pump1 : BOOL;    run_pump1 : BOOL;    reset_alarm : BOOL;END_VARFUNCTION_BLOCK FB_StartGuardVAR_INPUT    bStartCmd : BOOL;    bReset : BOOL;END_VARVAR_OUTPUT    bBlocked : BOOL;    bStartAllow : BOOL;END_VARVAR    nStarts : INT;    trigStart : R_TRIG;END_VARtrigStart(CLK := bStartCmd);IF trigStart.Q THEN nStarts := nStarts + 1; END_IFIF bReset THEN nStarts := 0; END_IFbBlocked := nStarts > 20;bStartAllow := bStartCmd AND NOT bBlocked;PROGRAM PumpCtrlVAR    fbGuard1 : FB_StartGuard;    xAllow1 : BOOL;    xRequest1 : BOOL;END_VARfbGuard1(bStartCmd := xRequest1, bReset := gvl.reset_alarm, bStartAllow => xAllow1);gvl.run_pump1 := xAllow1;

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

  1. Feed the STATE output into the command instead of a permission output that contains the input itself: NOT bProtBlocked1 rather than bStartAllow. The protection keeps working, and the start-count lockout is unaffected.
  2. Check what is wired to the block input: the start command and the running feedback are different signals, and swapping one for the other only shows up on site.
Check your project

Upload a PLCopen XML or CODESYS .export file: the report is free and the code is not stored.

Local version on GitHub →

The same linter without uploading a file: command line and GitHub Action.

Related rules

2026-11-26

Processing happens in memory, and the uploaded code is not stored. The tool advises; code changes are up to the engineer (see what the linter can't see). What happens to your code → · Rule reference · Your code & privacy · Industry benchmark · Feedback · GitHub