Rules / param-channel-mismatch
Pump 2's block input is fed with pump 1's signal
The parameter name refers to one channel while the value comes from another: bPump2_Fault := xFaultPump1. The rule fires only when the channel numbering in that same call is confirmed by matching pairs.
Severity: Critical
Rule id: param-channel-mismatch
Channel parameter fed from another channel
What the rule checks
In a function block call the parameter name refers to one channel while the value comes from another: bPump2_Fault := gvl.alarm_nasos_CO1. The rule fires only when channel numbering is proven within the same call, that is, consistent pairs exist for at least two channels. The consequence is quiet and dangerous: a faulty pump is treated as healthy and picked for duty, the interlock never fires, and the log looks perfectly normal.
What it does to the plant
A faulty pump is treated as healthy and selected to run, the protection never trips, and the log looks normal.
Example
VAR_GLOBAL xFaultPump1, xFaultPump2, xFaultPump3 : BOOL; xIdlePump1, xIdlePump2, xIdlePump3 : BOOL;END_VARFUNCTION_BLOCK FB_PumpGroupVAR_INPUT bPump1_Idle, bPump2_Idle, bPump3_Idle : BOOL; bPump1_Fault, bPump2_Fault, bPump3_Fault : BOOL;END_VARVAR_OUTPUT iReady : INT;END_VARiReady := BOOL_TO_INT(bPump1_Idle AND NOT bPump1_Fault) + BOOL_TO_INT(bPump2_Idle AND NOT bPump2_Fault) + BOOL_TO_INT(bPump3_Idle AND NOT bPump3_Fault);PROGRAM PumpsVAR fbGroup : FB_PumpGroup;END_VARfbGroup(bPump1_Idle := gvl.xIdlePump1, bPump1_Fault := gvl.xFaultPump1, bPump2_Idle := gvl.xIdlePump2, bPump2_Fault := gvl.xFaultPump1, bPump3_Idle := gvl.xIdlePump3, bPump3_Fault := gvl.xFaultPump3);
VAR_GLOBAL xFaultPump1, xFaultPump2, xFaultPump3 : BOOL; xIdlePump1, xIdlePump2, xIdlePump3 : BOOL;END_VARFUNCTION_BLOCK FB_PumpGroupVAR_INPUT bPump1_Idle, bPump2_Idle, bPump3_Idle : BOOL; bPump1_Fault, bPump2_Fault, bPump3_Fault : BOOL;END_VARVAR_OUTPUT iReady : INT;END_VARiReady := BOOL_TO_INT(bPump1_Idle AND NOT bPump1_Fault) + BOOL_TO_INT(bPump2_Idle AND NOT bPump2_Fault) + BOOL_TO_INT(bPump3_Idle AND NOT bPump3_Fault);PROGRAM PumpsVAR fbGroup : FB_PumpGroup;END_VARfbGroup(bPump1_Idle := gvl.xIdlePump1, bPump1_Fault := gvl.xFaultPump1, bPump2_Idle := gvl.xIdlePump2, bPump2_Fault := gvl.xFaultPump2, bPump3_Idle := gvl.xIdlePump3, bPump3_Fault := gvl.xFaultPump3);
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
- Fix the index in the value:
bPump2_Fault := gvl.alarm_nasos_CO2. - Repeated per-channel calls are better folded into a loop over an array (
FOR i := 1 TO 3 DO fb[i](...)), and then there is nothing left to renumber.
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