Skip to main content

DcOpfPreparation

Struct DcOpfPreparation 

Source
#[non_exhaustive]
pub struct DcOpfPreparation {
Show 20 fields pub name: String, pub n_buses: usize, pub n_source_generators: usize, pub n_source_branches: usize, pub base_mva: f64, pub units: Units, pub formula: BranchSusceptanceFormula, pub objective: PreparedObjective, pub skip_zero_impedance: bool, pub synthesize_unrated_limits: bool, pub correct_angle_difference_bounds: bool, pub bus_ids: Vec<BusId>, pub bus_analysis_rows: Vec<usize>, pub bus_source_rows: Vec<Option<usize>>, pub reference_buses: ReferenceBuses, pub p_d: Vec<f64>, pub g_s: Vec<f64>, pub p_shift: Vec<f64>, pub generators: DcGeneratorParameters, pub branches: DcBranchParameters,
}
Expand description

Matrix free DC OPF input data.

A problem instance is complete numerical input for one problem family. It is separate from the source network, a matrix projection, a solver formulation, and a solution.

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.
§name: String§n_buses: usize§n_source_generators: usize§n_source_branches: usize§base_mva: f64§units: Units§formula: BranchSusceptanceFormula

Formula used to calculate each branch susceptance.

§objective: PreparedObjective

The objective represented by the generator cost columns.

§skip_zero_impedance: bool§synthesize_unrated_limits: bool

Whether zero and negative source thermal ratings were replaced with synthesized limits while assembling this instance.

#[serde(default)] keeps documents written before this field readable; their limits retain the old unsynthesized meaning.

§correct_angle_difference_bounds: bool

Whether PowerModels’ angle difference correction was applied.

§bus_ids: Vec<BusId>

Dense bus index to external bus ID.

§bus_analysis_rows: Vec<usize>

Dense bus index to row in the star-lowered analysis network.

§bus_source_rows: Vec<Option<usize>>

Dense bus index to source bus row. A synthetic star bus has no source row; an explicitly isolated source bus has no dense row here.

§reference_buses: ReferenceBuses§p_d: Vec<f64>

Nodal active demand in dense bus order.

§g_s: Vec<f64>

Nodal shunt conductance in dense bus order.

The DC power flow model holds voltage magnitude at one per unit, so a shunt draws the constant real power g_s and does not depend on the angle. It belongs in the injection: the bus susceptance matrix keeps zero row sums and carries no shunt. A nodal balance subtracts it beside Self::p_d, as MATPOWER runpf does.

§p_shift: Vec<f64>

Nodal phase shift injection in dense bus order. The complete fixed withdrawal in L theta = Cg pg - fixed is p_d + g_s + p_shift.

§generators: DcGeneratorParameters§branches: DcBranchParameters

Implementations§

Source§

impl DcOpfPreparation

Source

pub fn n_generators(&self) -> usize

Source

pub fn n_branches(&self) -> usize

Source

pub fn calc_fixed_nodal_withdrawal(&self) -> Vec<f64>

Fixed nodal withdrawal in dense bus order.

With A oriented from bus to bus and L = A diag(b) A^T, the DC balance is L theta = Cg pg - (p_d + g_s + p_shift).

Source

pub fn calc_branch_flow_offset(&self) -> Vec<f64>

Fixed branch flow offset in active branch column order.

The complete branch flow over this preparation’s internal positive weights is f = diag(b) A^T theta + branch_flow_offset, where the offset is -b * shift elementwise. In the public PowerModels sign spelling the same flow is p_branch = -Bf va + b .* shift with the negated susceptances (crate::DcOperators emits that form); the two agree term for term because this b is the negation of the public one.

Source

pub fn calc_nodal_generator_data(&self) -> Result<NodalGeneratorParameters>

Project generator cost and bounds to bus space.

The bounds at a bus are the sum of the generator bounds, which is the range the bus total can reach. The cost curves at a bus combine by the parallel rule q = 1 / Σ(1/qᵢ), the curve that the least cost split of the bus total follows. That combination is an approximation: it agrees with generator space only while the split stays inside the bound of each generator. A bus with one generator keeps that generator’s own coefficients.

Trait Implementations§

Source§

impl Clone for DcOpfPreparation

Source§

fn clone(&self) -> DcOpfPreparation

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 DcOpfPreparation

Source§

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

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

impl<'de> Deserialize<'de> for DcOpfPreparation

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 DcOpfPreparation

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DcOpfPreparation

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 DcOpfPreparation

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 = 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.
§

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

§

fn vzip(self) -> V