EV-20: T4 through the Controller, T21 (a) on car_cycle itself
T4: battery A's power missing, NaN or unavailable, for one cycle (no write) and for 400 s (no spare, the current held, 0 A at 300 s). T21 (a): car_cycle on the same projection, guard and reading gives the same car figure, explains and over in Solar and Manual. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
@@ -303,6 +303,46 @@ for k, fn in (("i", lambda p, c: None),
|
||||
and nth(after, 0)[0] <= 422
|
||||
and not other and not any(x["hold"] for x in rr["trace"]))
|
||||
|
||||
# T4: battery A's power or the site's battery power missing (None), not a
|
||||
# number (NaN) or "unavailable", at 10 A: one cycle, then 400 s.
|
||||
class NanPlant(S.SunPlant):
|
||||
"""Battery A's power reads NaN (or the text 'unavailable') while set."""
|
||||
bad = None
|
||||
|
||||
async def number(self, e, invert=False):
|
||||
if e == "sensor.batt_a" and self.bad is not None:
|
||||
return float("nan") if self.bad == "nan" else None
|
||||
return await super().number(e, invert)
|
||||
|
||||
async def state(self, entity_id):
|
||||
if entity_id == "sensor.batt_a" and self.bad == "unavailable":
|
||||
return {"entity_id": entity_id, "state": "unavailable",
|
||||
"attributes": {}}
|
||||
return await super().state(entity_id)
|
||||
|
||||
|
||||
def _bad(kind):
|
||||
def f(p, c):
|
||||
p.bad = kind
|
||||
return f
|
||||
|
||||
|
||||
for kind in ("none", "nan", "unavailable"):
|
||||
r1 = std(400, plant_cls=NanPlant,
|
||||
events={300: _bad(kind), 301: _bad(None)})
|
||||
r4 = std(800, plant_cls=NanPlant, events={300: _bad(kind),
|
||||
700: _bad(None)})
|
||||
w4 = cur_writes(r4)
|
||||
sp = [x["spare"] for x in r4["trace"] if 302 <= x["t"] < 700]
|
||||
check(f"T4 [{kind}]: battery A's power bad for 1 cycle: no write "
|
||||
f"({[x for x in cur_writes(r1) if x[0] >= 300]})",
|
||||
[x for x in cur_writes(r1) if x[0] >= 300] == [])
|
||||
check(f"T4 [{kind}]: bad for 400 s: no spare computed, the current held, "
|
||||
f"then 0 A once at 300 s (+2 s) ({w4})",
|
||||
sp and all(v is None for v in sp)
|
||||
and [a for _, a, _ in w4 if _ < 700] == [10.0, 0.0]
|
||||
and 599 <= [t for t, a, _ in w4 if a == 0.0][0] <= 602)
|
||||
|
||||
# T31: the meter goes silent at 10 A.
|
||||
for race in (False, True):
|
||||
tag = "race" if race else "step"
|
||||
|
||||
@@ -110,6 +110,22 @@ for cover in (True, False):
|
||||
and round(a["proj"] or 0) != round(b["proj"] or 0)]
|
||||
check(f"T21 (c): with the cover off, the guard's own projection "
|
||||
f"(the car left out) is the Manual twin's ({pj[:2]})", not pj)
|
||||
# T21 (a): car_cycle itself, fed the same projection, guard and reading on
|
||||
# two Controllers that differ only in the mode (the twins of (c), now).
|
||||
cs, cm = rs["c"], rm["c"]
|
||||
proj_s, guard_s = cs._peak_proj_real, cs.peak_guard
|
||||
same_in = (proj_s == cm._peak_proj_real
|
||||
and repr(guard_s) == repr(cm.peak_guard)
|
||||
and cs.car.reading == cm.car.reading)
|
||||
cs.car_cycle(proj_s, guard_s, 3400.0, None)
|
||||
cm.car_cycle(proj_s, guard_s, 3400.0, None)
|
||||
check(f"T21 (a): car_cycle on the same projection, guard and reading gives "
|
||||
f"the same car_alarm_w, car_explains and car_over in Solar and Manual "
|
||||
f"(inputs equal {same_in}; {cs.car_alarm_w()} {cs.car_explains} "
|
||||
f"{cs.car_over} vs {cm.car_alarm_w()} {cm.car_explains} {cm.car_over})",
|
||||
same_in and (cs.car_alarm_w(), cs.car_explains, cs.car_over)
|
||||
== (cm.car_alarm_w(), cm.car_explains, cm.car_over)
|
||||
and cs.car_alarm_w() is not None)
|
||||
over_note = [x for x in rs["plant"].notes if x[1] == messages.ID_CAR_OVER]
|
||||
check("T21 D1: Solar's car-over notice reads 'Solar charges the car at 16 A' "
|
||||
"(the charger's current), never Manual's stored value",
|
||||
|
||||
Reference in New Issue
Block a user