fix(core): scope METER_VALUE_ANOMALY to cumulative energy registers per connector#129
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
METER_VALUE_ANOMALYfalse positives shiv3 reported from the ocpp-cp-simulator integration.The rule flattened every
sampledValueacross measurand, phase, unit, location and connector into one series and asserted monotonicity, but only cumulativeEnergy.*.Registermeasurands 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 everyMeterValuesmessage.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 absentmeasuranddefaults toEnergy.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_ANOMALYand 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_VIOLATIONis tracked separately in #128.Reported by shiv3.
Closes #127