Skip to content

fix(mpc): score remaining slot time in forecastLoadWh after #1130 #1144

Closed

Description

@frahlg

#1130 plans only the remaining time in the current price slot. forecastLoadWh still multiplies LoadW by the full LenMin.

Found on master 6eadec3f (go/internal/mpc/load_bounds.go).

What happens

trimFirstExecutionSlot sets ExecutionStartMs so DurationHours() is the remainder. Action energy, EV budgets, and dispatch intent use that remainder.

forecastLoadWh does:

wh += math.Max(0, s.LoadW) * float64(min) / 60.0

with min = s.LenMin (default 60). After trim, first-slot LoadW is a remaining-interval average. Rain-check then integrates it as a full 15 minutes.

Horizon-scale error is small on a 24h plan. It is the one leftover that can still rewrite load energy for the current quarter, which is the failure #1130 was closing.

LoadpointPlanWindows similarly reports energy from ExecutionStart to slot end, not remaining-from-now, so the UI can overstate leftover EV Wh after a mid-slot plan.

What a fix needs

  • forecastLoadWh / rain-check must use DurationHours() (or remaining hours), same as ValidatePlan.
  • Test: first slot ExecutionStartMs 10 minutes in, LenMin=15 — rain-check energy is 5 minutes of load, not 15.
  • Optionally the same remaining-from-now for LoadpointPlanWindows.

Open PR overlap: #1131 is the version-packages PR for #1130 only. Do not fold this into that changelog bump.

Activity

  1. added
    bug
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions