EV-21: test fixes (T41/T46 on base, test_ev20_writers T46 with the cut first)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -218,10 +218,16 @@ check(f"T46: Solar starts on 1 phase (select at the start), then another "
|
||||
s46[:1] and s46[0][2] == 1
|
||||
and not [x for x in s46 if 140 < x[0] < 700])
|
||||
low = [x for x in w46 if 140 < x[0] < 700]
|
||||
# EV-21: with both batteries at the cut-out, the other writer's 3 phases
|
||||
# take the period over the aim, so Solar's peak cut lowers the car first,
|
||||
# within 1 cycle and at 690 W/A (EV-21 T34 (ii)); the 6 A hold and the pause
|
||||
# follow. Every write in the stretch lowers; none waits for PHASE_GAP_S.
|
||||
six = [x for x in low if x[1] == 6.0]
|
||||
check(f"T46 (a)(b): the arithmetic uses the 3 phases the car draws on, and a "
|
||||
f"lower current (the 6 A hold, the pause) is written within the 30 s "
|
||||
f"rule, never blocked by PHASE_GAP_S ({w46})",
|
||||
low and low[0][1] == 6.0 and low[0][0] <= 171
|
||||
f"lower current (EV-21's cut, the 6 A hold, the pause) is written "
|
||||
f"within the 30 s rule, never blocked by PHASE_GAP_S ({w46})",
|
||||
low and six and six[0][0] <= 171 and low[0][0] <= 171
|
||||
and all(b[1] < a[1] for a, b in zip(low, low[1:]))
|
||||
and [a for _, a, _ in low][-1:] == [0.0])
|
||||
imp46 = sum(max(0.0, x["grid"]) for x in r46["trace"]
|
||||
if x["t"] > 140 and x["sp"] > 0)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user