Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:openego/eDisGo into features/#377-gr…
Browse files Browse the repository at this point in the history
…id-separation
  • Loading branch information
khelfen committed May 4, 2023
2 parents 825109b + c6a2edb commit caf4e6b
Show file tree
Hide file tree
Showing 9 changed files with 305 additions and 48 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 @@ -20,3 +20,4 @@ Changes
* Added method to scale timeseries `#353 <https://github.com/openego/eDisGo/pull/353>`_
* Added method to iteratively reinforce a grid in case the power flow analysis does not always converge `#353 <https://github.com/openego/eDisGo/pull/353>`_
* Added method to aggregate LV grid buses to station bus secondary side `#353 <https://github.com/openego/eDisGo/pull/353>`_
* Added option to run reinforcement with reduced number of time steps `#379 <https://github.com/openego/eDisGo/pull/379>`_
25 changes: 25 additions & 0 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,10 @@ def reinforce(
time steps. If your time series already represents the worst-case,
keep the default value of None because finding the worst-case
snapshots takes some time.
* 'reduced_analysis'
Reinforcement is conducted for all time steps at which at least one
branch shows its highest overloading or one bus shows its highest voltage
violation.
* :pandas:`pandas.DatetimeIndex<DatetimeIndex>` or \
:pandas:`pandas.Timestamp<Timestamp>`
Use this option to explicitly choose which time steps to consider.
Expand Down Expand Up @@ -1161,6 +1165,27 @@ def reinforce(
This is used in case worst-case grid reinforcement is conducted in order to
reinforce MV/LV stations for LV worst-cases.
Default: False.
num_steps_loading : int
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be
used to specify the number of most critical overloading events to consider.
If None, `percentage` is used. Default: None.
num_steps_voltage : int
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be
used to specify the number of most critical voltage issues to select. If
None, `percentage` is used. Default: None.
percentage : float
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be
used to specify the percentage of most critical time steps to select. The
default is 1.0, in which case all most critical time steps are selected.
Default: 1.0.
use_troubleshooting_mode : bool
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be
used to specify how to handle non-convergence issues in the power flow
analysis. If set to True, non-convergence issues are tried to be
circumvented by reducing load and feed-in until the power flow converges.
The most critical time steps are then determined based on the power flow
results with the reduced load and feed-in. If False, an error will be
raised in case time steps do not converge. Default: True.
Returns
--------
Expand Down
27 changes: 27 additions & 0 deletions edisgo/flex_opt/reinforce_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from edisgo.flex_opt import exceptions, reinforce_measures
from edisgo.flex_opt.costs import grid_expansion_costs
from edisgo.tools import tools
from edisgo.tools.temporal_complexity_reduction import get_most_critical_time_steps

if TYPE_CHECKING:
from edisgo import EDisGo
Expand Down Expand Up @@ -81,6 +82,24 @@ def reinforce_grid(
This is used in case worst-case grid reinforcement is conducted in order to
reinforce MV/LV stations for LV worst-cases.
Default: False.
num_steps_loading : int
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be used
to specify the number of most critical overloading events to consider.
If None, `percentage` is used. Default: None.
num_steps_voltage : int
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be used
to specify the number of most critical voltage issues to select. If None,
`percentage` is used. Default: None.
percentage : float
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be used
to specify the percentage of most critical time steps to select. The default
is 1.0, in which case all most critical time steps are selected.
Default: 1.0.
use_troubleshooting_mode : bool
In case `timesteps_pfa` is set to 'reduced_analysis', this parameter can be used
to specify how to handle non-convergence issues in the power flow analysis.
See parameter `use_troubleshooting_mode` in function :attr:`~.EDisGo.reinforce`
for more information. Default: True.
Returns
-------
Expand Down Expand Up @@ -155,6 +174,14 @@ def _add_transformer_changes_to_equipment_changes(mode: str | None):
snapshots["min_residual_load"],
]
).dropna()
elif isinstance(timesteps_pfa, str) and timesteps_pfa == "reduced_analysis":
timesteps_pfa = get_most_critical_time_steps(
edisgo,
num_steps_loading=kwargs.get("num_steps_loading", None),
num_steps_voltage=kwargs.get("num_steps_voltage", None),
percentage=kwargs.get("percentage", 1.0),
use_troubleshooting_mode=kwargs.get("use_troubleshooting_mode", True),
)
# if timesteps_pfa is not of type datetime or does not contain
# datetimes throw an error
elif not isinstance(timesteps_pfa, datetime.datetime):
Expand Down
3 changes: 1 addition & 2 deletions edisgo/network/overlying_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ def distribute_overlying_grid_requirements(edisgo_obj):
).values,
)
edisgo_copy.timeseries._loads_active_power.loc[:, hp_district.index] = (
scaling_df
* edisgo_obj.overlying_grid.heat_pump_central_active_power.sum(axis=1)[0]
scaling_df * edisgo_obj.overlying_grid.heat_pump_central_active_power
).transpose()

# decentral PtH - distribute dispatch time series from overlying grid
Expand Down
Loading

0 comments on commit caf4e6b

Please sign in to comment.