pub struct Envelope {
pub floor: Power,
pub ceiling: Power,
}Expand description
A closed interval of active power, load convention.
floor may be negative (the asset may be required to feed in or discharge)
and ceiling may be positive. An empty interval — floor > ceiling — is a
real and meaningful outcome: two rules that cannot both be satisfied. It is
resolved by Envelope::resolve, which keeps the stricter ceiling, because
exceeding a grid limit is worse than falling short of a floor.
Fields§
§floor: PowerThe lowest permitted power.
ceiling: PowerThe highest permitted power.
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn intersect(self, other: Self) -> Self
pub fn intersect(self, other: Self) -> Self
The intersection of two intervals — the operation the whole design rests on. Narrowing is the only thing any layer is allowed to do.
Sourcepub fn clamp(self, wanted: Power) -> Power
pub fn clamp(self, wanted: Power) -> Power
The value inside the interval closest to wanted.
When the interval is empty the ceiling wins: a grid or safety ceiling is a duty towards someone else, a floor is a comfort promise to the household, and breaking the second is recoverable.