SAFETY-126: a landing error on the aim is not an overrun
During the night grid charge under the peak reserve the guard alarmed (ERROR PEAK_GUARD_FLOOR_LIMITED, "Battery stopped limiting the peak") and the Batteries "Why" said "The peak limit needs power" at quarter ends, while every quarter landed on the aim. The charge lands the period 0-7 W over the aim and excess_w()'s 900 / remaining turns that into tens of kW in the last second; with nothing able to give, check_peak_floor_limited() alarmed on any wanted > 0. Each cycle the guard wants power, _peak_landing() asks misses_aim(): with the batteries at 0 W, does the period end more than ALARM_MISS_W over the aim? If not, the decision is within_aim: no reserve alarm, no red peak row, no "Why" peak. The claim and the commands are unchanged. A real overrun under the reserve alarms on the same cycle as before. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
cc9bbeb73e
commit
40595e42ae
@@ -818,9 +818,11 @@ def refusing(c, inv) -> int:
|
||||
def peak_engaged(c) -> bool:
|
||||
"""The peak guard asks the batteries for power this cycle. Not when it is
|
||||
blind or floor-limited: those are engaged with a 0 W floor (no charging
|
||||
only), so no battery gives power for it."""
|
||||
only), so no battery gives power for it. Nor when the quarter ends on
|
||||
the aim anyway (SAFETY-126, `within_aim`)."""
|
||||
pg = getattr(c, "peak_guard", None)
|
||||
return bool(pg is not None and pg.engaged and (pg.floor_w or 0.0) > 0.0)
|
||||
return bool(pg is not None and pg.engaged and (pg.floor_w or 0.0) > 0.0
|
||||
and not pg.within_aim)
|
||||
|
||||
|
||||
def battery_rows(c, shadow, running, held=False):
|
||||
|
||||
Reference in New Issue
Block a user