EV-21: test fixes (T41/T46 on base, test_ev20_writers T46 with the cut first)
checks / unit (pull_request) Successful in 47m29s
infra-pin / fresh (pull_request) Successful in 1s

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-25 17:26:38 +01:00
co-authored by Claude
parent 7bc8988be0
commit 36e9dd765e
2 changed files with 14 additions and 8 deletions
+5 -5
View File
@@ -167,7 +167,7 @@ r = drive(step_fn((960, 3000.0), base=900.0), sun41, dur=2100,
first="car", phases=3, socs={"a": 10.0, "b": 10.0},
opts={"ev_phases": "3"})
w = [(t, a) for t, a, _ in after(r, 950)]
cuts = [x["cuts"] for x in r["rec"].rows if 900 <= x["t"] < 1800]
cuts = [x["cuts"] or 0 for x in r["rec"].rows if 900 <= x["t"] < 1800]
second = [t for t, a in w if 1400 <= t < 1800 and a == 0.0]
re2 = [t for t, a in w if 1401 <= t < 1800 and a > 0.0]
q = quarter_avg(r, 900)
@@ -175,11 +175,11 @@ nxt = [t for t, a in w if 1800 <= t <= 1800 + 130 and a > 0.0]
check(f"T41/OQ4: after the second cut the car comes back in the next "
f"period, by the start rule ({nxt[:1]})", bool(nxt))
check(f"T41: writes {w[:6]}: a restart between the cuts, the second cut "
f"within 1 cycle of 1400 ({second[:1]}), {max(cuts)} cuts in the "
f"within 1 cycle of 1400 ({second[:1]}), {max(cuts, default=0)} cuts in the "
f"period, no restart after it until 1800 ({re2[:1]}); the period "
f"{q:.0f} W <= aim, nothing banked ({r['c'].car_peak_q})",
any(960 < t < 1400 and a > 0 for t, a in w) and second
and second[0] <= 1401 and max(cuts) == 2 and not re2 and q <= AIM
and second[0] <= 1401 and max(cuts, default=0) == 2 and not re2 and q <= AIM
and not r["c"].car_peak_q)
never("T41", r)
@@ -488,9 +488,9 @@ check(f"T45: the read-back says 0 A, the power stays: the alarm no later than "
r = shape("W", dur=1100)
z = zero_at(r, 960)
rec = r["rec"]
dec = rec.at(z) or {}
dec = (rec.at(z) or {}) if z is not None else {}
rb = [x["t"] for x in r["trace"] if z and x["t"] > z and x["rb"] == 0.0]
car_b = (rec.at(z - 1) or {}).get("car", 0.0)
car_b = (rec.at(z - 1) or {}).get("car", 0.0) if z is not None else 0.0
lim = None
bad = []
if rb: