Edisgo run edisgo#629
Open
MoritzSchloesser wants to merge 42 commits into
Open
Conversation
Adds optional overlying_grid_data kwarg to run_edisgo() that is stashed on RunContext for downstream tasks instead of being passed as a keyword to every task (which broke task signatures). task_import_overlying_grid_data now: - accepts the standard (edisgo, ctx, *, ...) signature - reads overlying_grid_data from ctx, falls back to overlying_grid.path in the runner config - loads dispatchable + renewables_potential CSVs and applies them via set_time_series_active_power_predefined - shifts the year and reindexes overlying-grid attributes to the active edisgo timeindex so CSV-based input lines up with OEDB time series task_set_timeindex now reduces existing time-series data to the new index (via reduce_timeseries_data_to_given_timeindex) instead of silently leaving stale data behind. Renames the uc4_example_MS preset to uc4_example.
…ndex
powermodels_io.from_powermodels now slices the destination time index
explicitly when writing OPF flex results back to the EDisGo
timeseries (gen_nd, heatpumps, electromobility, dsm, storage). Using
`loc[:, names]` overwrites every row of the underlying DataFrame
even when the OPF only covered a subset of timesteps; restricting
to `timeseries.timeindex` keeps untouched rows intact.
task_optimize:
- fixes typo `flexbile` → `flexible` in the dsm shortcut
- corrects the dsm condition (was checking `is not None`, should
populate when `None`)
- materializes empty flex lists once instead of repeating `or []`
at every call site
task_import_overlying_grid_data reindexes the three SOC attributes
(storage_units_soc, thermal_storage_units_{central,decentral}_soc) to
timeindex + 1 extra step, because PowerModels expects the
end-of-period SOC value; non-SOC overlying-grid attributes still
reindex to the plain timeindex.
uc4_example preset reworked: switches to opf_version 3 (HV
constraints from overlying grid), drops base_reinforce + check_integrity
from the pipeline, adds an explicit `overlying_grid.path` config slot,
splits import_electromobility kwargs onto separate lines, and enables
archive + save_opf_results on the final save step.
Adds optional overlying_grid_data kwarg to run_edisgo() that is stashed on RunContext for downstream tasks instead of being passed as a keyword to every task (which broke task signatures). task_import_overlying_grid_data now: - accepts the standard (edisgo, ctx, *, ...) signature - reads overlying_grid_data from ctx, falls back to overlying_grid.path in the runner config - loads dispatchable + renewables_potential CSVs and applies them via set_time_series_active_power_predefined - shifts the year and reindexes overlying-grid attributes to the active edisgo timeindex so CSV-based input lines up with OEDB time series task_set_timeindex now reduces existing time-series data to the new index (via reduce_timeseries_data_to_given_timeindex) instead of silently leaving stale data behind. Renames the uc4_example_MS preset to uc4_example.
…ndex
powermodels_io.from_powermodels now slices the destination time index
explicitly when writing OPF flex results back to the EDisGo
timeseries (gen_nd, heatpumps, electromobility, dsm, storage). Using
`loc[:, names]` overwrites every row of the underlying DataFrame
even when the OPF only covered a subset of timesteps; restricting
to `timeseries.timeindex` keeps untouched rows intact.
task_optimize:
- fixes typo `flexbile` → `flexible` in the dsm shortcut
- corrects the dsm condition (was checking `is not None`, should
populate when `None`)
- materializes empty flex lists once instead of repeating `or []`
at every call site
task_import_overlying_grid_data reindexes the three SOC attributes
(storage_units_soc, thermal_storage_units_{central,decentral}_soc) to
timeindex + 1 extra step, because PowerModels expects the
end-of-period SOC value; non-SOC overlying-grid attributes still
reindex to the plain timeindex.
uc4_example preset reworked: switches to opf_version 3 (HV
constraints from overlying grid), drops base_reinforce + check_integrity
from the pipeline, adds an explicit `overlying_grid.path` config slot,
splits import_electromobility kwargs onto separate lines, and enables
archive + save_opf_results on the final save step.
…rlyingGrid object
…nterface This branch includes changes that were required to run eDisGo within eGo when overlying_grid_data is not stored in csv-files but taken from eTraGo results.
This reverts commit 5fce257.
- timeseries.task_manual_ts: pass set_time_series_manual's real kwargs (generators_p/loads_p/... instead of *_active_power) — task was unusable. - config._adapt_ego_legacy: merge the duplicated 'overlying_grid' dict key (the 'path' entry was silently dropped). - tasks.io.import_overlying_grid_data: rewrite tangled control flow — guard .get(...).empty against None, drop the double from_csv, only warn on a genuinely unknown source, and infer the SOC extra step only when derivable (no IndexError on a single-timestamp timeindex). - validator: load_from no longer satisfies the time-series/flex prerequisite for analyze/reinforce/optimize, since _load_artifact reloads with import_timeseries=False and drops flex data (+ regression test). - powermodels_io: unify SOC year via DateOffset instead of replace(year=) to avoid a Feb-29 ValueError on leap-to-non-leap remapping. - context.ensure_engine: connect directly to a configured local postgres (psycopg2, pool_pre_ping) when SSH is disabled and host params are given. - config._resolve_extends: resolve a relative 'extends' against the including file before falling back to a bundled preset.
…ct loader - registry: register_task now records requires/provides/ts_altering metadata (TaskMeta) exposed via get_task_meta. Tasks declare their pre-/post- conditions (setup_grid provides 'grid', TS tasks provide 'timeseries', flex imports require 'grid' and provide 'flex', analyze/reinforce require 'timeseries', optimize requires 'timeseries'+'flex', base_reinforce requires 'grid'). - validator: check those metadata generically instead of maintaining parallel hard-coded task-name sets, so it stays in sync with the tasks. load_from provides only 'grid' (not timeseries/flex), matching _load_artifact. Compute the known-task set once instead of per step. - runner._load_artifact and tasks.grid.task_load_from_base now share one load_saved_edisgo() helper instead of duplicating the import_edisgo_from_files policy.
- tools.align_series_to_timeindex: single helper that shifts a series' year (via DateOffset, leap-safe) and reindexes onto the edisgo time index, with an optional end-of-period step for SOC series. Used by both tasks.io.import_overlying_grid_data and powermodels_io (which now reindexes the SOC series instead of .loc, so a missing step yields NaN not KeyError). - context: declare overlying_grid_data as a RunContext field instead of a dynamically-set attribute; the task reads it directly. - EDisGo.run_pipeline: accept and forward overlying_grid_data (API symmetry with run_edisgo). - config._adapt_ego_legacy: deep-copy cfg['database'] before injecting ssh so the caller's config is not mutated.
Cover the previously-untested task control flow (source of the review bugs): task_manual_ts applies its kwargs, import_overlying_grid_data handles the disabled/unknown/etrago-without-data/empty-etrago/csv-without-path branches without crashing, and every bundled preset passes the metadata-driven validator.
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.
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