diff --git a/.changeset/energyplan-keeps-the-car-room.md b/.changeset/energyplan-keeps-the-car-room.md new file mode 100644 index 000000000..498e3df0e --- /dev/null +++ b/.changeset/energyplan-keeps-the-car-room.md @@ -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. diff --git a/go/internal/mpc/native_car_room_test.go b/go/internal/mpc/native_car_room_test.go new file mode 100644 index 000000000..ff111e09b --- /dev/null +++ b/go/internal/mpc/native_car_room_test.go @@ -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) + } +} diff --git a/optimizer/native/bundle/ftw-solver-linux-amd64 b/optimizer/native/bundle/ftw-solver-linux-amd64 index 9ef3f2dc9..c4149c016 100755 Binary files a/optimizer/native/bundle/ftw-solver-linux-amd64 and b/optimizer/native/bundle/ftw-solver-linux-amd64 differ diff --git a/optimizer/native/bundle/ftw-solver-linux-arm64 b/optimizer/native/bundle/ftw-solver-linux-arm64 index 42cdb5607..78b30ba71 100755 Binary files a/optimizer/native/bundle/ftw-solver-linux-arm64 and b/optimizer/native/bundle/ftw-solver-linux-arm64 differ diff --git a/optimizer/native/bundle/manifest.json b/optimizer/native/bundle/manifest.json index c504ea838..1a618852b 100644 --- a/optimizer/native/bundle/manifest.json +++ b/optimizer/native/bundle/manifest.json @@ -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, @@ -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",