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
fix(control): do not discharge a battery that never reported SoC #1134
A battery with no SoC reading is treated as 10% full, which is above the discharge floor, so dispatch can still discharge it.
Found on master 6eadec3f in go/internal/control/dispatch.go.
What happens
// Default to near-empty SoC so dispatch errs on the side of// caution (no discharge) if a battery never reports SoC.// Using 0.5 would allow discharge of a potentially empty battery.soc:=0.1ifr.SoC!=nil {
soc=*r.SoC
}
The discharge clamp later blocks only when SoC < 0.05. 0.10 is above that floor, so an unreporting pack can be given a negative target until the clamp at ~5%.
The comment claims "no discharge". The number does not implement that.
What a fix needs
Missing SoC must not produce a discharge target (treat as empty, or set dischargeBlocked).
Charge-from-surplus may still be allowed if that is the safer default; say so in the test.
Test: battery online, SoC == nil, planner or self-consumption would discharge — target must be ≥ 0.
Resolved by #1170 (89b3b2c1). Current master retains the final missing-SoC discharge floor, including slew, fuse relief and known/unknown sibling cases. The TestMissingSoC* regressions passed three times with the race detector during this review. Charging from surplus with unknown SoC remains covered.
Activity
fix(control): ignore stale load, missing SoC, and stale meters
frahlg commentedon Oct 18, 2026
Resolved by #1170 (
89b3b2c1). Current master retains the final missing-SoC discharge floor, including slew, fuse relief and known/unknown sibling cases. TheTestMissingSoC*regressions passed three times with the race detector during this review. Charging from surplus with unknown SoC remains covered.