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

global_constraint: add operational limit constraint #618

Merged
merged 3 commits into from May 10, 2023
Merged

Conversation

FabianHofmann
Copy link
Collaborator

@FabianHofmann FabianHofmann commented May 9, 2023

Analogous to primary_energy_limit but directly working on carrier output. This will help to replace some stores in pypsa-eur (sector-coupled) by light-weight constrained generators.

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.

@fneum
Copy link
Member

fneum commented May 10, 2023

Can you explain a little more about how it works? I don't yet understand why it is better than a Store.

@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Patch coverage: 77.50% and no project coverage change.

Comparison is base (c8d9b7e) 76.64% compared to head (49c472c) 76.65%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #618   +/-   ##
=======================================
  Coverage   76.64%   76.65%           
=======================================
  Files          24       24           
  Lines        6290     6330   +40     
  Branches     1331     1338    +7     
=======================================
+ Hits         4821     4852   +31     
- Misses       1188     1194    +6     
- Partials      281      284    +3     
Impacted Files Coverage Δ
pypsa/optimization/global_constraints.py 85.65% <76.92%> (-1.56%) ⬇️
pypsa/optimization/optimize.py 88.18% <100.00%> (+0.04%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@FabianHofmann
Copy link
Collaborator Author

FabianHofmann commented May 10, 2023

The reason is that modelling stores is quite extensive. You have intertemporal constraints with auxiliary variables (soc, charge, discharge). If you limit the total energy output of one single generator (or a generator carrier fleet) instead of setting up a store with an initial soc which depletes over time, you save a lot of complexity. So (reducing to generators) the constraint is just saying

$$\sum_{G \in \Theta, t} g_{G, t} <= limit$$

where $\Theta$ is the set of generators which belong to the carrier set in the global constraint.

@fneum
Copy link
Member

fneum commented May 10, 2023

Ah, I see that makes sense.

Copy link
Member

@fneum fneum 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! Nicely tested, so it was easy to review.

@fneum
Copy link
Member

fneum commented May 10, 2023

At some point, we need to update the documentation of the GlobalConstraint component:

https://pypsa.readthedocs.io/en/latest/components.html#global-constraints

@fneum fneum enabled auto-merge May 10, 2023 09:43
@fneum fneum added this to the Release v0.23 milestone May 10, 2023
@fneum fneum merged commit 1f80c04 into master May 10, 2023
20 checks passed
@tintin305
Copy link

I don't see any place that caters for selecting investment_periods. Will this still need to be introduced as a parameter?

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.

None yet

3 participants