EV-20 round 3: no non-zero write while the meter is silent (C17); the age pause on a held read (C18)
While the meter's age is past meter_max_age_s, or on a held charger read, Solar sends no non-zero current: no retry, no raise, no phase change begun, and a phase change under way ends at its 0 A. 0 A is always allowed. On a held read Solar still steps (Manual does not), so a pause due then is not slipped. Rows in test_ev20_rig.py section 8. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
@@ -368,13 +368,15 @@ class CarMixin:
|
||||
cycle's read did) and writes only through `carmode`'s writers."""
|
||||
if not self.charger.configured():
|
||||
return
|
||||
if self.car.held:
|
||||
held = bool(self.car.held)
|
||||
now = self.car_now()
|
||||
if held and self.car_mode != carmode.SOLAR \
|
||||
and not self.car_solar.engaged:
|
||||
# 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.
|
||||
return
|
||||
now = self.car_now()
|
||||
if self.car_mode != carmode.SOLAR:
|
||||
if self.car_mode != carmode.SOLAR and not held:
|
||||
await self.car_writer.step(
|
||||
self.charger, self.car.reading, mode=self.car_mode,
|
||||
want_a=self.car_a, want_phases=self.car_n, rev=self.car_rev,
|
||||
@@ -394,7 +396,7 @@ class CarMixin:
|
||||
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)
|
||||
clock=self.car_now, held=held)
|
||||
|
||||
# ------------------------------------------------------- EV-20: Solar
|
||||
def car_may_charge(self, inv) -> bool:
|
||||
@@ -458,7 +460,17 @@ class CarMixin:
|
||||
start_s=60.0 * carmode.solar_option(o, "ev_start_min"),
|
||||
pause_s=60.0 * carmode.solar_option(o, "ev_pause_min"),
|
||||
spare_w=spare, room_w=room, margin_w=margin, first=self.car_first,
|
||||
unknown_s=self._car_meter_over_s() if spare is None else 0.0)
|
||||
unknown_s=self._car_meter_over_s() if spare is None else 0.0,
|
||||
silent=self._car_meter_silent())
|
||||
|
||||
def _car_meter_silent(self) -> bool:
|
||||
"""SPIKE-06 C17 (N8): is the meter known silent (its age past
|
||||
`meter_max_age_s`)? Then Solar writes no non-zero current."""
|
||||
if not self.p1_enabled:
|
||||
return False
|
||||
age = self.p1.age_s()
|
||||
bound = float(self.o.get("meter_max_age_s", 30) or 30)
|
||||
return age is not None and age > bound
|
||||
|
||||
def _car_meter_over_s(self) -> float:
|
||||
"""EV-20 rig round 2 (PM): on `ha_signed`, how far the meter's age is
|
||||
|
||||
Reference in New Issue
Block a user