EV-20 rig round 1: stuck check armed on the reading before the send; no amp ping-pong; ha_signed meter age
infra-pin / fresh (pull_request) Successful in 4s
checks / unit (pull_request) Failing after 1h11m9s

The stuck check's baseline is the signature of the latest reading taken
before the send (kept at begin_write), never one that arrived while the write
waited; a refused write's first post-send sample is its baseline (EV-36).
After a step down, a step back up needs UP_HYST_W past the boundary. Solar's
15 s meter-age gate applies only where the age measures arrival; on
ha_signed it is the source's meter_max_age_s. Rows in test_ev20_rig.py;
harness modes for the rig's interleave and an on-change meter.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
Claude
2026-11-23 14:28:21 +01:00
parent cc8c0dc2ae
commit 711c5f3627
6 changed files with 342 additions and 13 deletions
+15 -2
View File
@@ -430,6 +430,10 @@ SOLAR_WRITE_S = 30.0 # at most one current change per this ...
SOLAR_STEP_A = 1.0 # ... and only on a change of this or more
UP_W, UP_S = 4500.0, 180.0 # auto phases: to 3 at this for this long
DOWN_W, DOWN_S = 4000.0, 300.0 # ... back to 1 under this for this long
# Rig round 1: after a step down, a step back up needs this much more than the
# amp boundary, so a spare that dithers on a boundary is one change, not 10 /
# 9 / 10 every 30 s (N5's intent).
UP_HYST_W = 100.0
ONE_PHASE_S = 10.0 # one phase drawing while 3 are allowed this long
ONE_PHASE_MIN_W = 500.0 # ... with the car drawing at least this
# D3: at shutdown the 0 A is tried this many times, this far apart, each
@@ -522,6 +526,7 @@ class SolarPlan:
self.target_w = None
self._before = None # the state before a phase change
self.ext_at = None # C6: Manual's latest non-zero write
self.last_dir = 0 # the latest change: +1 up, -1 down
def pause(self, why="paused"):
self.a = 0.0
@@ -541,6 +546,7 @@ class SolarPlan:
self.why)
self.n, self.switch = n, True
self.a, self.set_at, self.why = float(a), now, "running"
self.last_dir = 0
self.ok_since = self.low_since = None
self.up_since = self.down_since = None
@@ -607,7 +613,7 @@ class SolarPlan:
if hi < CH.MIN_A:
self.pause()
return
self.a, self.set_at = float(hi), now
self.a, self.set_at, self.last_dir = float(hi), now, -1
if auto and not self.switch: # auto phases, by dwells
if self.n == 1:
self.down_since = None
@@ -640,7 +646,13 @@ class SolarPlan:
if want is not None and want >= CH.MIN_A:
self.low_since = None
self.why = "running"
if want > self.a and self.last_dir < 0:
# Up again after a step down: only past the boundary plus
# `UP_HYST_W` (no ping-pong on an amp boundary).
up = amps_for(target_w - UP_HYST_W, self.n, clamp) or 0.0
want = max(self.a, up)
if abs(want - self.a) >= SOLAR_STEP_A and self._gate(now):
self.last_dir = 1 if want > self.a else -1
self.a, self.set_at = want, now
return
if auto and self.n == 3 and target_w >= DOWN_W and not self.switch:
@@ -649,6 +661,7 @@ class SolarPlan:
self.low_since = None
self.why = "running"
if self.a != CH.MIN_A and self._gate(now):
self.last_dir = 1 if CH.MIN_A > self.a else -1
self.a, self.set_at = CH.MIN_A, now
return
if self.low_since is None:
@@ -658,7 +671,7 @@ class SolarPlan:
self.pause()
return
if self.a != CH.MIN_A and self._gate(now):
self.a, self.set_at = CH.MIN_A, now
self.a, self.set_at, self.last_dir = CH.MIN_A, now, -1
class SolarWriter(ManualWriter):