ding0.grid.mv_grid package

Submodules

ding0.grid.mv_grid.mv_connect module

ding0.grid.mv_grid.mv_connect.connect_node(node, node_shp, mv_grid, target_obj, proj, graph, conn_dist_ring_mod, debug)[source]

Connects node to target_obj.

Parameters:
  • node (LVLoadAreaCentreDing0, i.e.) – Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0)
  • node_shp (Shapely Point object) – Shapely Point object of origin node
  • target_obj (type) – object that node shall be connected to
  • proj (pyproj Proj object) – equidistant CRS to conformal CRS (e.g. ETRS -> WGS84)
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes and newly created branches
  • conn_dist_ring_mod (float) – Max. distance when nodes are included into route instead of creating a new line.
  • debug (bool) – If True, information is printed during process.
Returns:

LVLoadAreaCentreDing0 – object that node was connected to.

(instance of LVLoadAreaCentreDing0 or MVCableDistributorDing0.

If node is included into line instead of creating a new line (see arg conn_dist_ring_mod), target_obj_result is None.

See also

ding0.grid.mv_grid.mv_connect()
for details on the conn_dist_ring_mod parameter.
ding0.grid.mv_grid.mv_connect.disconnect_node(node, target_obj_result, graph, debug)[source]

Disconnects node from target_obj

Parameters:
  • node (LVLoadAreaCentreDing0, i.e.) – Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0)
  • target_obj_result (LVLoadAreaCentreDing0, i.e.) – Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0)
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes and newly created branches
  • debug (bool) – If True, information is printed during process
ding0.grid.mv_grid.mv_connect.find_connection_point(node, node_shp, graph, proj, conn_objects_min_stack, conn_dist_ring_mod, debug)[source]
Goes through the possible target connection objects in conn_objects_min_stack (from nearest to most far
object) and tries to connect node to one of them.

Function searches from nearest to most far object.

Parameters:
  • node (LVLoadAreaCentreDing0, i.e.) – Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0)
  • node_shp (Shapely Point object) – Shapely Point object of node
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • proj (pyproj Proj object) – equidistant CRS to conformal CRS (e.g. ETRS -> WGS84)
  • conn_objects_min_stack (list) –

    List of connection objects.

    Each object is represented by dict with Ding0 object, shapely object, and distance to node, sorted ascending by distance.

  • conn_dist_ring_mod (type) – Max. distance when nodes are included into route instead of creating a new line.
  • debug (bool) – If True, information is printed during process

See also

ding0.grid.mv_grid.mv_connect()
for details on the conn_dist_ring_mod parameter.
ding0.grid.mv_grid.mv_connect.find_nearest_conn_objects(node_shp, branches, proj, conn_dist_weight, debug, branches_only=False)[source]

Searches all branches for the nearest possible connection object per branch.

Picks out 1 object out of 3 possible objects:

  • 2 branch-adjacent stations and
  • 1 potentially created cable distributor on the line (perpendicular projection)).

The resulting stack (list) is sorted ascending by distance from node.

Parameters:
  • node_shp (Shapely Point object) – Shapely Point object of node
  • branches (BranchDing0) – BranchDing0 objects of MV region
  • proj (pyproj Proj object) – nodes’ CRS to equidistant CRS (e.g. WGS84 -> ETRS)
  • conn_dist_weight (float) – length weighting to prefer stations instead of direct line connection.
  • debug (bool) – If True, information is printed during process
  • branches_only (bool, defaults to False) – If True, only branch objects are considered as connection objects
Returns:

list – List of connection objects. Each object is represented by dict with Ding0 object, shapely object, and distance to node.

See also

mv_connect_satellites()
for details on conn_dist_weight param
ding0.grid.mv_grid.mv_connect.get_lv_load_area_group_from_node_pair(node1, node2)[source]
ding0.grid.mv_grid.mv_connect.mv_connect_generators(mv_grid_district, graph, debug=False)[source]

Connect MV generators to MV grid

Parameters:
  • mv_grid_district (MVGridDistrictDing0) – MVGridDistrictDing0 object for which the connection process has to be done
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • debug (bool, defaults to False) – If True, information is printed during process.
Returns:

NetworkX Graph Obj – NetworkX graph object with nodes and newly created branches

ding0.grid.mv_grid.mv_connect.mv_connect_satellites(mv_grid, graph, mode='normal', debug=False)[source]

Connect satellites (small Load Areas) to MV grid

Parameters:
  • mv_grid (MVGridDing0) – MV grid instance
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • mode (str, defaults to ‘normal’) – Specify mode how satellite LVLoadAreaCentreDing0 are connected to the grid. Mode normal (default) considers for restrictions like max. string length, max peak load per string. The mode ‘isolated’ disregards any connection restrictions and connects the node LVLoadAreaCentreDing0 to the next connection point.
  • debug (bool, defaults to False) – If True, information is printed during process

Note

conn_dist_weight: The satellites can be connected to line (new terminal is created) or to one station where the line ends, depending on the distance from satellite to the objects. This threshold is a length weighting to prefer stations instead of direct line connection to respect grid planning principles.

Example: The distance from satellite to line is 1km, to station1 1.2km, to station2 2km. With conn_dist_threshold=0.75, the ‘virtual’ distance to station1 would be 1.2km * 0.75 = 0.9km, so this conn. point would be preferred.

Returns:NetworkX Graph Obj – NetworkX graph object with nodes and newly created branches
ding0.grid.mv_grid.mv_connect.mv_connect_stations(mv_grid_district, graph, debug=False)[source]

Connect LV stations to MV grid

Parameters:
  • mv_grid_district (MVGridDistrictDing0) – MVGridDistrictDing0 object for which the connection process has to be done
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • debug (bool, defaults to False) – If True, information is printed during process
Returns:

NetworkX Graph Obj – NetworkX graph object with nodes and newly created branches

ding0.grid.mv_grid.mv_connect.parametrize_lines(mv_grid)[source]

Set unparametrized branches to default branch type

Parameters:mv_grid (MVGridDing0) – MV grid instance

Note

During the connection process of satellites, new branches are created - these have to be parametrized.

ding0.grid.mv_grid.mv_routing module

ding0.grid.mv_grid.mv_routing.ding0_graph_to_routing_specs(graph)[source]

Build data dictionary from graph nodes for routing (translation)

Parameters:graph (NetworkX Graph Obj) – NetworkX graph object with nodes
Returns:dict – Data dictionary for routing.

See also

ding0.grid.mv_grid.models.models.Graph()
for keys of return dict
ding0.grid.mv_grid.mv_routing.routing_solution_to_ding0_graph(graph, solution)[source]

Insert solution from routing into graph

Parameters:
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • solution (BaseSolution) – Instance of BaseSolution or child class (e.g. LocalSearchSolution) (=solution from routing)
Returns:

NetworkX Graph Obj – NetworkX graph object with nodes and edges

ding0.grid.mv_grid.mv_routing.solve(graph, debug=False, anim=None)[source]

Do MV routing for given nodes in graph.

Translate data from node objects to appropriate format before.

Parameters:
  • graph (NetworkX Graph Obj) – NetworkX graph object with nodes
  • debug (bool, defaults to False) – If True, information is printed while routing
  • anim (AnimationDing0) – AnimationDing0 object
Returns:

NetworkX Graph Obj – NetworkX graph object with nodes and edges

See also

ding0.tools.animation.AnimationDing0()
for a more detailed description on anim parameter.

ding0.grid.mv_grid.tools module

ding0.grid.mv_grid.tools.set_circuit_breakers(mv_grid, mode='load', debug=False)[source]

Calculates the optimal position of a circuit breaker at lv stations (if existing) on all routes of mv_grid, adds and connects them to graph.

Parameters:
  • mv_grid (MVGridDing0) – MV grid instance
  • debug (bool, defaults to False) – If True, information is printed during process

Note

According to planning principles of MV grids, a MV ring is run as two strings (half-rings) separated by a circuit breaker which is open at normal operation [1], [2]. Assuming a ring (route which is connected to the root node at either sides), the optimal position of a circuit breaker is defined as the position (virtual cable) between two nodes where the conveyed current is minimal on the route. Instead of the peak current, the peak load is used here (assuming a constant voltage).

The circuit breaker will be installed to a LV station, unless none exists in a ring. In this case, a node of arbitrary type is chosen for the location of the switch disconnecter.

If a ring is dominated by loads (peak load > peak capacity of generators), only loads are used for determining the location of circuit breaker. If generators are prevailing (peak load < peak capacity of generators), only generator capacities are considered for relocation.

The core of this function (calculation of the optimal circuit breaker position) is the same as in ding0.grid.mv_grid.models.Route.calc_circuit_breaker_position but here it is 1. applied to a different data type (NetworkX Graph) and it 2. adds circuit breakers to all rings.

The re-location of circuit breakers is necessary because the original position (calculated during routing with method mentioned above) shifts during the connection of satellites and therefore it is no longer valid.

References

[1]
  1. Tao, “Automatisierte Grundsatzplanung von Mittelspannungsnetzen”, Dissertation, 2006
[2]FGH e.V.: “Technischer Bericht 302: Ein Werkzeug zur Optimierung der Störungsbeseitigung für Planung und Betrieb von Mittelspannungsnetzen”, Tech. rep., 2008

Module contents