EV-05 round 5: headroom counts only the batteries that can give
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:
@@ -448,31 +448,44 @@ class CarMixin:
|
||||
<= OWN_PAUSE_MAX_S
|
||||
return 0.0 <= mono - wr.phase_done_at <= OWN_PAUSE_TAIL_S
|
||||
|
||||
def _car_batt_able(self) -> bool:
|
||||
"""EV-05: can a battery still give power? One that is above its own
|
||||
cut-out level, not refusing to give and not under a safety stop."""
|
||||
def _car_giving(self) -> list:
|
||||
"""EV-05: the batteries that can give power now: above their own
|
||||
cut-out level, not refusing to give (SAFETY-73), not under a safety
|
||||
stop, and switched on (battery modes)."""
|
||||
out = []
|
||||
for inv in self.inverters:
|
||||
soc, floor = inv.soc, inv.bms_soc_floor
|
||||
if soc is None or floor is None or inv.sign_wd.tripped \
|
||||
or (inv.refused or 0) > 0:
|
||||
continue
|
||||
if self.modes_on and not self.pack_mode(inv).use:
|
||||
continue
|
||||
if float(soc) > float(floor):
|
||||
return True
|
||||
return False
|
||||
out.append(inv)
|
||||
return out
|
||||
|
||||
def _car_batt_able(self) -> bool:
|
||||
"""EV-05: can a battery still give power at all?"""
|
||||
return bool(self._car_giving())
|
||||
|
||||
def _car_batt_headroom(self, guard) -> bool:
|
||||
"""EV-05 round 4: can the batteries still RAISE their output? A
|
||||
battery above its cut-out (`_car_batt_able`), the guard neither
|
||||
saturated nor at the peak reserve, and the batteries' output more
|
||||
than `HEADROOM_W` under what they can give."""
|
||||
if not self._car_batt_able() or guard is None \
|
||||
or guard.saturated or guard.floor_limited:
|
||||
"""EV-05 rounds 4 and 5: can the batteries still RAISE their output?
|
||||
The guard is neither saturated nor at the peak reserve, and the units
|
||||
that can give (`_car_giving`) give more than `HEADROOM_W` under their
|
||||
own ratings (and under `guard.able_w` when the guard names it). A unit
|
||||
that refuses or is stopped counts neither in what is given nor in what
|
||||
could be."""
|
||||
giving = self._car_giving()
|
||||
if not giving or guard is None or guard.saturated \
|
||||
or guard.floor_limited:
|
||||
return False
|
||||
batt = self.site_batt_w
|
||||
top = guard.able_w if guard.able_w is not None else self.site_rating_w
|
||||
if batt is None or top is None:
|
||||
if any(inv.batt is None for inv in giving):
|
||||
return False
|
||||
return float(batt) < float(top) - HEADROOM_W
|
||||
batt = sum(float(inv.batt) for inv in giving)
|
||||
top = sum(float(inv.rating_w()) for inv in giving)
|
||||
if guard.able_w is not None:
|
||||
top = min(top, float(guard.able_w))
|
||||
return batt < top - HEADROOM_W
|
||||
|
||||
def _car_solar_pause(self, mono) -> bool:
|
||||
"""EV-05: Solar's own 0 A (a pause, the peak cut, the phase change)
|
||||
|
||||
Reference in New Issue
Block a user