Skip to content

fix(core): scope METER_VALUE_ANOMALY to cumulative energy registers per connector#129

Merged
sepehr-safari merged 1 commit into
mainfrom
fix/meter-value-anomaly-per-bucket
Jul 22, 2026
Merged

fix(core): scope METER_VALUE_ANOMALY to cumulative energy registers per connector#129
sepehr-safari merged 1 commit into
mainfrom
fix/meter-value-anomaly-per-bucket

Conversation

@sepehr-safari

Copy link
Copy Markdown
Member

Fixes the METER_VALUE_ANOMALY false positives shiv3 reported from the ocpp-cp-simulator integration.

The rule flattened every sampledValue across measurand, phase, unit, location and connector into one series and asserted monotonicity, but only cumulative Energy.*.Register measurands are monotonic and non-negative per OCPP 1.6 section 7.28. So any charge point reporting more than one measurand per sample, or any multi-connector station, produced a false warning on nearly every MeterValues message.

Change

Readings are now bucketed by (connectorId, measurand, phase, unit, location), and the monotonic and non-negative checks apply only to cumulative energy registers (an absent measurand defaults to Energy.Active.Import.Register). Other measurands are ignored by this rule.

Safety

The fix can only remove false positives (it checks a subset of readings), so no scenario's failure set changes: the meter-anomaly scenario still detects METER_VALUE_ANOMALY and the 15-scenario conformance contract is unchanged. Three regression tests cover the reproduction (a rising energy register interleaved with a constant power sample, a genuine decrease still caught among other measurands, and cross-connector bucketing). Full gate green: lint, typecheck, 515 tests, build. Patch changeset included.

The sibling connector-blindness in STATUS_TRANSITION_VIOLATION is tracked separately in #128.

Reported by shiv3.

Closes #127

…er connector

The rule flattened every sampledValue across measurand, phase, unit,
location and connector into one series and asserted monotonicity, but only
cumulative Energy.*.Register measurands are monotonic and non-negative per
OCPP 1.6 section 7.28. Any charge point reporting more than one measurand
per sample, or any multi-connector station, produced a false warning on
nearly every MeterValues message.

Readings are now bucketed by (connectorId, measurand, phase, unit, location)
and the monotonic and non-negative checks apply only to cumulative energy
registers (an absent measurand defaults to Energy.Active.Import.Register);
other measurands are ignored by this rule. Genuine energy-register anomalies
are still detected, so the scenario corpus and conformance contract are
unchanged. Adds three regression tests covering shiv3's reproduction.

Reported by shiv3 from the ocpp-cp-simulator integration.
@sepehr-safari
sepehr-safari merged commit e1c65e5 into main Jul 22, 2026
2 checks passed
@sepehr-safari
sepehr-safari deleted the fix/meter-value-anomaly-per-bucket branch July 22, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

METER_VALUE_ANOMALY false positives: monotonicity is checked across all measurands at once

1 participant