EV-28: never select the phases while the car still draws
Stage zero counted mode3 B as quiet whatever the power and selected at the 20 s timeout under load. A power reading now decides (under 100 W); mode3 (not C, not D) only without one. Still drawing at 20 s: no select, the current comes back at once, one failed try, next try PHASE_GAP_S later. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -613,10 +613,15 @@ async def slow_stop():
|
||||
|
||||
w5s, n05s = run(slow_stop())
|
||||
seq5s = w5s.writes()[n05s:]
|
||||
check("a car that is slow to stop: the phases are selected after 20 s at most "
|
||||
f"({seq5s[1][0] - seq5s[0][0]:.0f} s after the 0 A)",
|
||||
[x[1] for x in seq5s][:2] == ["current", "phases"]
|
||||
and 19.0 <= seq5s[1][0] - seq5s[0][0] <= 22.0)
|
||||
# EV-28: a car still drawing at 20 s gets no select; the current comes back
|
||||
rest5s = [x for x in seq5s if x[1] == "current" and x[2] == 10.0]
|
||||
check("a car that is slow to stop (about 1300 W after 20 s): the phases are "
|
||||
"NOT selected, the add-on gives up at 20 s, the 10 A come back at once "
|
||||
f"({[(x[1], x[2]) for x in seq5s]}), one failed try",
|
||||
[x[1] for x in seq5s].count("phases") == 0
|
||||
and [x[2] for x in seq5s if x[1] == "current"][:2] == [0.0, 10.0]
|
||||
and rest5s and 20.0 <= rest5s[0][0] - seq5s[0][0] <= 21.0
|
||||
and w5s.sim.phases_allowed == 1 and w5s.c.car_writer.phase_fails == 1)
|
||||
|
||||
|
||||
async def zero_refused():
|
||||
@@ -890,9 +895,11 @@ check("the write paths are exactly these (all in carmode.py): the current "
|
||||
("carmode.py", "write_phases")])
|
||||
|
||||
|
||||
async def fuzz(seed):
|
||||
async def fuzz(seed, slow=False):
|
||||
rnd = random.Random(seed)
|
||||
w = World(setpoint=rnd.choice([6, 10, 16]), phases=rnd.choice([1, 3]))
|
||||
if slow: # EV-28: the car's power ramps down slowly
|
||||
w.sim.ramp_w_s, w.sim.stop_delay_s = 200.0, float(seed % 2)
|
||||
w.sim.lag_s = rnd.choice([0.0, 0.0, 3.0, 12.0])
|
||||
race = seed % 2 == 1 # half the sites run read -> settle -> cycle
|
||||
bad, seen, others, holds, undos = [], 0, 0, 0, 0
|
||||
@@ -961,6 +968,9 @@ async def fuzz(seed):
|
||||
bad.append((seed, step, "phases selected outside Manual"))
|
||||
if sp != 0.0:
|
||||
bad.append((seed, step, "phases with the setpoint up", sp))
|
||||
if power >= carmode.QUIET_W: # EV-28 (N1)
|
||||
bad.append((seed, step, "phases selected under load",
|
||||
power))
|
||||
if last_switch is not None and t - last_switch < 600.0:
|
||||
bad.append((seed, step, "two switches inside 10 min",
|
||||
t - last_switch))
|
||||
@@ -977,7 +987,15 @@ for _seed in range(14):
|
||||
fz_o += _o
|
||||
fz_h += _h
|
||||
fz_u += _u
|
||||
check(f"fuzz: {fz_n} charger writes over 14 random sites and 5600 steps of "
|
||||
for _seed in range(100, 104): # EV-28: ramp 200 W/s, B after 0 or 1 s
|
||||
_b, _n, _o, _h, _u = run(fuzz(_seed, slow=True))
|
||||
fz_bad += _b
|
||||
fz_n += _n
|
||||
fz_o += _o
|
||||
fz_h += _h
|
||||
fz_u += _u
|
||||
check(f"fuzz: {fz_n} charger writes over 18 random sites (4 of them with a "
|
||||
f"car that stops at 200 W/s) and 7200 steps of "
|
||||
f"random user changes, outages, unplugs, refusals, shadow and control "
|
||||
f"stops, in both cycle orders: none over the clamp, none outside "
|
||||
f"Manual, none with control stopped, in shadow mode or with no car, the "
|
||||
|
||||
Reference in New Issue
Block a user