Skip to content

Commit

Permalink
Merge pull request #380 from openego/features/#377-grid-separation
Browse files Browse the repository at this point in the history
Features/#377 grid separation
  • Loading branch information
birgits authored May 9, 2023
2 parents 5569b61 + 9a90942 commit f3c6895
Show file tree
Hide file tree
Showing 11 changed files with 840 additions and 90 deletions.
1 change: 1 addition & 0 deletions doc/whatsnew/v0-3-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ Changes
* Added method to aggregate LV grid buses to station bus secondary side `#353 <https://github.com/openego/eDisGo/pull/353>`_
* Adapted codebase to work with pandas 2.0 `#373 <https://github.com/openego/eDisGo/pull/373>`_
* Added option to run reinforcement with reduced number of time steps `#379 <https://github.com/openego/eDisGo/pull/379>`_
* Added a new reinforcement method that separate lv grids when the overloading is very high `#380 <https://github.com/openego/eDisGo/pull/380>`_
18 changes: 13 additions & 5 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,9 @@ def analyze(
--------
tuple(:pandas:`pandas.DatetimeIndex<DatetimeIndex>`,\
:pandas:`pandas.DatetimeIndex<DatetimeIndex>`)
Returns the time steps for which power flow analysis did not converge.
First index contains time steps for which power flow analysis did converge.
Second index contains time steps for which power flow analysis did not
converge.
References
--------
Expand Down Expand Up @@ -1261,12 +1263,15 @@ def reinforce(
run_analyze_at_the_end = False

logger.info(f"Run the following reinforcements: {setting_list=}")

for setting in setting_list:
logger.info(f"Run the following reinforcement: {setting=}")
if not catch_convergence_problems:
func = reinforce_grid
else:
func = catch_convergence_reinforce_grid
func = (
catch_convergence_reinforce_grid
if catch_convergence_problems
else reinforce_grid
)

func(
edisgo_obj,
max_while_iterations=max_while_iterations,
Expand All @@ -1275,14 +1280,17 @@ def reinforce(
n_minus_one=n_minus_one,
**setting,
)

if run_analyze_at_the_end:
lv_grid_id = kwargs.get("lv_grid_id", None)

if mode == "lv" and lv_grid_id:
analyze_mode = "lv"
elif mode == "lv":
analyze_mode = None
else:
analyze_mode = mode

edisgo_obj.analyze(
mode=analyze_mode, lv_grid_id=lv_grid_id, timesteps=timesteps_pfa
)
Expand Down
Loading

0 comments on commit f3c6895

Please sign in to comment.