Topological Searches¶
Once you converted your network into a MultiGraph there are several functions to perform topological searches and analyses at your disposal. You can either use the generalpurpose functions that come with NetworkX (see http:/networkx.github.io/documentation/networkx1.10/reference/algorithms.html) or topology’s own ones which are specialized on electrical networks.
calc_distance_to_bus¶

pandapower.topology.
calc_distance_to_bus
(net, bus, respect_switches=True, nogobuses=None, notravbuses=None, weight='weight')¶ Calculates the shortest distance between a source bus and all buses connected to it.
 INPUT:
net (pandapowerNet)  Variable that contains a pandapower network.
bus (integer)  Index of the source bus.
 OPTIONAL:
 respect_switches (boolean, True)  True: open line switches are being considered
(no edge between nodes)
False: open line switches are being ignored
nogobuses (integer/list, None)  nogobuses are not being considered
 notravbuses (integer/list, None)  lines connected to these buses are not being
considered
weight (string, None) – Edge data key corresponding to the edge weight
 OUTPUT:
 dist  Returns a pandas series with containing all distances to the source bus
in km. If weight=None dist is the topological distance (int).
 EXAMPLE:
import pandapower.topology as top
dist = top.calc_distance_to_bus(net, 5)
connected_component¶

pandapower.topology.
connected_component
(mg, bus, notravbuses=[])¶ Finds all buses in a NetworkX graph that are connected to a certain bus.
 INPUT:
mg (NetworkX graph)  NetworkX Graph or MultiGraph that represents a pandapower network.
bus (integer)  Index of the bus at which the search for connected components originates
 OPTIONAL:
 notravbuses (list/set)  indices of notravbuses: lines connected to these buses are
not being considered in the graph
 OUTPUT:
cc (generator)  Returns a generator that yields all buses connected to the input bus
 EXAMPLE:
import pandapower.topology as top
mg = top.create_nx_graph(net)
cc = top.connected_component(mg, 5)
connected_components¶

pandapower.topology.
connected_components
(mg, notravbuses=set())¶ Clusters all buses in a NetworkX graph that are connected to each other.
 INPUT:
mg (NetworkX graph)  NetworkX Graph or MultiGraph that represents a pandapower network.
OPTIONAL: notravbuses (set)  Indices of notravbuses: lines connected to these buses are
not being considered in the graph
 OUTPUT:
 cc (generator)  Returns a generator that yields all clusters of buses connected
to each other.
 EXAMPLE:
import pandapower.topology as top
mg = top.create_nx_graph(net)
cc = top.connected_components(net, 5)
unsupplied_buses¶

pandapower.topology.
unsupplied_buses
(net, mg=None, slacks=None, respect_switches=True)¶ Finds buses, that are not connected to an external grid.
 INPUT:
net (pandapowerNet)  variable that contains a pandapower network
 OPTIONAL:
mg (NetworkX graph)  NetworkX Graph or MultiGraph that represents a pandapower network.
 in_service_only (boolean, False)  Defines whether only in service buses should be
included in unsupplied_buses.
 slacks (set, None)  buses which are considered as root / slack buses. If None, all
existing slack buses are considered.
 respect_switches (boolean, True)  Fixes how to consider switches  only in case of no
given mg.
 OUTPUT:
ub (set)  unsupplied buses
 EXAMPLE:
import pandapower.topology as top
top.unsupplied_buses(net)
determine_stubs¶

pandapower.topology.
determine_stubs
(net, roots=None, mg=None, respect_switches=False)¶ Finds stubs in a network. Open switches are being ignored. Results are being written in a new column in the bus table (“on_stub”) and line table (“is_stub”) as True/False value.
 INPUT:
net (pandapowerNet)  Variable that contains a pandapower network.
 OPTIONAL:
 roots (integer/list, None)  indices of buses that should be excluded (by default, the
ext_grid buses will be set as roots)
 EXAMPLE:
import pandapower.topology as top
top.determine_stubs(net, roots = [0, 1])