diff --git a/core/loadpoint.go b/core/loadpoint.go index 2a0a46bd1..f77c61af1 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -1209,6 +1209,8 @@ func (lp *Loadpoint) pvScalePhases(sitePower, minCurrent, maxCurrent float64) in availablePower := lp.chargePower - sitePower scalable := (sitePower > 0 || !lp.enabled) && activePhases > 1 && lp.configuredPhases < 3 + lp.log.DEBUG.Printf("!! pvScalePhases DOWN activePhases: %d, available power: %.0fW, scalable: %T", activePhases, availablePower, scalable) + // scale down phases if targetCurrent := powerToCurrent(availablePower, activePhases); targetCurrent < minCurrent && scalable { lp.log.DEBUG.Printf("available power %.0fW < %.0fW min %dp threshold", availablePower, float64(activePhases)*Voltage*minCurrent, activePhases) @@ -1238,6 +1240,8 @@ func (lp *Loadpoint) pvScalePhases(sitePower, minCurrent, maxCurrent float64) in target1pCurrent := powerToCurrent(availablePower, 1) scalable = maxPhases > 1 && phases < maxPhases && target1pCurrent > maxCurrent + lp.log.DEBUG.Printf("!! pvScalePhases UP maxPhases: %d, available power: %.0fW, scalable: %T", maxPhases, availablePower, scalable) + // scale up phases if targetCurrent := powerToCurrent(availablePower, maxPhases); targetCurrent >= minCurrent && scalable { lp.log.DEBUG.Printf("available power %.0fW > %.0fW min %dp threshold", availablePower, 3*Voltage*minCurrent, maxPhases) @@ -1268,6 +1272,8 @@ func (lp *Loadpoint) pvScalePhases(sitePower, minCurrent, maxCurrent float64) in lp.resetPhaseTimer() } + lp.log.DEBUG.Println("!! pvScalePhases EXIT") + return 0 }