EV-05 round 6: grade the car out only while Solar can cut it
checks / unit (pull_request) Successful in 25m32s
infra-pin / fresh (pull_request) Successful in 1s

Review of 69f5818:
- Solar grades the car out of the peak alarms only while it can really cut
  it (not under another writer's hold, a refused or given-up write, an
  untaken way-out 0 A, a charger fault, an unreadable charger). Otherwise
  the alarms stand as in Off and the quarter is banked as the car's.
- A battery refusing to give counts for nothing at every N (N=1:
  Controller.batt_refused); the site safety stops leave none able; a
  battery switched Off still counts (the guard draws on it).
- Only pressing Solar lifts Solar's other-writer hold: leaving Solar, or
  setting Manual's values, no longer writes over another writer (N10).

Tests: Solar vs Off twins for another writer, a refused cut write and a
refused fault 0 A; N=1 refusing battery against a car-Off twin; N10 on every
exit and on Manual value changes; the able_w cap; batteries switched Off.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-18 18:50:37 +01:00
co-authored by Claude
parent 69f58181bc
commit b4a222f9e8
3 changed files with 209 additions and 11 deletions
@@ -95,6 +95,22 @@ inputs (`car_sun_inputs`) and runs the writer in the same background task.
it had headroom and the cut waited (review repro: battery A refuses, house to
20 950 W, period 3436 W against the twin's 3363 W).
## Round 6 (review of 69f5818)
- **Solar grades the car out of the peak alarms only while it can cut it**
(`ctl_car.car_solar_can_cut`): not while another writer holds the charger,
a write of ours was refused or given up, a way-out 0 A is not taken, the
charger shows a fault or cannot be read. Otherwise the normal alarms stand
as in Off, and the quarter is banked as the car's (it can set the peak).
- **A refusing battery counts for nothing at every N**: at N=1 the refusal is
`Controller.batt_refused` (SAFETY-52). The site's own safety stops (circulation,
site sign) leave no battery able to give.
- **A battery switched Off still counts for the headroom**: the peak guard's
floor draws on it, so it can catch a cloud edge.
- **Only pressing Solar lifts Solar's other-writer hold.** Leaving Solar (Off,
Manual) or setting Manual's current or phases is not the user taking the
charger back, so nothing is written over that writer (N10).
## Solar kWh
Per cycle in Solar: `min(car power, max(0, spare - room))` Batteries first,