Skip to main content

OpfSolution

Struct OpfSolution 

Source
pub struct OpfSolution {
Show 30 fields pub opf_type: OpfType, pub base_mva: f64, pub power_flow: PfSolution, pub total_cost: f64, pub total_load_mw: f64, pub total_generation_mw: f64, pub total_losses_mw: f64, pub generators: OpfGeneratorResults, pub pricing: OpfPricing, pub branches: OpfBranchResults, pub devices: OpfDeviceDispatch, pub par_results: Vec<ParResult>, pub virtual_bid_results: Vec<VirtualBidResult>, pub benders_cut_duals: Vec<f64>, pub objective_terms: Vec<ObjectiveTerm>, pub audit: SolutionAuditReport, pub bus_q_slack_pos_mvar: Vec<f64>, pub bus_q_slack_neg_mvar: Vec<f64>, pub bus_p_slack_pos_mw: Vec<f64>, pub bus_p_slack_neg_mw: Vec<f64>, pub vm_slack_high_pu: Vec<f64>, pub vm_slack_low_pu: Vec<f64>, pub angle_diff_slack_high_rad: Vec<f64>, pub angle_diff_slack_low_rad: Vec<f64>, pub solve_time_secs: f64, pub iterations: Option<u32>, pub solver_name: Option<String>, pub solver_version: Option<String>, pub ac_opf_timings: Option<AcOpfTimings>, pub nlp_trace: Option<NlpTrace>,
}
Expand description

Result of an Optimal Power Flow computation.

Fields§

§opf_type: OpfType

OPF formulation type; required for correct interpretation of all other fields.

§base_mva: f64

System MVA base used to convert MW/MVAr values to per-unit.

§power_flow: PfSolution

Underlying power flow solution (voltages, injections, branch flows).

§total_cost: f64

Total objective cost for the solved interval (dollars).

§total_load_mw: f64

Total system load (MW).

§total_generation_mw: f64

Total generation (MW).

§total_losses_mw: f64

Total system losses (MW). Zero for DC-OPF.

§generators: OpfGeneratorResults

Generator dispatch and dual values.

§pricing: OpfPricing

LMP decomposition.

§branches: OpfBranchResults

Branch-level results and constraint duals.

§devices: OpfDeviceDispatch

FACTS device, storage, and transformer dispatch.

§par_results: Vec<ParResult>

PAR implied shift angles.

§virtual_bid_results: Vec<VirtualBidResult>

Virtual bid clearing results.

§benders_cut_duals: Vec<f64>

Benders cut dual values from AC-SCOPF.

§objective_terms: Vec<ObjectiveTerm>

Exact objective decomposition.

§audit: SolutionAuditReport

Persisted exact-audit status for this solution payload.

§bus_q_slack_pos_mvar: Vec<f64>

Per-bus reactive-power balance slack (positive direction, MVAr). Entry i corresponds to bus index i in the network. Non-empty only when bus_reactive_power_balance_slack_penalty_per_mvar > 0.

§bus_q_slack_neg_mvar: Vec<f64>

Per-bus reactive-power balance slack (negative direction, MVAr).

§bus_p_slack_pos_mw: Vec<f64>

Per-bus active-power balance slack (positive direction, MW).

§bus_p_slack_neg_mw: Vec<f64>

Per-bus active-power balance slack (negative direction, MW).

§vm_slack_high_pu: Vec<f64>

Per-bus voltage-magnitude high slack (pu), one per bus. σ_high[i] = max(0, vm[i] - vm_max[i]). Non-empty only when voltage_magnitude_slack_penalty_per_pu > 0.

§vm_slack_low_pu: Vec<f64>

Per-bus voltage-magnitude low slack (pu), one per bus. σ_low[i] = max(0, vm_min[i] - vm[i]).

§angle_diff_slack_high_rad: Vec<f64>

Per-branch angle-difference high slack (radians), indexed by network branch order. sigma_high[i] allows Va_from - Va_to to exceed angmax by this amount. Non-empty only when angle_difference_slack_penalty_per_rad > 0.

§angle_diff_slack_low_rad: Vec<f64>

Per-branch angle-difference low slack (radians), indexed by network branch order. sigma_low[i] allows Va_from - Va_to to go below angmin by this amount.

§solve_time_secs: f64

Total solve time in seconds.

§iterations: Option<u32>

Number of solver iterations, when the backend exposes it.

§solver_name: Option<String>

Name of the LP/NLP solver (e.g. "HiGHS", "Gurobi", "Ipopt").

§solver_version: Option<String>

Version string of the solver.

§ac_opf_timings: Option<AcOpfTimings>

Per-phase timing breakdown within the OPF solve.

§nlp_trace: Option<NlpTrace>

NLP solver stats and final-iterate diagnostics. Populated by the NLP backend (Ipopt today). Captures problem size, termination status, and residuals/barrier at the final iterate so post-mortem analysis can distinguish convergence/infeasibility/iteration-limit cases without parsing log strings.

Implementations§

Source§

impl OpfSolution

Source

pub fn audit(&self) -> &SolutionAuditReport

Persisted exact-audit status stored on the serialized solution payload.

Source

pub fn has_objective_ledger(&self) -> bool

Whether this solution carries an exact objective ledger that can be audited.

Source

pub fn refresh_audit(&mut self)

Recompute and store the persisted audit block from the exact objective ledger. Gated by the SURGE_OBJECTIVE_AUDIT env var — see crate::objective_audit_enabled. When the gate is off (the default), this is a no-op and the audit field stays at its serde default.

Source

pub fn objective_ledger_mismatches(&self) -> Vec<ObjectiveLedgerMismatch>

Return every objective-ledger mismatch found on this OPF solution.

Source

pub fn objective_ledger_is_consistent(&self) -> bool

Whether the OPF solution’s exact objective ledger reconciles cleanly.

Trait Implementations§

Source§

impl AuditableSolution for OpfSolution

Source§

impl Clone for OpfSolution

Source§

fn clone(&self) -> OpfSolution

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 OpfSolution

Source§

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

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

impl Default for OpfSolution

Source§

fn default() -> OpfSolution

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

impl<'de> Deserialize<'de> for OpfSolution

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 OpfSolution

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