Skip to main content

Module matrix

Module matrix 

Source
Expand description

Sparse matrix calculations for power system cases.

DC OPF and sensitivity builders use the DC bus susceptance matrix L = A diag(b) Aᵀ, where A is the signed bus by branch incidence matrix (n×m) and b is the positive branch susceptance vector. Stored nonzero off diagonal entries are negative, diagonals are nonnegative, and diag = sum of |off-diagonal|; this is the M-matrix form SDDM solvers expect once the grounded matrix is positive definite.

Re-exports§

pub use laplacian::GroundedIndexMap;
pub use laplacian::calc_reference_indicator;
pub use laplacian::calc_unit_vector;
pub use laplacian::calc_weighted_laplacian;
pub use laplacian::ground_at;
pub use laplacian::ground_at_each;
pub use sensitivity::SensitivityMatrices;
pub use sensitivity::SensitivityMatrixMetadata;
pub use sensitivity::SensitivityMetadata;
pub use sensitivity::SensitivityOptions;
pub use sensitivity::SensitivitySolver;
pub use sensitivity::SensitivitySolverPath;
pub use sensitivity::calc_lodf;
pub use sensitivity::calc_ptdf;
pub use sensitivity::calc_ptdf_lodf;
pub use sensitivity::calc_ptdf_lodf_with_options;

Modules§

laplacian
Weighted bus Laplacians L = A diag(w) Aᵀ, reference grounding, and the index bookkeeping for mapping a grounded solve back to full size. For DC power flow, w is the branch susceptance vector b, and L is the DC bus susceptance matrix.
multiconductor
Native multiconductor nodal admittance over MulticonductorNetwork (#232): terminal and conductor indexed, in the network’s actual units (volts, amperes, siemens), with no implicit positive sequence transformation anywhere.
sensitivity
DC sensitivity matrices.
triplet
CooBuilder — a small HashMap backed coordinate format accumulator. Deduplicates (i, j) entries on insert (each add is O(1) amortized, independent of nnz). Replaces the previous Vec linear scan accumulator, which was O(nnz²) per case.

Structs§

BuildOptions
MatrixStats
Common stats over a sparse matrix used by the TUI and meta.json.
YbusParts
Re(Y_bus) and Im(Y_bus) as separate CSR matrices.
ZeroImpedanceSkips
Branch rows skipped because the selected builder cannot represent a zero branch denominator.

Enums§

BranchSusceptanceFormula
Rule for the DC branch susceptance b.
Scheme
Which MATPOWER fast decoupled scheme to use.
ZeroImpedanceRule
Which branch denominator a matrix builder uses when deciding whether a branch can contribute a finite admittance or susceptance.

Functions§

calc_adjacency_matrix
Calculate the n × n 0/1 adjacency matrix.
calc_admittance_matrix
Calculate the bus admittance matrix, returned as separate real and imaginary sparse matrices.
calc_bdoubleprime_matrix
Calculate the MATPOWER fast decoupled power flow Bpp matrix.
calc_bprime_matrix
Calculate the MATPOWER fast decoupled power flow Bp matrix.
calc_diagonal
Sparse diagonal matrix from values (square, len × len).
calc_lacpf_matrix
Calculate the flat start linear AC power flow block matrix.
calc_susceptance_diagonal
B = diag(b), shape m × m.
calc_zero_impedance_skips
Count in-service branch rows the given builder rule will skip. This is the shared accounting used by matrix metadata and solver property regressions.
check_sddm
Whether a matrix is SDDM (symmetric diagonally dominant M-matrix). Useful as a quick sanity check before feeding it to an SDDM solver.