Skip to main content

Module uftp

Module uftp 

Source
Expand description

UFTP 3.1 in this crate’s shapes, behind the uftp feature: a FlexRequest as a DeviationEnvelope, a FlexOffer option or a FlexOrder as a deviation series, the FlexOrderSettlement item for an order, and the check a receiver can run on a settlement alone.

UFTP’s power sign is this crate’s: “A positive value indicates that power flows towards the prosumer (consumption)” [UFTP 3.1 § 4.2.1], so MinPower, MaxPower, ISP Power, BaselinePower, ActualPower and OrderedFlexPower map without change. The specification does not sign DeliveredFlexPower and PowerDeficiency, so every function that writes or checks them takes a FlexSign and none assumes one.

// A DSO settles an order and builds the item the aggregator's UFTP check accepts:
let order = order();
let ordered = uftp::ordered(&order, Rounding::HalfAwayFromZero)?;
let ours = settle(&baseline(ordered.grid()), &metered(ordered.grid()), &ordered, MeasurementPoint::ConnectionPoint)?;
let item = uftp::settlement(&order, &ours, FlexSign::AsOrdered)?;

// The aggregator checks a received item from its own fields:
for d in uftp::check(&item, FlexSign::AsOrdered)? {
    println!("{d}"); // ISP 71: PowerDeficiency sent 0 W, expected -1 MW
}

Re-exports§

pub use ::uftp as wire;

Structs§

Discrepancy
A received value the settlement rule does not give, or an ISP on one side only.

Enums§

FlexSign
How DeliveredFlexPower and PowerDeficiency are signed on the wire. There is no default: the UFTP specification does not say, so the contract must.
Kind
What a Discrepancy is.

Functions§

baseline_reference
The BaselineReference naming method: its id, such as mbma@1.
check
Checks received on its own: for every ISP, DeliveredFlexPower and PowerDeficiency must be what the settlement rule gives from the message’s BaselinePower, OrderedFlexPower and ActualPower. Returns every discrepancy, in ISP order; empty if the message is right.
compare
Compares received with ours, ISP by ISP: every field that differs, and ISPs on one side only. Returns every discrepancy, in ISP order; empty if they agree.
grid
The whole day a message’s header names: its Period, TimeZone and ISP-Duration.
isps
The settlement’s lines as UFTP ISP elements, one per ISP, numbered per day.
method_of
The method a BaselineReference names, or None for a reference this crate does not know. The reference is a method id and nothing else. UFTP defines no syntax for it, so a suffix such as xofy@1(x=4,y=5) is not read as xofy@1: its parameters would be a convention nobody defined.
ordered
The ordered deviation per ISP: the order’s ISP power × its ActivationFactor, in integers, rounded once as rounding says; 0 W in an ISP the order does not name. The ISP list is the offer’s, copied unchanged [UFTP 3.1 § 4.2.24], and OrderedFlexPower is “as per the referenced FlexOrder” [§ 4.2.28]; the uftp crate checks settlements the same way.
profile
The ISP elements of a FlexOffer option or a FlexOrder as a deviation per ISP, from the first to the last ISP they name; None in an ISP between them that none names (nothing is offered there), so DeviationEnvelope::check tells it from an offered 0 W.
request
A FlexRequest as bounds on the deviation per ISP of its day, with each ISP’s disposition. An ISP the request does not name has no band; an ISP without Disposition is Disposition::Unstated. The provenance is the sender’s domain, the message id and its timestamp.
settlement
The FlexOrderSettlement item for order, from our settlement of it: the order’s references and its price × ActivationFactor (wire::FlexOrder::settlement, spec note SS-26) and one ISP element per settled ISP the order covers. BaselineReference names our method when the order names none and no D-Prognosis. UFTP has no field for the measurement point; it stays in our receipt (Settlement::canonical).