#[non_exhaustive]pub struct Branch {Show 21 fields
pub from: BusId,
pub to: BusId,
pub r: f64,
pub x: f64,
pub b: f64,
pub charging: Option<BranchCharging>,
pub rate_a: f64,
pub rate_b: f64,
pub rate_c: f64,
pub rating_sets: Vec<BranchRatingSet>,
pub current_ratings: Option<BranchCurrentRatings>,
pub tap: f64,
pub shift: f64,
pub in_service: bool,
pub angmin: f64,
pub angmax: f64,
pub control: Option<TransformerControl>,
pub solution: Option<BranchSolution>,
pub uid: Option<String>,
pub route: Option<Vec<Location>>,
pub extras: BTreeMap<String, Value>,
}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.from: BusId§to: BusId§r: f64Series resistance (p.u.).
x: f64Series reactance (p.u.).
b: f64MATPOWER compatible total line charging susceptance (p.u.). This is the
legacy total projection; when charging is present,
per terminal admittance is canonical and this field is compatibility data.
charging: Option<BranchCharging>Per terminal shunt admittance (p.u.). If absent, derive symmetric
susceptance from b.
rate_a: f64§rate_b: f64§rate_c: f64§rating_sets: Vec<BranchRatingSet>Additional MVA rating sets beyond A/B/C. Matrix builders continue to use
rate_a unless they opt into one of these named sets.
current_ratings: Option<BranchCurrentRatings>Current ratings, when the source distinguishes them from MVA ratings.
tap: f64Tap ratio, MATPOWER convention: 0 means “no tap” (a line), treated as 1.
shift: f64Phase shift (degrees).
in_service: bool§angmin: f64§angmax: f64§control: Option<TransformerControl>Regulating-transformer control data, when this branch is a transformer
under automatic tap or phase control. None for lines and for fixed-ratio
transformers. #[serde(default)] so JSON written before the field existed
still deserializes.
solution: Option<BranchSolution>Solved branch flow values, when present in a case snapshot.
uid: Option<String>Stable row identity; see Bus::uid.
route: Option<Vec<Location>>Polyline route in the network’s coordinate space (BalancedNetwork.geo),
present only when a source provides intermediate geometry; endpoint
only rendering derives from the bus locations. #[serde(default)] so
JSON written before the field existed still deserializes.
extras: BTreeMap<String, Value>Implementations§
Source§impl Branch
impl Branch
pub fn new(from: BusId, to: BusId, r: f64, x: f64) -> Branch
Sourcepub fn effective_tap(&self) -> f64
pub fn effective_tap(&self) -> f64
Effective tap ratio (0 ⇒ 1).
Sourcepub fn divisible_tap(&self, row: usize) -> Result<f64, Error>
pub fn divisible_tap(&self, row: usize) -> Result<f64, Error>
effective_tap for a builder that divides by it,
which the remap of an exact 0.0 does not make safe on its own.
§Errors
Error::DegenerateTap under
MIN_DIVISIBLE_MAGNITUDE, where a
tap scales an admittance past anything a matrix can carry. row only
labels the error.
Sourcepub fn terminal_charging(&self) -> BranchCharging
pub fn terminal_charging(&self) -> BranchCharging
Per terminal shunt admittance, deriving the legacy symmetric MATPOWER charging model when the richer field is absent.
Sourcepub fn series_admittance(&self, row: usize) -> Result<Option<(f64, f64)>, Error>
pub fn series_admittance(&self, row: usize) -> Result<Option<(f64, f64)>, Error>
Series admittance (g, b) = (r, −x) / (r² + x²) of the branch pi
model, the primitive beside effective_tap and
terminal_charging. Ok(None) for a zero
impedance branch — one whose impedance magnitude is under
MIN_DIVISIBLE_MAGNITUDE; the
caller decides whether that is a skip or an error.
§Errors
Error::NonFiniteSusceptance when r/x are NaN/Inf, so a bad
value cannot write NaN or a silent zero downstream. row only labels
the error.
Sourcepub fn synthesize_rate_a(
&self,
angle_window_rad: f64,
fr_vmax: f64,
to_vmax: f64,
) -> f64
pub fn synthesize_rate_a( &self, angle_window_rad: f64, fr_vmax: f64, to_vmax: f64, ) -> f64
Apparent power bound, per unit, for a branch the source left unrated
(rate_a == 0, which reads as unlimited). angle_window_rad is the
widest angle difference the branch may hold, in radians. That window
and the two terminal voltage ceilings give the widest voltage phasor
difference the branch can hold. The difference over |Z| bounds the
current, and the larger ceiling turns the current into power. Returns
0.0 for a zero impedance branch — one under
MIN_DIVISIBLE_MAGNITUDE, the
bound the rest of the builders divide by — which stays unlimited.
The caller supplies the window in radians, because
angmin and angmax are degrees in
the neutral model and radians in a normalized network, and a branch
cannot tell which it holds. Convert them with
IndexedNetwork::angle_radians,
which reads the convention of the network. The method takes the
magnitude of the window and holds it at π, the widest phasor
separation two terminals can have.
Sourcepub fn total_charging_b(&self) -> f64
pub fn total_charging_b(&self) -> f64
Total susceptance projection for MATPOWER shaped formats that only carry one line charging value.
Sourcepub fn has_non_matpower_charging(&self) -> bool
pub fn has_non_matpower_charging(&self) -> bool
Whether this branch has charging that a MATPOWER branch row cannot carry.
Sourcepub fn is_transformer(&self) -> bool
pub fn is_transformer(&self) -> bool
A transformer iff the raw tap field is nonzero (an explicit 1 counts) or
there is a phase shift.
Sourcepub fn has_angle_limits(&self) -> bool
pub fn has_angle_limits(&self) -> bool
True when the branch constrains its angle difference, i.e. the limits deviate from the ±360° “unconstrained” default. Formats without angle limit fields (PSS/E, PowerWorld) use this to warn on what they drop.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Branch
impl<'de> Deserialize<'de> for Branch
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Branch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Branch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Branch
impl JsonSchema for Branch
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more