Repository navigation
fix(loadpoint): a charger on one phase under a three-phase order is seen, and planned at its rate #1796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
fix(loadpoint): a charger on one phase under a three-phase order is seen, and planned at its rate #1796
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "ftw": patch | ||
| --- | ||
|
|
||
| When a charger draws on one phase although FTW ordered three, FTW now says so and plans with what the charger delivers. In 0.155.0 an Easee charger on one phase took 3.13 kW all night against a 7.6 kW plan order: about 13 of the 24 planned kWh arrived, and the plan kept promising the rest. FTW now compares the charger's power with the site meter's phases. When one phase carries all of it and the other two less than a third, for two minutes, the charger panel says "Charging on one phase" with the phase and its current. For the rest of that charging session the plan counts the rate the charger delivered, and FTW repeats the order that got that rate. Two minutes with the draw on all three phases, or unplugging, ends it. The fuse limit is unchanged: it still reads only the site meter and FTW's own orders. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package api | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "math" | ||
| "testing" | ||
| "testing/synctest" | ||
| "time" | ||
|
|
||
| "github.com/srcfl/ftw/go/internal/loadpoint" | ||
| "github.com/srcfl/ftw/go/internal/telemetry" | ||
| ) | ||
|
|
||
| // Field report, 22 Oct 2026: a three-phase plan order an Easee served on L1 | ||
| // at 3.13 kW all night. The loadpoint controller sees it from the site | ||
| // meter, and the verdict names the phase and its current instead of a | ||
| // charger that does not follow. | ||
| func TestThreePhaseOrderDrawnOnOnePhaseIsLimited(t *testing.T) { | ||
| synctest.Test(t, func(t *testing.T) { | ||
| tel := telemetry.NewStore() | ||
| tel.DriverHealthMut("easee") | ||
| var steps []float64 | ||
| for a := 0.0; a <= 16; a++ { | ||
| if a == 0 || a >= 6 { | ||
| steps = append(steps, a*690) | ||
| } | ||
| } | ||
| mgr := loadpoint.NewManager() | ||
| mgr.Load([]loadpoint.Config{{ID: "garage", DriverName: "easee", MinChargeW: 4140, MaxChargeW: 11040, AllowedStepsW: steps}}) | ||
| slot := time.Now() | ||
| plan := func(time.Time) (loadpoint.Directive, bool) { | ||
| return loadpoint.Directive{SlotStart: slot, SlotEnd: slot.Add(time.Hour), LoadpointEnergyWh: map[string]float64{"garage": 7590}}, true | ||
| } | ||
| sample := func(string) (loadpoint.EVSample, bool) { | ||
| return loadpoint.EVSample{Connected: true, RequestActive: true, PowerW: 3130, PowerAt: time.Now()}, true | ||
| } | ||
| send := func(_ context.Context, driver string, payload []byte) error { | ||
| c := tel.BeginCommand(driver, payload, time.Now()) | ||
| tel.CompleteCommand(c, "accepted") | ||
| return nil | ||
| } | ||
| ctrl := loadpoint.NewController(mgr, plan, sample, send) | ||
| ctrl.SetSiteFuse(loadpoint.SiteFuse{MaxAmps: 25, Voltage: 230, PhaseCnt: 3}) | ||
| ctrl.SetSitePhases(func() (loadpoint.SitePhases, bool) { | ||
| return loadpoint.SitePhases{A: [3]float64{14.4, .75, .75}, At: time.Now()}, true | ||
| }) | ||
| srv := New(&Deps{Tel: tel, Loadpoints: mgr}) | ||
| changedAt := time.Now() | ||
| var f ControlFeedback | ||
| for range 6 * 60 / 5 { | ||
| ctrl.Tick(context.Background(), time.Now()) | ||
| tel.Update("easee", telemetry.DerEV, 3130, nil, []byte(fmt.Sprintf( | ||
| `{"connected":true,"control_power_observed_at":%q,"control_power_confirmed":true,"power_max_age_s":180}`, | ||
| changedAt.Format(time.RFC3339Nano)))) | ||
| time.Sleep(5 * time.Second) | ||
| f = srv.controlFeedback(time.Now())[0] | ||
| } | ||
| if f.Status != "limited" || f.Reason != "one_phase" || f.Severity != "warning" || f.ChargingPhase != "L1" || | ||
| f.ChargingPhaseA == nil || math.Abs(*f.ChargingPhaseA-13.6) > .1 { | ||
| a := math.NaN() | ||
| if f.ChargingPhaseA != nil { | ||
| a = *f.ChargingPhaseA | ||
| } | ||
| t.Fatalf("3.13 kW on L1 under a %.0f W order reads %s/%s/%s, phase %q at %.1f A", *f.SentW, f.Status, f.Reason, f.Severity, f.ChargingPhase, a) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| // One phase never hides a charger that draws more than it is told. | ||
| func TestOnePhaseDoesNotExplainADrawAboveTheOrder(t *testing.T) { | ||
| sent, actual := 0.0, 3130.0 | ||
| f := ControlFeedback{Kind: "ev", SentW: &sent, ActualW: &actual, ChargingPhase: "L1", Response: "device_reported"} | ||
| cmd := telemetry.CommandEvidence{Result: "accepted"} | ||
| connected := true | ||
| classifyControlFeedback(&f, cmd, true, true, "fuse_limit", &connected, time.Now()) | ||
| if f.Reason == "one_phase" { | ||
| t.Fatalf("a draw against a stop read as one phase: %+v", f.Reason) | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a detected 3,130 W session is replanned,
LimitPowersupplies 3,130 W as the MPC maximum, andcoreReservePlanemits that value inLoadpointMaxPowerW. The preceding duty-plan branch therefore lowersmaxWto 3,130 W, so this assignment clips the saved 7,590 W order back to 3,130 W. The finalSnapChargeW(3130, 4140, 3130, steps)returns zero because the ceiling is below the charger's minimum. Consequently, the reserve/duty-plan path stops charging after detecting precisely the one-phase case this change addresses. Keep the modeled delivered-power ceiling separate from the legal hardware-order ceiling, and cover a directive containingLoadpointMaxPowerWin the regression test.Useful? React with 👍 / 👎.