EV-19: no floor alarm when the batteries first reach the reserve early in a Manual car session
checks / unit (pull_request) Successful in 25m47s
infra-pin / fresh (pull_request) Failing after 2s

EV-15 rig F-B, reproduced on 43b0db7 (tools/ev19_reserve.py, T1 grid). At
the reserve inverter-b goes on following the house, so its output rises
in that cycle. The battery reading shows the rise one cycle before the P1
sample does, and EV-18's house figure (held - car + now - min(now, prev))
counted the new battery power as house load. `_car_need_house` latched:
one PEAK_GUARD_FLOOR_LIMITED ERROR and goodwe_peak_soc_floor at R+1, red
until the guard stopped wanting power.

ctl_car._car_explains_alarm: for the house latch only, a reading above
both earlier readings counts as house only up to the higher of them. The
credit stays the lower of the last two readings. The claim, floor,
setpoints and charger writes are unchanged (342 runs, same digests).

test_ev19.py: T1-T17, T20, N1-N6 of reports/EV-19-test-plan.md; 49
checks red on 43b0db7, 124 of 124 green here.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
ems-agent
2026-11-20 20:16:25 +01:00
co-authored by Claude
parent 43b0db73d2
commit 4950a2374f
4 changed files with 1332 additions and 2 deletions
+9 -2
View File
@@ -58,7 +58,7 @@ class CarMixin:
self.car_over = False # ... held: the card and row say so
self._car_over_since = None
self._car_over_gone = None
self._car_batt_prev = None
self._car_batt_prev = self._car_batt_prev2 = None
self._car_need_real = self._car_need_excl = False # EV-10 latches
self._car_need_house = self._car_over_now = False # EV-18 latches
self._car_latch_block = None
@@ -414,7 +414,14 @@ class CarMixin:
when the guard no longer wants power, whatever the cover option says
(this runs every cycle). DECISIONS/EV-04-manual-mode.md (EV-18)."""
now, prev = self.site_batt_w, self._car_batt_prev
prev2, self._car_batt_prev2 = self._car_batt_prev2, prev
self._car_batt_prev = now
# EV-19: the reading can show a rise one cycle before the meter does
# (the batteries pick up the house at the reserve), so a reading above
# both earlier ones is not yet counted as house.
seen = now
if now is not None and prev is not None and prev2 is not None:
seen = min(float(now), max(float(prev), float(prev2)))
wants = bool(guard is not None and guard.engaged
and guard.blind is None
and (guard.wanted_w or 0.0) > 0.0)
@@ -436,7 +443,7 @@ class CarMixin:
self._car_need_excl = self._car_need_excl or \
peakguard.misses_aim(excl, batt_w=batt, target_w=target_w)
self._car_need_house = self._car_need_house or \
self._car_lands_over(excl, now, batt, target_w)
self._car_lands_over(excl, seen, batt, target_w)
if w is None or batt is None or not wants \
or not (guard.saturated or guard.floor_limited):
return False