Repository navigation
fix(control): a battery that may not export cuts an exporting discharge at once - #2155
Merged
Merged
Conversation
…ge at once In planner_self, planner_cheap and passive arbitrage, a discharge while the meter shows export now has a floor on the reactive path: the battery's latest sample less the export on the latest meter sample. The meter-clamp snap carries it past the slew limit, so the cut lands on the next tick. With the setup guide's 5 s ticks and 500 W slew, each drop in house load sold battery energy for about half a minute. The floor takes only export the meter itself shows. A discharge that feeds a car the battery does not cover keeps its ramp, which holds a phase under the fuse after a restart. It stops at 0 W, and raising the discharge again still follows the slew limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ssors The floor read RawW and SmoothedW straight from cached readings, which survive a driver going stale. It now takes the meter and each battery through OnlineMeterW and OnlineRawW, and skips the cut when the meter is not live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frahlg
added a commit
that referenced
this pull request
Dec 5, 2026
Review on #2012 (Fredrik, 14 Nov): planner_self, planner_cheap and planner_passive_arbitrage never sell, but the boost cover aimed at exactly 0 W and gave up the dead band the reactive path keeps (#1969). - The cover and the 30 s hold use the same lifted aim as the reactive path, through one helper, noExportGridAimW. The reactive path now calls it too, so the two cannot drift. - In those modes the cover goes no further than the latest meter and battery samples show, as the fast cut on export does (#2155). Without this the boost undid that cut while the smoothed meter caught up with a stopped car, and exported for three ticks. - During a boost and the hold, a cut of discharge passes the slew limit, as the meter clamp's does. With the setup guide's 500 W slew the car's stop otherwise eased the battery down 500 W a tick, on the energy path in every mode. Tests, with a 500 W slew where it matters: - TestBatteryBoostKeepsTheNoExportBand: the three modes settle at the dead band, not 0 W; arbitrage keeps 0 W. - TestBatteryBoostNoExportCutsAtOnceWhenTheCarStops: only the tick the car stops on exports, with and without charger lag. - TestBatteryBoostFollowsTheCarBothWays: exact targets, a cover-load slot where the "car stopped" leg fails on master, and slew cases. - TestBatteryBoostEndingAtAChargeSlotCharges: the hold does not hold back a planned charge, on the energy and legacy paths. Golden: only seeded_ev_boost/043 is re-recorded, spliced into master's file so the other records keep their values. planner_cheap, cheap slot: -3157 W becomes -3097 W, projected grid 0 W becomes +60 W, the record's GridToleranceW. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A field report on 0.175 (Pixii as battery and site meter,
planner_passive_arbitrage, battery export not allowed): while the battery discharged about 3 kW, the grid went to −3.5 kW on 27 November and −3.2 kW on 29 November, about 1 kWh a day sold at spot and bought back at full price. The log showeddispatch: meter clamp reduced battery target … deadband_w=42 mode=self_consumption, so the clamp ran, but too late.The box runs the setup guide's timing: 5 s ticks and a slew of 500 W a tick (
web/setup.js; the defaults are 2 s and 3000 W). When the heat pump's compressor stops, the PI asks for half the error. That is too little for the meter clamp to engage, and the slew limit then takes the discharge down 500 W a tick. Smoothing adds to it: the Pixii driver polls every 5 s, and the Kalman filter shows 73 % of a step on its first sample.Change
In
planner_self,planner_cheapandplanner_passive_arbitrage, on the reactive path, a discharge while the meter shows export gets a floor: the battery's latest sample less the export on the latest meter sample. The existing meter-clamp snap then carries it past the slew limit, so the cut lands on the next tick.planner_arbitrage, which may export, is unchanged.Evidence
New tests in
go/internal/control/no_export_band_test.go. The battery follows each command within one tick, and the meter gives one sample per 5 s tick, as a Pixii does.The tick on which the load drops still exports until the next meter sample: about 3.5 Wh for 2.5 kW at 5 s. Only a faster meter poll removes that.
Golden replay: 5 of 551 records changed. Each is a battery discharging while the meter exports, in a mode that may not export, with the grid between −641 and −5,183 W. The discharge now ends at 0 W or lands the grid at about +60 W. I re-recorded
seeded_planner.jsonandslew_limiter.jsononly; the other families showed only float noise on re-dump and stay as on master.make verifypassed on this machine.Related
ComputeDispatch. No textual conflict.control_interval_s: 5andslew_rate_w: 500.🤖 Generated with Claude Code