#[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
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
impl AcBranchData
Sourcepub fn calc_branch_admittance(&self, branch: usize) -> [Complex64; 4]
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_towith 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.
Sourcepub fn calc_branch_admittance_series_derivative(
&self,
branch: usize,
) -> [[Complex64; 4]; 2]
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.
Sourcepub fn calc_branch_flows(&self, vm: &[f64], va: &[f64]) -> AcBranchFlows
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.
Sourcepub fn calc_branch_flow_partials(
&self,
branch: usize,
vm: &[f64],
va: &[f64],
) -> ([Complex64; 4], [Complex64; 4])
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.
Sourcepub fn clear_jumper_charging(
&mut self,
max_impedance_squared: f64,
) -> Vec<usize>
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.
Sourcepub fn calc_admittance_matrix(
&self,
n: usize,
g_s: &[f64],
b_s: &[f64],
) -> YbusParts
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.