#[non_exhaustive]pub struct McOpfDroop {
pub monitors: Vec<(usize, Option<usize>)>,
pub knots: Vec<f64>,
pub values: Vec<f64>,
pub epsilon: f64,
}Expand description
Smooth clipped piecewise-linear controller, with SI-derived per-unit knots.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.monitors: Vec<(usize, Option<usize>)>Voltage-difference terminal pairs; None means physical ground. Multiple pairs use averaged magnitudes.
knots: Vec<f64>Strictly increasing voltage knots divided by V_base.
values: Vec<f64>Control power at each knot, divided by S_base.
epsilon: f64Positive softplus smoothing width in per-unit voltage.
Implementations§
Source§impl McOpfDroop
impl McOpfDroop
Sourcepub fn calc_terms(&self) -> McOpfDroopTerms
pub fn calc_terms(&self) -> McOpfDroopTerms
The curve’s terms, the one statement of the smoothed piecewise linear
curve: calc_control sums them and a symbolic
model builds its expression from them.
Sourcepub fn calc_monitored_voltage(&self, voltage: &[Complex64]) -> f64
pub fn calc_monitored_voltage(&self, voltage: &[Complex64]) -> f64
The mean monitored voltage magnitude: |V_p − V_n| over the monitor
pairs (V_n = 0 for ground), averaged, from per unit terminal
voltages indexed like the preparation’s terminals.
Sourcepub fn calc_control(&self, voltage: f64) -> McOpfDroopValue
pub fn calc_control(&self, voltage: f64) -> McOpfDroopValue
The curve’s control power at the monitored voltage voltage and its
slope: the piecewise linear curve through (knots, values) with each
corner smoothed by a softplus of width epsilon,
c(v) = values₀ + Σⱼ sⱼ ε (softplus((v − kⱼ)/ε) − softplus((v − kⱼ₊₁)/ε)),
sⱼ = (valuesⱼ₊₁ − valuesⱼ) / (kⱼ₊₁ − kⱼ).The one droop evaluation: the OPF residual, its validation and its parameter sensitivities read it.
Sourcepub fn calc_parameter_derivative(
&self,
voltage: f64,
d_knots: &[f64],
d_values: &[f64],
d_epsilon: f64,
) -> McOpfDroopValue
pub fn calc_parameter_derivative( &self, voltage: f64, d_knots: &[f64], d_values: &[f64], d_epsilon: f64, ) -> McOpfDroopValue
The directional derivative of calc_control
along a change (d_knots, d_values, d_epsilon) of the curve’s
parameters, at a fixed monitored voltage: the change of the control
power (value) and of its voltage slope (slope).
§Panics
When d_knots or d_values is shorter than the curve.