Skip to content

docs(pypsa): a PyPSA schedule, weight or limit that the data leaves out is absent rather than zero, and a committable extendable unit is assumed to have its big-M - #912

Merged
FBumann merged 4 commits into
claude/bold-wozniak-jewqijfrom
docs/pypsa-missing-readings
Oct 22, 2026
Merged

FBumann merged 4 commits into
claude/bold-wozniak-jewqijfrom
docs/pypsa-missing-readings

Conversation

@FBumann

@FBumann FBumann commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: Lets scan the pysa files about those missing values. And judge which should get 0, 1 or absent. As a stacked PR

Note

The following content was generated by AI.

Of the 73 PyPSA parameters that declare missing:, 61 change from 0 to absent. For each of them, every reading gives the same rows either way. Four keep 0, eight keep their reading, and none needs 1. Stacked on #894.

The judgement, by how the files read each parameter
Parameters Read as 0 and absent Now
the 18 *_set schedules and builds (Generator_p_set, Line_s_nom_set, StorageUnit_state_of_charge_set, …) a bare name in the where: of the row that fixes the value, and that row's right side a bare number in a where: is false at a missing row under both, and a real 0.0 is a row under both, so the rows are the same, and the missing value is never read absent
the 16 weights of the global constraints (*_primary_energy_weight, *_operational_limit_weight, *_tech_capacity_weight, *_volume_weight, *_expansion_cost_weight) and the 5 cycle and outage weights (Line_cycle_weight, Transformer_cycle_weight, Transformer_phase_shift_weight, the two *_BODF) a factor of a summand in a sum, or a coefficient under a where: that names it absent drops the summand and keeps the row; 0 keeps a term with no coefficient, which specsolve does not build absent
the 12 ramp limits, Line_v_ang_max, Transformer_v_ang_max, Carrier_max_growth ("no value means no limit") a bare name in a where: or a when:, and a value under it false at a missing row under both, so the value is never read absent
the 3 *_maintenance_duration only in assumptions, under where: *_maintainable a comparison is false at a missing row under both, so a maintainable unit without one fails the assumption either way absent
CVaR_alpha the divisor 1 - CVaR_alpha, under where: CVaR_omega read only where data prep writes it beside CVaR_omega absent
the 3 *_big_m a coefficient in the com-ext rows, under where: *_com_ext 0 would force p <= 0 at a missing row, and absent would drop the row. Neither is right: data prep writes one for each committable, extendable unit (get_committable_big_m_values) absent, with an assumption holds: *_big_m where *_com_ext
the 3 *_p_init status_initial * p_init, the output carried into the first snapshot a unit that came in off ramps from 0 * p_init, and absent would drop that row. PyPSA's default p_init is 0 0
CVaR_omega a factor of the cost expression (1 - CVaR_omega) * … + CVaR_omega * CVaR absent would drop that expression wherever no risk preference is set. 0 is risk-neutral, PyPSA's default 0
GlobalConstraint_counts_snapshot a bool flag false is a snapshot the row does not count false
the 7 *_nom_mod a divisor 0 is refused at load as a divisor absent, as in #894

No parameter here takes 1. The values a PyPSA default of 1 would fill, such as efficiency and p_max_pu, declare no missing:. They stay refused, because data prep writes PyPSA's default into every row.

Verification

Method. A script listed every place a fragment reads each of the 73 parameters: the entry, the field and the text. I judged each parameter against the table "What a missing row reads as" in absence.md, from the position of each reading. Then a second script rewrote the 61 missing: 0 lines, in the fragments and in examples/pypsa.yaml alike.

Gates on 6c6afb9, which merges #894's head 2d7355f, and so main with #898, #899, #900, #901, #904, #907, #909 and #911:

  • pixi run lint passes.
  • pixi run test passes: 3077 passed, 1 skipped. test_the_fragments_merge_to_the_one_file holds, so the fragments and the one file agree.
  • pixi run docs-build passes.
  • compile-tex was not run, because the container cannot download the TeX bundle. CI runs it.
  • The merge had no conflict. Every generator was re-run on it. Only four gallery pages changed: pypsa.md and the three *_commitment.md pages. In those, the big-M assumptions print their condition's indices sorted by name, as fix(language): two files that declare their dimensions in different orders load to the same program #911 prints every derived frame.

Not checked. I did not build the PyPSA ladder in specsolve with this mathspec, because specsolve pins a mathspec release. The claim that the rows stay the same rests on the table in absence.md, and on specsolve already keeping a missing: 0 table sparse.

Not done

🤖 Generated with Claude Code

https://claude.ai/code/session_01A2crTbivTGt2WzGpTebdmf

…ut is absent rather than zero

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2crTbivTGt2WzGpTebdmf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2crTbivTGt2WzGpTebdmf
@FBumann
FBumann added this pull request to stack #913 October 20, 2026 15:32
@FBumann FBumann added the v0.4.0 label Oct 20, 2026
@read-the-docs-community

read-the-docs-community Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The big-M assumptions print their condition's indices sorted by name, as
#911 prints every derived frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2S9sN1jLGGMCCwqwVyGD6
@FBumann FBumann added the v0.5.0 label Oct 21, 2026
@FBumann FBumann mentioned this pull request Oct 21, 2026
@brynpickering
brynpickering requested review from FabianHofmann and removed request for brynpickering October 21, 2026 11:48

@FabianHofmann FabianHofmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good catch @FBumann

@FBumann
FBumann removed this pull request from stack #913 October 22, 2026 09:17
@FBumann
FBumann merged commit da86544 into claude/bold-wozniak-jewqij Oct 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants