EV-20: Car Solar mode, spare sun to the car (charging only)
Solar as a second writer next to Manual (carmode.SolarPlan, SolarWriter on ManualWriter's one write site, safe phase sequence and other-writer watch): signed spare, Batteries first on the batteries' ratings, the margin, whole amps rounded down, the 30 s / 1 A rule, start and pause dwells, auto phases, a one-phase car. Every way out ends at 0 A, retried by EV-04's rule; at shutdown before the inverters, three tries inside 15 s (D3); start-up and a returning charger or HA write 0 A first (D2); never over another writer's hold. The peak guard treats a Solar car as a Manual car (D1 wording). Solar kWh sensor and card line; select.goodwe_car_sun_first; ev_margin_w, ev_start_min, ev_pause_min with config, validator, translations, DOCS, DECISIONS and CHANGELOG. Checks: test_ev20.py, test_ev20_exits.py, test_ev20_writers.py, test_ev20_guard.py, test_ev20_long.py, test_ev20_long_car.py, test_ev20_fuzz.py (harness tools/ev20_sun.py, ev20_kit.py, ev20_day.py); test_ev03/test_ev04 no longer use Solar as the refused example. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
@@ -253,6 +253,7 @@ class CycleMixin:
|
||||
|
||||
stale_after = float(self.o.get("stale_input_s", 15))
|
||||
late_s = self._readings_late(site_standing) # SAFETY-128
|
||||
self._car_late_s = late_s # EV-20: Solar holds, then the stale rule
|
||||
self._late_zero = late_s is not None and late_s >= stale_after
|
||||
# ⚠️ `any`, NOT the sole unit's. The hold exists so a single missed
|
||||
# poll does not become a fault; a LATCHED inverter must still reach the
|
||||
@@ -272,6 +273,7 @@ class CycleMixin:
|
||||
# this cycle's. (DECISIONS/MAIN-orchestration-archive.md)
|
||||
self.why_words = messages.why_waiting(bad_for)
|
||||
self._why_waiting_since = now - timedelta(seconds=bad_for)
|
||||
self._car_hold_kick() # EV-20: Solar counts from now
|
||||
return
|
||||
if late_s is not None and late_s < stale_after and self.inputs_ok \
|
||||
and (self.auto or self.shadow) \
|
||||
@@ -279,6 +281,7 @@ class CycleMixin:
|
||||
and not (n_units > 1 and self.site_sign_wd.tripped):
|
||||
self.reason = f"readings late {late_s:.0f}s" # SAFETY-128: hold
|
||||
self.why_words = messages.why_late()
|
||||
self._car_hold_kick() # EV-20: Solar holds its current
|
||||
return
|
||||
|
||||
claims = []
|
||||
@@ -396,8 +399,9 @@ class CycleMixin:
|
||||
# `_peak_proj_real` keeps the quarter as the meter will bill it, for
|
||||
# the car's own words. Only a fresh, trusted car reading is left out.
|
||||
self._peak_proj_real = self._peak_proj
|
||||
# EV-20: a Solar car exactly as a Manual car.
|
||||
if (self._peak_proj is not None and not self.car_cover
|
||||
and self.car_manual()):
|
||||
and self.car_controlled()):
|
||||
self._peak_proj = self.car_exclude(self._peak_proj,
|
||||
self.car_alarm_w())
|
||||
self.peak_guard = None if not self.p1_enabled else peakguard.decide(
|
||||
@@ -1065,7 +1069,8 @@ class CycleMixin:
|
||||
await self.check_price_gap()
|
||||
await self.check_charger()
|
||||
await self.check_car_over()
|
||||
self.car_kick() # EV-04: Manual, in the background
|
||||
await self.check_car_release() # EV-20 (D3)
|
||||
self.car_kick() # EV-04/20: in the background
|
||||
await self.check_fixed_note()
|
||||
|
||||
# SAFETY-31's alarm, and its boundary is the LATCH, not a number: it
|
||||
|
||||
Reference in New Issue
Block a user