Owner 2026-11-18 (dev finding 1, brief v4 Expected 8): while a battery is above its cut-out, the car's peak cut waits until the guard has wanted power for 15 s in a row (CUT_WAIT_S), so a cloud edge the batteries catch does not pause the car. It cuts at once with no battery able, or with 120 s or less of the 15-minute period left (CUT_NEAR_END_S: waiting 15 s then costs at most 8/7 of the cut, taken off the car at once). Tests: T21/T22 cut at 15 s and not sooner, the period lands under the aim; T21b a house step and a cloud edge the batteries catch: no cut, no pause; T24 (c) late in the period: the cut at once, under the aim; T12's cut row with the batteries at their cut-out. The harness's battery level model was 1000x too fast (round 1); fixed. The 10-hour day: 0 cut pauses in both priorities. Co-Authored-By: Claude <noreply@anthropic.com>
3.9 KiB
EV-05 — Solar mode: spare sun to the car
The design is reports/EV-01-design-report.md (sections 2 to 5, decisions 2 and
5) and the EV-05 brief v3 (owner answers Q1 and Q4, 2026-11-17). This record
keeps what the code had to decide.
Where it lives
carmode.SolarPlan decides (pure, monotonic clock): what current, on what
phases. carmode.SolarWriter makes the charger match it. It is a subclass of
ManualWriter, so the write, the read-back, the phase sequence and the
other-writer watch are Manual's and there is still one write_current and one
write_phases call in app/ (test_ev04.py's AST check). ctl_car builds the
inputs (car_sun_inputs) and runs the writer in the same background task.
The rules the brief left open
- Entering Solar starts at 0 A. Choosing Solar, a restart in Solar, the charger or Home Assistant coming back, a charger error or a stuck reading clearing, and control starting again all reset the plan: 0 A if the charger shows more, then the start rule. Switching from Manual to Solar therefore pauses a Manual charge for the start dwell. Simple and on the safe side.
- The peak cut is what the guard would ask the batteries for. The excess is
taken off the car only when the guard is engaged and wants a discharge
(
wanted_w > 0), and bymin(excess, wanted). Batteries that only stop charging in a cloud's first seconds are not "asked", so a cloud does not cut the car. A partial cut caps the car for the rest of that 15-minute period. - The cut waits 15 s while a battery can still give (owner 2026-11-18,
round 2):
ctl_car.CUT_WAIT_S, counted from the first cycle in a row in which the guard wants power. A battery "can give" when it is above its own cut-out level, not refusing to give and not under a safety stop (_car_batt_able). It cuts at once with nothing able, or with 120 s or less of the period left (CUT_NEAR_END_S): waiting 15 s with R s left raises what must come off afterwards by R / (R - 15), at most 8/7 at 120 s, and the cut then takes it off the car at once. test_ev05.py T21 (a step beyond the batteries, cut at 15 s) and T24 (c) (a late step, cut at once) show the period landing under the aim; the 10-hour day of test_ev05_long.py has no cut pause at the shippedslew_w0. - The 4.0 to 4.14 kW band on 3 phases. 3 phases need 4.14 kW at 6 A, the switch back to 1 phase is under 4.0 kW. Inside that band the car holds 6 A on 3 phases with no pause count (the hysteresis the design chose). Under 4.0 kW the down-switch comes after 5 minutes; if the 10-minute gap blocks it, the pause rule does instead.
- A phase switch also waits for the 30 s write rule, so the current set after a switch is never sooner than 30 s after the one before it.
- The meter's age. The spare is not computed from a meter reading older
than
stale_input_s, also whenmeter_max_age_s(P1) is longer. - A stale, stuck or not corroborated charging car makes the spare unknown:
hold, then 0 A after Pause after. A paused or idle car with a fresh reading
counts 0 W (
car_w_trustedis None outside mode3 C). - A stuck reading's 0 A is written whatever the frozen read-back says, since that read-back means nothing then. Every other exit skips the write when the charger already shows 0 A, and never writes over another writer.
- The guard's alarm path uses the Solar car like Manual's
(
car_alarm_w), and Solar's own 0 A (pause, cut, phase change) gets EV-15's bounded grace (_car_solar_pause). A Solar quarter is never banked as "set by the car", and Solar shows no Car over the peak limit. - Shadow mode runs the plan without writing, so the card says what it would set; the charger got its one 0 A when shadow mode came on.
Solar kWh
Per cycle in Solar: min(car power, max(0, spare - room)) Batteries first,
min(car power, max(0, spare)) Car first; never above today's kWh; reset at the
day change; kept in the store (car_sun).