flexpool 0.5.0

The flexpool command line: check portfolios, scenarios and alarm journals, make secrets and tokens, probe a daemon.
flexpool-0.5.0 is not a library.

โšก flexpool

An open-source virtual power plant for aggregators. flexpool pools batteries, homes and depots, plans them against day-ahead prices, offers their flexibility to grid operators and proves what was delivered. Every number is exact, every decision has a reason, and every step can be replayed.

crates.io License: MIT OR Apache-2.0 Rust 1.100

๐Ÿ“– Documentation ยท ๐Ÿš€ Getting started ยท ๐Ÿ”Œ API ยท ๐Ÿ“ Changelog

๐Ÿงช Experimental. Pre-1.0: APIs can change between releases. Everything runs end to end on simulated and replayed market days; orders are paper orders, no exchange is connected, and devices are only ever read. Test with your counterparties before production use.

๐Ÿš€ Quick start

git clone https://github.com/hupe1980/flexpool && cd flexpool
docker compose up -d --wait
open http://localhost:8080            # ๐Ÿ–ฅ๏ธ the operator desk

The demo replays a market day on a test clock, with 400 assets in two pools. Some of the API:

curl -s localhost:8080/api/v1/portfolio                       # pools, assets, MW and MWh
curl -s 'localhost:8080/api/v1/plan/day-ahead?risk=cautious'   # schedule, water values, orders per pool
curl -s localhost:8080/api/v1/book/day-ahead/delivery         # the Fahrplan against measured delivery
curl -s -X POST localhost:8080/api/v1/sandbox/clock/advance \
     -H 'content-type: application/json' -d '{"to":"next-gate"}'   # โฉ jump to the next market gate

๐Ÿฆ€ From source (Rust 1.100, just): just run starts the daemon, just ci runs every check.

๐Ÿงฐ The command line checks portfolios, scenarios and alarm journals offline:

cargo install flexpool
flexpool portfolio check portfolio/demo

๐Ÿ–ฅ๏ธ The desk

Calm by default, loud on exception. Every value shows its age, every order has a reason, and nothing reaches a market until a person releases it. In German and English, light and dark.

๐Ÿ“’ Book and delivery: the release with its digest, positions after the auction, the Fahrplan against measured power ๐Ÿ“ˆ Timeline: prices, the forecast fan and every model scored over 14 days
๐Ÿค Flexibility: a grid operator's request answered, sent by a person, the settlement recomputed ๐Ÿงญ Overview: what matters now, readable in five seconds

โœจ What it does

๐Ÿ“‹ Portfolio as code Owners, pools, technical units and assets in portfolio.toml and assets.csv, checked down to every MaLo check digit
๐Ÿ“ก Telemetry Simulated in the sandbox, or read from SunSpec and IEC 60870-5-104 devices, read-only, with a quality on every value
๐Ÿšจ Alarms One alarm per cause (ISA-18.2), acknowledged on a hash-chained journal, handed over between shifts, paged as signed CloudEvents
๐Ÿ”ฎ Forecast Day-ahead price quantiles, scored against published prices, with a place for your own model
๐Ÿงฎ Plan Scenarios and a storage optimiser with a risk knob: a schedule, water values and protective orders per battery pool
๐Ÿ“’ Book Pre-trade checks, a release a person makes, a kill switch, positions and the Fahrplan nomination for mako
โšก Delivery The Fahrplan against measured power, the running quarter projected, and what to trade back
๐Ÿ’ฌ Explanations Warum? on every order from its facts; Nachrechnen recomputes any release from its journal record
๐Ÿค Flexibility market UFTP 3.1 requests become offers built from the units behind a congestion point; every settlement is recomputed before it is accepted
๐Ÿ”Œ Interfaces REST with OpenAPI 3.1, CloudEvents with published schemas, Standard Webhooks, read-only MCP tools, W3C Trace Context
๐Ÿ”’ Data protection Personal data declared on every event; erasure@1 acted on and confirmed truthfully

๐Ÿ—๏ธ Workspace

Component Purpose
flexpool-core Exact units, the Berlin quarter-hour calendar, the single float-to-decimal boundary
flexpool-portfolio Parse, check, query and summarise the portfolio
flexpool-telemetry Measurement quality, the live store, quarter-hour means, the sandbox simulator
flexpool-alarms The alarm engine, the hash-chained journal, handover and KPIs
flexpool-forecast Probabilistic day-ahead forecasts and their scoring
flexpool-plan Scenarios, the storage optimiser with CVaR, water values, orders
flexpool-rules Dated market and alarm rules, each citing its source (rules/)
flexpool-sim Bitemporal market data, scenarios, the test clock and replay
flexpool-adapters Read-only SunSpec Modbus TCP and IEC 60870-5-104 sessions
flexpool-files Bounded, contained reads of the files an operator keeps
flexpool-service The HTTP shell: configuration, authentication, limits, problem documents, trace context
flexpoold The daemon: API, MCP, events, the flexibility market
flexpool The offline command line; it never links the daemon
desk The operator desk (React, TypeScript), served by flexpoold
xtask The repository guards just ci runs

๐ŸŽฏ The domain crates read no clock, do no I/O and spawn no task. Money and energy are exact decimals, and business time is the Europe/Berlin quarter hour.

๐ŸŒ Part of the Open Utility Stack

flexpool fills the aggregator role in the Open Utility Stack. It follows the stack's conventions for events, contracts and autonomy, so its counterparts, like fms on the grid operator's side, can be replaced by any system that follows them too. platform.toml declares what it emits and consumes.

๐Ÿค Contributing and security

๐Ÿ“„ License

Licensed under either MIT or Apache-2.0, at your option.