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

Corrects TCT constraint #521

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

Corrects TCT constraint #521

wants to merge 5 commits into from

Conversation

trevorb1
Copy link
Collaborator

@trevorb1 trevorb1 commented Feb 3, 2025

Closes #520

Changes proposed in this Pull Request

In this PR I update the TCT constraint logic. Specifically, I have removed existing capacity from the rhs of the constraint equation, and left the summation over only extendable generators.

For example, if there is 10MW of existing solar capacity, and the target is at least 50MW, the constraint will read:

sum(solar_ext_p_nom) >= 40

I think to improve interoperability between electricity and sector, it would be nice to not hard code in the Generator and StorageUnit component filtering, but I will add that as a new issue.

Checklist

  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in all of config.default.yaml.
  • Changes in configuration options are also documented in doc/configtables/*.csv.

@trevorb1 trevorb1 requested a review from ktehranchi February 3, 2025 22:54
@trevorb1
Copy link
Collaborator Author

trevorb1 commented Feb 3, 2025

@ktehranchi, as you did the original implementation of TCT, and I uncommented some of your code, could you do a quick review of this please? I just want to make sure I didnt change how you envisioned the TCT constraint.

@trevorb1 trevorb1 linked an issue Feb 3, 2025 that may be closed by this pull request
2 tasks
@trevorb1 trevorb1 changed the title Tct bug Correct TCT constraint Feb 3, 2025
@trevorb1 trevorb1 changed the title Correct TCT constraint Corrects TCT constraint Feb 3, 2025
@trevorb1
Copy link
Collaborator Author

trevorb1 commented Feb 4, 2025

Added assertion that will flag if a max capacity limit is higher than existing installed capacity

For example, this will print out:

AssertionError: TCT constraint of 500.0 MW for solar must be at least 20473.200008288026

n.model.add_constraints(
lhs >= (target["min"]),
name=f"GlobalConstraint-{target.name}_{target.planning_horizon}_min",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The reason I have "GlobalConstraint" appended is to be able to get pypsa to export the shadow price of the constraint (PyPSA/PyPSA#850) . So it'd be good to add that back!

@ktehranchi
Copy link
Collaborator

LGTM but added one comment on the naming of the constraint.

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.

Technology Capacity Target Constraint
2 participants