EV-21 fix round 1 (formal round 4): C14 cut due while batteries charge; C15 grace once per value
checks / unit (pull_request) Successful in 46m9s
infra-pin / fresh (pull_request) Successful in 1s

C14 (PM Q2): slowing a battery charge counts as the batteries taking more, so the cut is due whatever the batteries do; their charge counts only as headroom for the 15 s wait. C15 (PM Q1): sent_at is renewed only for a new value, so a retry of a refused cut gets no new 2 s grace. test_ev21_fix1.py: both red on 36e9dd7; C16, C18 and Q1's other writer pinned as the code has them. Test shapes: slow batteries and refusals start after Solar's own start, which C14 would otherwise cut on its start blip; T38 cover off from 300 s; T46 bounds the excess; T39 counts writes after the cut.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-27 01:33:41 +01:00
co-authored by Claude
parent 36e9dd765e
commit 5759e9dc9f
9 changed files with 250 additions and 36 deletions
@@ -10,8 +10,9 @@ the failure catalogue it answers.
## The rule, in plain words
- **Solar only.** When the 15-minute period heads over the aim (cap less
margin) and the batteries would have to give more than now for it, the car is
lowered first. A charge the batteries only have to slow down is not a cut.
margin), the car is lowered first. Slowing a battery charge counts as the
batteries taking more (PM Q2), so a charge they could slow down only counts
as headroom for the 15 s wait.
- **How far.** `floor((car W - excess W) / (230 x phases))` A, with the phases
the car draws on (1 for a one-phase car). Under 6 A it is 0 A, never between.
Never above the current Solar has set. An untrusted car figure cuts to 0 A.
@@ -64,11 +65,9 @@ the failure catalogue it answers.
## Choices the rulings left open
- **"The batteries would have to give more than now"** is `battery W + excess
> 0` on the projection with the car: the guard's `wanted_w` with the cover on,
the same test on the real period with it off. Without it, Solar's own start
on slow batteries cut the car for the seconds the batteries took to stop
charging.
- **A lowering on its way** (`CUT_SENT_S`, 2 s) counts as Solar's own for
grading, once per value (PM Q1): a re-send of the same value, a retry
included, gets no new grace; after it, not read back is not cut.
- **While the 15 s wait runs** the cap is the current Solar has then (C4: no
raise while due).
- **Under a cut the plan may lower** (formal C10), by its own 30 s rule.