Flexibility market
How flexpool answers a grid operator: a request becomes an offer built from the batteries behind the congestion point, a person sends it, and every settlement is recomputed before it is accepted.
A distribution grid operator (DSO) that expects congestion asks aggregators for flexibility: less consumption, or more, in certain quarter hours behind one congestion point. flexpool is the aggregator. It speaks UFTP 3.1 (the USEF Flex Trading Protocol, used by LF Energy Shapeshifter) as the Open Utility Stack profiles it:
| Document | Direction | What it says |
|---|---|---|
flex-request@1 | DSO → flexpool | which ISPs need a deviation, and how much |
flex-prognosis@1 | flexpool → DSO | the power flexpool expects at the congestion point all day: the baseline |
flex-offer@1 | flexpool → DSO | what flexpool can deliver, at what price |
flex-order@1 | DSO → flexpool | which option the DSO buys, and what share of it |
flex-settlement@1 | DSO → flexpool | what was delivered, per ISP, and what it is worth |
An ISP (imbalance settlement period) is one quarter hour, numbered from 1 per day: a normal day has 96, the spring day 92, the autumn day 100. Power is in whole watts, and positive means consumption: an offer of −250 000 W is 250 kW less consumption (or more feed-in) at the congestion point.
In the desk🔗
Flexibilität (g f) shows each request as a conversation: request, draft, sent, order, settlement. Each card has the requested band against the offered deviation per quarter hour, the share that fits and why, and the verdict on the settlement with the differing quarter hour marked.
Where the units are🔗
Each asset that takes part names the congestion point it sits behind, as a UFTP entity address, in the optional congestion_point column of assets.csv:
id,kind,technical_unit,owner,rated_kw,energy_kwh,malo,sr_id,tr_id,congestion_point
home-nord-00000-bat,battery,homes-nord,haushalte,8,5.8,50000000063,,,ea1.2026-11.netz-nord.example:cp-hh-nordAn entity address is ean.<18 digits> or ea1.<yyyy-mm>.<domain>:<id>. Today flexpool offers from batteries; other kinds stay out until the planner hands over a schedule for them.
From a request to an offer🔗
A request arrives as a signed CloudEvent (see Events). flexpool builds the offer at once, deterministically, and keeps it as a draft:
- Units. Every battery behind the congestion point becomes an energy envelope for the request's day: from −rated (discharge) to +rated (charge), never below empty or above full, starting half full. The state of charge at a future quarter hour is not known, so the offer does not pretend to know it.
- Headroom. The envelopes are summed into the pool's envelope (
flexibility::pool::aggregate), and its headroom says how far the pool may move from its plan in each ISP. - Target. In each ISP the request marks
requested, the offer takes the deviation inside the requested band and inside the headroom, as far from zero as both allow. A requested band has one direction (UFTP § 3.8.2); a band across zero is refused with the ISP named. ISPs markedavailableare not offered. - Split. The pool deviation is split across the batteries in proportion to their headroom, each capped by the power its stored energy sustains over the offered quarter hours, and the split is proven with
flexibility::pool::check_split. When the batteries hold too little, flexpool offers the largest share that fits, in 64ths, in whole kilowatts rounded toward zero. A quarter hour whose share falls short of the band is left out, never offered short, and the finished offer is checked against the bands. - Price. The offered energy at
flex.price_eur_per_mwh, rounded once to the cent.
The offer names its baseline as dprognosis@1: the pool's plan is the D-Prognosis the settlement is measured against. When a person sends the offer, flexpool first sends that plan as flex-prognosis@1 for the whole day from ISP 1, so the operator has it before any order. A plan already sent for the congestion point and day is not sent again; a changed one goes out as the next revision.
curl -s localhost:8080/api/v1/flex/requests # requests, and the offer drafted for each
curl -s localhost:8080/api/v1/flex/offers # drafts and sent offers, with their split per batteryA person sends the offer🔗
An offer commits a price, so it is a person's decision, not an agent's:
curl -s -X POST localhost:8080/api/v1/flex/offers/<message-id>/sendflexpoold refuses to send an offer twice, after its request expired, or once a higher revision replaced the request. A revision is the same operator's request for the same congestion point and day: its draft replaces the old one, an offer already sent stays bound to the revision it answered, and a revision that is not higher is refused. The offer leaves through events.webhooks as flex-offer@1, signed with Standard Webhooks. It carries the request's chain as correlationid and causationid, and the trace that started the chain as traceparent.
Orders🔗
An order must name an offer flexpool sent and one of its options. A second order with the same client_reference and different content is refused. The order is unscaled, exactly as on the wire: its power and price are the option's, and the activation factor is applied once, at settlement.
Settlements are recomputed, never trusted🔗
Each flex-settlement@1 is deduplicated on source + id; its id must be <market.message_id>/<client_reference>, because one UFTP message settles several orders. flexpool then settles the same order itself with flexibility::settle (UFTP 3.1 § 2.6), against the prognosis it sent (the one the order names, or the highest revision sent before the order) and its own measurements. It maps the result to the profile with the operator's message id and penalty, and compares settlement_digest:
| Verdict | Meaning |
|---|---|
agreed | Both sides computed the same document; the digests match |
disputed | It names what differs first: the baseline method, the first ISP whose baseline, actual or ordered power differs, the first ISP whose delivered power or deficiency does not follow from the operator's own figures, or a money field |
unverifiable | flexpool cannot recompute it (a quarter hour without complete measurements, a baseline other than its D-Prognosis, an order it never offered) and holds it, never accepts it on trust |
Delivered power carries the order's sign; deficiency is a non-negative magnitude. The digest is SHA-256 over the RFC 8785 canonical JSON of the document without its settlement_digest.
curl -s localhost:8080/api/v1/flex/settlementsTry it in the sandbox🔗
A scenario can play the grid operator. The demo has one:
[dso]
congestion_point = "ea1.2026-11.netz-nord.example:cp-hh-nord"
request_at = "2025-10-01T16:00:00+02:00"
isps = [69, 76] # 17:00–19:00
min_kw = -600 # 200 to 600 kW less consumption
max_kw = -200
dispute_isp = 72 # settle this quarter hour differentlyAt request_at the request arrives; once you send the offer, the operator orders it; an hour after the last ordered quarter hour it settles from measured power. Its events are signed with a secret that exists only in scenario mode and go through the same checks as a real operator's. The sandbox does not steer the batteries to the offer (flexpool only reads devices), so the settlement shows the whole offer as deficiency.
Settings🔗
| Key | Default | Meaning |
|---|---|---|
flex.domain | — | Our UFTP domain, the sender of offers (empty: no offers) |
flex.price_eur_per_mwh | 150 | Offer price per MWh of offered flexibility |
flex.min_activation_factor | 1 | The smallest share the operator may order, 0 to 1 |
events.webhooks, events.webhook_secret | — | Where offers go, and the secret that signs them |
events.inbound_secrets | — | Secrets that may sign events sent to flexpool |
State is held in memory, the newest 500 of each kind: a restart forgets drafts and verdicts.