Repository navigation
Description
Follow-ups from the final review of #1891 (head b36e951) on 28 Oct 2026. None of them makes the PR worse than master or breaks the owner's fuse rule, so they wait until after stable.
- Battery phase relief: a one-phase battery still winds out on a noisy meter
- Mixed import/export overage with a one-tick battery read lag alternates 0 and full discharge
- Off-phase go-back has no size bound
- One guard trip cuts two or three times while the battery responds
Battery phase relief: a one-phase battery still winds out on a noisy meter
Seen on #1891 head b36e951 in a closed-loop harness, not on a real site. The battery is on L2 only and holds -2000 W. A load keeps L1 over the 16 A line at 16.5-18 A. The meter reports 0.01 A steps, with uniform house noise of +/-0.3 A per tick. Over 20 seeds and 300 ticks, the order winds to -6500 to -8000 W. L2 exports up to 20.5 A with L1 load held steady, and up to 23.7 A (1.48 x In) when L1 steps by 2 A every 40 ticks; in the worst case L2 is past 1.2 x In on 1141 of 5800 ticks. With noise up to +/-0.2 A, or on a whole-ampere meter, L2 stays at its 2 A hold.
Cause: phaseUnresponsive ends the worst phase's reference on any 0.5 A move. When noise moves L1 that far while the battery sits at a relief step that never reached L1, the new reference takes that wound-out power as its battery power. The next off-phase verdict goes back only that far, so each noise reset adds one relief step. The PR's 'Known limits' says the anti-windup keeps a one-phase battery from running out. That holds only while noise stays under about 0.5 A peak to peak.
Not blocking: master on the same harness winds to -10000 W, with L2 at 31-33 A and past 1.2 x In on 400-1900 ticks in every case except L1 at 16.5 A with no step.
Fix idea: let the config say which phases each battery uses, so the relief models it exactly. Or end a reference only on a worst-phase move that persists for two readings, or that the batteries' move explains. A quick 'explained by the batteries' check alone did not help, because noise often moves L1 the same way as the battery.
Test idea: pvDropRun-style loop with onePhase=2, L1 at 17-18 A, +/-0.3 A uniform noise per phase, 20 seeds. Assert that L2 stays inside the line, or at least under 1.2 x In.
Mixed import/export overage with a one-tick battery read lag alternates 0 and full discharge
Seen on #1891 head b36e951 in a closed-loop harness. The battery is balanced and holds -2000 W on a 16 A fuse. L1 imports 19.5 A from a load. L3 has 3.68 kW of one-phase PV with 1 A of load, so the battery pushes L3 past the export line. The battery's own reading lags the meter by one tick (the rig saw this lag in 207537).
The order alternates 0 and -10000 W on every tick. L3 exports up to 29.5 A (1.84 x In) and is past 1.2 x In on 54 of 108 ticks. Master in the same case: alternates 0 and about -9000 W, L3 up to 28.1 A, also 54 of 108 ticks. With an L1 load step from 17 to 20 A: PR peak 29.5 A, mean 22.2 A; master peak 29.5 A, mean 21.7 A. So this is the same failure class as master, about 1 A worse at the peak in one case.
At lag 0 the PR holds steadily (-1553 W, L3 at 17.25 A, 0 ticks past 1.2 x In), while master hunts there too (53-54 ticks past 1.2 x In). At lag 2 the PR is at or better than master. Overall the PR is still a net gain.
Cause: when phases are over both lines, phaseSentReliefW asks for no relief on either side, by design. phaseFuseReliefW then centres the phases from the lagging battery reading, which brings back the read-lag wind-up that the last-command bound fixes for one direction.
Fix idea: in the mixed case, bound the least-over shift by the same shift computed from sentW (the move from the last command), for example by taking the smaller of the two in magnitude, so a lagging reading cannot double a move already sent.
Test idea: the pvDropRun loop with readLag=1, L1 load at 19.5 A, and L3 = 1 A load minus 16 A of PV. Assert no order reversal larger than 500 W after tick 12, and L3 under 1.2 x In.
Off-phase go-back has no size bound
On #1891 head b36e951, an off-phase verdict sends the batteries back to their power at the worst phase's reference, however far they have moved since. If the reference has lived a long time, a false verdict on a balanced battery can put the worst phase well past the line for one tick. That happens when L1 reads just over the line through a slow drift and a big one-phase load then drops on another phase. With 20 W/tick of drift and a 2.5 kW drop on L3, I saw one tick at 16.76 A, and master does about the same (16.79 A). The line-reset rule from 8c3ae3c kept these references short in every case I tried with 0.02-0.05 A noise. A drift above the line on a noise-free meter with sub-ampere resolution could still produce a larger step. Fix idea: cap the go-back at the move that would put the worst phase back at its reference reading plus phaseResponseA. Test idea: drift at 2-10 W/tick with zero noise for 300+ ticks, then drop a load on L3 of 2 x (move since reference)/690 A. Assert that L1 stays under 1.2 x In.
One guard trip cuts two or three times while the battery responds
applyFuseGuard's per-phase relief reads phase currents that do not yet show a cut already sent, so one trip cuts two or three times while the battery responds (about 2 s lag). At the line the overage is tiny, so it is harmless; after a larger house step the extra cuts keep the battery below the line until the 30 s hold ends. Found while diagnosing rig s18-16 (fixed by #1913). Test idea: house step of 3 A on a 16 A fuse with a battery lag of 2 s: one trip, one cut.
🤖 Generated with Claude Code
Activity