EV-05 round 5: headroom counts only the batteries that can give
checks / unit (pull_request) Successful in 24m24s
infra-pin / fresh (pull_request) Successful in 2s

Review of 8818768: the headroom test compared the output with the site
rating, which still counted a battery refusing to give (SAFETY-73) or under
a safety stop, so the 15 s wait ran at the real maximum (N4). Now only the
units that can give (above their cut-out, not refusing, not stopped,
switched on) count, in what they give and in their ratings.

Tests: R5a (A refuses, B at full rating, against a car-Off twin: the cut at
910, period 3361 W), R5b (headroom and a slow battery: the cut at exactly
15 s), R5c (floor-limited alone decides: cut at once). DOCS wrapped to 79.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-18 17:27:17 +01:00
co-authored by Claude
parent 8818768dab
commit 69f58181bc
5 changed files with 164 additions and 46 deletions
+2 -1
View File
@@ -60,6 +60,7 @@ class SunPlant:
self.batt_nan = set() # units whose battery figure reads None
self.utc_off = 0.0 # the wall clock jumps, the model clock not
self.ha_down = False # Home Assistant answers nothing (SAFETY-112)
self.response_s = RESPONSE_S # a slow battery takes longer
def batt_of(self, u, at):
w = 0.0
@@ -131,7 +132,7 @@ class SunPlant:
if e == SET:
return self._logged("current", float(v), self.ch.request_current)
if e.startswith("number.sp_"):
self.hists[e[-1]].append((self.t + RESPONSE_S, float(v)))
self.hists[e[-1]].append((self.t + self.response_s, float(v)))
return True