Skip to content

fix(loadpoint): mark a one-phase car only from an order rise - #1894

Merged
frahlg merged 1 commit into
masterfrom
d5-one-phase-drop-steady-check
Oct 27, 2026
Merged

frahlg merged 1 commit into
masterfrom
d5-one-phase-drop-steady-check

Conversation

@frahlg

@frahlg frahlg commented Oct 27, 2026

Copy link
Copy Markdown
Member

Item D5 of the stable plan.

Problem

The steady one-phase check (steadyVerdict, one_phase_car.go:119-136) had no baseline. It marked a car one-phase when one phase carried the charger's whole draw and the other two carried less than a third.

Take a three-phase car at 6 A (4140 W, or 18 A over one phase's voltage), a 3 kW oven on L1 and some solar on every phase. The meter reads [17, 4.5, 4.5] A, and the check marks the car one-phase within 60 s. computeCommandForBudget then triples the order (controller.go:2647-2651). A planned 4140 W slot went out as 11040 W. In a closed loop, with a house load of [12, -1.5, -1.5] A, the mark set and cleared 12 times in 15 minutes. 84 of 181 orders went above 6 kW on a 4140 W plan.

Change

  • Delete steadyVerdict, observeSteadyPhase and their state. A car is now marked one-phase only by the rise test, which measures from the meter just before FTW's own order rose.
  • Cost: after a Core restart, a one-phase car stays unmarked until the next 2 A rise. Until then it takes a third of the order. That means it gets less charge for a while. It does not raise any order. The fuse path does not change.
  • TestOnePhaseCarMarkedAfterARestart becomes TestOnePhaseCarMarkedOnTheRiseAfterARestart. No car is marked without a rise, and a one-phase car is marked on the first rise after the restart.

Tests

  • New tests from the audit repro (caa-33) are in one_phase_house_load_test.go: TestHouseLoadDoesNotMarkAThreePhaseCar, TestHouseLoadKeepsAPlannedThreePhaseOrder and TestHouseLoadDoesNotSwingAThreePhaseOrder. All three fail on master with the numbers above and pass on this branch. The rewritten restart test also fails on master.
  • go test -race -count=1 ./internal/loadpoint/... ./internal/api/... ./internal/control/... ./cmd/ftw/... ./internal/mpc/...: all ok.
  • go vet ./... and go build ./...: clean.

Risk

Low. The change deletes code and never raises an order. #1865 also touches one_phase_car.go, but only chargerPhaseMaxA, so the two should not conflict.

🤖 Generated with Claude Code

The steady check had no baseline. A 3 kW load on L1 and solar on L2/L3
read [17, 4.5, 4.5] A next to a three-phase car at 6 A, which it took
for a one-phase car. The order then tripled from 4140 W to 11040 W and
swung back on the next rise test. Delete the steady check and keep the
rise test, which compares against the meter before the rise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T13:32:01.249280Z 261d1db PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 1fd653e into master Oct 27, 2026
23 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