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
9 changes: 9 additions & 0 deletions .changeset/energyplan-keeps-the-car-room.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"ftw": patch
---

The bundled Energyplan worker now keeps a battery that may not cover the car
out of the car's import room, as Core requires. Until now Core rejected such a
plan: a site with one battery and one car got Core's own plan, and a site with
several batteries or cars got the worker's plan with a warning. The worker's
plan now passes without one.
31 changes: 31 additions & 0 deletions go/internal/mpc/native_car_room_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package mpc

import (
"context"
"testing"
"time"

"github.com/srcfl/ftw/go/internal/loadpoint"
)

// The bundled worker plans the field night of 15 Nov 2026 (fuseNightSlots)
// without the battery making the car's import room. Core accepts the plan,
// so the site keeps the worker's plan instead of falling back to Core DP.
func TestNativeBatteryThatMayNotCoverTheCarMakesItNoRoom(t *testing.T) {
o := nativeWorker(t, 1500*time.Millisecond)
defer o.Close()
slots := fuseNightSlots()
for _, mode := range []Mode{ModeArbitrage, ModePassiveArbitrage} {
p := fuseNightParams(mode, true)
plan, err := o.Optimize(context.Background(), slots, p)
if err != nil {
t.Fatalf("%s: %v", mode, err)
}
for i, a := range plan.Actions {
if a.LoadpointW > 0 && a.BatteryW < -50 && slots[i].LoadW+a.LoadpointW > fuseNightImportW+loadpoint.SitePowerEpsW {
t.Errorf("%s slot %d: battery %.0f W makes the room for a %.0f W car", mode, i, a.BatteryW, a.LoadpointW)
}
}
t.Logf("%s: %s, car %.0f%% by slot 7", mode, plan.Solver.Backend, 100*plan.Actions[7].LoadpointSoC)
}
}
Binary file modified optimizer/native/bundle/ftw-solver-linux-amd64
Binary file not shown.
Binary file modified optimizer/native/bundle/ftw-solver-linux-arm64
Binary file not shown.
10 changes: 5 additions & 5 deletions optimizer/native/bundle/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"product": "energyplan",
"version": "0.7.0",
"source_repository": "srcfl/energyplan",
"source_commit": "847936a15de6efed4192c2ec2d67f31f6f98ce64",
"source_commit": "7ea7d99835a80f6fd56efb14f89a1c206e43016b",
"rustc": "rustc 1.95.0 (59807616e 2026-04-14)",
"protocol_version": 1,
"forecast_protocol_version": 1,
Expand Down Expand Up @@ -35,12 +35,12 @@
"bytes": 15377
},
"ftw-solver-linux-amd64": {
"sha256": "67ff308aa4f30134a066898a1638f2f0436eff0a299d661af8de3a04cadb2bee",
"bytes": 2102880
"sha256": "22bec2f482e2f1bc63e1781fb37fc672bfa897df0f738452eaf3714b10c2a8d2",
"bytes": 2108704
},
"ftw-solver-linux-arm64": {
"sha256": "a6f1609d61c38d6a8fb7b00ec695ed6bdd962c657b9fe544833c4acde0d4338b",
"bytes": 1674152
"sha256": "b56d705ebd80823c9a90b784c876c27ae153a3b3ab3beb28a9acc23ef05f5261",
"bytes": 1676792
},
"rust-runtime/COPYRIGHT-library.html": {
"sha256": "90567e2718bf7fd65a71a3a43c5596488e80e5f51ed02bfea6fec54458b5f3d1",
Expand Down
Loading