pub struct PfSolution {Show 21 fields
pub pf_model: PfModel,
pub status: SolveStatus,
pub iterations: u32,
pub max_mismatch: f64,
pub solve_time_secs: f64,
pub voltage_magnitude_pu: Vec<f64>,
pub voltage_angle_rad: Vec<f64>,
pub active_power_injection_pu: Vec<f64>,
pub reactive_power_injection_pu: Vec<f64>,
pub branch_p_from_mw: Vec<f64>,
pub branch_p_to_mw: Vec<f64>,
pub branch_q_from_mvar: Vec<f64>,
pub branch_q_to_mvar: Vec<f64>,
pub bus_numbers: Vec<u32>,
pub island_ids: Vec<usize>,
pub q_limited_buses: Vec<u32>,
pub n_q_limit_switches: u32,
pub gen_slack_contribution_mw: Vec<f64>,
pub convergence_history: Vec<(u32, f64)>,
pub worst_mismatch_bus: Option<u32>,
pub area_interchange: Option<AreaInterchangeResult>,
}Expand description
Result of a power flow computation.
Fields§
§pf_model: PfModelPhysical model family used to produce this solved state.
status: SolveStatusSolve status.
iterations: u32Number of iterations taken.
max_mismatch: f64Maximum power mismatch at convergence (per-unit).
solve_time_secs: f64Solve time in seconds.
voltage_magnitude_pu: Vec<f64>Bus voltage magnitudes in per-unit (indexed by internal bus order).
voltage_angle_rad: Vec<f64>Bus voltage angles in radians (indexed by internal bus order).
active_power_injection_pu: Vec<f64>Real power injection at each bus in per-unit.
reactive_power_injection_pu: Vec<f64>Reactive power injection at each bus in per-unit.
branch_p_from_mw: Vec<f64>Real power flow at each branch from-end in MW.
branch_p_to_mw: Vec<f64>Real power flow at each branch to-end in MW.
branch_q_from_mvar: Vec<f64>Reactive power flow at each branch from-end in MVAr.
branch_q_to_mvar: Vec<f64>Reactive power flow at each branch to-end in MVAr.
bus_numbers: Vec<u32>External bus numbers (for joining with reference solutions).
island_ids: Vec<usize>Island membership for each bus (0-indexed island ID, per internal bus order).
Empty when island detection was not performed. When populated, island_ids[i]
gives the connected-component index for internal bus i. Isolated buses
(degree 0) form their own single-bus island.
q_limited_buses: Vec<u32>External bus numbers of all buses that were switched from PV to PQ by reactive power limit enforcement during this solve.
Empty when the underlying AC solver did not enforce Q limits or no limits were violated. For DC solves this is always empty.
n_q_limit_switches: u32Total number of bus type switches (PV→PQ or PQ→PV) performed by Q-limit enforcement across all outer NR iterations.
Zero when no limits were enforced. For DC solves this is always zero.
gen_slack_contribution_mw: Vec<f64>Active power contribution of each generator to the slack balancing
redistribution, in MW (indexed by network.generators order).
Non-zero only when the originating AC solver used distributed slack. When multiple generators share a participating bus, the bus-level slack share is split per the solver’s slack-attribution policy instead of being duplicated onto every generator at that bus. For DC solves this is empty by construction.
convergence_history: Vec<(u32, f64)>Per-iteration convergence history: (iteration_number, max_mismatch_pu).
Empty unless the originating solver recorded it.
worst_mismatch_bus: Option<u32>External bus number with the largest power mismatch on the final solve
iteration. None on successful convergence.
area_interchange: Option<AreaInterchangeResult>Area interchange enforcement results. None when interchange
enforcement was not active.
Implementations§
Source§impl PfSolution
impl PfSolution
Sourcepub fn diverged(n_buses: usize, n_branches: usize, pf_model: PfModel) -> Self
pub fn diverged(n_buses: usize, n_branches: usize, pf_model: PfModel) -> Self
Create a diverged solution with flat voltage profile (Vm=1.0, Va=0.0).
Sourcepub fn flat_start(n_buses: usize, n_branches: usize, pf_model: PfModel) -> Self
pub fn flat_start(n_buses: usize, n_branches: usize, pf_model: PfModel) -> Self
Create an unsolved solution with flat voltage profile (Vm=1.0, Va=0.0).
Sourcepub fn generator_reactive_power_mvar(&self, network: &Network) -> Vec<f64>
pub fn generator_reactive_power_mvar(&self, network: &Network) -> Vec<f64>
Estimate per-generator reactive power output (MVAr) in network.generators order.
This reconstructs generator reactive dispatch from the solved bus-level
reactive injections, fixed bus shunts, and static bus load withdrawals.
For buses with multiple in-service generators, the bus-level reactive
output is apportioned by reactive capability range (qmax - qmin) when
available; otherwise it is split evenly across the in-service units at
that bus.
Sourcepub fn branch_apparent_power(&self) -> Vec<f64>
pub fn branch_apparent_power(&self) -> Vec<f64>
Compute apparent power flow |S_ij| on each branch in MVA.
Uses the stored from-end branch P/Q values (MW/MVAr).
Sourcepub fn branch_loading_pct(
&self,
network: &Network,
) -> Result<Vec<f64>, SolutionError>
pub fn branch_loading_pct( &self, network: &Network, ) -> Result<Vec<f64>, SolutionError>
Compute branch loading as percentage of Rate A for each branch.
Returns max(|S_from|, |S_to|) / rate_a * 100. Branches with
rate_a <= 0 return 0.0.
Sourcepub fn branch_pq_flows(&self) -> Vec<(f64, f64)>
pub fn branch_pq_flows(&self) -> Vec<(f64, f64)>
Return the stored from-end real and reactive power flows in MW/MVAr.
Trait Implementations§
Source§impl Clone for PfSolution
impl Clone for PfSolution
Source§fn clone(&self) -> PfSolution
fn clone(&self) -> PfSolution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more