Optimizer: use effective limit soc

This commit is contained in:
andig 2025-08-28 13:53:03 +02:00
parent d0cc3494d7
commit 9da7dff68b
2 changed files with 7 additions and 3 deletions

View file

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

View file

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