EV-19 review round 2: pin the 50 W blind band and the car term of the stillness test
checks / unit (pull_request) Successful in 25m14s
infra-pin / fresh (pull_request) Failing after 1s

Test-only. Two unit checks in test_ev19.py: an honest step with a burst
that moves the meter's house side +/-60 W alarms in base's cycle, and
inside the band (0 W) the car explains at most the step's own cycle;
a car step offset by a burst at the meter is not discounted. They kill
RISE_STILL_W = 500 W and a stillness test without the car term.

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 23:14:09 +01:00
co-authored by Claude
parent c2bb32ec93
commit 77684ecfad
+29
View File
@@ -184,6 +184,35 @@ for d, want in ((STILL - 10.0, True), (STILL + 10.0, False)):
f"cycle: {'still, the rise is not yet house (explained)' if want else 'moved, the rise counts as house (not explained, as base)'}",
ud.get(1) is want and ud.get(0) is True)
# Review round 2: the blind band in absolute W (the owner's 50 W; change this
# check with the owner). An honest step at E+5 (house aim - 500 -> aim + 1 900
# W, more than the car) with one burst that leaves the meter's house side
# moving d W: at |d| = 60 the alarm cycle is base's (E+5); inside the band
# (d = 0) the car explains at most the step's own cycle, never from E+6.
for dd in (60.0, -60.0, 0.0):
hb = (lambda t: AIM - 500.0 if t < 5 else AIM + 1900.0)
bd = (lambda t, B=2400.0 - dd: B if t == 5 else 0.0)
ubd = urun(range(0, 15), lambda t, hb=hb, bd=bd: hb(t) + CAR - bd(t), bd)
print(f" band d={dd:+.0f} W E+4..E+8: {run_of(ubd, 4, 8)}")
t0 = 5 if dd else 6
check(f"band: an honest step whose burst moves the meter's house side "
f"{dd:+.0f} W: not explained from E+{t0}",
ubd.get(4) is True and not any(run_of(ubd, t0, 14))
and len(run_of(ubd, t0, 14)) == 15 - t0)
# Review round 2: the stillness test uses the house side (held - car). The car
# steps 1 380 -> 2 760 W, the house aim - 500 -> aim + 3 000 W (more than the
# car) and b gives one reading of 4 880 W, all at E+5, meter in step: the
# meter's total stays, its house side drops 1 380 W, so nothing is discounted.
hc = (lambda t: AIM - 500.0 if t < 5 else AIM + 3000.0)
wc = (lambda t: CAR if t < 5 else 2 * CAR)
bc5 = (lambda t: 4880.0 if t == 5 else 0.0)
ucw = urun(range(0, 15), lambda t: hc(t) + wc(t) - bc5(t), bc5, w=wc)
check("car term: the car steps up with the house and a burst, the meter's "
"total still: not explained from E+5 (as base)",
ucw.get(4) is True and not any(run_of(ucw, 5, 14))
and len(run_of(ucw, 5, 14)) == 10)
# Review round 1 (mC): EV-18's `_car_over_now` keeps the reading as it is. b
# gives 2 000 W, the house alone with it lands under the aim and the period
# with the car too, so nothing explains; b rises to 4 000 W at E+5 one cycle