You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run Core's DP shadow rarely, as a fallback check, instead of after every replan #1957
After each published plan, Core runs a DP shadow (startCoreDPShadow, go/internal/mpc/core_dp_shadow.go) to compare its own DP plan with the active plan. On the home box (Raspberry Pi 4, FTW v0.158.0-beta.1) it never produced a better plan over 500 consecutive replans, while still using a noticeable share of the Pi's CPU.
Evidence comes from /api/mpc/diagnose/history on one site over about 4 days (29 Oct to 3 Nov): one battery, arbitrage mode, 15-minute slots, and one EV session.
Count
Replans with a shadow block
500
Shadow compared (optimal)
451, all on battery-only replans
Shadow skipped after a timeout (EV plugged in)
40
Shadow rejected by ValidatePlan
9
Active plan cheaper, terminal-corrected
451 of 451, by 0.95 to 15.4 öre (median 5.0)
Shadow cheaper
0
Shadow solve_ms was 706 ms at p50, 1,082 ms at p90 and 9,892 ms at most. At about 4.9 shadows per hour that is roughly 96 CPU-seconds per day on a Pi 4. It runs after publication, so it does not delay the plan. It does compete for CPU with the next replan, forecasting and everything else on the box. With a car plugged in it mostly times out or is rejected, so those replans gain no comparison either.
Proposal
Keep Core's DP as a fallback and run the shadow only rarely, as a health check rather than on every replan. For example:
run a shadow at most once every N hours (for example 6 h) on a scheduled replan, plus once after a worker version change;
always run it, or the DP itself, when the native plan is rejected, unavailable or falls back. This is the case the DP exists for;
keep the existing timeout and skip logic, and the dp_shadow diagnostics when a shadow runs;
optionally add a setting (off / sampled / every replan) for debugging.
This keeps the DP fallback exercised and comparable while giving the CPU back on Pi-class hardware.
Notes
This is one site and one week. The numbers come from Core's own dp_shadow diagnostics: active_minus_shadow_terminal_corrected_ore, solver.status and solver.solve_ms.
Related: Energyplan 0.7.0 is in progress. Nothing in this issue depends on it.
Activity