Skip to main content

Module units

Module units 

Source
Expand description

Exact physical and monetary quantities.

Only physically meaningful operations exist: power × duration is energy, energy × price is money, capacity price × power × duration is money. Adding power to energy does not compile. Same-unit arithmetic is checked: overflow yields None, never a wrapped value.

ⓘ
use flexpool_core::{Kw, Kwh};
use rust_decimal::Decimal;
let _ = Kw::new(Decimal::ONE).checked_add(Kwh::new(Decimal::ONE));

Structs§

Eur
Money in euros, kept at full precision until Eur::round_cents.
EurPerMwPerH
Capacity price in euros per megawatt and hour (FCR, aFRR capacity).
EurPerMwh
Energy price in euros per megawatt-hour (day-ahead, intraday, aFRR energy).
Kw
Power in kilowatts. Positive is consumption (import), negative is feed-in (export).
Kwh
Energy in kilowatt-hours.

Functions§

parse_plain
Parses a plain decimal as written in data files: optional minus, digits, optional fraction. Underscores, exponents, a leading + and whitespace are refused — 1_0.5 is not 10.5.