You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimizer burns stored energy via simultaneous charge+discharge when SoC starts above soc_max — every plan rejected until the battery drains #768
A site whose battery is above planner.soc_max_pct (the everyday state: vendor self-use logic filled it to 100% before FTW planned anything, cap 90%) gets every Python plan rejected:
optimizer plan rejected: slot 0 storage foxess energy 12043.487 inconsistent with replay 12200.000
and runs permanently on the Go fallback ("Mathematical optimizer unavailable" in the Plan view) until SoC falls below the cap by itself.
Root cause — arithmetic proof
The LP has no complementarity constraint, so simultaneous charge and discharge is representable, and with the battery above max_energy_wh it becomes optimal: the per-slot recovery service penalty rewards shedding the over-cap energy, and round-trip losses are the fastest shredder. With c = d = X:
reported net power: c − d = 0
internal energy step: dt·(η_c·c − d/η_d) = −dt·X·(1/η_d − η_c)
Live site, 12.2 kWh pack, default 0.5C limit (6100 W), 15-min slots, η = 0.95:
0.25 h × 6100 W × (1/0.95 − 0.95) = 156.51 Wh
12200.000 − 12043.487 = 156.51 Wh ← exact match
A second rejection minutes later showed the same ratio (12018.107 / 12171.879 ≈ 0.9873 ≈ the same burn) as smoothed SoC drifted.
Core's replay integrates the reported net power — physics, where c=d moves nothing — computes 12200.000, and rejects. The validator is doing exactly its job: the plan is physically unexecutable at slot 0.
Verified in direct_highs.py (additive dynamics, energy[0] == initial pinned, reported power charge − discharge, reported energy energy[t+1]); recourse.py shares the same dynamics and recovery-penalty structure, so likely all formulations are affected.
Impact
Every site whose battery self-fills past soc_max_pct loses the mathematical optimizer for the rest of the day, silently downgraded to the Go fallback — i.e., the optimizer is unavailable precisely in the state most PV sites are in on a sunny afternoon.
Fix directions (team call)
Kill the incentive: price recovery such that burning round-trip losses is never profitable (e.g., penalize only recovery worsening relative to the initial corridor — the Go replay already reasons this way — or cap the recovery-speed reward below the η-burn cost).
Post-solve normalization: strip min(c,d) from both sides and recompute the energy/SoC trajectory from net powers before responding. Makes every response replay-consistent by construction — but that partially blinds the validator, so worth explicit discussion.
Workaround meanwhile: planner.soc_max_pct: 100 removes the out-of-window state (at the cost of planning full-depth cycling), or wait for evening SoC to fall under the cap.
Activity