Repository navigation
fix(ev): let a fresh pilot explain the draw while the driver withholds its limit - #2062
Merged
Merged
Conversation
…s its limit #2056: a steady Easee charge under load balancing (13 A order and readback, 8 A pilot, 5.44 kW) read Not following for 15 s between two pilot confirmations a minute apart, though the pilot was still fresh. The load-balancing verdict needed the driver's current_limit_a; without it nothing explained the draw, and the mismatch clock, running since the limit began, made the verdict Not following at once. The test driver, built on srcfl/device-drivers#200, withholds its limit for up to 30 s after its order reading moves. While the driver reports no limit, a fresh pilot below the order now explains a draw that matches it, as limited/charger_pilot_limit/info. Only the driver can name the load balancing. A car taking far less than the pilot is still Not following. Refs #2056 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.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. |
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
#2056: on v0.165.1-beta.1 a steady Easee charge under load balancing turned from "Limited by the charger's load balancing" to "Not following" (
power_below_target) for 15 s, then back. FTW ordered 13 A on three phases (8.97 kW), the charger read back 13 A, the pilot was 8 A and the car took 5.44 kW throughout. Pilot confirmations came at 14:14:51 and 14:15:51; the flip ran from 14:15:23 to 14:15:38.What I found
The load-balancing verdict in
classifyControlFeedbackneeds the driver'scurrent_limit_a. When that field is missing, nothing else explains the draw, and Core goes straight topower_below_target. It does so at once, with no two-minute wait, because the mismatch clock has run since the limit began: the draw was below the order all along, only explained.The pilot was not the trigger. Confirmed at 14:14:51, it stayed inside Core's 90 s window until 14:16:21, and the verdict came back at 14:15:38, before the next confirmation.
The likely trigger is in the driver. The issue names a test driver built on the open pilot change in srcfl/device-drivers#200 (easee_cloud 1.5.0). That driver reports
current_limit_aonly while the pilot "answers" the order: the pilot was recorded after the order, or the order has stood 30 s (ORDER_SETTLE_MS). When its reading of Easee's dynamic current (observation 48) changes value, the 30 s start again. Easee records a value only when it changes, so a pilot that holds at 8 A gets no new record, and the driver withholds its limit. Its 20 s hold (LIMIT_RELEASE_HOLD_MS) covers part of that, which leaves about 10 s plus one poll with no limit. With a 5 s poll that fits the report to the second: last limit at 14:15:03, the change seen at 14:15:08, the hold over at 14:15:23, the order settled at 14:15:38. The driver keeps sending the fresh 8 A pilot all the while.What moved observation 48 is not known. Two causes fit: FTW's own retune by 1 A (at 8.28 kW that is under the 10 % that counts as a new step, so Core keeps its clocks), or Easee resetting its dynamic current and the driver sending the order again (srcfl/device-drivers#227). I have not seen either on hardware. How sure I am:
masterat the same point.Change
While the driver reports no limit, a fresh pilot below the order is the current the charger lets the car take. It explains a draw that matches it, in the same band as a reported limit. Without the driver's word Core does not name the load balancing, so the verdict is the existing
limited / charger_pilot_limit / info: "Limited by the charger", "The charger signals 8 A to the car … The internal limiting cause is unknown." When the driver reports its limit again, the verdict goes back toload_balancer_limit.limit_ain the API still carries only what the driver reports. The fallback lives inside the verdict.Not covered
When the pilot itself is missing or past its 90 s window and the driver reports no limit, Core has no current evidence. It still says Not following once the mismatch clock has run. The #200 driver drops the pilot at 90 s instead of sending it with its old confirmation time. To show "the last pilot is too old" there, that driver would have to keep sending it, and every client would need a verdict and words for it. I left that for a decision.
Evidence
TestFreshPilotExplainsTheDrawWhileTheDriverWithholdsItsLimitreplays the issue: 13 A order and readback, an 8 A pilot confirmed each minute, 5.44 kW, and the driver's limit gone for 15 s from 30 s after a confirmation. Onmasterit fails at 35 s withnot_following/power_below_target/warning. With the fix the gap readscharger_pilot_limit, and the verdict isload_balancer_limitwhen the limit comes back and after the second confirmation. A second confirmation without the limit keepscharger_pilot_limit. A second case drops the car to 3 kW in the gap and stayspower_below_target.cd go && go test ./internal/api/ ./internal/loadpoint/ ./cmd/ftw/ -count=1: all ok.make verify: passed. A first run failed only inTestAViewerMayStillRead, where/api/system/infogave no answer within 5 s under the suite's parallel load. That test does not reach control feedback, and it passed 5 of 5 runs alone; the secondmake verifyrun passed.easee-equalizer-wait) on a scratch branch: no conflict, and the three packages above pass.Overlap
#2050 is open and touches
api_control_feedback.goandapi_pilot_evidence_test.go. This change sits in other hunks: the limit block, and a new test at the end of the file. So it branches frommasterand does not stack. #2017, #1865 and #1789 also touchapi_control_feedback.go, in other hunks.Refs #2056
🤖 Generated with Claude Code