Does this plan fit?
Caps from the grid operator, the connection limit and a § 14a minimum combine into one envelope. A schedule is checked per quarter hour, and every violation names who set the bound.
Limits and envelopes →Open-source Rust library · MIT OR Apache-2.0
The limits a grid operator sets, the plan an aggregator makes, the baseline both agree on, and the settlement of what was delivered — in whole watts, one sign convention, and a receipt both sides hash to the same digest.
Get started Read the docs GitHub
cargo add flexibilityCaps from the grid operator, the connection limit and a § 14a minimum combine into one envelope. A schedule is checked per quarter hour, and every violation names who set the bound.
Limits and envelopes →Baseline methods with stable ids — dprognosis@1, schedule@1, mbma@1, xofy@1 — each with required parameters and a published card.
Delivered flexibility and power deficiency per quarter hour, exactly as UFTP 3.1 § 2.6 computes them; the specification's own table is a test.
Settlement →Every settlement has a canonical JSON text and a sha256: digest. The other side recomputes it — in Rust, a shell script or any RFC 8785 library — and compares one hash.
A grid of quarter hours in its own time zone, a cap in kilowatts, a plan, and a check whose every message names the quarter hour, the values and who set the bound. This is the README's example; it runs in the crate's test suite.
use flexibility::jiff::{civil::{date, time}, tz::TimeZone};
use flexibility::*;
let berlin = TimeZone::get("Europe/Berlin")?;
let grid = Grid::day(date(2026, 12, 1), &berlin, IspDuration::FIFTEEN_MINUTES)?;
let noon = grid.local(time(12, 0, 0, 0))?;
// The grid operator caps consumption at 4.2 kW from 17:00 to 19:00, local time.
let evening = grid.window(time(17, 0, 0, 0), time(19, 0, 0, 0))?;
let dso = Provenance::new("dso.example", "order-42", noon);
let envelope = Envelope::unbounded(grid.clone()).apply(&Limit::consumption_cap(evening, kw!(4.2), dso))?;
// A car planned at 7.4 kW all evening breaks it in ISPs 69 to 76, and says who set the cap.
let plan = Schedule::new(Series::filled(grid, kw!(7.4)), Provenance::new("agr.example", "plan-7", noon));
let violations = plan.check(&envelope)?;
assert_eq!(
violations[0].to_string(),
"ISP 69 (17:00–17:15 +01:00): planned 7.4 kW above max 4.2 kW set by dso.example order-42"
);Cap a feeder's sites per quarter hour, keep the § 14a minimum, and settle the flexibility you bought, with a receipt the aggregator can check.
Start here →Plan a pool inside every limit, prove what you delivered against the agreed baseline, and catch a wrong settlement before you sign it.
Start here →Turn LPC, S2, OpenADR or CSIP-AUS limits into one envelope, check a heat pump's or a car's plan against it, and send each device what it must keep.
Start here →Recompute any settlement from its canonical text, with a shell script or any RFC 8785 library, and find the first quarter hour two parties disagree on.
Start here →Each converter is a Cargo feature, off by default. It changes the sign at the boundary and nowhere else, and refuses what it cannot carry exactly.
explain says why a quarter hour allows what it allows.Changing when or how much power a site draws or feeds in, because the grid needs it: less consumption on a congested evening, more feed-in when demand peaks. A grid operator (DSO) buys it from an aggregator, who moves heat pumps, cars, batteries and plants, and both have to agree afterwards on how much was delivered.
The power a site would have drawn without the activation. Delivered flexibility is measured against it, so the method decides the money. flexibility names each method with a version (mbma@1, xofy@1) whose computation never changes, so a settlement can be recomputed years later and give the same watts.
Every baseline and settlement has a canonical JSON text (RFC 8785) and a sha256: digest. Both sides compute it from their own inputs and compare one hash; if they differ, Settlement::diff names the first quarter hour, field or input where they part.
Because 0.1 kW is not representable in binary, and a settlement that depends on the rounding of a float is not reproducible. Power is whole watts in an i64, energy whole watt-seconds; a remainder is refused unless you name a rounding. Floats on the wire (S2, IEC 104) are read once, as the decimal written.
No. It is pure arithmetic: no clock, file, network or environment. Protocol crates parse and send messages; flexibility turns their values into limits, schedules and settlements and back, so an integration gets the same numbers in a test, a replay and production.
Settlement follows UFTP 3.1 § 2.6 exactly, and the crate reproduces the specification's own table. Signs follow UFTP § 4.2.1 (consumption positive). It models the German § 14a EnWG minimum, records the measurement point the EU network code on demand response asks for, and maps the protocols listed above.
cargo add flexibility, follow the getting-started guide, and compare your digest with the one in the docs.