powergrid_synth.core.grid_graph
This module creates a PowerGridGraph class, inherited from nx.Graph, with some customized methods like accessing subgraph by specifying voltage_level.
Module Contents
- class powergrid_synth.core.grid_graph.DistributionGrid(incoming_graph_data=None, **attr)[source]
Bases:
PowerGridGraphGraph representation of a radial distribution feeder.
Inherits from
PowerGridGraphand adds convenience properties for radial-tree distribution grids annotated with hop distances, node types, and cable parameters (Schweitzer et al. 2017 format).- classmethod from_nx(G)[source]
Create a DistributionGrid from any NetworkX graph.
All node, edge, and graph attributes are copied.
- Parameters:
G (networkx.Graph)
- Return type:
- nodes_at_hop(h)[source]
Return list of nodes at the given hop distance.
- Parameters:
h (int)
- Return type:
list
- nodes_by_type(node_type)[source]
Return list of nodes with the given
node_typeattribute.- Parameters:
node_type (str) – One of
'load','injection', or'intermediate'.- Return type:
list
- property is_radial: bool
True if the graph is a connected tree.
- Return type:
bool
- property max_hop: int
Maximum hop distance in the feeder.
- Return type:
int
- property root
Return the root node (hop distance 0).
- property total_gen_mw: float
Total real-power generation (MW) across all injection nodes.
- Return type:
float
- property total_load_mw: float
Total real-power load (MW) across all load nodes.
- Return type:
float
- class powergrid_synth.core.grid_graph.PowerGridGraph(incoming_graph_data=None, **attr)[source]
Bases:
networkx.GraphCustom NetworkX Graph for Power Grids. Extends nx.Graph to support subgraph extraction by voltage level.
- class powergrid_synth.core.grid_graph.TransmissionGrid(incoming_graph_data=None, **attr)[source]
Bases:
PowerGridGraphGraph representation of a transmission-level power grid.
Inherits from
PowerGridGraphand adds convenience methods specific to meshed, multi-voltage-level transmission networks.- property n_levels: int
Number of distinct voltage levels.
- Return type:
int
- property voltage_levels: list[int]
Sorted list of distinct voltage levels present in the grid.
- Return type:
list[int]