FAILURE MAP
← Case archive

FA-93331 / EV charging session scheduling / Open access

Site power profile from charge plans: overload comparison · case 01

Running exactly at the site limit is reported as an overload.

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

ROOT CAUSE

The overload test is inclusive.

VERIFIED REPAIR

Report only totals strictly above site_max.

Unsuccessful approach: Skipping the first segment hides real overloads at plan start.

Case contract

plan holds [start, end, kw] charging intervals ([start, end), zero-length ignored). Build the site profile as change points [[t, total_kw]] over the interval breakpoints, merging equal consecutive levels, and close with [last breakpoint, 0] unless the profile already ends at 0. Also return the start points of segments whose total exceeds site_max. Return [profile, overloads].

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(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e) if e > s})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw >= site_max:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
   [[[0, 0], [4, 11], [14, 0]], []]],
  ['regression: overload comparison (partial repair)',
   [[[29, 44, 7], [24, 34, 4], [12, 12, 4], [12, 14, 11], [30, 35, 11]], 7],
   [[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]],
    [12, 29, 30, 34]]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[30, 45, 0], [9, 9, 11], [12, 27, 4], [4, 14, 11], [27, 32, 7]], 7],
   [[[4, 11], [12, 15], [14, 4], [27, 7], [32, 0]], [4, 12]]],
  ['regression: overload comparison (partial repair)', [[[27, 29, 11]], 7],
   [[[27, 11], [29, 0]], [27]]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[9, 14, 0], [6, 8, 7]], 7], [[[6, 7], [8, 0]], []]],
  ['regression: overload comparison (partial repair)', [[[1, 16, 4], [6, 21, 7], [11, 11, 0]], 11],
   [[[1, 4], [6, 11], [16, 7], [21, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
   [[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
  ['regression: overload comparison (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[5, 10, 7], [2, 7, 4]], 7],
   [[[2, 4], [5, 11], [7, 7], [10, 0]], [5]]],
  ['regression: overload comparison (partial repair)', [[[19, 29, 11]], 7],
   [[[19, 11], [29, 0]], [19]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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 fixtureActualExpectedOutcome
boundary: zero-length interval before plan[[[10, 11], [20, 0]], [10]][[[10, 11], [20, 0]], []]Failed
boundary: exact site limit[[[0, 11], [10, 0]], [0]][[[0, 11], [10, 0]], []]Failed
boundary: empty plan[[], []][[], []]Passed
regression: overload comparison[[[0, 0], [4, 11], [14, 0]], [4]][[[0, 0], [4, 11], [14, 0]], []]Failed
regression: overload comparison (partial repair)[[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [12, 29, 30, 34, 35]][[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [12, 29, 30, 34]]Failed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / 0d1e0e3a0a4f80484d8936de0026aaf6b002185faa666d13015659da53cfd555

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e) if e > s})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw >= site_max and len(out) > 1:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
   [[[0, 0], [4, 11], [14, 0]], []]],
  ['regression: overload comparison (partial repair)',
   [[[29, 44, 7], [24, 34, 4], [12, 12, 4], [12, 14, 11], [30, 35, 11]], 7],
   [[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]],
    [12, 29, 30, 34]]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[30, 45, 0], [9, 9, 11], [12, 27, 4], [4, 14, 11], [27, 32, 7]], 7],
   [[[4, 11], [12, 15], [14, 4], [27, 7], [32, 0]], [4, 12]]],
  ['regression: overload comparison (partial repair)', [[[27, 29, 11]], 7],
   [[[27, 11], [29, 0]], [27]]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[9, 14, 0], [6, 8, 7]], 7], [[[6, 7], [8, 0]], []]],
  ['regression: overload comparison (partial repair)', [[[1, 16, 4], [6, 21, 7], [11, 11, 0]], 11],
   [[[1, 4], [6, 11], [16, 7], [21, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
   [[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
  ['regression: overload comparison (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[5, 10, 7], [2, 7, 4]], 7],
   [[[2, 4], [5, 11], [7, 7], [10, 0]], [5]]],
  ['regression: overload comparison (partial repair)', [[[19, 29, 11]], 7],
   [[[19, 11], [29, 0]], [19]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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 fixtureActualExpectedOutcome
boundary: zero-length interval before plan[[[10, 11], [20, 0]], []][[[10, 11], [20, 0]], []]Passed
boundary: exact site limit[[[0, 11], [10, 0]], []][[[0, 11], [10, 0]], []]Passed
boundary: empty plan[[], []][[], []]Passed
regression: overload comparison[[[0, 0], [4, 11], [14, 0]], [4]][[[0, 0], [4, 11], [14, 0]], []]Failed
regression: overload comparison (partial repair)[[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [29, 30, 34, 35]][[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [12, 29, 30, 34]]Failed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / 000ee681f71131c834ad6d253e9f3b8944fa86eb1264cc64c620237b83e006f3

3 / The verified repair

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

N = 1
observations = []
def solve(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e) if e > s})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw > site_max:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
   [[[0, 0], [4, 11], [14, 0]], []]],
  ['regression: overload comparison (partial repair)',
   [[[29, 44, 7], [24, 34, 4], [12, 12, 4], [12, 14, 11], [30, 35, 11]], 7],
   [[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]],
    [12, 29, 30, 34]]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[30, 45, 0], [9, 9, 11], [12, 27, 4], [4, 14, 11], [27, 32, 7]], 7],
   [[[4, 11], [12, 15], [14, 4], [27, 7], [32, 0]], [4, 12]]],
  ['regression: overload comparison (partial repair)', [[[27, 29, 11]], 7],
   [[[27, 11], [29, 0]], [27]]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[9, 14, 0], [6, 8, 7]], 7], [[[6, 7], [8, 0]], []]],
  ['regression: overload comparison (partial repair)', [[[1, 16, 4], [6, 21, 7], [11, 11, 0]], 11],
   [[[1, 4], [6, 11], [16, 7], [21, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison',
   [[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
   [[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
  ['regression: overload comparison (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: overload comparison', [[[5, 10, 7], [2, 7, 4]], 7],
   [[[2, 4], [5, 11], [7, 7], [10, 0]], [5]]],
  ['regression: overload comparison (partial repair)', [[[19, 29, 11]], 7],
   [[[19, 11], [29, 0]], [19]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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 fixtureActualExpectedOutcome
boundary: zero-length interval before plan[[[10, 11], [20, 0]], []][[[10, 11], [20, 0]], []]Passed
boundary: exact site limit[[[0, 11], [10, 0]], []][[[0, 11], [10, 0]], []]Passed
boundary: empty plan[[], []][[], []]Passed
regression: overload comparison[[[0, 0], [4, 11], [14, 0]], []][[[0, 0], [4, 11], [14, 0]], []]Passed
regression: overload comparison (partial repair)[[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [12, 29, 30, 34]][[[12, 11], [14, 0], [24, 4], [29, 11], [30, 22], [34, 18], [35, 7], [44, 0]], [12, 29, 30, 34]]Passed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / 888af1c635db5a483a63a81e48d51f5c678610147678044b6a3f5b827807d04f

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:54.238185+00:00.

Case digest / 9b0c6d9ffb00b9d0a35073b51924cd61bf3f21ed359d8931aa875952ad885939