Skip to content

Fix:Issue warning instead of error for non-extendable heat storage in energy-to-power ratio constraints#1769

Merged
lindnemi merged 4 commits intomasterfrom
fix-tes-e2p-constraints-for-fixed-capacities
Jul 25, 2025
Merged

Fix:Issue warning instead of error for non-extendable heat storage in energy-to-power ratio constraints#1769
lindnemi merged 4 commits intomasterfrom
fix-tes-e2p-constraints-for-fixed-capacities

Conversation

@amos-schledorn
Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request

@lindnemi raised that, if all TES are non-extendable, the energy-to-power ratio constraints fail with an error message. This PR replaces the error message with a warning and a non-enforcing of the energy-to-power ratio and charger/discharger ratio constraints.
Tested by @lindnemi

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Sources of newly added data are documented in doc/data_sources.rst.
  • A release note doc/release_notes.rst is added.

Copy link
Copy Markdown
Contributor

@TomKae00 TomKae00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@lindnemi
Copy link
Copy Markdown
Contributor

Yes, this is what i have been using and it works.

However, I noticed a different problem now:

When i fix the capacities after the first run, and rerun the model, it may occur that the constraint, which remains in the model after the first run, causes an infeasibility. This happened because of minor constraint violations that occured during the first solve, e.g., I got

Link-ext-p_nom-lower[PL0 0 urban central water pits charger-2030]: +1 Link-p_nom[PL0 0 urban central water pits charger-2030] ≥ 8892.54423403
Store-ext-e_nom-upper[PL0 0 urban central water pits-2030]: +1 Store-e_nom[PL0 0 urban central water pits-2030] ≤ 1333881.6351
TES_energy_to_power_ratio[50]: +1 Store-e_nom[PL0 0 urban central water pits-2030] - 150 Link-p_nom[PL0 0 urban central water pits charger-2030] = -0

This is infeasible, because: 150 * 8892.54423403 = 1333881.6351045 > 1333881.6351

Not sure how to best solve it, for a quick fix i just allowed the store to be extendable, because this constraint anyways forces store and link to be proportional. Not sure why it occured in the first place, since it should only affect extendable link and i thought i had all of them disabled 🤔

Anyways, while i am figuring this out, this PR can be merged

@lindnemi lindnemi enabled auto-merge (squash) July 25, 2025 07:33
@amos-schledorn
Copy link
Copy Markdown
Contributor Author

Yes, this is what i have been using and it works.

However, I noticed a different problem now:

When i fix the capacities after the first run, and rerun the model, it may occur that the constraint, which remains in the model after the first run, causes an infeasibility. This happened because of minor constraint violations that occured during the first solve, e.g., I got

Link-ext-p_nom-lower[PL0 0 urban central water pits charger-2030]: +1 Link-p_nom[PL0 0 urban central water pits charger-2030] ≥ 8892.54423403
Store-ext-e_nom-upper[PL0 0 urban central water pits-2030]: +1 Store-e_nom[PL0 0 urban central water pits-2030] ≤ 1333881.6351
TES_energy_to_power_ratio[50]: +1 Store-e_nom[PL0 0 urban central water pits-2030] - 150 Link-p_nom[PL0 0 urban central water pits charger-2030] = -0

This is infeasible, because: 150 * 8892.54423403 = 1333881.6351045 > 1333881.6351

Not sure how to best solve it, for a quick fix i just allowed the store to be extendable, because this constraint anyways forces store and link to be proportional. Not sure why it occured in the first place, since it should only affect extendable link and i thought i had all of them disabled 🤔

Anyways, while i am figuring this out, this PR can be merged

Thanks for the review! Infeasibilities after fixing some decisions are quite common. Did you try enabling cross-over or tightening the infeasibility tolerance (and loosening it for the second run)?

@lindnemi lindnemi merged commit c059ba5 into master Jul 25, 2025
8 checks passed
@lindnemi lindnemi deleted the fix-tes-e2p-constraints-for-fixed-capacities branch July 25, 2025 08:19
toniseibold pushed a commit that referenced this pull request Dec 1, 2025
… energy-to-power ratio constraints (#1769)

* fix: replace ValueError with logger warnings for TES constraints when no extendable links are found and return

* doc: update release notes

---------

Co-authored-by: Micha <[email protected]>
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.

3 participants