Skip to content

fix(mpc): cap Energyplan time budget by remaining slot time #1148

Closed

Description

@frahlg

#1130 refuses to publish a plan whose first price slot ended during the solve. The worker budget is still model-size only (500ms vs 5s), so a late-in-slot replan can burn the full budget, get slot_elapsed, and retry.

Found on master 6eadec3f in go/internal/mpc/energyplan.go and execution_time.go.

What happens

energyplanTimeBudget looks at slot×asset size and PV curtailment. Request TimeLimitS = min(Timeout*0.8, budget). Process timeout is 7s.

Remaining first-slot time is not used. trimFirstExecutionSlot runs before solve; after solve, firstSlotExpired discards the plan and queues slot_elapsed. A 5s fleet solve started with 200ms of slot left spends the budget on a result that cannot be published.

Replan ctx is WithCancel only — no wall deadline tied to the slot end.

#1144 is the rain-check LenMin leftover. This is the worker wall-clock leftover.

What a fix needs

  • Cap TimeLimitS (and the process wait) by remaining first-slot time plus a small publish margin.
  • If remaining time is below the small-model budget, skip or fail fast rather than solve and discard.
  • Test: now = slot end − 200ms, fleet size that would get 5s — worker budget ≤ remaining, no slot_elapsed retry from a plan that could not have landed.

Open PR overlap: #1131 is changelog-only for #1130. #1129 is storage.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions