Loadpoint: project continuous device min power shortfall into PV disable gate (#33075)

This commit is contained in:
andig 2026-08-22 14:02:27 +02:00 • committed by GitHub
parent fbbe12a0ec
commit bf57d398c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 11 deletions

View file

@ -1657,10 +1657,11 @@ func (lp *Loadpoint) pvMaxCurrent(mode api.ChargeMode, sitePower, batteryPower f
// notes: activePhases can be 1, 2 or 3 and phaseTimer can only be active if lp current is already at minCurrent // notes: activePhases can be 1, 2 or 3 and phaseTimer can only be active if lp current is already at minCurrent
projectedSitePower -= Voltage * minCurrent * float64(activePhases-1) projectedSitePower -= Voltage * minCurrent * float64(activePhases-1)
} }
// a continuous device that is enabled but not consuming keeps its demand out // a continuous device consuming less than its min power demand keeps the
// of site power, hiding insufficient surplus until it starts (#32282) // remainder out of site power, hiding insufficient surplus until it ramps
if lp.chargerHasFeature(api.Continuous) && !lp.charging() { // up (#32282). Project the shortfall towards min power into the gate.
projectedSitePower += currentToPower(minCurrent, lp.minActivePhases()) if lp.chargerHasFeature(api.Continuous) {
projectedSitePower += max(0, currentToPower(minCurrent, lp.minActivePhases())-lp.chargePower)
} }
// kick off disable sequence, unless climater keep-alive is holding // kick off disable sequence, unless climater keep-alive is holding
// charging at minCurrent — otherwise the "pausing soon" badge would // charging at minCurrent — otherwise the "pausing soon" badge would

View file

@ -909,11 +909,12 @@ func TestNewLoadpointFromConfigDisabledVehicle(t *testing.T) {
require.Empty(t, config.Instances(config.Vehicles().Devices())) require.Empty(t, config.Instances(config.Vehicles().Devices()))
} }
// TestPVDisableIdleContinuousDevice is a regression test for #32282: a continuous // TestPVDisableContinuousDeviceShortfall is a regression test for #32282: a continuous
// device that is enabled but not consuming (heat pump boost signalled, compressor // device consuming less than its min power demand keeps the remainder out of site
// idle) does not show its demand in site power. Without projecting it, the disable // power, so the disable gate never trips on the missing surplus. The shortfall
// gate only trips on grid consumption which the idle device never causes. // towards min power is projected into the gate regardless of charge status, since
func TestPVDisableIdleContinuousDevice(t *testing.T) { // some chargers (sgready) report StatusC while the device is idle.
func TestPVDisableContinuousDeviceShortfall(t *testing.T) {
const dt = time.Minute const dt = time.Minute
tc := []struct { tc := []struct {
@ -927,8 +928,14 @@ func TestPVDisableIdleContinuousDevice(t *testing.T) {
{"idle, insufficient surplus", api.StatusB, 0, -400, 0}, {"idle, insufficient surplus", api.StatusB, 0, -400, 0},
// idle device, export covers its demand: keep enabled // idle device, export covers its demand: keep enabled
{"idle, sufficient surplus", api.StatusB, 0, -700, 7}, {"idle, sufficient surplus", api.StatusB, 0, -700, 7},
// consuming device: measured power reflects demand, keep lenient hysteresis // idle device reporting StatusC (sgready-style): still disable
{"consuming, exporting", api.StatusC, 300, -200, minA}, {"idle, StatusC, insufficient surplus", api.StatusC, 0, -400, 0},
// starting device: own draw plus surplus covers min power, keep enabled
{"starting, demand covered", api.StatusB, 300, -400, 7},
// running below min power without surplus for the remaining demand: disable
{"running below min, insufficient surplus", api.StatusC, 300, -200, 0},
// consuming min power, importing: unchanged disable behavior
{"consuming, importing", api.StatusC, 600, 100, 0},
} }
for _, tc := range tc { for _, tc := range tc {