Create admittance helpers (old: PSI PM interface)#327
Open
acostarelli wants to merge 5 commits into
Open
Conversation
…ance, three_winding_arcs) Promote the π-model admittance helpers that lived inline in PowerSimulations.jl's PowerModels translator (get_branch_to_pm) and were later copied into PowerOperationsModels.jl's native DCP/ACP builders as private `_*` helpers, into a single public, reduction-aware home in PNM: - branch_admittance(b) for lines / 2-winding transformers, and branch_admittance(segment, nr) for reduction-aggregated arcs - reduced_arc_admittance(nr, from_no, to_no) - winding_admittance(w) and three_winding_arcs(d) for 3-winding transformers - branch_flow_limits(branch) New file src/BranchAdmittance.jl (included after common.jl); exports added. Tests in test/test_branch_admittance.jl ported from POM's native model tests plus a three_winding_arcs decomposition check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
acostarelli
commented
Jun 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new public set of helpers for computing π-model branch admittances and directional flow limits (including reduction-aware equivalents and 3-winding transformer winding decomposition), aligning logic that previously lived in downstream translator/build paths into PowerNetworkMatrices.jl.
Changes:
- Exports and includes a new
BranchAdmittance.jlimplementation providingbranch_admittance,reduced_arc_admittance,winding_admittance,three_winding_arcs, andbranch_flow_limits. - Adds a new test file covering the new helpers, including reduction-aware behavior and 3-winding transformer winding decomposition.
- Wires the new file into the main module via
include(...)and exports.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/PowerNetworkMatrices.jl |
Exports new helper APIs and includes the new implementation file. |
src/BranchAdmittance.jl |
Implements new admittance/flow-limit helpers (including reduction-aware and 3W transformer support). |
test/test_branch_admittance.jl |
Adds unit tests for the new helper APIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+26
to
+34
| function branch_admittance(b::PSY.ACTransmission) | ||
| ys = 1.0 / (PSY.get_r(b, PSY.SU) + PSY.get_x(b, PSY.SU) * im) | ||
| b_sh = PSY.get_b(b, PSY.SU) | ||
| return ( | ||
| g = real(ys), b = imag(ys), | ||
| g_fr = 0.0, b_fr = b_sh.from, g_to = 0.0, b_to = b_sh.to, | ||
| tap = 1.0, shift = 0.0, | ||
| ) | ||
| end |
Member
Author
There was a problem hiding this comment.
This is what get_branch_to_pm does
added 2 commits
June 16, 2026 22:28
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.
No description provided.