FA-12251 / Power metering accounting / Open access
Export in one interval erases import from another · case 01
Export in one interval erases import from another.
ROOT CAUSE
Netting over the full billing period crosses the tariff settlement boundary.
VERIFIED REPAIR
Apply the nonnegative net-import rule separately to each interval.
Unsuccessful approach: Ignoring export entirely charges imports that should cancel within the same interval.
Case contract
Input rows are [import, export] nonnegative energy per settlement interval. Net each row first, then return total positive net import. Export credits are separate and cannot offset another interval.
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(rows):
return max(sum(i-e for i,e in rows),0)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export cannot cross intervals', solve([[3*N,0],[0,2*N]]), 3*N)
check('within interval credit', solve([[3*N,N]]), 2*N)
check('balanced interval', solve([[N,N]]), 0)
check('export only', solve([[0,N]]), 0)
check('import only', solve([[N,0]]), N)
check('empty period', solve([]), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| export cannot cross intervals | 1 | 3 | Failed |
| within interval credit | 2 | 2 | Passed |
| balanced interval | 0 | 0 | Passed |
| export only | 0 | 0 | Passed |
| import only | 1 | 1 | Passed |
| empty period | 0 | 0 | Passed |
SHA-256 / 92307ed7e69662d21a16d5a9ed3dcb39e3e7503d80d1b67c6b37b1334121cb3b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
return sum(i for i,e in rows)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export cannot cross intervals', solve([[3*N,0],[0,2*N]]), 3*N)
check('within interval credit', solve([[3*N,N]]), 2*N)
check('balanced interval', solve([[N,N]]), 0)
check('export only', solve([[0,N]]), 0)
check('import only', solve([[N,0]]), N)
check('empty period', solve([]), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| export cannot cross intervals | 3 | 3 | Passed |
| within interval credit | 3 | 2 | Failed |
| balanced interval | 1 | 0 | Failed |
| export only | 0 | 0 | Passed |
| import only | 1 | 1 | Passed |
| empty period | 0 | 0 | Passed |
SHA-256 / aadc0d0ffefd9b4a4eefe01cf429f4f82ef025822509c6fb42bdb5d1e4174082
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
return sum(max(i-e,0) for i,e in rows)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export cannot cross intervals', solve([[3*N,0],[0,2*N]]), 3*N)
check('within interval credit', solve([[3*N,N]]), 2*N)
check('balanced interval', solve([[N,N]]), 0)
check('export only', solve([[0,N]]), 0)
check('import only', solve([[N,0]]), N)
check('empty period', solve([]), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| export cannot cross intervals | 3 | 3 | Passed |
| within interval credit | 2 | 2 | Passed |
| balanced interval | 0 | 0 | Passed |
| export only | 0 | 0 | Passed |
| import only | 1 | 1 | Passed |
| empty period | 0 | 0 | Passed |
SHA-256 / 164826c5435f2a65f476c50ddcd196c1f1a2e5ad4f155967dfbe991ca177190e
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.212437+00:00.
Case digest / d7d4693491a0cd635d0e88986a6c47275f5c738480b525b6765108ddd66a2230