From f4910d284b4cae6fe9e05fc4db3a6a4a932660e9 Mon Sep 17 00:00:00 2001 From: RenatusRo <126881912+RenatusRo@users.noreply.github.com> Date: Fri, 7 Nov 2025 09:48:37 +0100 Subject: [PATCH] Optimizer: adjust fixed power demand (#25098) --- core/site_optimizer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/site_optimizer.go b/core/site_optimizer.go index 43049e079..1e4b01d89 100644 --- a/core/site_optimizer.go +++ b/core/site_optimizer.go @@ -51,6 +51,8 @@ type responseDetails struct { BatteryDetails []batteryDetail `json:"batteryDetails"` } +const slotsPerHour = float64(time.Hour / tariff.SlotDuration) + func (site *Site) optimizerUpdateAsync(battery []measurement) { var err error @@ -236,7 +238,7 @@ func (site *Site) optimizerUpdate(battery []measurement) error { maxPower := lp.EffectiveMaxPower() bat.PDemand = prorate(lo.RepeatBy(minLen, func(i int) float32 { - return float32(maxPower) + return float32(maxPower / slotsPerHour) }), firstSlotDuration) for i := range maxLen { @@ -351,7 +353,7 @@ func continuousDemand(lp loadpoint.API, minLen int) []float32 { } return lo.RepeatBy(minLen, func(i int) float32 { - return float32(pwr) + return float32(pwr / slotsPerHour) }) }