pub struct OperatingNomogram {
pub name: String,
pub index_flowgate: String,
pub constrained_flowgate: String,
pub points: Vec<(f64, f64)>,
pub in_service: bool,
}Expand description
A piecewise-linear operating nomogram: restricts one flowgate’s MW limit based on the real-time MW flow measured on a second “index” flowgate.
The points vector is a sorted list of (index_flow_mw, constrained_limit_mw)
pairs defining the nomogram curve. evaluate(index_flow_mw) performs
piecewise-linear interpolation with flat extrapolation at the endpoints.
§Example
use surge_network::network::OperatingNomogram;
let nom = OperatingNomogram {
name: "NomA".into(),
index_flowgate: "FG_North".into(),
constrained_flowgate: "FG_South".into(),
points: vec![(-500.0, 1000.0), (0.0, 800.0), (500.0, 500.0)],
in_service: true,
};
assert!((nom.evaluate(250.0) - 650.0).abs() < 1e-9);Fields§
§name: StringHuman-readable name.
index_flowgate: StringName of the flowgate whose flow is used as the x-axis input.
constrained_flowgate: StringName of the flowgate whose MW limit is tightened by this nomogram.
points: Vec<(f64, f64)>Sorted (index_flow_mw, constrained_limit_mw) breakpoints.
Must have at least one point. Need not cover the full operating range; out-of-range inputs are clamped to the nearest endpoint (flat extrapolation).
in_service: boolWhether this nomogram is actively enforced.
Implementations§
Source§impl OperatingNomogram
impl OperatingNomogram
Sourcepub fn evaluate(&self, index_flow_mw: f64) -> f64
pub fn evaluate(&self, index_flow_mw: f64) -> f64
Evaluate the nomogram: return the constrained flowgate’s MW limit
given index_flow_mw on the index flowgate.
Uses piecewise-linear interpolation between breakpoints, with flat
extrapolation outside the defined range. Returns f64::INFINITY if
points is empty (no constraint).
Trait Implementations§
Source§impl Clone for OperatingNomogram
impl Clone for OperatingNomogram
Source§fn clone(&self) -> OperatingNomogram
fn clone(&self) -> OperatingNomogram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more