Skip to main content

Module matrix

Module matrix 

Source
Expand description

Sparse matrix builders 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 incidence::IncidenceParts;
pub use incidence::build_flow_map;
pub use incidence::build_incidence;
pub use incidence::susceptance_diag;
pub use laplacian::GroundedIndexMap;
pub use laplacian::build_weighted_laplacian;
pub use laplacian::ground_at;
pub use laplacian::ground_at_each;
pub use laplacian::reference_indicator;
pub use laplacian::unit_vector;
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::build_lodf;
pub use sensitivity::build_ptdf;
pub use sensitivity::build_ptdf_lodf;
pub use sensitivity::build_ptdf_lodf_with_options;

Modules§

incidence
DC network primitives: the signed incidence matrix A, branch susceptances b, the flow map B Aᵀ, and the phase shift injection.
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.
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§

DcConvention
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§

build_adjacency
Build the n × n 0/1 adjacency matrix.
build_bdoubleprime
build_bprime
build_lacpf
build_ybus
sddm_check
Whether a matrix is SDDM (symmetric diagonally dominant M-matrix). Useful as a quick sanity check before feeding it to an SDDM solver.
skipped_zero_impedance
Count in-service branch rows the given builder rule will skip. This is the shared accounting used by matrix metadata and solver property regressions.