Skip to content

fix(control): include EV load in manual self consumption - #917

Merged
frahlg merged 2 commits into
masterfrom
agent/self-manual-raw-grid
Aug 16, 2026
Merged

fix(control): include EV load in manual self consumption#917
frahlg merged 2 commits into
masterfrom
agent/self-manual-raw-grid

Conversation

@frahlg

@frahlg frahlg commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Make Self (manual) drive its PI from the raw site meter, including positive EV charging even when battery_covers_ev is off.
  • Keep the existing EV policy in other modes and keep V2X discharge excluded by default.
  • Keep surplus-only loadpoints from using the home battery for EV charging while still allowing the battery to cover house load.
  • Add a patch changeset and update the affected golden control cases.

Root cause

Self (manual) subtracted EV charging from the site-meter signal. With PV charging the home battery and a larger EV load making the full site import, the PI saw house-side export and could ask the battery to charge harder. That looked and behaved like battery charging while the site imported.

Self (manual) now follows the normal self-consumption rule: drive the full site meter toward zero.

Safety

Fuse, SoC, slew, stale-meter and V2X guards are unchanged. The surplus-only cap still prevents home-battery discharge into its EV.

Validation

  • Björn's reported case: 5.56 kW site import, 4.26 kW battery charge and 8.11 kW EV load converges toward a -1.3 kW battery target and zero site flow.
  • go test -count=1 ./internal/drivers ./internal/control
  • make verify
  • Pre-push make verify-all, including Linux arm64, Linux amd64 and Windows amd64 builds.

Overlap

The patch was developed against #769, then replayed as one commit on current master; no #769 changes are included. It also applies cleanly with the open #887 and #888 control patches.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf882657b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread go/internal/control/dispatch.go Outdated
// needed by the house-side signal. If PV already covers the
// house, stop at idle rather than charging while the raw meter
// imports for the EV.
houseGridW := gridW - state.EVChargingW

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope the discharge floor to surplus-only EV power

When a site has both a surplus-only loadpoint and a regular loadpoint, EVSurplusOnlyReserveW is activated only by the former, but this calculation subtracts the aggregate EVChargingW from every live charger. For example, with a 3 kW surplus-only EV, a 4 kW regular EV, 1 kW house load, and BatteryCoversEV=true, the new floor limits the battery to -1 kW instead of allowing -5 kW to cover the house and regular EV while leaving the surplus-only EV unsupported. Track/subtract the surplus-only EV's actual draw separately so this clamp protects only the loadpoint that requires it.

AGENTS.md reference: AGENTS.md:L37-L37

Useful? React with 👍 / 👎.

@frahlg
frahlg force-pushed the agent/self-manual-raw-grid branch from cf88265 to 85ed8e5 Compare August 16, 2026 10:34
@frahlg
frahlg merged commit 2d775af into master Aug 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant