Skip to main content

Module opf

Module opf 

Source
Expand description

DC-OPF instance data derived from the network’s generators and their cost curves: cost, bounds, thermal limits, the generator→bus map, and nodal load.

The paper treats generation as a nodal variable p_g ∈ ℝⁿ, so the canonical vectors here are bus-indexed (length n), formed by scattering the generator-space data through C_g. The generator-space vectors and C_g ride along so a MATPOWER-faithful per-generator formulation can be reconstructed exactly.

Structs§

BusCosts
Length-n bus-indexed cost and bound vectors (paper form). All share index space; each is zero at buses with no generator.
GenCosts
Generator-space provenance (length n_gen, in C_g column order).
OpfInstance
Static DC-OPF instance data for a case.

Enums§

Units
Unit system for the emitted quantities.

Functions§

build_opf_instance
Build the OPF instance. Errors with Error::NoGenerators if the case has no in-service generators, Error::MissingGenCost if a generator has no cost row, or Error::UnsupportedCostModel if its cost is present but not a polynomial of degree ≤ 2.
cost_quadratic_diag
Q = diag(q) as a sparse matrix — the quadratic-cost analog of susceptance_diag. Feeds the DC-OPF QP objective ½ pᵀ Q p + cᵀ p consumed by the kkt interior-point operators.
project_gen_to_bus
Scatter-sum a generator-space vector onto buses: out = C_g v. Buses with several generators get the sum; one generator per bus is exact.