Skip to main content

PfSolution

Struct PfSolution 

Source
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: PfModel

Physical model family used to produce this solved state.

§status: SolveStatus

Solve status.

§iterations: u32

Number of iterations taken.

§max_mismatch: f64

Maximum power mismatch at convergence (per-unit).

§solve_time_secs: f64

Solve 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: u32

Total 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

Source

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).

Source

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).

Source

pub fn n_islands(&self) -> usize

Number of distinct islands detected in this solve.

Source

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.

Source

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).

Source

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.

Source

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

Source§

fn clone(&self) -> PfSolution

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 PfSolution

Source§

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

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

impl Default for PfSolution

Source§

fn default() -> PfSolution

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PfSolution

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 Serialize for PfSolution

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

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more