Skip to content

Commit

Permalink
Only conduct reinforcement for previously non-converging time steps i…
Browse files Browse the repository at this point in the history
…f grid has beed reinforced in between
  • Loading branch information
birgits committed Feb 16, 2024
1 parent dfb71ae commit 7ec2ec2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions edisgo/flex_opt/reinforce_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def catch_convergence_reinforce_grid(
Reinforcement strategy to reinforce grids with non-converging time steps.
First, conducts a grid reinforcement with only converging time steps.
Afterwards, tries to run reinforcement with all time steps that did not converge
Afterward, tries to run reinforcement with all time steps that did not converge
in the beginning. At last, if there are still time steps that do not converge,
the feed-in and load time series are iteratively scaled and the grid reinforced,
starting with a low grid load and scaling-up the time series until the original
Expand Down Expand Up @@ -769,15 +769,17 @@ def reinforce():
troubleshooting_mode = troubleshooting_mode_set
reinforce()

# Run reinforcement for time steps that did not converge after initial reinforcement
if not non_converging_timesteps.empty:
logger.info(
"Run reinforcement for time steps that did not converge after initial "
"reinforcement."
)
selected_timesteps = non_converging_timesteps
troubleshooting_mode = False
converged = reinforce()
# Run reinforcement for time steps that did not converge after initial
# reinforcement (only needs to done, when grid was previously reinforced using
# converged time steps, wherefore it is within that if-statement)
if not non_converging_timesteps.empty:
logger.info(
"Run reinforcement for time steps that did not converge after initial "
"reinforcement."
)
selected_timesteps = non_converging_timesteps
troubleshooting_mode = False
converged = reinforce()

if converged:
return edisgo.results
Expand Down

0 comments on commit 7ec2ec2

Please sign in to comment.