fix(control): include EV load in manual self consumption - #917
Conversation
There was a problem hiding this comment.
💡 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".
| // 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 |
There was a problem hiding this comment.
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 👍 / 👎.
cf88265 to
85ed8e5
Compare
Summary
battery_covers_evis off.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
go test -count=1 ./internal/drivers ./internal/controlmake verifymake 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.