Rules / heating-ai-no-range-check
Analog input with no plausibility check: a broken sensor reads as 0 °C
The analog input value is never compared against the physical range and the module's error code is never read. On a break or short the input returns an extreme value and the controller treats it as real. The rule belongs to the heating profile.
Severity: Critical
Rule id: heating-ai-no-range-check
Analog input without a plausibility check
This rule belongs to the optional "heating" profile and only runs when the profile is enabled.
What the rule checks
A value coming from an analog input (or a raw register) is never compared against a range anywhere in the project. On a broken or shorted sensor the input returns an extreme value and it travels into the controller as valid data: a broken Pt1000 reads as 0 °C and the valve opens fully. Inputs are taken from the device tree (nothing assigns them in code; the runtime does). A check means either a range comparison anywhere in the project or a read of the module's own channel error code (error_analog_code and the like). The latter is in fact stronger: a broken or shorted sensor is caught by the hardware. If plausibility is handled in a way static analysis cannot see (the HMI), verify before treating this as a defect.
What it does to the plant
A broken outdoor sensor reads as "0 °C outside": the heating curve computes the wrong setpoint and the valve runs to an end position.
Example
VAR_GLOBAL rOutdoor : REAL; rSetpoint : REAL;END_VARDEVICE MV210_101 SensorValue1.SensorValue -> GVL.rOutdoor SensorType1.SensorType = 35PROGRAM HeatCurvegvl.rSetpoint := 60.0 - gvl.rOutdoor;
VAR_GLOBAL rOutdoor : REAL; rSetpoint : REAL; xOutdoorFault : BOOL;END_VARDEVICE MV210_101 SensorValue1.SensorValue -> GVL.rOutdoor SensorType1.SensorType = 35PROGRAM HeatCurvegvl.xOutdoorFault := gvl.rOutdoor < -50.0 OR gvl.rOutdoor > 60.0;IF gvl.xOutdoorFault THEN gvl.rSetpoint := 60.0;ELSE gvl.rSetpoint := 60.0 - gvl.rOutdoor;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
- Compare the value with the sensor's physical range right after scaling:
IF T_out < -50.0 OR T_out > 150.0 THEN bSensorFault := TRUE; END_IF - While the reading is invalid, substitute a safe value (the last valid one, or a setpoint) instead of the raw one. A frozen plant usually starts with “0 °C outside”.
- If plausibility is handled by a separate alarm FB or by the HMI, the rule cannot see it; disable it in /rules or mark it as noisy.
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