FAILURE MAP
← Case archive

FA-12241 / Power metering accounting / Open access

A register delta loses complete counter revolutions · case 01

A register delta loses complete counter revolutions.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Modulo subtraction discards complete revolutions recorded by the hardware wrap counter.

THE FAILURE

Modulo subtraction discards complete revolutions recorded by the hardware wrap counter.

Unsuccessful approach: Adding one modulus whenever the reading decreases still drops multiple wraps and wraps ending above the initial reading.

Case contract

Given consecutive readings in [0, modulus) and a nonnegative wrap-count increment, return energy = end-start+wraps*modulus. Inconsistent negative energy returns None. Wrap count is authoritative, including multiple revolutions.

Why this case matters

Meter settlement depends on explicit register and tariff policies; this controlled model makes that policy observable.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(start, end, wraps, modulus):
    return (end-start) % modulus
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple wraps', solve(8, 2, N+1, 10), 10*(N+1)-6)
check('wrap ending above start', solve(2, 5, N, 10), 10*N+3)
check('ordinary increment', solve(2, 5, 0, 10), 3)
check('one wrap', solve(9, 1, 1, 10), 2)
check('stationary counter', solve(5, 5, 0, 10), 0)
check('full revolution', solve(5, 5, 1, 10), 10)
check('contradiction', solve(9, 1, 0, 10), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
multiple wraps414Failed
wrap ending above start313Failed
ordinary increment33Passed
one wrap22Passed
stationary counter00Passed
full revolution010Failed
contradiction2NoneFailed

SHA-256 / 3b34ee81dc5dd422a6cb388385f182b4f8817fcbc436ebcad8739f874d2c80cf

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(start, end, wraps, modulus):
    return end-start + (modulus if end < start else 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple wraps', solve(8, 2, N+1, 10), 10*(N+1)-6)
check('wrap ending above start', solve(2, 5, N, 10), 10*N+3)
check('ordinary increment', solve(2, 5, 0, 10), 3)
check('one wrap', solve(9, 1, 1, 10), 2)
check('stationary counter', solve(5, 5, 0, 10), 0)
check('full revolution', solve(5, 5, 1, 10), 10)
check('contradiction', solve(9, 1, 0, 10), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
multiple wraps414Failed
wrap ending above start313Failed
ordinary increment33Passed
one wrap22Passed
stationary counter00Passed
full revolution010Failed
contradiction2NoneFailed

SHA-256 / 18d6f15707af715aff26ff5c31898c2e7bb12847208d8c48f0d684e820cda0e9

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Simplified integer-energy accounting model; no hardware protocol, legal tariff, measurement uncertainty, or live grid behavior is represented. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:55.019176+00:00.

Case digest / f3749bf48f2f1b25e83531f3158cc917d7b4122baa5467acf22d71f121a7d088