Repository navigation
fix(control): a battery order on its way counts on each phase - #1805
Merged
Merged
Conversation
A one-phase charger's room is one phase's, but Core took the battery's whole unshown order off it, so a three-phase battery counted three times. With 4,703 W of battery order the car's phase had 661 W left, under the 1,610 W a start needs, and Charge now sat at 0 W (fuse_limit) with every phase near 0 A. The order now goes beside the chargers' unshown offers: in total import, and the same current on each phase. A three-phase charger's cap does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis 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. |
… sides The fuse's room now holds our unshown battery order, so the hourly idle start's label compared the ceiling's room without it against the fuse's room with it, and a car the ceiling held read fuse_limit. Both sides now count the order, as the start test itself does. 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.
For v0.155.1-beta.1.
Problem
A car on a one-phase charger (pinned
1p, or auto on a charger with no three-phase step) sits at 0 W, shown as limited by the main fuse, while every phase is far below its limit. It happens whenever Core has just raised the battery.Seen in the local rig on master 8ac2750: 25 A × 3 fuse, site meter at −0.68 A on each phase, Charge now 32 A on a one-phase charger, and Core sent 0 W (
fuse_limit) for 42 s. In a test with a 16 A fuse, 3 A of house load and a battery order that rises 1.5 kW every 30 s, the car did not start for 9 minutes. A three-phase car on the same site started at once.It is not new. It came with 47799bd (#1695, 17 Oct), so every beta from v0.147.2-beta.1 has it, including v0.155.0-beta.1. Stable v0.130.4 does not.
Cause
ev_fuse_budget.goputs a loadpoint that is not3pin a one-phase pool, so its room is one phase's: (limit − busiest phase) × 230 V.pendingBatteryCommandsWgives the battery's not-yet-shown order in total watts, and that total was taken off the one-phase room. A three-phase battery puts a third of it on each phase, so it counted three times there. In the rig: 5,364 W of room − 4,703 W of battery order = 661 W, under the 1,610 W a start needs (1,380 W + 230 W margin). Once the order had shown (20 s), the 35 s idle-start wait still had to pass: 42 s in all.Change
The battery's unshown order now goes beside the chargers' unshown offers before the room is worked out: in total import, and as the same current on each phase (
withBatteryOrders). The later "minus total" steps go. The hourly import ceiling's start test keeps its total.This follows the fuse rule: the site meter's measured current per phase, plus our own orders that cannot have shown yet, on the phases they land on.
pendingBatteryCommandsWis never negative, so nothing gains credit.fuse_phase.go). A one-phase battery on the car's phase is counted at a third of its draw there, as it already is for a three-phase car.import_limit/fuse_limitlabel compares rooms that now include the battery order; it can change only while the import ceiling is on.Evidence
TestEVHardLimitBatteryOrderCountsOnEachPhase: meter −466 W, −0.68 A on each phase, 4,703 W battery order. On master the1pandautocases fail withcap 0.0 W, want 3565.9 W;3ppasses on both. With the fix all three pass.go test ./internal/... ./cmd/ftw/...passes;go vetis clean. The field matrix is unchanged: no known row moves.Independent review
A separate review compared master and this branch on the same random inputs: about 120,000 steps, a heat-stress run, and a run with voltage or phase count at 0. The inputs covered 1–3 site phases, 1–2 chargers, 0–2 batteries, missing or partial phase currents, and the import ceiling on and off.
fuse_limit, also on three-phase pools. Both sides now count the order.TestEVHardLimitIdleCeilingLabelCountsBatteryOrderfails without that line.fuse_phase.go, and master already gives a three-phase car the same amps on the same battery. A phase near its limit still gets nothing. Any overshoot lasts until the meter shows the car and the cut lands.Why nothing caught it
Follow-ups (not here)
easee-charge-upmodel ignoresnumberPhasesand draws three-phase on a one-phase order; sim-ferroamp's meter never includes the car.max_charge_w(32 A · 7.4 kW) while the step table ends at 16 A (3.68 kW).🤖 Generated with Claude Code