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
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:
co-authored by
Claude
parent
f3f9483d9c
commit
34b81e8aeb
@@ -116,10 +116,15 @@ class Lag:
|
||||
after the reading (the HA source's debounce), so a cycle just after a
|
||||
quarter boundary can still see the old block; `tick` the cycle period;
|
||||
`tau_s` / `ramp_w_s` the battery's own lag (TEST-23's plant: `dead_s` 1,
|
||||
no lag or ramp)."""
|
||||
no lag or ramp). `batt_period_s` (MAINT-28): the battery register is
|
||||
published every that many seconds and held between (the rig: 10 s), so its
|
||||
reading is `batt_s` plus up to a period older than the meter's; None keeps
|
||||
the constant age."""
|
||||
|
||||
def __init__(self, dead_s=1.0, meter_s=1.0, batt_s=1.0, p1_s=0.35,
|
||||
tick=1.0, sub=0.25, tau_s=3.0, ramp_w_s=800.0):
|
||||
tick=1.0, sub=0.25, tau_s=3.0, ramp_w_s=800.0,
|
||||
batt_period_s=None):
|
||||
self.batt_period_s = batt_period_s
|
||||
self.dead_s, self.meter_s, self.batt_s = dead_s, meter_s, batt_s
|
||||
self.p1_s, self.tick, self.sub = p1_s, tick, sub
|
||||
self.tau_s, self.ramp_w_s = tau_s, ramp_w_s
|
||||
@@ -211,6 +216,11 @@ class Hass:
|
||||
if e.startswith("sensor.batt"):
|
||||
# A real reading jitters by a few watts; a dead-flat one is a
|
||||
# stale register to the add-on (SAFETY-37), which is not modelled.
|
||||
if self.lag is not None and self.lag.batt_period_s:
|
||||
per = self.lag.batt_period_s
|
||||
ts = math.floor((self.t - self.lag.batt_s) / per) * per
|
||||
j = (ord(u) * 31 + int(ts)) % 7 - 3
|
||||
return float(round(self._past(self.t - ts)[1][u]) + j)
|
||||
j = (ord(u) * 31 + int(self.t)) % 7 - 3
|
||||
p = self.plants[u].p if self.lag is None else \
|
||||
self._past(self.lag.batt_s)[1][u]
|
||||
|
||||
Reference in New Issue
Block a user