Settling

The settle phase: the DSO builds a FlexSettlement from its orders, the aggregator checks every item against the orders it accepted and answers Accepted or Disputed.

On this page

Each month (§2.6) the DSO sends a FlexSettlement: one item per order it placed, with the baseline, the measured power and what was delivered. The aggregator checks the items against its own record of the orders. It accepts or disputes each one in its FlexSettlementResponse (§3.10.1).

The DSO: one item per order#

let item = order.settlement(vec![SettlementIsp {
    span: IspSpan::new(69, 8)?,
    baseline_power: 400_000,
    ordered_flex_power: -300_000,
    actual_power: 120_000,
    delivered_flex_power: -280_000,
    power_deficiency: -20_000,
}])
.with_penalty("11.00".parse()?)?; // NetSettlement = Price − Penalty

let mut settlement = FlexSettlement::new(meta, first_day, last_day, Currency::EUR, vec![item]);
settlement.contract_settlements = contracts; // the 3.1.0 XSD requires one (SS-02)

order.settlement copies everything the item repeats from the order: OrderReference, Period, CongestionPoint, ContractID, D-PrognosisMessageID and BaselineReference. Its Price is the order's Price × ActivationFactor (partial activation). Without the order (in a test, say), FlexOrderSettlement::new(reference, period, point, price, isps) gives the same defaults.

The aggregator: check, then answer#

let settlement: FlexSettlement = opened.message().clone().try_into()?;
let answer: Message = match settlement.check_against(&accepted_orders) {
    Ok(statuses) => settlement.reply(Reply::accepted(new_id(), now), statuses).into(),
    Err(missing) => opened.reject(missing).response(new_id(), now).expect("a rule answer"),
};

Pass every order you accepted. check_against keeps those between the settlement's two parties within PeriodStart…PeriodEnd, and matches items to them by OrderReference, never by MessageID.

  • An order of the period that no item settles rejects the whole message with Missing Settlement Items.
  • Otherwise every item gets a status. It is Disputed, with a sentence naming the first difference, when:
    • it has no OrderReference, or its order was already settled by an earlier item;
    • no accepted order has its reference;
    • its Period, CongestionPoint or Currency differs from the order's;
    • its Price is 0.0001 or more away from the order's Price × ActivationFactor;
    • its NetSettlement is not Price − Penalty;
    • it settles an ISP the order does not cover;
    • its OrderedFlexPower is a watt or more away from the order's power × ActivationFactor.
  • All other items are Accepted. A settlement whose items are all disputed is still answered Accepted as a message: a disagreement is a dispute, not a rejection (§4.2.29).

uftp does not check what the DSO computes (delivered power, deficiency, penalty). Where your accounting disagrees, replace the status with item.dispute("Our meter reads …").

Partial activation#

An order at ActivationFactor 0.80 copies the option's ISPs and price unchanged (§4.2.24). The factor is applied once, at settlement, to the power and the price (§2.4.4, SS-26):

Option and orderSettlement item
Power −300 000 W, Price 95.00OrderedFlexPower −240 000 W, Price 76.00

The check compares with the exact product and accepts a price within one 0.0001 step and a power within one watt of it. order.settlement rounds the price half to even and keeps the order price's decimals.

Signs#

Every power is in watts, positive for consumption (§4.2.1). The specification gives DeliveredFlexPower and PowerDeficiency no sign of their own. uftp gives them the sign of OrderedFlexPower:

An order of 300 kW less, 280 kW deliveredWatts
OrderedFlexPower−300 000
DeliveredFlexPower−280 000
PowerDeficiency−20 000

Penalty is positive, because NetSettlement = Price − Penalty (§4.2.28). The §2.6.2 example writes magnitudes and a negative penalty instead; agree the reading with your counterpart (SS-25). A power outside the 64-bit range is refused when parsed.

Limits of the 3.1.0 schema#

  • SS-02. A settlement needs at least one ContractSettlement.
  • SS-20. It carries no TimeZone or ISP length, so its ISP numbers are read in the market's grid.
  • SS-23. The PDF lists ContractSettlementStatus elements in the response; the XSD has none, so contract settlements cannot be disputed item by item.
  • SS-24. The XSD makes OrderReference optional on the item. An item without one is disputed, because it cannot be matched.