MAINT-28 fix-forward: the peak pause ends only on a settled house estimate, and a pack under its peak reserve gives nothing for the house while it holds
checks / unit (pull_request) Successful in 28m10s
infra-pin / fresh (pull_request) Successful in 1s

Rig FAIL (TEST-23, f3f9483). F-1: the hold ended at each guard step because
grid + site_batt_w added a new meter reading to a battery reading up to 10 s
old. It now ends only when no battery reading may pre-date a step up of its
command (Controller._batts_settled()). F-2: while the pause holds, a pack in
maintenance CHARGE at or under its peak reserve is limited to 0 W, so it gives
only what the guard claims for the peak. Sim: Lag.batt_period_s (a held 10 s
register). Tests: test_maint28b.py. DECISIONS updated.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-13 16:56:18 +01:00
co-authored by Claude
parent f3f9483d9c
commit 34b81e8aeb
7 changed files with 395 additions and 12 deletions
+13 -5
View File
@@ -574,10 +574,11 @@ class CycleMixin:
else float(self.grid) + float(self.site_batt_w))
_susp = peakguard.shaping_suspended(
self.peak_guard, self.peak_fc, maint_aim)
_m28 = (len(self.inverters) > 1
and maint_aim > self.peak_aim_w())
self._maint_peak_hold = peakguard.shaping_held(
_susp, _peak_held and len(self.inverters) > 1
and maint_aim > self.peak_aim_w(),
self.peak_fc, maint_aim, house)
_susp, _peak_held and _m28, self.peak_fc, maint_aim,
house, self._batts_settled())
if self._maint_peak_hold:
# Edge-logged: level-logging here would write one line per
# cycle for as long as the event lasts and flush the 40-line
@@ -588,6 +589,11 @@ 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)
else:
self._maint_shape_suspended = False
hi = 0.0
@@ -604,10 +610,12 @@ class CycleMixin:
floor = self._charge_headroom(floor, claims)
if floor > 0:
hi, reason = -floor, "cheap-window charge"
shape = (hi, reason)
if shape is not None:
# PER-INVERTER, like the SET above and for the same reason -
# the shaping is about the pack being charged, which is `inv`.
claims.append(Claim.limit("maintenance", P_MAINT_SHAPE, hi=hi,
reason=reason,
claims.append(Claim.limit("maintenance", P_MAINT_SHAPE,
hi=shape[0], reason=shape[1],
actuator=self.actuator_of("maintenance",
inv)))