From 017e2c0e1a817e7bafb9fa5c27257e56e32e75b3 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 18 Oct 2024 18:02:55 +0200 Subject: [PATCH] chore: add more logging for #16599 --- core/loadpoint.go | 6 ++++++ 1 file changed, 6 insertions(+) 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 }