EV-54: a refused peak cut no longer stops Solar; tried again next quarter
checks / unit (pull_request) Successful in 52m35s
infra-pin / fresh (pull_request) Successful in 1s

Refused cut tries are capped at 3 per quarter key and never set the session-wide gave_up. The next quarter tries again while a cut is needed. Once no cut stands, a refused cut value is dropped (sent_a and the plan current = the read-back, taken), never re-sent; the drop waits for a good, known read-back. A cut write that raises counts as a refused try. New notice text (Q3); the hold path's text is unchanged. Tests: test_ev54.py, test_ev54_drop.py (T1-T35); test_ev52 N8 knows the new text.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-30 00:24:58 +01:00
co-authored by Claude
parent bdfd3e6848
commit a698211318
11 changed files with 1654 additions and 15 deletions
+14 -5
View File
@@ -294,7 +294,7 @@ class CarMixin:
w = self.car_solar
if not self.car_solar_mode():
self._cut = self._cut_fresh(None)
w.cut_a = None
w.cut_a, w.cut_on, w.cut_blind = None, False, False
return
key = None if real_proj is None else real_proj.block_start
st = self._cut
@@ -306,7 +306,10 @@ class CarMixin:
# N9: nothing sized from a stale projection; what stands stays.
w.cut_a = st["cap"] if st["cap"] is not None \
else self._car_wait_a(st)
w.cut_on, w.cut_blind = st["cap"] is not None, True
return
w.cut_blind = False
w.cut_quarter(key) # EV-54: the quarter's refused cut tries
ex = peakguard.excess_w(real_proj, target_w)
left = QUARTER_S - float(real_proj.elapsed_s)
r = self.car.reading
@@ -355,10 +358,11 @@ class CarMixin:
st = self._cut = self._cut_fresh(key)
st["cuts"] = cuts
w.cut_a = st["cap"]
w.cut_on = st["cap"] is not None
return
if not due:
st["since"], st["wait"] = None, None # the batteries caught it
w.cut_a = None
w.cut_a, w.cut_on = None, False
return
if st["since"] is None:
st["since"], st["car0"], st["ex"] = mono, car_w, ex
@@ -373,13 +377,18 @@ class CarMixin:
st["cap"] = 0.0 if a is None else a
st["cuts"] += 1
st["wait"], st["at"] = None, mono
w.cut_a = st["cap"]
w.cut_a, w.cut_on = st["cap"], True
return
# C4: due and waiting: no raise meanwhile. PM R1: held in watts (the
# plan's current on its phases), turned into amps with the phases at
# the write.
# the write. EV-54 (G1): a refused cut value is dropped in the wait,
# so the hold is the read-back the writer takes, not that value.
w.cut_on = False
p = w.plan
now_w = float(p.a) * carmode.VOLTS * (p.n if p.n in (1, 3) else n)
a_now = float(p.a)
if w.drop_ready(cur, self.car.stuck(mono)):
a_now = float(cur)
now_w = a_now * carmode.VOLTS * (p.n if p.n in (1, 3) else n)
st["wait"] = now_w if st["wait"] is None else min(st["wait"], now_w)
w.cut_a = self._car_wait_a(st)