diff --git a/core/site_optimizer.go b/core/site_optimizer.go index 1e4b01d89..f17122ce9 100644 --- a/core/site_optimizer.go +++ b/core/site_optimizer.go @@ -219,11 +219,11 @@ func (site *Site) optimizerUpdate(battery []measurement) error { if ts := lp.EffectivePlanTime(); !ts.IsZero() { // TODO precise slot placement - if slot := int(time.Until(ts) / tariff.SlotDuration); slot < minLen { + if slot := int(time.Until(ts) / tariff.SlotDuration); slot < minLen && slot >= 0 { bat.SGoal = lo.RepeatBy(minLen, func(_ int) float32 { return 0 }) bat.SGoal[slot] = float32(goal) } else { - site.log.DEBUG.Printf("plan beyond forecast range: %.1f at %v", goal, ts.Round(time.Minute)) + site.log.DEBUG.Printf("plan beyond forecast range or overrun: %.1f at %v slot %d", goal, ts.Round(time.Minute), slot) } }