pub struct PowerFlowJacobian { /* private fields */ }Expand description
The assembled sparse physical Jacobian, with its bus mappings and the machinery to update values in place.
Implementations§
Source§impl PowerFlowJacobian
impl PowerFlowJacobian
Sourcepub const fn matrix(&self) -> &SparseMatrix
pub const fn matrix(&self) -> &SparseMatrix
The 2n × 2n sparse matrix. Row k is active power at bus k, row
n + k reactive power; the columns follow
coordinates.
Sourcepub fn bus_ids(&self) -> &[BusId]
pub fn bus_ids(&self) -> &[BusId]
The bus behind row and column block position k, for both blocks of
both dimensions.
Sourcepub const fn coordinates(&self) -> VoltageCoordinates
pub const fn coordinates(&self) -> VoltageCoordinates
The selected voltage coordinates.
Sourcepub fn update(
&mut self,
instance: &AcPfInstance,
point: &OperatingPoint<BalancedNetwork>,
) -> Result<(), Error>
pub fn update( &mut self, instance: &AcPfInstance, point: &OperatingPoint<BalancedNetwork>, ) -> Result<(), Error>
Refresh the numerical values at a new operating point. The sparse
structure and the admittance parts are reused; topology changes
require a rebuild through calc_power_flow_jacobian.
§Errors
An operating point that does not share the instance’s network identities or does not state both voltage quantities.
Sourcepub fn from_admittance(
admittance: &YbusParts,
bus_ids: Vec<BusId>,
coordinates: VoltageCoordinates,
vm: &[f64],
va: &[f64],
) -> Result<Self, Error>
pub fn from_admittance( admittance: &YbusParts, bus_ids: Vec<BusId>, coordinates: VoltageCoordinates, vm: &[f64], va: &[f64], ) -> Result<Self, Error>
Assemble the Jacobian over a caller’s bus admittance matrix at the
voltages vm (per unit) and va (radians), in the matrix’s own bus
order. bus_ids names the bus behind each row; a preparation passes
its bus_ids with the matrix from its calc_admittance_matrix. The
values are the same functions of (G, B, vm, va) that
calc_power_flow_jacobian fills, so a solver that already holds
its admittance matrix and voltages builds the structure once here and
refreshes it with update_from_voltages
on every iteration, with no operating point or identity check.
§Errors
An admittance matrix that is not square, a conductance and
susceptance of different shapes, or bus_ids, vm or va whose
length is not the matrix side.
Sourcepub fn calc_bus_power_injection(
&self,
vm: &[f64],
va: &[f64],
) -> Result<BusPowerInjection, Error>
pub fn calc_bus_power_injection( &self, vm: &[f64], va: &[f64], ) -> Result<BusPowerInjection, Error>
The bus power injection S = diag(V) conj(Y V) over this Jacobian’s
admittance at the voltages vm (per unit) and va (radians) in bus
row order: the power flow mismatch’s network term. Pass the result to
update_from_injection to refresh the
Jacobian at the same voltages without forming the injection again, so
a Newton step computes it once for the mismatch and the Jacobian.
§Errors
vm or va whose length is not the bus count.
Sourcepub fn update_from_injection(
&mut self,
injection: &BusPowerInjection,
) -> Result<(), Error>
pub fn update_from_injection( &mut self, injection: &BusPowerInjection, ) -> Result<(), Error>
Refresh the numerical values at the voltages an injection from
calc_bus_power_injection was
formed at, reusing its currents and powers. The injection must come
from this Jacobian (or one assembled over the same admittance); the
values are those update_from_voltages
fills at the same voltages.
§Errors
An injection whose bus count is not this Jacobian’s.
Sourcepub fn update_from_voltages(
&mut self,
vm: &[f64],
va: &[f64],
) -> Result<(), Error>
pub fn update_from_voltages( &mut self, vm: &[f64], va: &[f64], ) -> Result<(), Error>
Refresh the numerical values at the voltages vm (per unit) and va
(radians) in bus row order. The sparse structure and admittance are
reused; this is the per iteration refresh of a Newton solve.
§Errors
vm or va whose length is not the bus count.