Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Dec 18, 2023
1 parent 593476e commit 4b989b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
21 changes: 6 additions & 15 deletions edisgo/network/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,23 +371,15 @@ def assign_grid_feeder(self, mode: str = "grid_feeder"):
"""
Assigns MV or LV feeder to each bus and line, depending on the `mode`.
The feeder name is written to a new column `mv_feeder` or `grid_feeder`,
depending on the `mode`, in :class:`~.network.topology.Topology`'s
:attr:`~.network.topology.Topology.buses_df` and
:attr:`~.network.topology.Topology.lines_df`.
The MV feeder name corresponds to the name of the neighboring node of the
HV/MV station. The grid feeder name corresponds to the name of the neighboring
node of the respective grid's station. The feeder name of the source node, i.e.
the station, is set to "station_node".
See :attr:`~.network.topology.Topology.assign_feeders` for more information.
Parameters
----------
mode : str
Specifies whether to assign MV or grid feeder.
If mode is "mv_feeder" the MV feeder the busses and lines are in are
determined. If mode is "grid_feeder" LV busses and lines are assigned the
LV feeder they are in and MV busses and lines are assigned the MV feeder
If mode is "mv_feeder" the MV feeder the buses and lines are in are
determined. If mode is "grid_feeder" LV buses and lines are assigned the
LV feeder they are in and MV buses and lines are assigned the MV feeder
they are in. Default: "grid_feeder".
"""
Expand All @@ -396,16 +388,15 @@ def assign_grid_feeder(self, mode: str = "grid_feeder"):

if mode == "grid_feeder":
graph = self.graph
station = self.station.index[0]
column_name = "grid_feeder"
elif mode == "mv_feeder":
graph = self._edisgo_obj.topology.to_graph()
station = self._edisgo_obj.topology.transformers_hvmv_df["bus1"][0]
column_name = "mv_feeder"
else:
raise ValueError("Choose an existing mode.")

# get all buses in network and remove station to get separate subgraphs
station = self.station.index[0]
# get all buses in network and remove station to get separate sub-graphs
graph_nodes = list(graph.nodes())
graph_nodes.remove(station)
subgraph = graph.subgraph(graph_nodes)
Expand Down
4 changes: 2 additions & 2 deletions edisgo/tools/pseudo_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def make_pseudo_coordinates(edisgo_obj: EDisGo, mv_coordinates: bool = False):
edisgo_obj : :class:`~.EDisGo`
eDisGo object to create pseudo coordinates for.
mv_coordinates : bool, optional
If False, pseudo coordinates are only generated for LV busses. If True, pseudo
coordinates are as well generated for MV busses.
If False, pseudo coordinates are only generated for LV buses. If True, pseudo
coordinates are as well generated for MV buses.
Default: False.
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/network/test_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def test_assign_length_to_grid_station(self):
)

def test_assign_grid_feeder(self):
# further things are checked in tests for Topology.assign_feeders
mv_grid = self.topology.mv_grid
lv_grid = self.topology.get_lv_grid(3)

Expand All @@ -120,7 +121,7 @@ def test_assign_grid_feeder(self):
assert not mv_grid.buses_df["grid_feeder"].isnull().any()
assert not lv_grid.buses_df["grid_feeder"].isnull().any()

# Check that feeder to station node of station node is 'station_node' and
# Check that feeder of station node is 'station_node' and
# one other feeder get the right feeder assigned
assert mv_grid.buses_df.iloc[0:2]["grid_feeder"].to_list() == [
"station_node",
Expand Down

0 comments on commit 4b989b9

Please sign in to comment.