Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save shadow price for CO2Limit global constraint as positive #870

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

martavp
Copy link
Member

@martavp martavp commented Apr 17, 2024

Closes #843

Changes proposed in this Pull Request

The dual of the CO2Limit global constraint was saved as negative due to the co2_emissions defined as -1. This PR forces the shadow CO2 price to be saved as a positive number.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@martavp martavp requested a review from lisazeyen April 17, 2024 07:00
@FabianHofmann
Copy link
Collaborator

@martavp I don't know if that is the right spot. people might name their constraints differently, "co2_limit", "co2limit", "co2-constraints' ....
Like this, we are only covering one specific case. Would it not be better to fix that in pypsa-eur explicitely? Then we also leave the functionality and its logic generic without special cases.

@martavp
Copy link
Member Author

martavp commented Apr 17, 2024

Thanks for the suggestion @FabianHofmann

I know the solution is a bit hacky but at least self-explanatory.

Would you suggest modifying the network in PyPSA-Eur after the optimize function was run?

Wouldn't potential people using different names for their co2Limite-related constraint also expect to get a positive value for the dual?

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.

Negative shadow price for Global CO2 constraint (also in linopy model )
2 participants