docs(pypsa): the cycle rows read each investment period's own cycle basis - #814
Merged
Merged
Conversation
…e commitment rows, as in pypsa master
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
…asis Line_cycle_weight, Transformer_cycle_weight and Transformer_phase_shift_cycle_weight span period; rung 66 records a line that closes a mesh in a later period, and the empty security copies linopy counts.
Documentation build overview
16 files changed ·
|
# Conflicts: # CHANGELOG.md
…ocs/pypsa-network-periods
FabianHofmann
force-pushed
the
docs/pypsa-fixed-modular
branch
from
October 2, 2026 09:06
df7f835 to
34af2a0
Compare
…riods # Conflicts: # CHANGELOG.md # docs/examples/pypsa.md # docs/examples/pypsa/line.md # docs/examples/pypsa/link.md # docs/examples/pypsa/transformer.md # examples/pypsa.yaml # examples/pypsa/line.yaml # examples/references/pypsa/references.json
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.
Note
The following content was generated by AI.
Kirchhoff_Voltage_Lawnow reads the cycle basis of each snapshot's investment period, as PyPSA does. Rung 66 records a line that closes a mesh in 2030, and the empty security copies linopy counts. Part of #783; stacks on #787 and #786.Method, gate output, PyPSA cites, what is not done
What changed
examples/pypsa.yaml:Line_cycle_weight,Transformer_cycle_weightandTransformer_phase_shift_cycle_weightspan[period, …, cycle].Line_angle_sumandTransformer_angle_sumread them withat(…, by=snapshot_period, over=period, into=snapshot). Thecycledimension andKirchhoff_Voltage_Lawsay that a label is a position in its period's basis. A cycle label that a period's basis does not reach has no weight there, so the row has no variable and is not built. No language work was needed.tests/test_pypsa_collapses.py: a standard parameter may gain a leadingperiodas well as a leadingscenario. With one period the frame collapses to the standard one. The docstring no longer callsperiod"mask-only".rung_66_cycles_per_period.py):optimize_security_constrained(multi_investment_periods=True), outageca66. Linesab66,bc66form a path in 2020.ca66comes in with 2030 and closes a triangle. PyPSA builds 2Kirchhoff-Voltage-Lawrows (2030 only) and solves to16000.0.docs/examples/pypsa.md: a rung 66 section; rows in the rung 6 and rung 15 tables; the rung 30 row "a branch not active in a period" now points at rung 66 and has the statussplit.PyPSA cites (02bdcbba)
constraints.py:1640-1652.window.iter_periods()yields one(None, all snapshots)pair withoutmulti_investment_periods(window.py:173-175).cycle_matrix(investment_period=…)drops the branches that are not active in that period (networks.py:1278-1281).abstract.py:472-489. In rung 66 each ofLine-fix-s-lower-security-…and-upper-…has 12 rows. 2 of them, 2020 × monitoredca66× outageca66, read+0 ≥ -40. The file builds the other 10 of each. The feasible set is the same.Measured (this PR)
ca66absent. That forces zero flow onab66andbc66. PyPSA on the same network without those lines in 2020 solves to43900.0, against16000.0. The page cites this PR for the number.Gates
pixi run python -m tools.pypsa_split split examples/pypsa && pixi run python -m tools.gallery: regeneratedexamples/pypsa/{line,transformer,power_flow}.yamland their pages.uv run --script examples/references/pypsa/reference.py: onlyrung_66_cycles_per_periodis new inreferences.json. Every other record is unchanged.uv run --script examples/references/pypsa/reference.py --check: "every rung solves to its record".pixi run lint: pass.pixi run ci: exit 0, 2626 passed, docs-build and compile-tex done.Not done, and found on the way
optimize_security_constrainedreadsn.c.sub_networksaftercreate_model(abstract.py:443-449). With periods, the lastdetermine_network_topologycall is the cycle loop of the last period (constraints.py:1641), which setssub_networkto NaN for branches that are not active then (networks.py:1278-1281). So the BODF comes from the last period's topology in every period, and an outage of a branch that is not active in the last period builds no row, without an error. Probe: the rung 66 network plusab_old66(a–b,build_year=2000,lifetime=25) withbranch_outages=['ab_old66', 'ca66']builds copies forca66only. The file'sLine_BODFandTransformer_BODFspan noperiod, so the file cannot state per-period factors yet. Rung 66 avoids the case: its only outage stands in the last period.constraints.py:1654vs:1660question from docs(pypsa): the pypsa line references point at pypsa master #806 and docs(pypsa): a line or transformer limits its voltage angle difference, as in pypsa master #808: on02bdcbbarung 55'sKeyErroris raised atconstraints.py:1660(tr.static.loc[…]). Line 1654 is theif "Transformer" in …test. The cite inTransformer_phase_shift_varyingstill says:1654. This PR does not change it; docs(pypsa): the pypsa line references point at pypsa master #806 owns line cites.Line_cycle_weightstill citesnetworks.py:1354-1361for the first scenario. On02bdcbbathexs(self.scenarios[0])calls are atnetworks.py:1334-1335and:1351-1352. Left to docs(pypsa): the pypsa line references point at pypsa master #806.tests/fixtures/pypsa_standard_shape.yamlis unchanged. It freezes the standard frames, and the test now allows a leadingperiod.