feat: configurable timestep selection for the run pipeline (#663)#692
Merged
Conversation
Add a `select_timesteps` pipeline task that reduces the analysed time index to a selected subset, in two modes: - manual: an explicit set/range of timesteps (positioned before the imports so egon_data downloads are restricted to the selected steps); - auto: the most critical time intervals, via either a power flow (`get_most_critical_time_intervals(by="power_flow")`) or the residual load (`by="residual_load"`, no power flow — intervals centered on the highest/lowest residual-load steps, snapped to `time_step_day_start`). Auto selection may yield two disconnected intervals. `pm_optimize` now detects a non-contiguous time index and runs a separate, independent OPF per contiguous interval (storage/heat state does not carry across the gap), merging the per-interval results and reporting per-interval solve status. `reinforce` handles the reduced index unchanged. Architecture: pipeline tasks stay thin (mode selection + data transfer); the computation lives in edisgo core: - selection logic in tools.temporal_complexity_reduction (`get_most_critical_time_steps`/`_intervals` gain a `by` mode; public `select_two_intervals`/`intervals_overlap`); - the multi-interval OPF split/merge in opf.powermodels_opf.pm_optimize. Also: - EV flexibility bands built in a dedicated `build_flexibility_bands` task and aligned (year + frequency) to the analysis index in `reduce_timeseries_data_to_given_timeindex`; - `OPFResults.interval_results` for the per-interval solve report; - config surface: a top-level `timeseries_selection` block + `uc5_select_timesteps` preset + `run_example_05.py`; - tests in tests/run, tests/tools, tests/opf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
select_timestepspipeline task that reduces the analysed time index to a selected subset, in two modes:get_most_critical_time_intervals(by="power_flow")) or the residual load (by="residual_load", no power flow — intervals centered on the highest/lowest residual-load steps, snapped totime_step_day_start).Auto selection may yield two disconnected intervals.
pm_optimizenow detects a non-contiguous time index and runs a separate, independent OPF per contiguous interval (storage/heat state does not carry across the gap), merging the per-interval results and reporting per-interval solve status.reinforcehandles the reduced index unchanged.Architecture: pipeline tasks stay thin (mode selection + data transfer); the computation lives in edisgo core:
get_most_critical_time_steps/_intervalsgain abymode; publicselect_two_intervals/intervals_overlap);Also:
build_flexibility_bandstask and aligned (year + frequency) to the analysis index inreduce_timeseries_data_to_given_timeindex;OPFResults.interval_resultsfor the per-interval solve report;timeseries_selectionblock +uc5_select_timestepspreset +run_example_05.py;Description
Please include a summary of the change and which issue is fixed.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist:
pre-commithooks