EV-20 review r3: a held read moves no plan count; only the meter-age pause may fire
On a held charger read no writer steps and the Solar plan does nothing: no phase change or switching start begins, no _set or end_switch, ok_since, up_since, down_since, low_since and set_at stay, and the hold pause does not fire; a decision due then runs on the next real reading. The one exception is the pause by the meter's age (C18, SolarWriter.held_pause). Rows: the reviewer's three shapes with 1- and 2-read gaps on and before the decision cycle, and the hold pause on a held cycle. DECISIONS wording fixed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
@@ -993,6 +993,26 @@ class SolarWriter(ManualWriter):
|
||||
"prev": None, "from": r.phases_allowed}
|
||||
|
||||
# ------------------------------------------------------------- step
|
||||
async def held_pause(self, drv, r, *, sun, now, tracker) -> None:
|
||||
"""EV-20 (C18, PM design r3): on a held charger read only the pause by
|
||||
the meter's age may come (0 A): nothing else in the plan moves, no
|
||||
phase change begins or goes on, no retry. Called instead of `step`."""
|
||||
if not self.engaged or self.seq is not None or self.hold \
|
||||
or self.fault is not None or self.restart \
|
||||
or self.plan.a <= 0.0 or self.plan.switch:
|
||||
return
|
||||
if not getattr(sun, "silent", False) \
|
||||
or getattr(sun, "unknown_s", 0.0) < sun.pause_s:
|
||||
return
|
||||
self.nz_block = self.held_step = True
|
||||
try:
|
||||
self.plan.pause("unknown")
|
||||
cur = None if r is None else (
|
||||
r.allowed_a if r.allowed_a is not None else r.setpoint_a)
|
||||
await self._put(drv, 0.0, cur, now, tracker)
|
||||
finally:
|
||||
self.nz_block = self.held_step = False
|
||||
|
||||
async def step(self, drv, r, *, mode, sun, clamp, now, tracker, writing,
|
||||
status, clock=None, held=False):
|
||||
"""One cycle. `sun` is `SunInputs` (None outside Solar); `writing` is
|
||||
|
||||
@@ -370,11 +370,21 @@ class CarMixin:
|
||||
return
|
||||
held = bool(self.car.held)
|
||||
now = self.car_now()
|
||||
if held and self.car_mode != carmode.SOLAR \
|
||||
and not self.car_solar.engaged:
|
||||
sun = None
|
||||
if self.car_mode == carmode.SOLAR:
|
||||
sun = getattr(self, "_car_sun_now", None) \
|
||||
or self.car_sun_inputs(now)
|
||||
if held:
|
||||
# EV-20 rig round 2 (PM): the charger missed a read for less than
|
||||
# `stale_input_s`; the last trusted figure stands and nothing is
|
||||
# decided or written from the gap.
|
||||
# decided or written from the gap. No writer steps and no plan
|
||||
# count (start, phase change, hold) moves (review r3, PM design);
|
||||
# a decision due now runs on the next real reading. The one
|
||||
# exception: Solar's pause by the meter's age (C18).
|
||||
if sun is not None and self.car_writing():
|
||||
await self.car_solar.held_pause(
|
||||
self.charger, self.car.reading, sun=sun, now=now,
|
||||
tracker=self.car)
|
||||
return
|
||||
if self.car_mode != carmode.SOLAR and not held:
|
||||
await self.car_writer.step(
|
||||
@@ -387,16 +397,12 @@ class CarMixin:
|
||||
if self.car_mode == carmode.SOLAR or w.engaged:
|
||||
# C6: one write clock: Manual's latest non-zero write counts.
|
||||
w.other_at = self.car_writer.nonzero_at
|
||||
sun = None
|
||||
if self.car_mode == carmode.SOLAR:
|
||||
sun = getattr(self, "_car_sun_now", None) \
|
||||
or self.car_sun_inputs(now)
|
||||
await w.step(
|
||||
self.charger, self.car.reading, mode=self.car_mode,
|
||||
sun=sun,
|
||||
clamp=self.car_clamp(), now=now, tracker=self.car,
|
||||
writing=self.car_writing(), status=self.car.status(now, True),
|
||||
clock=self.car_now, held=held)
|
||||
clock=self.car_now)
|
||||
|
||||
# ------------------------------------------------------- EV-20: Solar
|
||||
def car_may_charge(self, inv) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user