Write a Sienna investments portfolio from an expansion plan - #20
Open
thomaschristopherking wants to merge 1 commit into
Open
Conversation
The parts below this one carry a PLEXOS expansion plan as far as PyPSA and no further. There was no Sienna investments vocabulary, no translation, no sink and no pipeline, so an extendable network had nowhere to go. `plexos-to-sienna-investments` writes a SiennaSchemas `PortfolioDocument` beside the operations system it expands, and `pypsa-to-sienna-investments` does the same for a PyPSA network that states its own expansion. Each extendable component becomes a `SupplyTechnology` or a `StorageTechnology` carrying its capital cost, its operation cost, its capacity limits and its financial data. The base-system devices a technology stands for become its existing fleet, a carbon cap from the constraint sidecar becomes a `CarbonCaps` requirement, and the regions, demand and financials fill the rest of the document. `yearly_fixed_charge` reads the yearly fixed charge from the extensions sidecar where a PLEXOS model stated one, and falls back to `fom_cost` for a network a user wrote themselves. Sienna's `operation_costs.fixed` is yearly, and PyPSA's `fom_cost` is a charge for the whole modelled horizon, so the two are not the same number. 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 (30)
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
The parts below this one carry a PLEXOS expansion plan as far as PyPSA and no further: there
was no Sienna investments vocabulary, no translation, no sink and no pipeline, so an extendable
network had nowhere to go.
plexos-to-sienna-investmentsnow writes a SiennaSchemasPortfolioDocumentbeside the operations system it expands, andpypsa-to-sienna-investmentsdoes the same for a PyPSA network that states its own expansion.
Fourth of five for transition-zero/tz-infra-interop#116,
stacked on #19. The fifth adds the AEMO case study.
Files to review (30, +4383 / -27):
docs/translation_mappings/translation-from-plexos-to-sienna-investments.md(start here)interop/plugins/shared/sienna_investments_constants.py(new)interop/plugins/steps/pypsa_to_sienna_investments_map_technologies.py(new)interop/plugins/shared/pypsa_sienna_investments_translations/_supply.py(new)SupplyTechnology: capital cost, operation cost, capacity limits.interop/plugins/shared/pypsa_sienna_investments_translations/_carbon_caps.py(new)interop/plugins/sinks/emit_sienna_portfolio.py(new)PortfolioDocumentbeside the operations system.tests/features/pypsa_to_sienna_investments/portfolio.feature(new)Why
SiennaSchemas
Investments/is a separate, parallel data model rather than an extension ofOperations: its spatial unit is a region, its components are buildable technologies, and it
carries policy requirements and financials that Operations has no home for. An extendable PyPSA
network maps onto it and onto nothing in Operations, so without this the expansion plan reached
PyPSA and stopped.
How
Each extendable component becomes a technology. A generator becomes a
SupplyTechnology,a storage unit a
StorageTechnology, and each carries its capital cost, its operation cost,its capacity limits, its lifetime and its financial data. The base-system devices a technology
stands for become its existing fleet, with the build year off the network and the retirement
year off the sidecar.
The rest of the document comes from beside the components. A carbon cap comes from the
constraint records part 3 carries, the regions from the bus-to-area mapping, the demand from
the loads, and the financials from one base year the user states because no PyPSA field
carries one.
yearly_fixed_chargeis the one place the two pipelines differ. Sienna'soperation_costs.fixedis a yearly charge; PyPSA'sfom_costis a charge for the wholemodelled horizon. A network this translator wrote carries the yearly figure in the sidecar, so
the portfolio reads that; a network a user wrote states
fom_costalone, so it falls back tothat.
Reviewer notes
modules, the step and the sink arrive together because a reviewer reading "what does a
portfolio look like" wants the whole document. It splits further if you would rather have a
skeleton first: the vocabulary, sink and two technology types in one PR, then the
requirements and attributes in a second.
plexos-to-sienna-investmentsruns the operations steps and the investments steps over onemodel and writes both documents, which is why part 1's candidate drop matters: without it the
base system would contain the candidates the portfolio is about.
pypsa_to_sienna_investments_map_technologies.pyis 635 lines andorchestrates every table. I would like a second opinion on whether the existing-fleet and
supplemental-attribute paths belong in it or in modules of their own.
Tests
638 scenarios pass, and all 17 pre-commit hooks.
Open workspace in Conductor