EV-20 C19: a held read does nothing to a phase change under way
checks / unit (pull_request) Successful in 33m15s
infra-pin / fresh (pull_request) Failing after 2s

The C17 branch (end a phase change at its 0 A and pause) ran on a held read
too, so one failed read just after a select stopped the car for the 600 s
phase gap. A held read now leaves the change alone; it goes on at the next
real reading. The silent meter still ends it at its 0 A. Rows: test_ev20_rig
section 9.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
Claude
2026-11-24 03:19:19 +01:00
parent 0ef8de26cb
commit 6fbf2600f9
3 changed files with 51 additions and 0 deletions
@@ -171,4 +171,10 @@ one small set of facts and derives every path from them:
write a NEW 0 A there (no retry to a charger that is not answering).
- **Accepted (PM, P9g):** a frozen charger that also stops answering is
flagged only once it answers again; the 15 s safe path covers the gap.
- **A held read during a phase change (SPIKE-06 C19):** a phase change under
way does nothing on a held read (no write, no pause) and goes on at the next
real reading; it ends at its 0 A only while the meter is silent (C17). No
phase change begins on a held cycle; a gap of `stale_input_s` or more takes
the safe path unchanged. Accepted by design (PM): a one-sample partial
reading (only power unavailable, say) still gives the D2 0 A.
+5
View File
@@ -1146,6 +1146,11 @@ class SolarWriter(ManualWriter):
gap = self._gap_ok(now)
if self.sent_a == 0.0 and not self.taken:
self.plan.ok_since = None # 0 A first, then the start rule
if self.seq is not None and self.held_step:
# SPIKE-06 C19: a held read decides nothing for a phase change
# under way (no write, no pause); it goes on at the next real
# reading. A gap that reaches `stale_input_s` takes the safe path.
return
if self.seq is not None and self.nz_block:
# C17: a phase change under way ends at its 0 A; no select and no
# closing current while the meter is silent. The plan pauses and
+40
View File
@@ -673,4 +673,44 @@ for gap_at in (629, 630):
f"629 s: 0 A at {z[:1]} (629-630)",
present(nth(z, 0)) and 629 <= nth(z, 0) <= 630)
# =========================================================================== #
print("\n9. SPIKE-06 C19: A READ GAP DURING A PHASE CHANGE")
# =========================================================================== #
# The C17 (b) shape without the silent meter: a 1 -> 3 change, its 0 A at
# 301 s, select 3, closing current at 313 s. One to six failed charger reads
# right after the select change nothing: the closing current comes on time
# and no pause follows (0ef8de2: paused, no current until about 914 s).
def phase_run(events):
return S.drive(const(500.0), const(7600.0), dur=700, first="car",
socs={"a": 100.0, "b": 100.0}, car_phases=3,
events=events)
for n in (1, 2, 6):
r = phase_run({305: lambda p, c: p.ch.go_unavailable(),
305 + n: lambda p, c: p.ch.go_unavailable(False)})
w = cur_writes(r)
close = [(t, a) for t, a, _ in w if a > 0.0 and 301 < t < 700]
check(f"C19: {n} failed read(s) at 305 s, just after the select: the "
f"closing current on time ({close[:2]}), no pause ({w[:5]})",
present(nth(close, 0)) and 312 <= nth(close, 0)[0] <= 313 + n
and [a for t, a, _ in w if 301 < t < 700 and a == 0.0] == [])
nevers(r, f"C19 gap {n}")
# A gap of stale_input_s or more during the change: the safe path as before.
# The charger is taken as gone: nothing while it is away and no closing
# current; on its return the change is dropped and Solar starts over (0 A
# first, already standing here, so nothing is written; then the start rule,
# which on the 3 phases the select left waits for the phase gap).
r = phase_run({305: lambda p, c: p.ch.go_unavailable(),
322: lambda p, c: p.ch.go_unavailable(False)})
w = cur_writes(r)
during = [(t, a) for t, a, _ in w if 305 <= t < 322]
after = [(t, a) for t, a, _ in w if t >= 322]
check(f"C19: a 17 s gap during the change takes the safe path: nothing while "
f"away ({during}), no closing current, nothing non-zero before the "
f"start rule after the return ({after[:2]})",
during == [] and not [1 for t, a in after if a > 0.0 and t < 322 + 115]
and r["c"].car_solar.seq is None)
nevers(r, "C19 long gap")
report()