flexpool

Sandbox and scenarios

Replay a market day on a test clock: one scenario file for the demo, tests and bug reports.

A scenario describes one market day to replay. The same file starts the demo, drives a test and can be attached to a bug report.

name = "demo"
day  = "2025-10-02"

[market]
source = "synthetic"   # deterministic for the seed
seed   = 7
# source = "file"      # or real prices from a CSV next to this file
# file   = "data/2025-10-02.csv"

[clock]
start = "2025-10-01T10:00:00+02:00"   # optional: two hours before the day-ahead gate
flexpool scenario check scenarios/demo.toml   # every problem at once, with its key
flexpool scenario run   scenarios/demo.toml   # replays to the end, prints a summary

run is deterministic: the same file prints the same summary on every machine.

The test clockπŸ”—

In scenario mode flexpoold runs on a test clock that only moves forward. Jump to the next gate instead of waiting a real day:

curl -s localhost:8080/api/v1/sandbox/clock
curl -s -XPOST localhost:8080/api/v1/sandbox/clock/advance \
     -H 'content-type: application/json' -d '{"to":"next-gate"}'

Gates come from the rule packs in force on the replayed day: the day-ahead gate (12:00 the day before), the price publication, the three intraday auctions. A move returns every event it passed.

Nothing from the futureπŸ”—

Market data is bitemporal: each price knows the interval it is about and the instant it became known. Asking for day-ahead prices before their publication answers 425 not-yet-known with the publication time β€” the same rule every later decision is held to.

curl -s 'localhost:8080/api/v1/market/day-ahead/prices?day=2025-10-02'

The answer names the market time unit and the rule that set it: 15 minutes from delivery day 2025-10-01, hourly before. Replaying 2025-09-30 gives 24 prices.

A synthetic market also generates a price history: history_days (default 28, at most 60) days before the replayed day, each published at its own time. The forecast learns from it and is backtested on it; nothing in it lies after the test clock.

[market]
source       = "synthetic"
seed         = 7
history_days = 28

Real dataπŸ”—

A data file has a header start_utc,price_eur_mwh and one row per market time unit of the day, the start in RFC 3339 UTC. Gaps, duplicates, misaligned starts and prices outside the harmonised limits are refused with their line number β€” nothing is interpolated. Files must sit inside the scenario's directory and be at most 16 MiB. flexpool does not bundle real market data; check the licence of the platform you export from.

FaultsπŸ”—

With a portfolio, every asset reports simulated telemetry. A scenario can disturb assets on purpose, to see how the desk says it:

[[fault]]
asset = "home-nord-00008-ev"
kind  = "offline"                      # no value at all in the window
from  = "2025-10-01T11:30:00+02:00"
to    = "2025-10-01T13:30:00+02:00"

[[fault]]
asset = "pv-sued-1"
kind  = "stuck"                        # the value and its time freeze: stale after a minute
from  = "2025-10-01T12:05:00+02:00"
to    = "2025-10-01T15:00:00+02:00"

[[fault]]
asset = "bess-kiel-1"
kind  = "tripped"                      # online and reporting, but 0 kW: a delivery shortfall
from  = "2025-10-02T18:45:00+02:00"
to    = "2025-10-02T19:30:00+02:00"

Once orders are released and filled, the sandbox batteries follow the traded schedule β€” see Delivery.

flexpool scenario check scenarios/demo.toml --portfolio portfolio/demo checks that every fault names an asset of the portfolio; flexpoold refuses to start otherwise. The demo scenario carries these two faults.

A grid operatorπŸ”—

A [dso] table lets the scenario play a grid operator that asks the pool for flexibility, orders what you send and settles after delivery; see Flexibility market. scenario check confirms that a battery sits behind its congestion point.

SafetyπŸ”—

The sandbox routes exist only when sandbox.scenario is set, every response carries x-flexpool-sandbox: true, and scenario mode refuses to listen beyond loopback unless sandbox.allow_remote = true is set explicitly.

Edit this page