diff --git a/core/loadpoint/api.go b/core/loadpoint/api.go index 902f393c3..0ceec4278 100644 --- a/core/loadpoint/api.go +++ b/core/loadpoint/api.go @@ -98,6 +98,8 @@ type API interface { // EffectivePriority returns the effective priority EffectivePriority() int + // EffectiveLimitSoc returns the effective session limit soc + EffectiveLimitSoc() int // EffectivePlanId returns the effective plan id EffectivePlanId() int // EffectivePlanTime returns the effective plan time diff --git a/core/site_optimizer.go b/core/site_optimizer.go index 0ad44b8d1..75eafb245 100644 --- a/core/site_optimizer.go +++ b/core/site_optimizer.go @@ -148,9 +148,11 @@ func (site *Site) optimizerUpdate(battery []measurement) error { } if v := lp.GetVehicle(); v != nil { - limit := lp.GetLimitEnergy() * 1e3 // Wh - if limit == 0 { - limit = v.Capacity() * float64(lp.GetLimitSoc()) / 10 // Wh + limit := v.Capacity() * 1e3 // Wh + if v := lp.EffectiveLimitSoc(); v > 0 { + limit *= float64(v) / 100 + } else if v := lp.GetLimitEnergy(); v > 0 { + limit = v * 1e3 } bat.SMax = float32(limit)