chore: add more logging for #16599

This commit is contained in:
andig 2024-10-18 18:02:55 +02:00
parent 04721ef4c5
commit 017e2c0e1a

View file

@ -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
}