powergrid_synth.distribution.distribution_converter
Conversion utilities for building Schweitzer-format feeder graphs from pandapower and pypowsybl reference networks.
Module Contents
- powergrid_synth.distribution.distribution_converter.feeder_summary(feeders)[source]
Return a summary dict for each feeder graph.
- Parameters:
feeders (sequence of nx.Graph) – Feeder graphs produced by
pandapower_to_feeders().- Returns:
One dict per feeder with keys
n_nodes,n_edges,max_hop,is_tree,total_load_mw,total_gen_mw,node_types.- Return type:
list[dict]
- powergrid_synth.distribution.distribution_converter.pandapower_to_feeders(net)[source]
Convert a pandapower network to a list of Schweitzer-format feeder graphs.
Each connected component with at least three nodes is returned as a separate graph annotated with the attributes expected by
fit_params_from_feeders()andSchweetzerFeederGenerator:Node attributes:
h(hop distance from root),P_mw(positive = load, negative = generation),node_type('load'|'injection'|'intermediate'),pf(power factor).Edge attributes:
length_km(cable length in km).
The function handles lines, transformers, and closed bus–bus switches so that the full connectivity of the pandapower network is captured.
- Parameters:
net (pandapowerNet) – A pandapower network object.
- Returns:
One feeder graph per connected component (≥ 3 nodes).
- Return type:
list[nx.Graph]
- powergrid_synth.distribution.distribution_converter.pypowsybl_to_feeders(network)[source]
Convert a pypowsybl Network to a list of Schweitzer-format feeder graphs.
This is the pypowsybl counterpart of
pandapower_to_feeders(). It extracts buses, lines, two-winding transformers, loads, and generators from the pypowsybl Network and builds annotated feeder graphs suitable forfit_params_from_feeders()andSchweetzerFeederGenerator.- Parameters:
network (pypowsybl.network.Network) – A pypowsybl Network object (loaded from CGMES, XIIDM, MATPOWER, etc.).
- Returns:
One feeder graph per connected component (≥ 3 nodes), with the same node/edge attributes as
pandapower_to_feeders().- Return type:
list[nx.Graph]