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
+6 -5
View File
@@ -589,11 +589,12 @@ class CycleMixin:
"suspended so the peak claim is not "
"contradicted",
hint=messages.hint("maint_paused"))
# MAINT-28: under its peak reserve this pack gives only
# what the guard claims. DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md
shape = ((0.0, "peak reserve")
if _m28 and inv.name in self._under_reserve()
else None)
# MAINT-28: while held this pack gives only what the
# guard claims. DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md
shape = ((max((c.lo for c in claims
if c.source == peakguard.SOURCE),
default=0.0), "peak hold")
if _m28 else None)
else:
self._maint_shape_suspended = False
hi = 0.0
-7
View File
@@ -740,13 +740,6 @@ class TradeMixin:
ok = False
return ok
def _under_reserve(self) -> frozenset:
"""MAINT-28: the batteries at or under their peak reserve now
(`peakguard.reserve_split()`). DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md"""
floor = float(self.o.get(
"peak_soc_floor", peakguard.PEAK_OPTION_DEFAULTS["peak_soc_floor"]))
return frozenset(peakguard.reserve_split(self.packs, floor)[1])
def _reseed_drop(self, live) -> None:
"""SAFETY-96, N>=2: a battery that drops out of the split (stale link)
leaves the loop's start point, so the others take over at one slew step