Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/fresh-pilot-explains-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"ftw": patch
---

Keep a charge under the charger's load balancing at Limited when the driver
briefly stops reporting its limit (srcfl/ftw#2056).

An Easee charger read back FTW's 13 A order while its load balancing
signalled 8 A to the car, which took 5.44 kW. The EV status said "Limited by
the charger's load balancing", then "Not following" for 15 s, then Limited
again, though the 8 A pilot reading was still fresh. The test driver, built
on the open pilot change in srcfl/device-drivers#200, stops reporting its
limit for up to 30 s after its order reading moves. Core now lets a fresh
pilot below the order explain a draw that matches it. The status stays
Limited and reads "Limited by the charger" with the pilot current, because
only the driver can name the load balancing. A car that takes far less than
the pilot is still Not following.
20 changes: 15 additions & 5 deletions go/internal/api/api_control_feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,26 @@ func classifyControlFeedback(f *ControlFeedback, cmd telemetry.CommandEvidence,
// more keeps its verdict. A fresh pilot names the charger as the cause
// only when it is below the order and is that current. A lower current
// whose cause the driver does not show still asks for a look.
if f.Kind == "ev" && commanded && cmd.Result == "accepted" && f.SentW != nil && f.RequestedW != nil && f.RequestedA != nil && f.LimitA != nil && f.ActualW != nil &&
*f.SentW > 100 && *f.RequestedA > 0 && *f.LimitA > 0 && *f.LimitA+0.5 < *f.RequestedA && settled {
//
// While the driver reports no limit, a fresh pilot is that current: the
// charger signals it to the car now. easee_cloud stops reporting its
// limit for up to 30 s after its order reading moves, though its pilot
// stays fresh (srcfl/ftw#2056). Only the driver can name the load
// balancing, so the pilot alone names the charger.
limitA := f.LimitA
if limitA == nil {
limitA = f.PilotA
}
if f.Kind == "ev" && commanded && cmd.Result == "accepted" && f.SentW != nil && f.RequestedW != nil && f.RequestedA != nil && limitA != nil && f.ActualW != nil &&
*f.SentW > 100 && *f.RequestedA > 0 && *limitA > 0 && *limitA+0.5 < *f.RequestedA && settled {
perA := *f.RequestedW / *f.RequestedA
limitW := *f.LimitA * perA
limitW := *limitA * perA
tolerance := telemetry.ControlToleranceW(limitW)
if *f.ActualW >= limitW-math.Max(tolerance, math.Min(2*perA, 0.15*limitW)) && *f.ActualW <= limitW+tolerance && *f.ActualW < *f.SentW {
if f.LimitedBy == "load_balancer" {
set("limited", "load_balancer_limit", "info")
} else if f.PilotA != nil && *f.PilotA+0.5 < *f.RequestedA && math.Abs(*f.PilotA-*f.LimitA) <= 0.5 {
if f.DeviceLimitA != nil && math.Abs(*f.LimitA-*f.DeviceLimitA) <= 0.5 {
} else if f.PilotA != nil && *f.PilotA+0.5 < *f.RequestedA && math.Abs(*f.PilotA-*limitA) <= 0.5 {
if f.DeviceLimitA != nil && math.Abs(*limitA-*f.DeviceLimitA) <= 0.5 {
set("limited", "device_limit", "info")
} else {
set("limited", "charger_pilot_limit", "info")
Expand Down
82 changes: 82 additions & 0 deletions go/internal/api/api_pilot_evidence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,85 @@ func TestPilotLimitNeverHidesCommandFailureOrPendingCommand(t *testing.T) {
})
}
}

// Field report srcfl/ftw#2056, 21 Nov 2026, v0.165.1-beta.1, Easee Cloud
// with a test driver built on easee_cloud's pilot evidence: FTW ordered
// 13 A on three phases (8.97 kW), the charger read back 13 A, Easee's load
// balancing signalled 8 A and the car took 5.44 kW. Pilot confirmations
// came a minute apart. Between them the verdict turned to Not following
// for 15 s although the 8 A pilot was still fresh. That driver stops
// reporting its limit for up to 30 s after its order reading moves, until
// the pilot answers the order again. A fresh pilot still names the charger
// as the cause, but not its load balancing, which only the driver can.
func TestFreshPilotExplainsTheDrawWhileTheDriverWithholdsItsLimit(t *testing.T) {
const balanced = `,"current_limit_a":8,"current_limited_by":"load_balancer"`
for _, tc := range []struct {
name string
gapW float64
status, reason, severity string
}{
{"steady draw at the pilot", 5440, "limited", "charger_pilot_limit", "info"},
{"car far below the pilot", 3000, "not_following", "power_below_target", "warning"},
} {
t.Run(tc.name, func(t *testing.T) {
synctest.Test(t, func(t *testing.T) {
source := time.Now().Add(-time.Hour).Format(time.RFC3339Nano)
e := newEVTrace(5440)
read := func(confirmed time.Time, limit string) {
e.extra = fmt.Sprintf(`,"max_a":13,"dynamic_limit_a":13,"pilot_a":8,"pilot_observed_at":%q,"pilot_confirmed_at_ms":%d%s`, source, confirmed.UnixMilli(), limit)
}
check := func(when, status, reason, severity string) {
t.Helper()
f := e.verdict(t)
if f.Status != status || f.Reason != reason || f.Severity != severity {
t.Fatalf("%s: got %s/%s/%s want %s/%s/%s", when, f.Status, f.Reason, f.Severity, status, reason, severity)
}
}
// Five minutes under the balancer's 8 A, confirmed every minute.
for i := range 5 * 60 / 5 {
if i%12 == 0 {
read(time.Now(), balanced)
}
e.tick(8970, "plan")
}
first := time.Now()
read(first, balanced)
e.tick(8970, "plan")
check("first confirmation", "limited", "load_balancer_limit", "info")
for range 5 {
e.tick(8970, "plan")
}
// 30 s after the confirmation the driver reports no limit for
// 15 s. The pilot it confirmed stays fresh.
read(first, "")
if tc.gapW != e.drawW {
e.drawW, e.changedAt = tc.gapW, time.Now()
}
for range 3 {
e.tick(8970, "plan")
check(fmt.Sprintf("gap at %v", time.Since(first)), tc.status, tc.reason, tc.severity)
}
if f := e.verdict(t); f.PilotA == nil || *f.PilotA != 8 || f.LimitA != nil || f.LimitedBy != "" {
t.Fatalf("gap evidence: pilot %v, limit %v by %q", f.PilotA, f.LimitA, f.LimitedBy)
}
if tc.status != "limited" {
return
}
read(first, balanced)
e.tick(8970, "plan")
check("limit back", "limited", "load_balancer_limit", "info")
for range 2 {
e.tick(8970, "plan")
}
read(time.Now(), balanced)
e.tick(8970, "plan")
check(fmt.Sprintf("second confirmation at %v", time.Since(first)), "limited", "load_balancer_limit", "info")
// A second confirmation while the driver still withholds the
// limit keeps the charger as the cause.
read(time.Now(), "")
e.tick(8970, "plan")
check("second confirmation without the limit", "limited", "charger_pilot_limit", "info")
})
})
}
}
Loading