Baselines

The four baseline methods dprognosis@1, schedule@1, mbma@1 and xofy@1: parameters, rounding, derivation, method cards, and how each can be gamed.

On this page

A baseline is what a site would have done without the activation. It is never measured; it is computed, so the method is the settlement. Two parties agree on a delivered number only when they agree on the method, its parameters and its inputs.

The contract every method keeps#

  • A pure function with required parameters. No method has a default. Adjustment::None in xofy@1 is a choice the caller writes, not a fallback.
  • Refusal over invention. Too little history, a window that starts before the series, a day of the wrong length or a repeated date is Error::Method naming the reason. It never gives a shorter mean.
  • A stable id. MethodId displays and parses as name@version, such as mbma@1, and never changes its meaning.
  • Exact, rounded once. Methods sum first and divide once per ISP, rounding half away from zero to the watt. That rounding is part of the id.
  • A result that shows its work. Each method returns a Baseline over the event's ISPs, holding the method id, the parameters, a digest of every input, and its Derivation: which ISPs or days went in, and which adjustment was applied. Baseline::canonical() and Baseline::digest() give its canonical text and SHA-256 (see Settlement).

The four methods#

IdFunctionBaseline isParameters
dprognosis@1baseline::dprognosis(&prognosis, event)the aggregator's D-Prognosis, as sent (UFTP's default method)prognosis: the D-Prognosis Schedule, with who sent it and when
schedule@1baseline::schedule(&declared, event)a schedule the asset declared before the eventdeclared: the committed Schedule (an S2 plan, a Fahrplan)
mbma@1baseline::mbma(&measured, event, Mbma { n, gap })meter before / meter after: the mean of the last n ISPs before the event, held flatn ≥ 1 ISPs averaged; gap ISPs skipped between those and the event
xofy@1baseline::xofy(&day, event, &history, same_day, XofY { x, y, adjustment })the per-ISP mean of the x highest of y comparable days, optionally adjusted to the dayx in 1..=y; y ≤ 366 days given; adjustment

event is a Window. Every method returns the baseline over the ISPs the event overlaps, on a slice that keeps the day's ISP numbers.

mbma@1#

use flexibility::baseline::{self, Derivation, Mbma};

let evening = grid.window(time(17, 0, 0, 0), time(19, 0, 0, 0))?; // ISPs 69..=76
let b = baseline::mbma(&measured, evening, Mbma { n: 4, gap: 1 })?;
assert_eq!(b.derivation(), &Derivation::Mbma { isps: 64..=67 });  // ISP 68 is the gap

The formula: baseline(isp) = round(Σ measured(i) / n) over the n ISPs ending gap ISPs before the event's first ISP. It suits short activations, heat pumps and curtailment, and it fails on ramps; the accuracy score shows it.

xofy@1#

history is exactly the y comparable days, already filtered by the caller (day type, no event, no holiday). Each must cover the same local wall-clock times as day, ISP by ISP, dated before it, each date once; the order they are given in does not matter. The days are ranked by total consumption over the event ISPs (ties: the later date first), and the x highest are averaged per ISP.

Days line up by local time, not by ISP number. On 25 October, 17:00 is ISP 73, not 69: a target 17:00–19:00 on the 26th compares with ISPs 73–80 of the 25th and 69–76 of the 24th, so pass each as that slice (Grid::slice). Whole days of different lengths (92, 96 or 100 quarter hours) cannot line up and are refused, with that remedy in the message.

use flexibility::baseline::{self, Adjustment, XofY};

let b = baseline::xofy(&day, evening, &history, None, XofY {
    x: 5,
    y: 10,
    adjustment: Adjustment::None,
})?;

The same-day adjustment needs the day's own measurement as same_day, and uses a window of ISPs that ends gap ISPs before the event:

AdjustmentEffect
Nonethe X-of-Y mean as it is
Additive { window, gap, cap }shift every ISP by round(Σ(actual − baseline) / window) over the window, within ±cap if cap is Some
Ratio { window, gap, cap_percent }scale every ISP by Σ actual / Σ baseline over the window, within 1 ± cap_percent %

A ratio is held as an exact fraction until it is applied, with one division per ISP. A ratio window with no positive baseline consumption is refused. The Derivation::XofY records the chosen days (highest first) and the adjustment as applied (Applied::Additive(deviation) or Applied::Ratio { numerator, denominator }).

Method cards#

Each id has a MethodCard: one sentence, the formula, every parameter with its meaning, where it rounds, what it fits, and its known gaming vectors. baseline::cards() returns all of them, and MethodId::card() one:

for card in flexibility::baseline::cards() {
    println!("{}: {}", card.id, card.summary);
}
println!("{}", base.method().card().formula);
// baseline(isp) = round(Σ measured(i) / n) for the n ISPs i ending gap ISPs before the event's first ISP

The card is the text a contract or a register entry can cite. UFTP's BaselineReference field carries the id (see UFTP).

Gaming#

A baseline is a number the seller can influence before the event. These are the vectors the cards name, and what closes each:

MethodVectorClosed by
dprognosis@1the seller writes a high prognosisnothing in the method; compare prognoses with metered days using accuracy::score
schedule@1declare a schedule after the notificationthe contract's cut-off: the schedule's provenance carries its issue instant
mbma@1raise consumption just before the eventgap: the averaged ISPs end before the notification
xofy@1pick high daysthe caller filters the y days by rule before the event; the ranking is fixed
xofy@1inflate the adjustment windowthe window ends gap ISPs before the event, and the cap bounds the shift

dprognosis@1 is trivially gameable, because the seller writes it. It is here because UFTP uses the D-Prognosis as its default baseline and a DSO must be able to recompute a settlement made on it.