Skip to main content

AcBranchData

Struct AcBranchData 

Source
#[non_exhaustive]
pub struct AcBranchData {
Show 19 fields pub identities: Vec<String>, pub from_bus: Vec<usize>, pub to_bus: Vec<usize>, pub g: Vec<f64>, pub b: Vec<f64>, pub g_fr: Vec<f64>, pub b_fr: Vec<f64>, pub g_to: Vec<f64>, pub b_to: Vec<f64>, pub tap: Vec<f64>, pub shift: Vec<f64>, pub s_max: Vec<f64>, pub angle_min: Vec<f64>, pub angle_max: Vec<f64>, pub analysis_rows: Vec<usize>, pub analysis_sources: Vec<AnalysisBranchSource>, pub skipped_zero_impedance: Vec<usize>, pub thermal_limit_active: Vec<bool>, pub angle_bound_active: Vec<bool>,
}
Expand description

Branch data in active branch column order.

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.
§identities: Vec<String>

Stable branch identity aligned with every following column.

§from_bus: Vec<usize>§to_bus: Vec<usize>§g: Vec<f64>

Series conductance r / (r² + x²) in the selected admittance unit.

§b: Vec<f64>

Series susceptance −x / (r² + x²) in the selected admittance unit.

§g_fr: Vec<f64>

Charging conductance at the from terminal.

§b_fr: Vec<f64>

Charging susceptance at the from terminal.

§g_to: Vec<f64>

Charging conductance at the to terminal.

§b_to: Vec<f64>

Charging susceptance at the to terminal.

§tap: Vec<f64>

Tap ratio magnitude; one for a line. Kept separate from shift so a consumer stamps the complex tap itself.

§shift: Vec<f64>

Phase shift in radians.

§s_max: Vec<f64>

Apparent power limit in the selected power unit. Zero is a finite bound; positive infinity is unlimited. Check thermal_limit_active.

§angle_min: Vec<f64>

Selected branch angle bounds in radians; absent sides are infinities.

§angle_max: Vec<f64>§analysis_rows: Vec<usize>

Branch column to row in the star-lowered analysis network.

§analysis_sources: Vec<AnalysisBranchSource>

Source component for each analysis branch column. Lowered transformer windings remain mapped to their typed transformer row and winding.

§skipped_zero_impedance: Vec<usize>

Analysis branch rows omitted because r² + x² = 0.

§thermal_limit_active: Vec<bool>

Whether the instance activates each apparent power limit.

§angle_bound_active: Vec<bool>

Whether the instance activates each angle difference bound.

Implementations§

Source§

impl AcBranchData

Source

pub fn len(&self) -> usize

Number of active branch columns.

Source

pub fn is_empty(&self) -> bool

Whether the preparation carries no active branch.

Source

pub fn calc_branch_admittance(&self, branch: usize) -> [Complex64; 4]

The branch’s 2×2 pi model admittance block [Yff, Yft, Ytf, Ytt] in the preparation’s admittance unit, from its series admittance, terminal charging, tap and shift columns:

Yff = (y + y_fr) / tap²    Yft = -y / conj(t)
Ytf = -y / t               Ytt = y + y_to

with y = g + j b and t = tap e^{j shift}. These are the entries calc_admittance_matrix stamps for the same branch.

§Panics

Panics if branch is not an active branch column.

Source

pub fn calc_branch_admittance_series_derivative( &self, branch: usize, ) -> [[Complex64; 4]; 2]

The derivatives of Self::calc_branch_admittance for branch with respect to its series conductance g and series susceptance b, as [d/dg, d/db], each a [Yff, Yft, Ytf, Ytt] block. The pi model block is linear in the series admittance and does not depend on it through the charging, so each derivative is the block of a unit series admittance (1 for g, j for b) with no charging, at the branch’s tap and shift: the same one block formula, evaluated there.

§Panics

Panics if branch is not an active branch column.

Source

pub fn calc_branch_flows(&self, vm: &[f64], va: &[f64]) -> AcBranchFlows

The terminal flows of every active branch at the bus voltages vm (per unit) and va (radians), both in dense bus order:

S_f = V_f conj(Yff V_f + Yft V_t)
S_t = V_t conj(Ytf V_f + Ytt V_t)

over Self::calc_branch_admittance.

§Panics

Panics if vm and va differ in length or do not cover every bus a branch column names.

Source

pub fn calc_branch_flow_partials( &self, branch: usize, vm: &[f64], va: &[f64], ) -> ([Complex64; 4], [Complex64; 4])

The partials of branch column branch’s terminal powers (Self::calc_branch_flows) with respect to the polar voltages of its two buses, at vm (per unit) and va (radians) in dense bus order: (dS_from, dS_to), each ordered [d/dva_from, d/dvm_from, d/dva_to, d/dvm_to], with S = p + j q. The branch flow Jacobian dSbr/dV row by row, over the same pi model block and terminal currents.

§Panics

Panics if branch is not an active branch column or vm/va do not cover its buses.

Source

pub fn clear_jumper_charging( &mut self, max_impedance_squared: f64, ) -> Vec<usize>

Zero the terminal charging of every near ideal jumper: a branch whose series impedance satisfies |z|² = 1 / (g² + b²) <= max_impedance_squared. The series admittance is kept. Returns the affected branch columns in ascending order.

A jumper’s charging is a modeling artifact next to its very large series admittance, and stamping both can leave a badly conditioned admittance matrix. Apply this to a preparation before AcOpfPreparation::calc_admittance_matrix or AcPfPreparation::calc_admittance_matrix so the matrix, the flows of Self::calc_branch_flows and every formulation over these columns agree on the edited branches.

Source

pub fn calc_admittance_matrix( &self, n: usize, g_s: &[f64], b_s: &[f64], ) -> YbusParts

Stamp the bus admittance matrix of these branches and the bus shunts g_s + j b_s over n dense buses, keeping an explicit entry at every diagonal position, through the same accumulator as calc_admittance_matrix. With zero shunts it is the branch admittance alone, whose injection V conj(Y V) is the power each bus sends into its branches.

§Panics

Panics if a branch endpoint is >= n or g_s/b_s is shorter than n.

Trait Implementations§

Source§

impl Clone for AcBranchData

Source§

fn clone(&self) -> Self

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 AcBranchData

Source§

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

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

impl<'de> Deserialize<'de> for AcBranchData

Source§

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

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

impl PartialEq for AcBranchData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AcBranchData

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AcBranchData

Auto Trait Implementations§

Blanket Implementations§

§

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

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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