Skip to content

feat(reinforce): add traceable reinforce_log to Results - #743

Open
nader-00 wants to merge 3 commits into
devfrom
741-feature-traceable-reinforcement-log
Open

nader-00 wants to merge 3 commits into
devfrom
741-feature-traceable-reinforcement-log

Conversation

@nader-00

@nader-00 nader-00 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Description

Results.reinforce_log is a new long-format DataFrame that records why each grid-reinforcement measure happened - the violated component, the exceeded limit, the time step and load/feed-in case - alongside what equipment_changes already tracked (what changed and at what cost), one row per (violation, changed component).

  • check_tech_constraints: add a signed max_voltage_dev column, needed to derive issue_type (over-/undervoltage) and the allowed limit.
  • reinforce_measures: add optional return_node_mapping to reinforce_lines_voltage_issues/reinforce_mv_lv_station_voltage_issues so voltage-triggered reinforcements can be traced back to the violating node/station.
  • reinforce_grid: wire _add_reinforcement_log_entries into every stage that already writes equipment_changes; add a log_reinforcement toggle, a run_id to disambiguate repeated reinforce_grid() calls, human-readable INFO logging per violation, and an end-of-run cost summary grouped by trigger/issue_case/voltage_level.
  • Add tests for the signed voltage deviation, cost consistency with grid_expansion_costs, and CSV round-tripping.

Fixes #741

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • New and adjusted code is formatted using the pre-commit hooks
  • New and adjusted code includes type hinting now
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The Read the Docs documentation is compiling correctly
  • If new packages are needed, I added them the setup.py, and if needed the rtd_requirements.txt, the eDisGo_env.yml and the eDisGo_env_dev.yml.
  • I have added new features to the corresponding whatsnew file

Results.reinforce_log is a new long-format DataFrame that records why
each grid-reinforcement measure happened - the violated component, the
exceeded limit, the time step and load/feed-in case - alongside what
equipment_changes already tracked (what changed and at what cost), one
row per (violation, changed component).

- check_tech_constraints: add a signed max_voltage_dev column, needed
  to derive issue_type (over-/undervoltage) and the allowed limit.
- reinforce_measures: add optional return_node_mapping to
  reinforce_lines_voltage_issues/reinforce_mv_lv_station_voltage_issues
  so voltage-triggered reinforcements can be traced back to the
  violating node/station.
- reinforce_grid: wire _add_reinforcement_log_entries into every stage
  that already writes equipment_changes; add a log_reinforcement
  toggle, a run_id to disambiguate repeated reinforce_grid() calls,
  human-readable INFO logging per violation, and an end-of-run cost
  summary grouped by trigger/issue_case/voltage_level.
- Fix earthworks costs being charged once per iteration instead of
  once per line, which previously overstated reinforce_log's costs
  whenever a line needed several incremental parallel-line additions
  across iterations.
- Add tests for the signed voltage deviation, cost consistency with
  grid_expansion_costs, and CSV round-tripping.
@joda9
joda9 self-requested a review August 26, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: traceable reinforcement log — why was each measure triggered?

1 participant