EV-20: SPIKE-05 decisions C1, C6, C9 (brief v5) with rows for C1, C5, C6, C8, C9
checks / unit (pull_request) Successful in 34m42s
infra-pin / fresh (pull_request) Successful in 2s

C1: an own 0 A not yet read back is kept with the mode; a start in Off with
it writes the 0 A (retried), without it nothing; a start that will not write
warns once when the charger still has the add-on's current. C6: Solar's 30 s
gate also counts from Manual's latest write. C9: an exit also owes its 0 A
when the read-back shows Solar's own value. Rows for C5 and C8 too.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
Claude
2026-11-22 21:33:28 +01:00
parent d18ed56fad
commit e0138a2ae5
8 changed files with 282 additions and 5 deletions
+24 -1
View File
@@ -31,7 +31,7 @@ import ev20_sun as S # noqa: E40
from chargersim import SimCharger # noqa: E402
from ev20_kit import * # noqa: E402,F401,F403
from ev20_kit import LOG, check, fails, report # noqa: E402,F401
from named_absence import nth, present # noqa: E402,F401
from named_absence import given, nth, present # noqa: E402,F401
from ev20_kit import (_dies, _err, _freeze_after_write, _shutdown, # noqa: E402,F401
_until)
@@ -426,6 +426,29 @@ check("T5 (iv): a charger reading older than 15 s (this driver: the charger "
r5d["trace"][330]["spare"] is None
and [a for _, a, _ in cur_writes(r5d)] == [10.0])
# C6: one write clock. A plan whose start dwell is done waits 30 s from
# Manual's latest non-zero write (`ext_at`), and from its own.
p6 = SolarPlan(1)
starts6 = []
for k in range(300):
p6.ext_at = 150.0
p6.step(float(k), target_w=3000.0, n_now=1, auto=False, clamp=16,
start_s=120.0, pause_s=300.0)
if p6.a > 0.0 and not starts6:
starts6.append(k)
check(f"C6: Manual wrote at 150 s; Solar's start dwell is done at 120 s but "
f"its first current waits for 180 s ({starts6})", starts6 == [180])
r6m = std(400, mode="manual", sim=SimCharger(setpoint_a=0),
opts={"ev_start_min": 1},
events={100: act("car_current", 12), 105: act("car_mode", "solar")})
w6m = [(t, a) for t, a, _ in cur_writes(r6m)]
man = [x[0] for x in r6m["sim"].log if x[2] > 0.0 and x[0] <= 106]
check(f"C6: Manual writes 12 A, then Solar is chosen: Solar's own first "
f"write is 0 A, and no current of Solar's within 30 s of Manual's "
f"({man}, Solar {w6m})",
w6m[:1] and w6m[0][1] == 0.0 and present(nth(man, -1))
and not [t for t, a in w6m if a > 0.0 and t - nth(man, -1) < 30.0])
# T13: the start rule.
for race in (False, True):
tag = "race" if race else "step"