Skip to content

Translate the new-format network tables to buses and links#126

Open
nick-gorman wants to merge 1 commit into
mainfrom
translate-network-to-buses-links
Open

Translate the new-format network tables to buses and links#126
nick-gorman wants to merge 1 commit into
mainfrom
translate-network-to-buses-links

Conversation

@nick-gorman

Copy link
Copy Markdown
Member

This PR adds the translator that turns the new-format network tables into PyPSA buses and links.

network.py consumes the new-format network_geography, network_transmission_paths, network_transmission_path_limits, network_expansion_options and network_transmission_path_expansion_costs tables, and produces:

  • one bus per modelled geography (REZ buses only when REZs are modelled as discrete nodes),
  • existing links — the winter_reference limit becomes p_nom, the other demand conditions are returned per unit of p_nom in a link_timeslice_limits table,
  • expansion links, built per investment period from the unified expansion options/costs tables.

Flow paths and REZ connections run through one pipeline — both are just paths.

The module is dark: nothing calls its helpers yet (that wiring lands with the orchestrator PR), so there's no change to production behaviour.

src/ispypsa/translator/
└── network.py        → new-format network tables → PyPSA buses + links (+ per-timeslice link limits)
tests/test_translator/
└── test_network.py   → unit coverage for the buses/links helpers

network_geography becomes buses (REZ buses dropped when rezs is
attached_to_parent_node), and the path/limit/expansion tables become
links. The winter_reference limit is the link's static p_nom — winter is
the calendar's default season — with the other timeslices' forward and
reverse limits emitted as per-unit values in a link_timeslice_limits
table for pypsa_build to expand into p_max_pu/p_min_pu series (per-unit
values can exceed 1.0 when a season's limit tops winter's). Asymmetric
reverse limits land in p_min_pu rather than separate links.

Expansion options become one extendable link per (path, investment
period) with annuitised capital costs, gated by transmission_expansion /
rez_transmission_expansion according to whether the path connects a REZ.
Paths with no capacity data take
rez_to_sub_region_transmission_default_limit, replicating the existing
REZ behaviour.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.72727% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ispypsa/translator/network.py 97.72% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/ispypsa/translator/network.py 97.72% <97.72%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant