Skip to content

bug(mpc): diagnostic LOAD column misses EV charge power — operators see phantom exports #174

Closed

Description

@frahlg

What Erik saw

Screenshot from the 48 h plan table (cheap_charge mode):

Time LOAD BATTERY GRID Reason
22:00 1.60 kW −5.60 kW 137 W discharge — cover local load

By naïve math: `1.6 + (−5.6) = −4.0 kW` → looks like the battery is exporting 4 kW to grid while the mode is supposed to "never export via battery."

What's actually happening

The DP is correct. `mpc.go:377` folds the EV action into the grid equation:

```go
gridW := slot.LoadW + slot.PVW + battW + evW
```

And `mpc.go:383` includes EV in the mode's baseline:

```go
baseGridW := slot.LoadW + slot.PVW + evW
```

So a real slot looks like `LOAD 1.6 + EV 4.0 = 5.6 total consumption, battery covers all 5.6, grid ≈ 0`. "Never exports" is honoured.

Root cause

`diagnose.go:100–121` (`buildDiagnostic`) writes `LoadW: slot.LoadW` — household only. `Action.LoadpointW` exists on the Action struct but never lands in `DiagnosticSlot`, so the UI table has no way to show it.

Operators see `LOAD 1.6` alongside `BATTERY −5.6` and assume the difference is export. They can't tell the car is eating 4 kW.

Fix

  • Add `LoadpointW` (or `EVChargeW`, name tbd) to `DiagnosticSlot` in `diagnose.go`
  • Populate from `plan.Actions[i].LoadpointW`
  • Either
    • (a) add a dedicated "EV" column in the plan table, or
    • (b) show `LOAD + EV` as a combined value with a hover tooltip breakdown

I'd lean on (a) — keeps the household load forecast separate from EV dispatch decisions, which matters for debugging.

Out of scope

This does not touch the DP math. The DP is correct. The fix is purely in the diagnostic-rendering path.

Reported by

Field test by @erikarenhill (Discord). Collapses into this ticket:

cheap charing - never exports. MPC plannern - hold my beer, planerar mer export än arbitrage 😄

— same symptom, same root cause.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions