Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
69a3188
Changes by JD before edits of MS
May 13, 2026
78d07bc
Add example yaml for full example
May 13, 2026
de69b53
Add file for analysis-tasks, Add short cut for DSM
May 13, 2026
fb5d32b
Add file for flex-tasks, Add flexibility band generation,
May 13, 2026
bd5eaa8
Add file for grid-tasks, Add timeindex in setup task
May 13, 2026
aa78004
Add file for timeseries-tasks
May 13, 2026
3a28880
Edit uc4 example
May 19, 2026
03f97ea
Merge branch 'dev' into edisgo_run_edisgo
MoritzSchloesser May 19, 2026
b7e7415
Wire overlying-grid data through pipeline runner
May 20, 2026
b55e5a0
Fix OPF result write-back, flex resolution and overlying-grid SOC rei…
May 21, 2026
bb3a720
Changes by JD before edits of MS
May 13, 2026
0c8792e
Add example yaml for full example
May 13, 2026
d3476eb
Add file for analysis-tasks, Add short cut for DSM
May 13, 2026
25ae93e
Add file for flex-tasks, Add flexibility band generation,
May 13, 2026
56dbf72
Add file for grid-tasks, Add timeindex in setup task
May 13, 2026
579aba8
Add file for timeseries-tasks
May 13, 2026
65fa8fc
Edit uc4 example
May 19, 2026
7ad6490
Wire overlying-grid data through pipeline runner
May 20, 2026
5fce257
Redirect to installed julia version
May 21, 2026
d6eddc2
Fix OPF result write-back, flex resolution and overlying-grid SOC rei…
May 21, 2026
fc84a14
Add overly_grid boolean
May 21, 2026
d4672e3
Add full-flex distribution OPF configuration without overlying-grid c…
joda9 May 22, 2026
8d6a947
Add overlying grid enabler and source selection
May 27, 2026
04aad53
Change opf_version
May 27, 2026
f1be570
Add renewables_potential and dispatchable_generator timeseries to Ove…
ClaraBuettner May 27, 2026
e79dceb
Import overlying_grid_data only from csv files when it is not directl…
ClaraBuettner May 27, 2026
f31cf31
Select timesteps in overlying_grid_data that are relevant for eDisGo'…
ClaraBuettner May 27, 2026
58d8f73
Workaround for generators_dispatch stored as pandas.DataFrame
ClaraBuettner May 27, 2026
6382c43
Merge branch 'edisgo_run_edisgo' of github.com:openego/eDisGo into ed…
May 27, 2026
4f28f36
Merge commit '58d8f73e154736d5592e7595a8907259d4cfff37' into edisgo_r…
May 27, 2026
b367c81
Workarround for pd.DataFrames in flex_opt data
ClaraBuettner May 27, 2026
abf7f70
Replace hard-coded year and select it from the timeindex instead
ClaraBuettner Jun 3, 2026
76491a3
make ding0 grid path variable optional
joda9 Jun 3, 2026
0a28784
Merge pull request #635 from openego/features/edisgo_run_edisgo_ego_i…
joda9 Jun 3, 2026
5537672
Revert "Redirect to installed julia version"
Jun 10, 2026
8f9d07d
Merge branch 'dev' into edisgo_run_edisgo
joda9 Jun 23, 2026
74d6bd1
fix: resolve 10 review findings in the run pipeline framework
joda9 Jun 23, 2026
b3ff5ad
Merge branch 'dev' into edisgo_run_edisgo
joda9 Jul 1, 2026
031e743
refactor: declarative task metadata for the validator + shared artifa…
joda9 Jul 1, 2026
9b69608
refactor: shared time-series year-alignment helper + small cleanups
joda9 Jul 1, 2026
5957546
test: add task-level tests for the run pipeline
joda9 Jul 1, 2026
55d273a
Merge branch 'edisgo_run_edisgo' of github.com:openego/eDisGo into ed…
joda9 Jul 1, 2026
26865be
Merge branch 'dev' into edisgo_run_edisgo
joda9 Jul 2, 2026
1565b26
Add configurable database source (local egon-data / OEP) and fix SSH …
joda9 Jul 2, 2026
289dbee
Pin paramiko < 4.0 for SSH tunnel support
joda9 Jul 2, 2026
8ea04cf
feat: enhance database engine support and schema handling in pipeline…
joda9 Jul 3, 2026
c36fc8c
Keep pooled DB connections alive across long multi-grid runs
joda9 Jul 3, 2026
6c52995
Accept feasible non-optimal OPF solutions instead of computing an IIS
joda9 Jul 7, 2026
02fa8ea
Merge branch 'dev' into edisgo_run_edisgo
joda9 Jul 8, 2026
80a24e2
feat: configurable timestep selection for the run pipeline (#663) (#692)
joda9 Jul 8, 2026
9a21249
Allow using ding0 grids downloaded from zenodo (#690)
ClaraBuettner Jul 10, 2026
2761074
Use overlying_grid_data with adjusted timeindex to set generators_act…
ClaraBuettner Jul 13, 2026
7f6905b
Change database from OEP to local
MoritzSchloesser Jul 14, 2026
5a09fc3
feat: spatial complexity reduction for the run pipeline
MoritzSchloesser Jul 15, 2026
3456018
fix: trim electromobility flexibility bands to the active time index
MoritzSchloesser Jul 15, 2026
b9c3d8c
Add uc6_spatial_reduction preset and example runner
MoritzSchloesser Jul 15, 2026
fe3a156
docs: spatial reduction glossary and grilling-session notes
MoritzSchloesser Jul 15, 2026
4fae4a0
Change overlying_grid path
MoritzSchloesser Jul 15, 2026
a28731d
Fix stale UC5 naming in uc6_spatial_reduction.yaml, add issue writeup
MoritzSchloesser Jul 15, 2026
af2c7a0
Spatial complexity reduction for the run pipeline (partial) (#706)
MoritzSchloesser Jul 15, 2026
69c9f30
Remove local-only notes from tracking
MoritzSchloesser Jul 16, 2026
614f606
Merge branch 'edisgo_run_edisgo' of https://github.com/openego/eDisGo…
MoritzSchloesser Jul 16, 2026
beedffd
Ignore additional local-only scratch files
MoritzSchloesser Jul 16, 2026
9e40997
fix: trim apply_charging_strategy output to the active timeindex (#710)
MoritzSchloesser Jul 20, 2026
22845fb
fix: scope apply_heat_pump_operating_strategy output to the active ti…
MoritzSchloesser Jul 20, 2026
0556909
fix: raise ValueError when set_time_series_manual data misses timeste…
MoritzSchloesser Jul 20, 2026
d68b40e
fix: scope predefined_* self-provided-DataFrame inputs to the timeind…
MoritzSchloesser Jul 20, 2026
dc1249b
fix: scope get_flexibility_bands to the active timeindex (#714)
MoritzSchloesser Jul 21, 2026
94292ab
fix: add DSM.resample(), wire it into EDisGo.resample_timeseries (#715)
MoritzSchloesser Jul 21, 2026
bc24afa
fix: expose reduce_timeseries_data_to_given_timeindex on EDisGo (#716)
MoritzSchloesser Jul 21, 2026
800cc9e
fix: align flexibility_bands reads to the timeindex in the OPF builde…
MoritzSchloesser Jul 22, 2026
e4e64d8
fix: preserve gaps in the timeindex when resampling (#721)
MoritzSchloesser Jul 22, 2026
6f8d00e
fix: replace residual_load tiling with active-timeindex proration in …
MoritzSchloesser Jul 24, 2026
c48af1b
fix: reduce dumb/reduced/flexibility_bands to the active timeindex be…
MoritzSchloesser Jul 27, 2026
617fcbb
fix: reinforce all line segments on path to critical node
joda9 Aug 5, 2026
9b47289
fix(io): drop the dead bus-to-building-ID map in the PV rooftop import
joda9 Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,24 @@ eDisGo.egg-info/
.vscode/settings.json

*OEP_TOKEN.*

# local-only notes, not for sharing on this branch
/CONTEXT.md
/docs_notes/spatial_reduction_grilling_session.md
/docs_notes/issue_spatial_complexity_reduction_pipeline_integration.md
/docs_notes/issue_aggregation_mode_flexibility_bands_not_aggregated.md
/docs_notes/issue_temporal_reduction_flexibility_bands.md
analyse_spatial_reduction_executed_example.ipynb
analyse_spatial_reduction.ipynb
analyse_uc5_results copy.ipynb
analyse_uc5_results.ipynb
handson_edisgo_starter.ipynb
run_example_04.py
docs_notes/ego_timeseries_selection_plan.md
docs_notes/pr_description_spatial_complexity_reduction.md
docs_notes/timeseries_selection_remaining_tasks.md
results/uc4_example/main.zip
results/uc5_select_timesteps/32377_t_168_residual_load.csv
results/uc5_select_timesteps/main.zip
results/uc5_spatial_reduction/main.zip
results/uc6_spatial_reduction/main.zip
206 changes: 202 additions & 4 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@
from edisgo.tools import plots, tools
from edisgo.tools.config import Config
from edisgo.tools.geo import find_nearest_bus
from edisgo.tools.spatial_complexity_reduction import spatial_complexity_reduction
from edisgo.tools.spatial_complexity_reduction import (
apply_reduced_results_to_full_grid,
spatial_complexity_reduction,
)
from edisgo.tools.tools import (
check_timeindex_coverage,
determine_grid_integration_voltage_level,
get_path_length_to_station,
reduce_timeseries_data_to_given_timeindex,
)

if "READTHEDOCS" not in os.environ:
Expand Down Expand Up @@ -243,6 +248,31 @@ def config(self):
def config(self, kwargs):
self._config = Config(**kwargs)

def run_pipeline(self, config, overlying_grid_data=None):
"""
Run a YAML/JSON task pipeline on this EDisGo instance.

See :mod:`edisgo.run` for the config schema and task list.

Parameters
----------
config : str, :class:`pathlib.Path`, or dict
Pipeline config as path to a YAML/JSON file or as a dict.
overlying_grid_data : dict, optional
Overlying-grid data (e.g. eTraGo results) consumed by the
``import_overlying_grid_data`` task when
``overlying_grid.source == "etrago"``.

Returns
-------
:class:`~.EDisGo`
The EDisGo instance after the pipeline has run.

"""
from edisgo.run import _run_pipeline_on

return _run_pipeline_on(self, config, overlying_grid_data=overlying_grid_data)

def import_ding0_grid(self, path, legacy_ding0_grids=True):
"""
Import ding0 topology data from csv files in the format as
Expand Down Expand Up @@ -323,7 +353,11 @@ def set_time_series_manual(
providing the input parameter 'timeindex' or using the function
:attr:`~.edisgo.EDisGo.set_timeindex`.
Also make sure that the time steps for which time series are provided include
the set time index.
the set time index - this is now enforced: a `ValueError` is raised if a
non-empty DataFrame is missing data for a time step in
:attr:`~.network.timeseries.TimeSeries.timeindex` when a time index is
already set. A DataFrame with no columns is exempt from this check (nothing
is being written, so there is nothing to validate coverage for).

"""
# check if time index is already set, otherwise raise warning
Expand All @@ -334,6 +368,16 @@ def set_time_series_manual(
"upon initialisation of the EDisGo object by providing the input "
"parameter 'timeindex' or using the function EDisGo.set_timeindex()."
)
else:
for name, df in (
("generators_p", generators_p),
("loads_p", loads_p),
("storage_units_p", storage_units_p),
("generators_q", generators_q),
("loads_q", loads_q),
("storage_units_q", storage_units_q),
):
check_timeindex_coverage(self.timeseries.timeindex, name, df)
self.timeseries.set_active_power_manual(
self,
ts_generators=generators_p,
Expand Down Expand Up @@ -2162,6 +2206,14 @@ def apply_charging_strategy(
match the SimBEV data frequency and after determining the charging demand time
series resampled back to the original frequency.

The written charging point time series are trimmed to
:attr:`~.network.timeseries.TimeSeries.timeindex` when no such frequency
mismatch occurs. When it does occur, the resample round-trip above
currently fabricates a contiguous timeindex, which can reopen a gap
left by a prior manual/auto time step selection - the trim is skipped
in that case rather than risk operating on the wrong window. See
:func:`~.flex_opt.charging_strategies.charging_strategy` for details.

"""
charging_strategy(
self, strategy=strategy, charging_park_ids=charging_park_ids, **kwargs
Expand Down Expand Up @@ -2340,6 +2392,16 @@ def apply_heat_pump_operating_strategy(
pumps for which COP information in :attr:`~.edisgo.EDisGo.heat_pump` is
given are used. Default: None.

Notes
-----
The written load time series are scoped to
:attr:`~.network.timeseries.TimeSeries.timeindex`, regardless of
whether :attr:`~.edisgo.EDisGo.heat_pump`'s COP/heat demand time
series currently span a wider or different range. Raises
``KeyError`` if they are missing data for a time step in the active
timeindex - see :func:`~.flex_opt.heat_pump_operation.operating_strategy`
for details.

"""
hp_operating_strategy(self, strategy=strategy, heat_pump_names=heat_pump_names)

Expand Down Expand Up @@ -3551,6 +3613,65 @@ def spatial_complexity_reduction(
)
return edisgo_obj, busmap_df, linemap_df

def map_reduced_results_to_full_grid(
self,
reduced_grid: EDisGo,
flexible_cps: list | None = None,
flexible_hps: list | None = None,
flexible_loads: list | None = None,
flexible_storage_units: list | None = None,
) -> EDisGo:
"""
Writes optimized flexible-component dispatch from a spatially-reduced
grid back onto this (full) grid.

Counterpart to :meth:`spatial_complexity_reduction`: where that
method shrinks this grid for a faster OPF, this method maps the OPF's
active-power results from ``reduced_grid`` back onto ``self`` so
reinforcement can run on the full topology. Only components the OPF
actually rewrites are touched — flexible charging points, heat pumps,
DSM loads, and storage units. Inflexible loads/generators are
untouched, since the OPF never changed their series and ``self``
already holds the correct values for them.

See
:func:`~.tools.spatial_complexity_reduction.apply_reduced_results_to_full_grid`
for the full matching/disaggregation rules and the reactive-power
recompute this method triggers as a side effect.

Parameters
----------
reduced_grid : :class:`~.EDisGo`
The spatially-reduced EDisGo instance the OPF ran on. Supplies
the optimized active-power series and, if aggregated, the
``old_name`` provenance for disaggregation.
flexible_cps : list of str, optional
Names of flexible charging points in ``reduced_grid`` to map
back.
flexible_hps : list of str, optional
Names of flexible heat-pump loads in ``reduced_grid`` to map
back.
flexible_loads : list of str, optional
Names of flexible DSM loads in ``reduced_grid`` to map back.
flexible_storage_units : list of str, optional
Names of flexible storage units in ``reduced_grid`` to map back.

Returns
-------
:class:`~.EDisGo`
``self``, with active power written for the given flexible
components and reactive power recomputed.

"""
return apply_reduced_results_to_full_grid(
full_grid=self,
reduced_grid=reduced_grid,
flexible_cps=flexible_cps,
flexible_hps=flexible_hps,
flexible_loads=flexible_loads,
flexible_storage_units=flexible_storage_units,
)

def check_integrity(self):
"""
Method to check the integrity of the EDisGo object.
Expand Down Expand Up @@ -3691,8 +3812,8 @@ def resample_timeseries(
"""
Resamples time series data in
:class:`~.network.timeseries.TimeSeries`, :class:`~.network.heat.HeatPump`,
:class:`~.network.electromobility.Electromobility` and
:class:`~.network.overlying_grid.OverlyingGrid`.
:class:`~.network.electromobility.Electromobility`,
:class:`~.network.dsm.DSM` and :class:`~.network.overlying_grid.OverlyingGrid`.

Both up- and down-sampling methods are possible.

Expand All @@ -3716,6 +3837,14 @@ def resample_timeseries(

* :attr:`~.network.heat.HeatPump.heat_demand_df`

* :attr:`~.network.dsm.DSM.p_min`

* :attr:`~.network.dsm.DSM.p_max`

* :attr:`~.network.dsm.DSM.e_min`

* :attr:`~.network.dsm.DSM.e_max`

* All data in :class:`~.network.overlying_grid.OverlyingGrid`

Parameters
Expand Down Expand Up @@ -3748,8 +3877,77 @@ def resample_timeseries(
self.timeseries.resample(method=method, freq=freq)
self.electromobility.resample(freq=freq)
self.heat_pump.resample_timeseries(method=method, freq=freq)
self.dsm.resample(method=method, freq=freq)
self.overlying_grid.resample(method=method, freq=freq)

def reduce_timeseries_data_to_given_timeindex(
self,
timeindex,
freq="1H",
timeseries=True,
electromobility=True,
save_ev_soc_initial=True,
heat_pump=True,
dsm=True,
overlying_grid=True,
):
"""
Reduces timeseries data in this EDisGo object to given time index.

Thin wrapper around
:func:`edisgo.tools.tools.reduce_timeseries_data_to_given_timeindex`,
exposed here for discoverability - the underlying implementation is
otherwise only importable directly from ``edisgo.tools.tools``, which
made it easy to miss for anyone using :class:`~.EDisGo` outside the
``run`` pipeline (its only prior callers).

Parameters
-----------
timeindex : :pandas:`pandas.DatetimeIndex<DatetimeIndex>`
Time index to set.
freq : str or :pandas:`pandas.Timedelta<Timedelta>`, optional
Frequency of time series data. This is only needed if it cannot be
inferred from the given `timeindex` and if electromobility data
and/or overlying grid data is reduced, as the initial SoC is
tried to be set using the time step before the first time step in
the given `timeindex`. Offset aliases can be found here:
https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases.
Default: '1H'.
timeseries : bool
Indicates whether timeseries in
:class:`~.network.timeseries.TimeSeries` are reduced to given
time index. Default: True.
electromobility : bool
Indicates whether timeseries in
:class:`~.network.electromobility.Electromobility` are reduced to
given time index. Default: True.
save_ev_soc_initial : bool
Indicates whether to save initial EV SOC from timestep before
first timestep of given time index. Default: True.
heat_pump : bool
Indicates whether timeseries in :class:`~.network.heat.HeatPump`
are reduced to given time index. Default: True.
dsm : bool
Indicates whether timeseries in :class:`~.network.dsm.DSM` are
reduced to given time index. Default: True.
overlying_grid : bool
Indicates whether timeseries in
:class:`~.network.overlying_grid.OverlyingGrid` are reduced to
given time index. Default: True.

"""
reduce_timeseries_data_to_given_timeindex(
self,
timeindex,
freq=freq,
timeseries=timeseries,
electromobility=electromobility,
save_ev_soc_initial=save_ev_soc_initial,
heat_pump=heat_pump,
dsm=dsm,
overlying_grid=overlying_grid,
)


def import_edisgo_from_pickle(filename, path=""):
"""
Expand Down
Loading
Loading