EV-19 review round 1: discount a battery rise only while the meter has not moved
checks / unit (pull_request) Successful in 31m32s
infra-pin / fresh (pull_request) Failing after 1s

[Major] The rise discount applied to any rise, also one the meter
already shows, so an honest house step answered by one cycle of battery
power alarmed one cycle after base (review repro: T6 step + burst, R+6
instead of R+5). Now a reading above both earlier ones is discounted only
while the meter's house side (held - car; held alone when a car figure is
unknown) moved no more than RISE_STILL_W (50 W) since the last cycle.

Tests: the burst shapes (unit, meter in step and one cycle late;
controller, step at R+5 and R+30, 3 000 / 4 600 W) at base's second; the
"N6 unit" check tightened to the rise cycle; the RISE_STILL_W boundary;
a pin on EV-18's `_car_over_now` (mC); T10 restarts at R-1 and R (mE).
test_ev19: 144 of 144 here, 52 red on 43b0db7.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
ems-agent
2026-11-20 22:13:19 +01:00
co-authored by Claude
parent 4950a2374f
commit c2bb32ec93
4 changed files with 127 additions and 20 deletions
+28 -1
View File
@@ -201,7 +201,7 @@ def run(*, bw=4250.0, traj="t1", rp=180, r_rel=43, order="manual",
soc_after = soc_after or {u: 19.0 for u in units}
lagb = 10.0 if traj == "t4" else 0.0
cls = type("Plant", (Plant,), {
"force": frc, "batt_lag": lagb,
"force": frc, "batt_lag": lagb, "R": R,
"lost": {u: {R + k for k in v} for u, v in (lost or {}).items()},
"p1_lag": 5.0 if traj == "t4r" else 0.0, "p1_from": float(R)})
@@ -477,6 +477,17 @@ def _step_house(k, lo=AIM + 520.0 - CAR, hi=AIM + 1900.0):
return lambda t, R: lo if t < R + k else hi
def _burst(k, w):
"""Inverter-b: 2 125 W until R+1, then `w` for 0.5 s before the cycle at
R+k (P1, sampled 0.3 s before it, and the reading both show it), else
0 W."""
def f(at, plant):
if at < plant.R + 1:
return 4250.0 / 2.0
return w if plant.R + k - 0.5 <= at <= plant.R + k else 0.0
return f
def _ignoring():
"""The charger accepts the 6 A write and ignores it: the car stays at
0 A."""
@@ -626,6 +637,22 @@ def jobs():
mode=md)
j[f"N2 reports 11 kW at 6 A {md}"] = t5_shape(
sim=Draw(CAR, 11000.0, setpoint_a=6), mode=md)
# Review round 1: an honest house step answered by ONE cycle of inverter-b
# power that P1 and the reading both show (the meter in step), after the
# T6 shape (4 250 W until R, then 0 W).
for k in (5, 30):
for hi in (1900, 2500):
for burst in (3000.0, 4600.0):
for md in ("manual", "off"):
j[f"RB step R+{k} aim+{hi} burst {burst:.0f} {md}"] = dict(
bw=4250.0, traj="t1", mode=md,
house_fn=_step_house(k - 0.5, hi=AIM + hi),
force={"b": _burst(k, burst)})
# T10 (mE): restarts at R-1 and R, so the rise cycle has no reading from
# two cycles back
for nm, sh in (("T2", t2_shape), ("T5", t5_shape)):
for k in (-1, 0):
j[f"T10 {nm} restart R{k:+d}"] = sh(rel=restart(k))
# T20 / N4: the same runs with the car never explaining
j["N4 T2 explain off"] = t2_shape(explain_off=True)
j["N4 T5 explain off"] = t5_shape(explain_off=True)