EV-05 round 8: Off respects the owed-only rule; grade out only a car Solar runs
checks / unit (pull_request) Successful in 26m14s
infra-pin / fresh (pull_request) Successful in 1s

Review of fa11dc3:
- Solar to Off writes no 0 A when Solar never had the charger (shadow or a
  stopped control since the start) or its not-writing 0 A is already taken
  (N10, Expected 11), as the shutdown does since round 7.
- car_solar_can_cut() also needs a car Solar runs: plan.a > 0, its own phase
  change, or its own 0 A inside EV-15's OWN_PAUSE_MAX_S.

Tests: the four p_off shapes (and Manual); p_paused at 1000 s and 890 s and
an own pause older than 85 s, each against an Off twin; the near-end rule
with slow batteries that keep headroom (review p_ne2).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-18 22:17:21 +01:00
co-authored by Claude
parent fa11dc3d85
commit e348a808ff
4 changed files with 121 additions and 8 deletions
+7 -3
View File
@@ -810,9 +810,13 @@ class SolarWriter(ManualWriter):
return
if mode != MANUAL: # Off: 0 A until taken, then nothing
self.seq = None
await self._exit_zero("off", drv, cur, now, tracker)
if self.zero_owed:
return # tried again next cycle (or gave up)
# Round 8: not when Solar never had the charger (shadow or a
# stopped control since the start) or its not-writing 0 A is
# already taken: nothing over another writer (N10).
if not (self.out and (self.zero_ok or not self.had_control)):
await self._exit_zero("off", drv, cur, now, tracker)
if self.zero_owed:
return # tried again next cycle (or gave up)
self._leave() # Manual writes its own current
return
self.engaged = True
+12 -5
View File
@@ -458,13 +458,20 @@ class CarMixin:
writer holds the charger, a write of ours was refused or given up, a
way-out 0 A is not taken, the charger shows a fault, or it cannot be
read, and not while Solar is not writing (Stop, shadow, a safety stop:
round 7). Only then may the car be graded out of the peak alarms."""
round 7), and not a car Solar is not running (round 8). Only then may
the car be graded out of the peak alarms."""
w = getattr(self, "car_solar", None)
r = self.car.reading
return bool(w is not None and r is not None and r.available
and self.car_writing() # round 7: Stop, shadow, latch
and not w.hold and not w.gave_up and w.fail_at is None
and w.fault is None and not w.zero_owed)
if not (w is not None and r is not None and r.available
and self.car_writing() # round 7: Stop, shadow, latch
and not w.hold and not w.gave_up and w.fail_at is None
and w.fault is None and not w.zero_owed):
return False
# Round 8: Solar cuts only a car it runs (`plan.a > 0`). While paused
# at 0 A a car that draws is someone else's, unless it is Solar's own
# 0 A or phase change still inside EV-15's bound.
return bool(w.plan.a > 0.0 or w.seq is not None
or self._car_solar_pause(self.car_now()))
def _car_giving(self) -> list:
"""EV-05: the batteries the peak guard can draw on now: above their