Skip to main content

Branch

Struct Branch 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§from: BusId§to: BusId§r: f64

Series resistance (p.u.).

§x: f64

Series reactance (p.u.).

§b: f64

MATPOWER 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: f64

Tap ratio, MATPOWER convention: 0 means “no tap” (a line), treated as 1.

§shift: f64

Phase 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

Source

pub fn new(from: BusId, to: BusId, r: f64, x: f64) -> Branch

Source

pub fn effective_tap(&self) -> f64

Effective tap ratio (0 ⇒ 1).

Source

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.

Source

pub fn terminal_charging(&self) -> BranchCharging

Per terminal shunt admittance, deriving the legacy symmetric MATPOWER charging model when the richer field is absent.

Source

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.

Source

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.

Source

pub fn total_charging_b(&self) -> f64

Total susceptance projection for MATPOWER shaped formats that only carry one line charging value.

Source

pub fn has_non_matpower_charging(&self) -> bool

Whether this branch has charging that a MATPOWER branch row cannot carry.

Source

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.

Source

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 Clone for Branch

Source§

fn clone(&self) -> Branch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Branch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Branch

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Branch, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Branch

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Branch

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,