FA-92876 / EV charging session scheduling / Open access
Post-charge idle occupancy fee: grace anchor · case 01
Drivers are billed idle time for minutes during which the car was still charging.
ROOT CAUSE
The grace period is measured from plug-in instead of from charge completion.
VERIFIED REPAIR
Start idle time at done + grace.
Unsuccessful approach: Taking the later of plug+grace and done forgets the grace after completion.
Case contract
Times are minutes 0..1440 of one day. done is when charging finished (None: never finished, no idle fee). Idle time starts at done+grace and ends at unplug (exclusive). Only minutes in [360, 1320) are billable (night waiver). Fee = ceil(billable/block)*rate cents, then capped at cap when cap is not None (cap 0 waives the fee). Return [billable minutes, fee].
Why this case matters
Depot, workplace and public EV chargers schedule sessions against prices, circuit limits and departure deadlines; a wrong decision silently strands a driver or overloads a feeder.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
if done is None or unplug <= done:
return [0, 0]
start = plug + grace
if unplug <= start:
return [0, 0]
billable = 0
for m in range(start, unplug):
if 360 <= m < 1320:
billable += 1
blocks = -(-billable // block)
fee = blocks * rate
if cap is not None:
fee = min(fee, cap)
return [billable, fee]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: grace anchor (partial repair)', [1210, 1288, 1405, 30, 40, None, 5], [2, 40]],
['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1392, 1440, 15, 5, 300, 10], [0, 0]],
['regression: grace anchor (partial repair)', [935, 1103, 1359, 15, 25, 0, 15], [202, 0]],
['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1262, 1395, 1440, 0, 40, None, 5], [0, 0]],
['regression: grace anchor (partial repair)', [1142, 1227, 1440, 10, 25, 0, 1], [83, 0]],
['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [240, 384, 858, 0, 40, None, 15], [474, 1280]],
['regression: grace anchor (partial repair)', [306, 373, 739, 10, 25, None, 10], [356, 900]],
['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: grace anchor (partial repair)', [808, 1193, 1387, 15, 5, None, 1], [112, 560]],
['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| boundary: unplugged inside grace | [95, 475] | [0, 0] | Failed |
| boundary: never finished | [0, 0] | [0, 0] | Passed |
| boundary: idle crosses night waiver | [120, 1200] | [20, 200] | Failed |
| regression: grace anchor | [141, 75] | [14, 10] | Failed |
| regression: grace anchor (partial repair) | [80, 640] | [2, 40] | Failed |
| control 1 | [289, 1000] | [285, 1000] | Failed |
| control 2 | [685, 230] | [388, 130] | Failed |
SHA-256 / d8925f67b48fdfe9708dee3fc226875ab15bbd1a4ac18d41027056eeafd6adff
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
if done is None or unplug <= done:
return [0, 0]
start = plug + grace if plug + grace > done else done
if unplug <= start:
return [0, 0]
billable = 0
for m in range(start, unplug):
if 360 <= m < 1320:
billable += 1
blocks = -(-billable // block)
fee = blocks * rate
if cap is not None:
fee = min(fee, cap)
return [billable, fee]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: grace anchor (partial repair)', [1210, 1288, 1405, 30, 40, None, 5], [2, 40]],
['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1392, 1440, 15, 5, 300, 10], [0, 0]],
['regression: grace anchor (partial repair)', [935, 1103, 1359, 15, 25, 0, 15], [202, 0]],
['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1262, 1395, 1440, 0, 40, None, 5], [0, 0]],
['regression: grace anchor (partial repair)', [1142, 1227, 1440, 10, 25, 0, 1], [83, 0]],
['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [240, 384, 858, 0, 40, None, 15], [474, 1280]],
['regression: grace anchor (partial repair)', [306, 373, 739, 10, 25, None, 10], [356, 900]],
['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: grace anchor (partial repair)', [808, 1193, 1387, 15, 5, None, 1], [112, 560]],
['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| boundary: unplugged inside grace | [10, 50] | [0, 0] | Failed |
| boundary: never finished | [0, 0] | [0, 0] | Passed |
| boundary: idle crosses night waiver | [20, 200] | [20, 200] | Passed |
| regression: grace anchor | [29, 15] | [14, 10] | Failed |
| regression: grace anchor (partial repair) | [32, 280] | [2, 40] | Failed |
| control 1 | [289, 1000] | [285, 1000] | Failed |
| control 2 | [398, 135] | [388, 130] | Failed |
SHA-256 / 4a68eec62eb3775c273395bffc22c94e357fe2492afdaa896d1ce5cf7202055c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
if done is None or unplug <= done:
return [0, 0]
start = done + grace
if unplug <= start:
return [0, 0]
billable = 0
for m in range(start, unplug):
if 360 <= m < 1320:
billable += 1
blocks = -(-billable // block)
fee = blocks * rate
if cap is not None:
fee = min(fee, cap)
return [billable, fee]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: grace anchor (partial repair)', [1210, 1288, 1405, 30, 40, None, 5], [2, 40]],
['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1392, 1440, 15, 5, 300, 10], [0, 0]],
['regression: grace anchor (partial repair)', [935, 1103, 1359, 15, 25, 0, 15], [202, 0]],
['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1262, 1395, 1440, 0, 40, None, 5], [0, 0]],
['regression: grace anchor (partial repair)', [1142, 1227, 1440, 10, 25, 0, 1], [83, 0]],
['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [240, 384, 858, 0, 40, None, 15], [474, 1280]],
['regression: grace anchor (partial repair)', [306, 373, 739, 10, 25, None, 10], [356, 900]],
['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
['regression: grace anchor', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: grace anchor (partial repair)', [808, 1193, 1387, 15, 5, None, 1], [112, 560]],
['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| boundary: unplugged inside grace | [0, 0] | [0, 0] | Passed |
| boundary: never finished | [0, 0] | [0, 0] | Passed |
| boundary: idle crosses night waiver | [20, 200] | [20, 200] | Passed |
| regression: grace anchor | [14, 10] | [14, 10] | Passed |
| regression: grace anchor (partial repair) | [2, 40] | [2, 40] | Passed |
| control 1 | [285, 1000] | [285, 1000] | Passed |
| control 2 | [388, 130] | [388, 130] | Passed |
SHA-256 / b3d121bc7a7cea8d47778c09c924bc804d83af5f422bfe2635a1deb24b34579d
Verification & scope
Deterministic stipulated toy contract for teaching; no claim of conformance with any standard, vendor protocol or production controller. 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:51:49.927547+00:00.
Case digest / b38fcf50cf3beeab01f1ac46fb2dbc35eefaba14b129b4f6046a7638ebf52529