#[non_exhaustive]pub struct AcOpfPreparation {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 objective: PreparedObjective,
pub skip_zero_impedance: bool,
pub synthesize_unrated_limits: bool,
pub synthesized_limit_window: SynthesizedLimitWindow,
pub correct_angle_difference_bounds: bool,
pub angle_difference_bounds: Option<AngleDifferenceBounds>,
pub bus_ids: Vec<BusId>,
pub bus_analysis_rows: Vec<usize>,
pub bus_source_rows: Vec<Option<usize>>,
pub reference_buses: ReferenceBuses,
pub buses: AcBusData,
pub generators: AcGeneratorData,
pub storage: AcStorageData,
pub branches: AcBranchData,
}Expand description
Matrix free AC OPF input data on the branch pi model.
Units follow Units. Under Units::PerUnit, powers are per unit on
base_mva and admittances are per unit on the system base. Under
Units::Native, powers stay in MW/MVAr and every admittance vector is
scaled by base_mva, so power computed from admittances and per unit
voltages lands in MW/MVAr. Voltage magnitudes are per unit and angles are
radians in both systems. Relaxations of AC OPF, the SOC forms included,
consume this same preparation; the relaxation is a formulation choice
made downstream.
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.name: String§n_buses: usize§n_source_generators: usize§n_source_branches: usize§base_mva: f64§units: Units§objective: PreparedObjectiveThe objective represented by the generator cost columns.
skip_zero_impedance: bool§synthesize_unrated_limits: boolWhether absent source ratings were replaced with synthesized limits.
synthesized_limit_window: SynthesizedLimitWindowThe angle difference interval those limits span. Omitted from a document when it is the stated one, so earlier documents read the window they were built with.
correct_angle_difference_bounds: boolWhether PowerModels’ angle difference correction was applied.
angle_difference_bounds: Option<AngleDifferenceBounds>Which angle difference bounds angle_min and angle_max carry.
None only in a document written before the field existed, whose
correct_angle_difference_bounds says whether the pad 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§buses: AcBusData§generators: AcGeneratorData§storage: AcStorageData§branches: AcBranchDataImplementations§
Source§impl AcOpfPreparation
impl AcOpfPreparation
pub fn n_generators(&self) -> usize
Sourcepub fn calc_admittance_matrix(&self) -> YbusParts
pub fn calc_admittance_matrix(&self) -> YbusParts
The bus admittance matrix Y = G + jB of this preparation, in dense
bus order and the preparation’s admittance unit: every branch column’s
pi model block (AcBranchData::calc_branch_admittance) plus the bus
shunts buses.g_s + j buses.b_s, which already hold any self-loop’s
folded stamp. Every diagonal position is stored, as an explicit zero
where nothing stamps it.
It agrees with calc_admittance_matrix
over the analysis network, restricted to the prepared buses, but needs
no network view and no remapping from analysis rows.
pub fn n_branches(&self) -> usize
pub fn n_storage(&self) -> usize
Sourcepub fn calc_nodal_generator_data(&self) -> Result<NodalAcGeneratorData>
pub fn calc_nodal_generator_data(&self) -> Result<NodalAcGeneratorData>
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.
Sourcepub fn calc_vm_setpoints(&self) -> Vec<f64>
pub fn calc_vm_setpoints(&self) -> Vec<f64>
Conventional voltage magnitude start: the case voltage, overwritten by each generator’s positive setpoint in generator column order (last wins), with a non-positive case voltage falling back to 1.0.
The result is not clamped to [vm_min, vm_max];
calc_banded_vm_setpoints is the
clamped form a power flow holding these magnitudes reads.
Sourcepub fn calc_banded_vm_setpoints(&self) -> Vec<f64>
pub fn calc_banded_vm_setpoints(&self) -> Vec<f64>
calc_vm_setpoints with each bus that a
generator setpoint regulates held inside its [vm_min, vm_max] band.
A power flow holds a regulated magnitude at its setpoint with no
magnitude variable to bound it, so an out of band setpoint would pin
the bus at an infeasible magnitude. A band that is not usable (a non
finite or inverted bound) applies no clamp, and a bus no generator
regulates keeps its case voltage.