Carry a PLEXOS Constraint through the extensions sidecar - #19
Open
thomaschristopherking wants to merge 1 commit into
Open
Conversation
A PLEXOS `Constraint` holds a weighted sum over the objects it names to a right-hand side, and that is how a model states an energy budget, a running-hour cap, an RPS target and an emission target. The AEMO 2024 ISP file carries 186 of them. `map_constraints` reported every one as not carried and the reading stopped there, so nothing downstream could apply a constraint even in principle. A PyPSA `GlobalConstraint` limits one carrier over the whole horizon and cannot name a set of components, so no shape of `Constraint` fits it. The concept survives a hop through PyPSA only in the sidecar, which now carries each `Constraint` it can read: the sense, the period its right-hand side applies over, the limit, and each term of the weighted sum with the class its object belongs to and the property that weights it. `pypsa-to-sienna` relays each record on, because a hop that cannot apply a constraint must not be the hop that loses it. Signed-off-by: Thomas C. King <thomas.k@transitionzero.org>
|
Warning Review limit reachedNext included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 11, 2026
thomaschristopherking
added this pull request to stack #23
September 11, 2026 09:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
A PLEXOS
Constraintholds a weighted sum over the objects it names to a right-hand side,which is how a model states an energy budget, a running-hour cap, an RPS target and an
emission target. The AEMO 2024 ISP file carries 186 of them, and
map_constraintsreportedevery one as not carried. Each
Constraintthe translator can read now reaches the extensionssidecar.
Third of five for transition-zero/tz-infra-interop#116,
stacked on #18.
Files to review (6, +291 / -47):
interop/core/extensions.py(start here)ConstraintExtension, with the sense, the period and the weighted terms.interop/plugins/shared/plexos_pypsa_translations/_constraints.pyinterop/plugins/steps/pypsa_to_sienna_map_components.pytests/features/plexos_to_pypsa/constraints.featureWhy
A PyPSA
GlobalConstraintlimits one carrier over the whole horizon and cannot name a set ofcomponents, so no shape of PLEXOS
Constraintfits it. That is a real gap in the hub, and itis not closable here. What was avoidable was losing the constraint entirely: the concept
survives a hop through PyPSA only if something carries it, and nothing did.
How
The sidecar record carries what a consumer needs to rebuild the constraint: the sense
(
<=,==,>=), the period its right-hand side applies over, the limit, and each term ofthe weighted sum with the class its object belongs to and the property that weights it. PLEXOS
names that coefficient property per class (
Generation Coefficient,Flow Coefficientand therest), so the record names it rather than assuming one.
pypsa-to-siennarelays each record into its own sidecar rather than reading it. A hop thatcannot apply a constraint must not be the hop that loses it.
Reviewer notes
The gap analysis still lists every one as unapplied, and part 5 reads the carbon caps out of
these records for the Sienna portfolio.
or weights a class the reader does not know, becomes a
NOT_MAPPEDentry against the objectthat states it, and one warning names a few and counts the rest.
Tests
610 scenarios pass, and all 17 pre-commit hooks.
Open workspace in Conductor