Loadpoint: make EffectiveMaxPower honor circuit limits (#23554)

This commit is contained in:
andig 2025-09-12 17:16:52 +02:00 • committed by GitHub
parent d1d0f3e4fa
commit 23ffe16145
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -217,11 +217,21 @@ func (lp *Loadpoint) EffectiveMinPower() float64 {
return Voltage * lp.effectiveMinCurrent() * float64(lp.minActivePhases())
}
// EffectiveMaxPower returns the effective max power taking vehicle capabilities and phase scaling into account
// EffectiveMaxPower returns the effective max power taking vehicle capabilities,
// phase scaling and load management power limits into account
func (lp *Loadpoint) EffectiveMaxPower() float64 {
lp.RLock()
defer lp.RUnlock()
return lp.effectiveMaxPower()
res := lp.effectiveMaxPower()
if lp.circuit != nil {
if v := lp.circuit.GetMaxPower(); v > 0 {
res = min(res, v)
}
}
return res
}
// effectiveMaxPower returns the effective max power taking vehicle capabilities and phase scaling into account