Sienna-Platform / Sienna-Platform/PowerNetworkMatrices.jl

`arc_subnetwork_axis` keeps pre-merge arc labels after a bus merge

Open
#369 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
31
Forks
22
Avg merge
1d 11h
Merged PRs (30d)
18

Description

What happens

When a reduction merges a bus, every arc axis in the resulting Ybus is relabeled to the surviving bus numbers — except arc_subnetwork_axis.
_make_subnetwork_axes only subtracts removed_arcs and adds newly created arcs; it never maps endpoints through merged_bus_pairs the way _resolve_arc_admittance and the branch-map
remap do.
Entries therefore keep the number of a bus that is no longer on the bus axis.

Reproduction

Build c_sys14 and zero out Line3 (2-3), Line6 (3-4) and Line4 (2-4) with set_r!/set_x!, so buses 2, 3 and 4 merge into one.

With no pinned buses, bus 2 survives.
get_arc_axis(nrd) reports (2,5), (2,7), (2,9), while arc_subnetwork_axis still holds (4,5), (4,7), (4,9).

With bus 4 pinned as irreducible, bus 4 survives instead.
get_arc_axis(nrd) reports (1,4), (4,5), while arc_subnetwork_axis still holds (1,2), (2,5).

Either way the same arcs appear under two different keys depending on which axis you read.

Why it matters

The two axes are meant to be the same arc set, partitioned by island.
Any consumer that intersects them, or resolves an arc_subnetwork_axis key against bus_lookup or a branch map, gets a KeyError or a silent miss.
The failure surfaces at the point of use, arbitrarily far downstream of the reduction that caused it.

_validate_surviving_arc_keys does not catch it: it walks the branch-map-derived arc axis only, so arc_subnetwork_axis is unvalidated.

Fix shape

Relabel arc_subnetwork_axis values through merged_bus_pairs inside _make_subnetwork_axes, dropping self-loops and collapsing duplicates the way _resolve_arc_admittance already does.
Then extend _validate_surviving_arc_keys to cover this axis so a future regression is loud.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with _make_subnetwork_axes and compare its handling with _resolve_arc_admittance and the branch-map remap. Reproduce the c_sys14 reduction with the specified zeroed lines and pinned-bus variants, then check _validate_surviving_arc_keys. Done means arc_subnetwork_axis uses surviving endpoints, drops self-loops and duplicates, and is covered by validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.