EV-05 round 5: headroom counts only the batteries that can give
checks / unit (pull_request) Successful in 24m24s
infra-pin / fresh (pull_request) Successful in 2s

Review of 8818768: the headroom test compared the output with the site
rating, which still counted a battery refusing to give (SAFETY-73) or under
a safety stop, so the 15 s wait ran at the real maximum (N4). Now only the
units that can give (above their cut-out, not refusing, not stopped,
switched on) count, in what they give and in their ratings.

Tests: R5a (A refuses, B at full rating, against a car-Off twin: the cut at
910, period 3361 W), R5b (headroom and a slow battery: the cut at exactly
15 s), R5c (floor-limited alone decides: cut at once). DOCS wrapped to 79.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-18 17:27:17 +01:00
co-authored by Claude
parent 8818768dab
commit 69f58181bc
5 changed files with 164 additions and 46 deletions
@@ -85,6 +85,16 @@ inputs (`car_sun_inputs`) and runs the writer in the same background task.
were already at full output, and the period landed over the aim (review
repro: house 25 900 and 25 950 W, test_ev05.py R4/N4 against a car-Off twin).
## Round 5 (review of 8818768)
- **Headroom counts only the batteries that can give** (`ctl_car._car_giving`):
above their cut-out, not refusing to give (SAFETY-73), not under a safety
stop, switched on. Their output is compared with their own ratings (and
`guard.able_w` when the guard names it). Before, the site rating still
counted a refusing unit, so a battery that gave its full rating looked like
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).
## Solar kWh
Per cycle in Solar: `min(car power, max(0, spare - room))` Batteries first,