MAINT-28 fix-forward round 2: while the pause holds, the maintenance pack gives only what the peak guard claims
checks / unit (pull_request) Successful in 27m52s
infra-pin / fresh (pull_request) Successful in 1s

Owner go 2026-11-13. The pack in maintenance CHARGE gets a unit limit with hi
= the guard's own floor while the pause holds, at any SoC (replaces the
under-reserve limit). Sim 45 min: A give 2.39 -> 0.02 kWh, SoC 49.0 %, charge
back 4 s. test_safety84 n2_charge_banked re-pinned (192 of 480 rows),
test_maint28 quarter bound to the month peak. Tests: test_maint28b.py.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-13 19:49:19 +01:00
co-authored by Claude
parent 34b81e8aeb
commit 776b84ca20
6 changed files with 40 additions and 25 deletions
+22 -6
View File
@@ -16,10 +16,12 @@ peak forecast like the live sensor, house +-50 W every 5 s, 3000 W then
times (base 1b5f7c9: dozens), no release of the pause on an estimate that
mixes a new grid with an old battery reading, quarters at or under the aim,
A's charge back after the load.
2. F-2: A starts just over its reserve: while the pause holds it gives for the
house only down to the reserve, never below.
2. F-2 and the cap: while the pause holds, A gives only what the peak guard
claims, at any SoC (never under its reserve, SoC barely drops); with the
other pack under its reserve and a house too big for it, A still gives for
the guard.
3. The mirror: B in CHARGE, under its reserve at the load: it gives nothing
for the house, the other pack carries what the guard claims.
for the house.
4. Unchanged: the MAINT-24 live shape (A 1475 W, B no grid trade), with the
same lag on.
5. `peakguard.shaping_held()` with `settled`, and `Controller._batts_settled()`.
@@ -188,14 +190,28 @@ check("after the load A's charge is back within 20 cycles (1 s each: a 10 s "
back is not None and back <= 20)
# ============================================================================ #
print("\n2. F-2: A starts just over its peak reserve (21 %), the pause holds")
print("\n2. the cap: while the pause holds, A gives only what the guard claims")
rows, st, c = scen(soc=RESERVE + 1.0, house=stepped_house(3000.0, 6500.0))
show("A 21 %", rows, st)
check("A gave for the house while above the reserve (as before)",
any(r["u"] > 500 for r in rows if r["soc"] > RESERVE + 0.5))
check("A gives only the guard's claim, under 0.15 kWh (f3f9483 0.94)",
sum(r["u"] for r in rows if r["u"] > 0) / 3.6e6 < 0.15)
check("A never goes under its peak reserve in the peak (rig: to 10 %)",
min(r["soc"] for r in rows) >= RESERVE - 0.5)
check("every quarter at or under the month aim", quarters_ok(st))
rows, st, c = scen(house=stepped_house(3000.0, 6500.0))
soc_start = max(r["soc"] for r in rows if r["t"] <= PRE + 5.0)
check("A at 49 %: its SoC barely drops (under 0.5 point; f3f9483 6.1)",
soc_start - min(r["soc"] for r in rows if r["t"] >= PRE) < 0.5)
rows, st, c = scen(soc=49.0, other=18.2, house=stepped_house(3000.0, 12000.0))
show("A 49 %, B 18 % under its reserve, house 12000 W", rows, st)
load = [r for r in rows if PRE <= r["t"] < PRE + LOAD]
check("the guard's own claim stands: with B under its reserve A gives for "
"the peak (over 0.2 kWh; the cap yields to the guard)",
sum(r["u"] for r in load if r["u"] > 0) / 3.6e6 > 0.2)
g = [("give" if r["u"] > 50 else "idle") for r in load]
sw = sum(1 for x, y in zip(g, g[1:]) if x != y)
print(f" give/idle switches of A in the load: {sw}")
check("...give/idle switches of A at most 10 in the 13 min", sw <= 10)
# ============================================================================ #
print("\n3. mirror: B in CHARGE at 18 % (under its reserve), A on Cheap hours")