Tag flow-path limit timeslices with their region's demand condition#113
Open
nick-gorman wants to merge 3 commits into
Open
Tag flow-path limit timeslices with their region's demand condition#113nick-gorman wants to merge 3 commits into
nick-gorman wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
14f1a7b to
939f346
Compare
The custom-constraints templater emits region-tagged timeslices (qld_peak_demand etc.) lifted from PLEXOS, but the IASR-derived flow-path limits carried region-agnostic ones (peak_demand). For intraregional links that's harmless, but for interregional links the two tables couldn't be lined up — it wasn't clear which region's demand condition a cross-region limit belonged to. The PLEXOS model resolves it consistently: a path's forward limit is tagged with the destination region's demand condition and its reverse limit with the origin region's, because the receiving region's load is what tightens the limit. This applies that rule while the sub-regional limits are built (before any granularity aggregation, so a REZ stays symmetric even when single_region retargets its geo_to to NEM), prefixing each timeslice with the lowercased region id so the flow-path and custom-constraint tables share one vocabulary. See #109. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The region->region identities in _build_geo_region_lookup were unexercised. The documented parallel-path injection case (CNSW-SNW) is intra-region, so it drops out at nem_regions and nothing reached _add_region_to_timeslices with endpoints that are already NEM regions. This pins that path: a cross-region corridor whose only base sibling is suffixed is injected at nem_regions and must still read forward=qld, reverse=nsw — which needs the identities to resolve NSW/QLD. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Captures the conventions used for this PR so future descriptions are consistent: lead with the story, include a directory-tree diagram, flag the non-obvious design choices, drop sections that say nothing distinctive, and keep the tone dry and understated rather than effusive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
188cc9a to
4e9366d
Compare
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.
Background
Two tables on this branch describe transmission limits by demand condition, and they were inconsistent. The custom-constraints templater (#112) emits region-tagged timeslices read from PLEXOS —
qld_peak_demand,vic_winter_reference, and so on. The flow-path limits templater, sourced from the IASR workbook, emitted region-agnostic ones — plainpeak_demand,summer_typical,winter_reference. AEMO defines these demand conditions per region, so the flow-path limits should carry the same region-specific timeslices as the rest of the model. For an intraregional link the region is implied, but for an interregional link a region-agnostic timeslice is also ambiguous: a NSW↔QLD limit has apeak_demandvalue in each direction with nothing to say which region's demand condition each belongs to.PLEXOS tags a path's forward limit with the destination region's demand condition and its reverse limit with the origin region's (the receiving region's load is what tightens an import limit). The investigation is written up in #109. This PR adopts the same convention for the flow-path limits so they're consistent with the custom constraints: each limit's timeslice is prefixed with the lowercased region id, and both tables end up using one vocabulary.
What to expect in the diff
The logic is one new helper,
_add_region_to_timeslices, slotted into the existing orchestrator. Most of the line count is the test files relearning the prefixed values and the docstring I/O examples being brought up to date.A few design choices worth knowing before reading the code:
geo_from) to its parent sub-region (geo_to), both in the same region, so its symmetric limit should get the same prefix in both directions.single_regionlater rewritesgeo_toto the singleNEMgeo — so prefixing afterwards would tag the forward limitnem_*and the reverseqld_*. Prefixing first gives bothqld_*, and aggregation only re-keys the path id, leaving the prefix alone.sub_regional_geography, which already maps both sub-regions and REZs to their region id. NEM regions are added as identities so already-aggregated geos still resolve._assert_geos_have_regionsruns before prefixing for every granularity, so an endpoint absent from the geography raises rather than silently producing aNaNprefix.Where the changes live
The
timeslicecolumn isn't consumed downstream yet, so this is a no-op at runtime; it brings the flow-path timeslices into line with the custom constraints for when both are used together.🤖 Generated with Claude Code