Use maximum possible phases for scale-up calculation (#2753)
This commit is contained in:
parent
6165a16055
commit
89efcb6e64
2 changed files with 6 additions and 3 deletions
|
|
@ -1079,7 +1079,7 @@ func (lp *LoadPoint) pvScalePhases(availablePower, minCurrent, maxCurrent float6
|
|||
scalable := maxPhases > 1 && phases < maxPhases
|
||||
|
||||
// scale up phases
|
||||
if min3pCurrent := powerToCurrent(availablePower, 3); min3pCurrent >= minCurrent && scalable {
|
||||
if min3pCurrent := powerToCurrent(availablePower, maxPhases); min3pCurrent >= minCurrent && scalable {
|
||||
lp.log.DEBUG.Printf("available power %.0fW > %.0fW min %dp threshold", availablePower, 3*Voltage*minCurrent, maxPhases)
|
||||
|
||||
if lp.phaseTimer.IsZero() {
|
||||
|
|
|
|||
|
|
@ -162,9 +162,12 @@ func TestPvScalePhases(t *testing.T) {
|
|||
ctrl.Finish()
|
||||
|
||||
// scale up
|
||||
min3p := 3 * minA * Voltage
|
||||
min3p := float64(tc.maxExpected) * minA * Voltage
|
||||
lp.phaseTimer = time.Time{}
|
||||
lp.Phases = tc.physical // reset to initial state
|
||||
|
||||
// reset to initial state
|
||||
lp.Phases = tc.physical
|
||||
lp.measuredPhases = tc.measuredPhases
|
||||
|
||||
plainCharger.EXPECT().Enable(false).Return(nil).MaxTimes(1)
|
||||
phaseCharger.EXPECT().Phases1p3p(3).Return(nil).MaxTimes(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue