EV-20 round 3: no non-zero write while the meter is silent (C17); the age pause on a held read (C18)
checks / unit (pull_request) Successful in 35m34s
infra-pin / fresh (pull_request) Failing after 2s

While the meter's age is past meter_max_age_s, or on a held charger read,
Solar sends no non-zero current: no retry, no raise, no phase change begun,
and a phase change under way ends at its 0 A. 0 A is always allowed. On a
held read Solar still steps (Manual does not), so a pause due then is not
slipped. Rows in test_ev20_rig.py section 8.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
Claude
2026-11-24 01:24:36 +01:00
parent f62501174d
commit 3083093e22
4 changed files with 109 additions and 9 deletions
+57
View File
@@ -616,4 +616,61 @@ check(f"ha_signed: 40 s after the meter went silent Solar is told the sun "
f"has been unknown for 10 s ({seen})",
seen.get("u") is not None and 9.0 <= seen["u"] <= 12.0)
# =========================================================================== #
print("\n8. SPIKE-06 ROUND 3: NO NON-ZERO WRITE WHILE THE METER IS SILENT (C17);")
print(" THE AGE PAUSE ON A HELD READ (C18)")
# =========================================================================== #
# C17 (a): 7 A, a raise to 10 A at 340 s that the charger ignores, the meter
# silent from 345 s (ha_signed). No re-send of the 10 A (the retry would come
# at 400 s, meter age 55 s); 0 A when the age reaches 330 s.
sim = TSim(setpoint_a=0, windows=[(335.0, 350.0, "ignore")])
r = S.drive(const(500.0), lambda t: 3000.0 if t >= 340 else 2300.0,
dur=900, first="car", socs={"a": 100.0, "b": 100.0}, sim=sim,
opts={"ev_phases": "1"},
events={345: lambda p, c: setattr(p, "meter_on", False)})
w = cur_writes(r)
nz = [(t, a) for t, a, _ in w if a > 0.0 and t > 345 + 30]
z = [t for t, a, _ in w if a == 0.0 and t > 345]
raise_ = [(t, a, ok) for t, a, ok in w if 330 <= t <= 345]
check(f"C17 (a): an ignored raise ({raise_}), then the meter silent from "
f"345 s: no re-send while it is silent ({nz}), 0 A at meter age 330 "
f"(+2) ({z[:1]})",
present(nth(raise_, 0)) and nth(raise_, 0)[2] is False and nz == []
and present(nth(z, 0)) and 345 + 329 <= nth(z, 0) <= 345 + 333)
nevers(r, "C17 (a)")
# C17 (b): a 1 -> 3 phase change starts at 301 s (its 0 A); the meter has been
# silent since 276 s, so its age passes 30 s at 307 s, before the closing
# current (313 s without silence). The change ends at its 0 A: no closing
# current, nothing non-zero until the meter is back.
r = S.drive(const(500.0), const(7600.0), dur=900, first="car",
socs={"a": 100.0, "b": 100.0}, car_phases=3,
events={276: lambda p, c: setattr(p, "meter_on", False),
800: lambda p, c: setattr(p, "meter_on", True)})
w = cur_writes(r)
seq0 = [t for t, a, _ in w if a == 0.0 and 295 <= t <= 305]
nz = [(t, a) for t, a, _ in w if a > 0.0 and 306 < t < 800]
check(f"C17 (b): a phase change under way when the meter goes silent ends at "
f"its 0 A ({seq0}): no closing current, no non-zero write while silent "
f"({nz}); writes {w[:6]}",
present(nth(seq0, 0)) and nz == []
and [a for t, a, _ in w if 301 <= t < 800][-1:] == [0.0])
nevers(r, "C17 (b)")
# C18: a charger read gap on the very cycle the age pause is due (ha_signed,
# meter silent from 300 s: due at 629 s without a gap, the meter's last sample
# being at 299 s). The held cycle still steps Solar's pause: 0 A at 629 s, at
# most one cycle later (f625011: 631 s with the gap from 629 s).
for gap_at in (629, 630):
r = S.drive(const(500.0), const(2900.0), dur=760, first="car",
socs={"a": 100.0, "b": 100.0}, opts={"ev_phases": "1"},
events={300: lambda p, c: setattr(p, "meter_on", False),
gap_at: lambda p, c: p.ch.go_unavailable(),
gap_at + 2: lambda p, c: p.ch.go_unavailable(False)})
w = cur_writes(r)
z = [t for t, a, _ in w if a == 0.0 and t > 300]
check(f"C18: a 2-sample read gap from {gap_at} s, the age pause due at "
f"629 s: 0 A at {z[:1]} (629-630)",
present(nth(z, 0)) and 629 <= nth(z, 0) <= 630)
report()