Rules / family-gap
One channel in a group never gets a field written
A field is declared for every channel (boilers 1 to 4, pumps 1 to 3) and written for all of them but one. Usually the block was copied from a neighbouring channel and left unfinished. The compiler is silent: the variable exists and the type is right.
Severity: Critical
Rule id: family-gap
Channel never written: a gap in the family
What the rule checks
A field is declared for every channel in a family (boilers 1–4, pumps 1–3) and used by all of them but exactly one, where it is never written. The usual cause: the block was copied from a neighbouring channel and left unfinished. The compiler stays silent: the variable exists and the type is right, nobody just writes to it. On site this shows up as “boiler 4 never reports alarms” while the other three work, and it never reproduces on the bench. The rule relies on declarations: if the field is not declared for that channel, it is different hardware rather than a gap, and nothing is reported.
What it does to the plant
"Boiler 4 never reports alarms" while the other three do, and the bench cannot reproduce it.
Example
VAR_GLOBAL boiler_1_code, boiler_2_code, boiler_3_code, boiler_4_code : WORD; boiler_1_alarm, boiler_2_alarm, boiler_3_alarm, boiler_4_alarm : BOOL;END_VARPROGRAM BoilerAlarmsgvl.boiler_1_alarm := gvl.boiler_1_code <> 0;gvl.boiler_2_alarm := gvl.boiler_2_code <> 0;gvl.boiler_3_alarm := gvl.boiler_3_code <> 0;IF gvl.boiler_1_alarm OR gvl.boiler_2_alarm OR gvl.boiler_3_alarm OR gvl.boiler_4_alarm THEN gvl.boiler_1_code := 0;END_IF
VAR_GLOBAL boiler_1_code, boiler_2_code, boiler_3_code, boiler_4_code : WORD; boiler_1_alarm, boiler_2_alarm, boiler_3_alarm, boiler_4_alarm : BOOL;END_VARPROGRAM BoilerAlarmsgvl.boiler_1_alarm := gvl.boiler_1_code <> 0;gvl.boiler_2_alarm := gvl.boiler_2_code <> 0;gvl.boiler_3_alarm := gvl.boiler_3_code <> 0;gvl.boiler_4_alarm := gvl.boiler_4_code <> 0;IF gvl.boiler_1_alarm OR gvl.boiler_2_alarm OR gvl.boiler_3_alarm OR gvl.boiler_4_alarm THEN gvl.boiler_1_code := 0;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
- Check that channel's block: an assignment was most likely copied from the neighbour and kept its indexes:
gvl.kotel_3_alarms3 := ...instead ofgvl.kotel_4_alarms3 := .... - If the field genuinely does not apply to that channel (no such hardware), drop its declaration. The rule goes quiet and the GVL loses a dead variable.
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