Skip to content

docs(pypsa): a given schedule or a global-constraint weight that a component lacks is absent - #919

Closed
FBumann wants to merge 2 commits into
claude/bold-wozniak-jewqijfrom
fix/pypsa-absent-sets-and-weights
Closed

FBumann wants to merge 2 commits into
claude/bold-wozniak-jewqijfrom
fix/pypsa-absent-sets-and-weights

Conversation

@FBumann

@FBumann FBumann commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: I dived in a bit and I think we should just change it to the correct one (absent here). (review of #894)

Prompt: A stacked PR should do those changes!!

Note

The following content was generated by AI.

What this changes

In examples/pypsa.yaml, 34 parameters are declared missing: absent instead of 0. These are the 18 *_set parameters and the 16 global-constraint weights. Stacked on #894, which makes a value the only other choice.

Which parameters, and why the model stays the same
  • The 18 *_set parameters, a given schedule or nominal power, such as Generator_p_set and Store_e_nom_set.
    • Each is read only in its own constraint, under its own presence test (where: Generator_p_set AND …).
    • A bare number name in a where is false at a missing row under both readings. So absent builds the same rows that 0 did.
  • The 16 global-constraint weights: *_primary_energy_weight, *_operational_limit_weight, *_volume_weight, *_expansion_cost_weight and *_tech_capacity_weight.
    • Each is a factor inside a sum. Under absent, a missing weight leaves the summand out, where 0 added zero times it.
    • The sum has the same value, and the model has fewer zero terms.
    • The assumptions that read the storage weights use them only as a presence test.
  • The fragments in examples/pypsa/ and the gallery pages are regenerated with tools.pypsa_split and tools.gallery.

Why

Bryn asked in review of #894 whether a _set table and a global-constraint weight should be absent. Each one applies only where it has a row, so absent is what the data means.

Verification

Gates on the same tree as 23e715e, where this change was first made on #894's branch and then reverted there (2d7355f):

  • pixi run lint passes.
  • pixi run test passes: 3077 passed, 1 skipped.
  • pixi run docs-build passes.
  • compile-tex was not run, because the container cannot download the TeX bundle. CI runs it.

The uses. A script listed every use of each changed parameter in examples/pypsa.yaml. All 18 *_set uses are under their own presence test. All 16 weights are factors inside a sum, or a presence test in an assumption.

Not measured. No test in this repository solves a model. The claim that the optimum does not change rests on the reading rules above. specsolve's differential rungs are where it would be measured.

Not done
  • The cycle weights (Line_cycle_weight, Transformer_cycle_weight, Transformer_phase_shift_weight) stay missing: 0. They are factors in the KVL angle sums, the same pattern, but the review did not name them.
  • A global-constraint row that reads no component at all can now be absent where it was 0 <= limit. This differs only where the limit is negative. Before, that row was infeasible.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D2S9sN1jLGGMCCwqwVyGD6

…mponent lacks is absent

Every `*_set` parameter is read only under its own presence test, so
absent reads it as missing: 0 did. Each global-constraint weight is a
factor inside a sum, where absent leaves the summand out instead of
adding zero times it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2S9sN1jLGGMCCwqwVyGD6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2S9sN1jLGGMCCwqwVyGD6

FBumann commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Note

The following content was generated by AI.

Closed as a duplicate of #912, which is also stacked on #894. #912 declares the same 34 parameters missing: absent, and 27 more.


Generated by Claude Code

@FBumann FBumann closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants