fms

Ask the flexibility market

Turn a day-ahead congestion forecast into a UFTP flexibility request, order the cheapest offers that cover it and settle what was delivered.

Β§ 14a control limits devices when the grid is already overloaded. A day ahead, the grid operator can ask aggregators for flexibility first: say which quarter hours an asset will be congested, order the cheapest offers that cover the need and settle what was delivered. FMS computes each step deterministically: the same forecast and offers give the same request and orders, and no agent decides. It writes the Open Utility Stack's flex-request@1, flex-order@1 and flex-settlement@1 documents as CloudEvents. Your UFTP gateway signs and sends them; FMS sends nothing.

Try the Elm transformerπŸ”—

Run these commands with the installed service in a fresh directory. The baseline feeder's 18 kW transformer feeds premises H1, forecast at 16 Β± 2 kW from 17:00 to 19:00 on 1 December.

fmsd example baseline --out feeder.json
fmsd example flex-forecast --out forecast.json
fmsd flex request feeder.json --forecast forecast.json --expiration 2026-11-30T12:00:00Z --at 2026-11-30T08:00:00Z

The report names the congested span and why:

{"start": 69, "duration": 8, "expected_kw": 16.0, "sigma_kw": 2.0, "rating_kw": 18.0, "excess_kw": 1.29}

FMS plans with the one-sided 95 % band, expected flow Β± 1.645 Οƒ. 16 + 1.645 Γ— 2 = 19.29 kW leaves the 18 kW rating by 1.29 kW. Below the report is the de.fms.flex.request.sent event. Its request marks ISPs 69–76 requested with the band βˆ’18 kW to βˆ’1.29 kW, at least 1.29 kW less consumption, and the rest of the day available within Β±18 kW.

The aggregator answers with two options: heat pumps, βˆ’1 kW for 3.00 EUR, and wallboxes, βˆ’2 kW for 10.00 EUR. Order from it:

fmsd example flex-offer --out offer.json
fmsd flex order feeder.json --forecast forecast.json --expiration 2026-11-30T12:00:00Z --at 2026-11-30T11:00:00Z --offer offer.json > orders.json

The heat pumps cost less per watt-ISP and are ordered in full. The wallboxes cover the 290 W still needed at activation factor 0.15, which is 300 W. orders.json holds one de.fms.flex.order.sent event for each, caused by the offer, with shortfall: []. Each order carries the option's power and price unscaled, as on the UFTP wire; the factor applies once, at settlement.

After the day, settle the heat-pump order against the metered power and the aggregator's D-Prognosis, a flex-prognosis@1 event. Pass every one received:

fmsd example flex-prognosis --out prognosis.json
fmsd example flex-actual --out actual.json
jq '.orders[0]' orders.json > order.json
fmsd flex settle --order order.json --prognosis prognosis.json --actual actual.json

ISP 71 measured 15.1 kW against a 16 kW prognosis, so it delivered βˆ’900 of the ordered βˆ’1000 W, a 100 W deficiency. The de.fms.flex.settlement.sent event carries the UFTP Β§ 2.6 settlement with its settlement_digest.

The forecastπŸ”—

The forecast is yours, from your forecasting service; FMS does not forecast. One file names one congestion point and the asset it stands for (the transformer or a line), the day and its zone, the ISP length and the UFTP domains of the request. Per ISP it gives each premises' expected kW and its standard deviation:

{
  "schema_version": 1,
  "congestion_point": "ea1.2026-11.dso.example:cp-elm",
  "asset": "T1",
  "date": "2026-12-01", "zone": "Europe/Berlin", "isp_duration": "PT15M",
  "sender": "dso.example", "recipient": "agr.example",
  "isps": [{"isp": 69, "demand": {"H1": {"kw": 16.0, "sigma": 2.0}}}]
}

The asset's flow comes from the same branch-flow model the estimator uses, losses included. Its spread is the root sum of squares of the downstream premises' spreads. A negative value is feed-in, and a feed-in band below βˆ’rating is congestion too: the request then asks for more consumption. FMS refuses a premises or asset the export does not hold, an ISP outside the day, a negative spread and a value that is not finite.

How offers are chosenπŸ”—

RuleWhy
Only offers answering this request: its message id, congestion point and day, from the aggregator it went to, in --currency, not expiredSelected by dataschema and CE-6 first; an offer for something else is listed under skipped with the reason
Cheapest price per watt-ISP first; ties by offer id, then optionNormalises options of different size; the order is reproducible
The smallest activation factor, in hundredths, that covers what is still needed, and at least the option's minimumRounding up overshoots by at most 1 % of an option rather than leave a need uncovered
An option that pushes power the wrong way in a congested ISP is not orderedIt would worsen what it is paid to relieve
What no option covers is listed under shortfall per ISPΒ§ 14a control still covers it, and the planner sees that it will

Pass --at for byte-identical output; message ids and order references are UUIDv5 over the inputs. Without --at the current time stamps the documents, and the ids stay the same.

Which prognosis settles an orderπŸ”—

Order baselinePrognosis used
d_prognosis names onethat one
method dprognosis@1the highest revision whose event time is before the order's
any other methodnone: refused rather than settled against the wrong baseline

Only prognoses for the order's congestion point, day and ISP length, from the aggregator the order went to, count. Two different documents for the same choice are refused. stderr names the prognosis used. For the lab, --d-prognosis FILE takes the order's ISPs as {"start", "watts"} instead.

Serve the registerπŸ”—

Providers read the grid operator's register of providers and units, flex-register@1, from a listener of its own. Each sees only its own entry and units; the operator sees all. Keep the register as a flex-register@1 file and list the client certificates you issued, each pinned by its SHA-256 to operator or a provider id:

fmsd serve-register --register register.json --clients clients.json --tls-dir tls --listen 0.0.0.0:8443
{"clients": [{"sha256": "3b1f…", "party": "9912345000007"}, {"sha256": "a90c…", "party": "operator"}]}

tls/ holds the issuer of the client certificates (ca.pem) and the service's certificate and key. The listener accepts TLS 1.3 only. A certificate from another issuer fails the handshake; one that is not pinned gets nothing. GET /api/v1/flex/register answers with Cache-Control: no-store. A register with duplicate ids, a unit of an unlisted provider or a qualification that ends before it starts is refused at start, as is a pin for an unlisted party. To revoke a provider, remove its pin and restart.

How the documents mapπŸ”—

Requests, orders and settlements are UFTP 3.1 messages mapped onto the Open Utility Stack's flex-request@1, flex-order@1 and flex-settlement@1; an offer arrives as flex-offer@1 and becomes a UFTP FlexOffer that has passed uftp's rules, a D-Prognosis as flex-prognosis@1 covering the day from ISP 1 without a gap. An order carries the option's power and price unscaled, as on the wire; the activation factor applies once, at settlement. market.conversation_id names the conversation of an answer. The mapping refuses what a profile cannot say rather than guess: a request ISP without a disposition, a baseline named twice, a BaselineReference that is not a method id such as mbma@1, a power beyond Β±2^53 W, an ISP outside 1–1500, a price whose scale does not match its digits. A settlement's power_deficiency is a magnitude. Every event names its profile URN as dataschema; a request is internal, an order or settlement confidential, and the request, its orders and their settlements share one W3C trace (traceparent).