MAINT-28 fix-forward round 3: the cap is the guard's largest claim of the period, 0 W for a pack the guard does not place on
checks / unit (pull_request) Successful in 28m17s
infra-pin / fresh (pull_request) Successful in 1s

test_maint28 quarter bound back to aim + 1 W (now 5925 W; the guard alone landed
5960.1 W): the pack's limit is the largest floor the guard claimed in the 15-minute
period. A pack in peak_guard.held (the guard places its claim on the others) gets
0 W. test_safety84 n2_charge_banked re-pinned again, its banked quarters asserted
under the aim. New test: guard claims on the other pack only.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-13 21:21:14 +01:00
co-authored by Claude
parent 776b84ca20
commit fb4a449591
6 changed files with 40 additions and 15 deletions
@@ -40,6 +40,6 @@ The sim had no battery-reading lag, and the first version said the 300 W line is
**F-1: the pause ends only on a settled estimate.** `Controller._batts_settled()` is False from a step UP of a unit's command (`MAINT_STEP_W` = 100 W more give or less charge, the SAFETY-128 pending size) until its reading changed `PLANT_SETTLE_S` (6 s) after the step, or `BATT_OBLIGED_S` (17 s) have passed. `peakguard.shaping_held(..., settled)` then keeps the pause. A step down makes the estimate err high, which only holds the pause, so it waits for nothing. Measured in the 45 min sim, pause on: settled, the estimate was at most 146 W under the real house (0 cycles over 300 W); not settled, up to 1933 W under (725 of 1611 cycles over 300 W). Sim, 45 min, house 6500 W: 83 of 83 releases on a stale estimate (f3f9483) -> 0; flips 148 -> 1 (1b5f7c9 210). Charge is back 13 s after the load (7 s in the test), not 0: the first settled estimate. No cut-back is touched.
**F-2 and the cap (owner 2026-11-13): while the pause holds, the maintenance pack gives only what the guard claims.** While the pause holds (N>=2, month aim above the cap), the pack in maintenance CHARGE gets a unit limit `hi` = the guard's own floor (0 W when it claims nothing), at any SoC, so it also gives nothing for the house under its peak reserve. `hi` = 0 W alone was tried and is wrong: it crosses the guard's claim and resolves to 0 W (house 12 kW, B under its reserve: quarter 6713 W, a new month peak); with the guard's floor as `hi` the guard still gets its power. Other packs are unchanged (B not in maintenance still gives for the house). Sim, 45 min, house 6500 W: A at 49 %: A gives 0.02 kWh (uncapped 2.39), SoC stays at 49.0 %, charge/give flips 1, quarters 1958 1873 2873 W (all under the aim), charge back 4 s after the load. B at 18.2 % in CHARGE: f3f9483 gave 1.89 kWh to 10.0 % (log "giving nothing for the peak"); now 0.00 kWh, 18.2 %. Give/idle switches of the pack: 15 in 45 min, but they are the guard's claim on and off (3 episodes, one per quarter start, of 94 s at most 490 W, and 5 blips of 5-19 s at 100-490 W, 0.04 kWh in all); bridging gaps under 10 s would make it 3 episodes, 6 switches. Not added.
**F-2 and the cap (owner 2026-11-13): while the pause holds, the maintenance pack gives at most what the guard claimed this period.** While the pause holds (N>=2, month aim above the cap), the pack in maintenance CHARGE gets a unit limit `hi` = the largest floor of the guard's claim in this 15-minute period (reset at each period and when the pause ends), at any SoC; 0 W when the guard places its claim on the other packs, i.e. this pack is under its reserve (`peak_guard.held`; the claim itself is site-scoped). Other packs are unchanged (B not in maintenance still gives for the house). Why not `hi` = 0 W: it crosses the guard's claim and resolves to 0 W (house 12 kW, B under its reserve: quarter 6713 W, a new month peak). Why the largest, not the present floor: the guard alone lands 10 W over its aim (SAFETY-126) because its floor drops to 0 W each time the projection reaches the aim, and the pack steps on and off (15 give/idle switches in 45 min, test_maint28 quarter 5960.1 W against 5950 W); holding the largest floor of the period gives test_maint28 5925 W and 0 switches. Sim, 45 min, house 6500 W: A at 49 %: A gives 0.37 kWh (uncapped 2.39), SoC 50.5 -> 48.3 %, charge/give flips 1, give/idle switches 0, quarters 1422 1370 2550 W (all under the aim), charge back 4 s after the load. B at 18.2 % in CHARGE: f3f9483 gave 1.89 kWh to 10.0 % (log "giving nothing for the peak"); now 0.00 kWh, 18.2 %, quarters 5948 and 5952 W: the guard places everything on the other pack, and its own landing error shows (up to +9.5 W, inside SAFETY-126's 10 W; test_maint28b allows that and nothing more). test_safety84 n2_charge_banked: banked quarters 3349 and 3016 W against the aim 3950 W.
Mutants, each red in `test_maint28b.py`: the freshness check dropped (always settled); the cap dropped.