pub struct IndexedNetwork<'n> { /* private fields */ }Expand description
A Network paired with its derived IndexCore. Borrows the network; the
core is either owned (the one-shot IndexedNetwork::new) or borrowed from a
cached IndexCore (IndexedNetwork::with_core).
Implementations§
Source§impl<'n> IndexedNetwork<'n>
impl<'n> IndexedNetwork<'n>
Sourcepub fn new(net: &'n Network) -> IndexedNetwork<'n>
pub fn new(net: &'n Network) -> IndexedNetwork<'n>
Sourcepub fn with_core(net: &'n Network, core: &'n IndexCore) -> IndexedNetwork<'n>
pub fn with_core(net: &'n Network, core: &'n IndexCore) -> IndexedNetwork<'n>
Pair net with an already-built IndexCore — no allocation. The core
must have been built from this same net.
pub fn n(&self) -> usize
pub fn base_mva(&self) -> f64
Sourcepub fn per_unit_base(&self) -> f64
pub fn per_unit_base(&self) -> f64
The divisor for turning a power quantity (shunt, load, generation) into
per unit. base_mva for a raw network; 1.0 for a normalized one, whose
powers are already per unit (so a second division would scale them twice).
base_mva itself stays at the system base — for MW recovery and
write-back — so use this, not base_mva, wherever the intent is “÷ base
to get per unit”. The effect is that a per-unit matrix builder yields the
same matrix for a network and its to_normalized
form.
Sourcepub fn angle_radians(&self, angle: f64) -> f64
pub fn angle_radians(&self, angle: f64) -> f64
A branch/bus angle field (shift, va) in radians. The raw model stores
angles in degrees; a normalized network already stores radians, so for it
this is the identity. The angle analogue of
per_unit_base: a builder gets the same radians
whether it is handed a network or its
to_normalized form, so the matrix comes out
the same.
pub fn name(&self) -> &str
Sourcepub fn branches(&self) -> &[Branch]
pub fn branches(&self) -> &[Branch]
All branches, in source order (column order for incidence-based builds).
Sourcepub fn generators(&self) -> &[Generator]
pub fn generators(&self) -> &[Generator]
All generators, in source order.
Sourcepub fn bus_index(&self, bus_id: BusId) -> Option<usize>
pub fn bus_index(&self, bus_id: BusId) -> Option<usize>
Resolve a bus id to its dense [0, n) index.
Sourcepub fn in_service_branches(&self) -> impl Iterator<Item = (usize, &Branch)>
pub fn in_service_branches(&self) -> impl Iterator<Item = (usize, &Branch)>
In-service branches with their index into branches.
Sourcepub fn in_service_gens(&self) -> impl Iterator<Item = (usize, &Generator)>
pub fn in_service_gens(&self) -> impl Iterator<Item = (usize, &Generator)>
In-service generators with their index into generators.
Sourcepub fn reference_bus_indices(&self) -> Vec<usize>
pub fn reference_bus_indices(&self) -> Vec<usize>
Dense indices of every reference (slack) bus, in ascending order. A
network may carry more than one BusType::Ref (a slack per island, or
several the source file marked) — the matrix layer grounds one row/column
per entry. Empty when the network has no reference bus.
Sourcepub fn reference_bus_index(&self) -> Result<usize, Error>
pub fn reference_bus_index(&self) -> Result<usize, Error>
Dense index of the single reference (slack) bus. Errors unless exactly
one BusType::Ref exists; for the multi-reference case use
reference_bus_indices.
Sourcepub fn to_petgraph(&self) -> Graph<usize, usize, Undirected>
pub fn to_petgraph(&self) -> Graph<usize, usize, Undirected>
Undirected graph view: node weight = dense bus index, edge weight =
index into branches. Out-of-service branches are
skipped; parallel branches are kept as separate edges.
Sourcepub fn n_connected_components(&self) -> usize
pub fn n_connected_components(&self) -> usize
Number of connected components in the in-service topology.
Sourcepub fn connected_component_labels(&self) -> Vec<usize>
pub fn connected_component_labels(&self) -> Vec<usize>
Connected-component label per dense bus index (in-service topology): two
buses share a label iff an in-service branch path joins them, and an
isolated bus is its own component. Labels are representative indices in
[0, n), not a dense [0, k) range — use them for equality grouping
(e.g. checking every island carries a reference bus to ground).
Sourcepub fn check_reference_coverage(&self) -> Result<(), Error>
pub fn check_reference_coverage(&self) -> Result<(), Error>
Error unless every connected component of the in-service topology carries at least one reference (slack) bus. This is the grounding precondition for the DC Laplacian: an island with no reference leaves its all-ones null vector in the system, so the reference-grounded Laplacian stays singular. With one reference in a single island it reduces to the single slack requirement. Reports the count of ungrounded components.
Sourcepub fn is_radial(&self) -> bool
pub fn is_radial(&self) -> bool
True iff the in-service topology is a forest (|E| = |V| - components).
Sourcepub fn connectivity_report(&self) -> ConnectivityReport
pub fn connectivity_report(&self) -> ConnectivityReport
One-shot topological diagnostic.