FA-92881 / EV charging session scheduling / Open access
Post-charge idle occupancy fee: block rounding · case 01
Idle minutes shorter than a full block are never billed.
ROOT CAUSE
Started billing blocks are floored instead of rounded up.
VERIFIED REPAIR
Round the block count up with ceiling division.
Unsuccessful approach: Nearest rounding still drops started blocks that are less than half used.
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 = 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: block rounding', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: block rounding (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: block rounding', [11, 183, 646, 10, 40, 1000, 15], [286, 800]],
['regression: block rounding (partial repair)', [797, 925, 1320, 10, 25, 1000, 10], [385, 975]],
['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: block rounding', [649, 977, 1118, 10, 5, 1000, 10], [131, 70]],
['regression: block rounding (partial repair)', [839, 991, 1013, 15, 25, 1000, 5], [7, 50]],
['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: block rounding', [37, 320, 601, 10, 5, None, 10], [241, 125]],
['regression: block rounding (partial repair)', [349, 571, 753, 30, 5, 300, 5], [152, 155]],
['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: block rounding', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: block rounding (partial repair)', [334, 705, 791, 30, 25, 1000, 5], [56, 300]],
['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: block rounding | [14, 5] | [14, 10] | Failed |
| regression: block rounding (partial repair) | [2, 0] | [2, 40] | Failed |
| control 1 | [285, 1000] | [285, 1000] | Passed |
| control 2 | [388, 125] | [388, 130] | Failed |
SHA-256 / aaa9da04a4cc958de3d4667ecf34de4df15f7f33fe5834058ea7173b0498c028
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 = done + grace
if unplug <= start:
return [0, 0]
billable = 0
for m in range(start, unplug):
if 360 <= m < 1320:
billable += 1
blocks = round(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: block rounding', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: block rounding (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: block rounding', [11, 183, 646, 10, 40, 1000, 15], [286, 800]],
['regression: block rounding (partial repair)', [797, 925, 1320, 10, 25, 1000, 10], [385, 975]],
['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: block rounding', [649, 977, 1118, 10, 5, 1000, 10], [131, 70]],
['regression: block rounding (partial repair)', [839, 991, 1013, 15, 25, 1000, 5], [7, 50]],
['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: block rounding', [37, 320, 601, 10, 5, None, 10], [241, 125]],
['regression: block rounding (partial repair)', [349, 571, 753, 30, 5, 300, 5], [152, 155]],
['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: block rounding', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: block rounding (partial repair)', [334, 705, 791, 30, 25, 1000, 5], [56, 300]],
['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: block rounding | [14, 5] | [14, 10] | Failed |
| regression: block rounding (partial repair) | [2, 0] | [2, 40] | Failed |
| control 1 | [285, 1000] | [285, 1000] | Passed |
| control 2 | [388, 130] | [388, 130] | Passed |
SHA-256 / a92cbc5cfba13e395dc86a791daf57f0b961958a7778f1bb2d3a664a950f9cec
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: block rounding', [267, 472, 501, 15, 5, None, 10], [14, 10]],
['regression: block rounding (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: block rounding', [11, 183, 646, 10, 40, 1000, 15], [286, 800]],
['regression: block rounding (partial repair)', [797, 925, 1320, 10, 25, 1000, 10], [385, 975]],
['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: block rounding', [649, 977, 1118, 10, 5, 1000, 10], [131, 70]],
['regression: block rounding (partial repair)', [839, 991, 1013, 15, 25, 1000, 5], [7, 50]],
['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: block rounding', [37, 320, 601, 10, 5, None, 10], [241, 125]],
['regression: block rounding (partial repair)', [349, 571, 753, 30, 5, 300, 5], [152, 155]],
['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: block rounding', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
['regression: block rounding (partial repair)', [334, 705, 791, 30, 25, 1000, 5], [56, 300]],
['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: block rounding | [14, 10] | [14, 10] | Passed |
| regression: block rounding (partial repair) | [2, 40] | [2, 40] | Passed |
| control 1 | [285, 1000] | [285, 1000] | Passed |
| control 2 | [388, 130] | [388, 130] | Passed |
SHA-256 / 587826b2131c2d8c273ff14fb5140dc73c8c3d73b177a310719e08979f66f90c
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.962780+00:00.
Case digest / f1709e02a0b12bdfcbbbc481fd66c88590c738865f26e831891005e0e87cdc99