EV-18 review round 2: the contradiction latch touches only the alarm; an unknown energy reading is not a contradiction
- [Critical] The latch set `w = None` before `_car_quarter`, so with cover off the guard's input (`car_exclude`) counted the car as house and the batteries discharged. The latch now changes only the figure graded for the alarm; the car's energy count, the guard's input and the car-over row keep the unlatched `car_alarm_w()`. Cover-off N4 twins (energy gap, T9(c) liar, SoC 60 % and at the reserve) give the same commands as without the latch. - [Major] `corroborated()` is False for an unknown energy reading, so one missing reading latched a correct figure for the quarter. New `CarTracker.contradicted()`: only a meter that answered over a whole window and fell short. R1 (energy entity unknown 1 s at E+200, T2 and T3 shapes): red for that cycle only, explained from the next. - Minors: unit checks that a contradiction in our own pause latches nothing (MF) and that the latch ends with the quarter (MG). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -80,10 +80,12 @@ def shape(after, before=PRE_W, at=None):
|
||||
|
||||
def run(house, *, a=None, b=None, lost=None, car_a=6, phases=1, aim=AIM,
|
||||
mode="manual", dur=None, extra=None, sim=None, soc=None, plug=True,
|
||||
x=1, mono_x=None, explain_off=False):
|
||||
x=1, mono_x=None, explain_off=False, latch_off=False,
|
||||
cover=True):
|
||||
"""One run; returns (run, trace). `x`: fake seconds per cycle (wall and
|
||||
monotonic both; `mono_x` sets the monotonic rate apart). `explain_off`:
|
||||
the car never explains (for the control-identity check)."""
|
||||
the car never explains, `latch_off`: no contradiction latch (both for the
|
||||
control-identity check). `cover`: the option `ev_batt_cover`."""
|
||||
force = {}
|
||||
if a is not None:
|
||||
force["a"] = a
|
||||
@@ -98,6 +100,10 @@ def run(house, *, a=None, b=None, lost=None, car_a=6, phases=1, aim=AIM,
|
||||
orig = c.car_settle
|
||||
if explain_off:
|
||||
c._car_explains_alarm = lambda *a_, **k_: False
|
||||
if latch_off:
|
||||
c._car_contradicted = lambda *a_, **k_: False
|
||||
if not cover:
|
||||
c.o["ev_batt_cover"] = False
|
||||
if mono_x is not None and mono_x != x:
|
||||
c.car_now = (lambda f=c.car_now: f() * mono_x / x)
|
||||
|
||||
@@ -197,6 +203,16 @@ def commands(r, tr):
|
||||
return h.hexdigest()[:16]
|
||||
|
||||
|
||||
def energy_gap(at, secs=1):
|
||||
"""The charger's energy entity is missing (unknown) for `secs` from `at`."""
|
||||
def on(p, c):
|
||||
p.ch.no_energy = True
|
||||
|
||||
def off(p, c):
|
||||
p.ch.no_energy = False
|
||||
return {at: on, at + secs: off}
|
||||
|
||||
|
||||
def restart(c):
|
||||
"""A restart as the car side sees it: a fresh `car_init` and an empty
|
||||
corroboration history, and no floor alarm standing."""
|
||||
|
||||
Reference in New Issue
Block a user