Skip to content

use the helpers to reduce reactive power#311

Open
jd-lara wants to merge 1 commit into
mainfrom
jd/improve_injection_detection
Open

use the helpers to reduce reactive power#311
jd-lara wants to merge 1 commit into
mainfrom
jd/improve_injection_detection

Conversation

@jd-lara
Copy link
Copy Markdown
Member

@jd-lara jd-lara commented May 31, 2026

Improving the reduction code to enable the reduction injectors that only supply reactive power.

This PR requires Sienna-Platform/PowerSystems.jl#1645

Comment thread src/reduction_helpers.jl
Comment on lines +77 to +78
forces_keep = PSY.supports_active_power(c) ||
(!reduce_reactive_power_injectors && PSY.supports_reactive_power(c))
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.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
forces_keep = PSY.supports_active_power(c) ||
(!reduce_reactive_power_injectors && PSY.supports_reactive_power(c))
forces_keep =
PSY.supports_active_power(c) ||
(!reduce_reactive_power_injectors && PSY.supports_reactive_power(c))

@test !(2 in reduced.irreducible_buses) # condenser bus is a reduction candidate
@test 2 in reduced.removed_buses # and is actually folded out of the chain

kept = PNM.get_reduction(adj, sys, DegreeTwoReduction(; reduce_reactive_power_injectors = false))
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.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
kept = PNM.get_reduction(adj, sys, DegreeTwoReduction(; reduce_reactive_power_injectors = false))
kept = PNM.get_reduction(
adj,
sys,
DegreeTwoReduction(; reduce_reactive_power_injectors = false),
)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts degree-two network reduction so reactive-only injection hosts can be reduced by default while still allowing callers to keep them via reduce_reactive_power_injectors = false.

Changes:

  • Updates system-derived irreducible bus selection to use PowerSystems active/reactive support traits.
  • Wires the DegreeTwoReduction option through AdjacencyMatrix.get_reduction.
  • Adds regression tests for a degree-2 bus hosting only a SynchronousCondenser.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/reduction_helpers.jl Applies active/reactive trait checks when deriving irreducible buses.
src/AdjacencyMatrix.jl Passes the reduction setting into the helper.
src/degree_two_reduction.jl Documents the reactive-only injector behavior.
test/test_degree_two_reactive_injectors.jl Adds targeted tests for reactive-only degree-2 reduction behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/reduction_helpers.jl
Comment on lines +77 to +78
forces_keep = PSY.supports_active_power(c) ||
(!reduce_reactive_power_injectors && PSY.supports_reactive_power(c))
@github-actions
Copy link
Copy Markdown
Contributor

Performance Results

Precompile Time

Main This Branch Delta
2.338 s 2.301 s -1.6%

Execution Time

Test Main This Branch Delta
matpower_ACTIVSg2000_sys-Build PTDF First 1.926 s 2.623 s +36.2%
matpower_ACTIVSg2000_sys-Build PTDF Second 542.9 ms 78.7 ms -85.5%
matpower_ACTIVSg2000_sys-Build Ybus First 12.9 ms 12.5 ms -2.8%
matpower_ACTIVSg2000_sys-Build Ybus Second 11.1 ms 11.6 ms +5.1%
matpower_ACTIVSg2000_sys-Build LODF First 145.4 ms 161.3 ms +11.0%
matpower_ACTIVSg2000_sys-Build LODF Second 144.3 ms 154.2 ms +6.9%
matpower_ACTIVSg2000_sys-Build VirtualMODF First 2.183 s 4.129 s +89.1%
matpower_ACTIVSg2000_sys-Build VirtualMODF Second 102.9 ms 1.076 s +945.3%
matpower_ACTIVSg2000_sys-VirtualMODF Query 10 rows 515.8 ms 505.6 ms -2.0%
matpower_ACTIVSg2000_sys-Radial network reduction First 537.9 ms 562.4 ms +4.6%
matpower_ACTIVSg2000_sys-Radial network reduction Second 0.7 ms 0.7 ms -0.4%
matpower_ACTIVSg2000_sys-Degree two network reduction First 1.833 s N/A N/A
matpower_ACTIVSg2000_sys-Degree two network reduction Second 1.3 ms N/A N/A
Base_Eastern_Interconnect_515GW-Build Ybus First 918.9 ms 778.8 ms -15.2%
Base_Eastern_Interconnect_515GW-Build Ybus Second 975.1 ms 646.6 ms -33.7%
Base_Eastern_Interconnect_515GW-Radial network reduction First 39.6 ms 36.3 ms -8.4%
Base_Eastern_Interconnect_515GW-Radial network reduction Second 1.449 s 36.0 ms -97.5%
Base_Eastern_Interconnect_515GW-Degree two network reduction First 376.0 ms N/A N/A
Base_Eastern_Interconnect_515GW-Degree two network reduction Second 50.1 ms N/A N/A
matpower_ACTIVSg2000_sys-Degree two network reduction N/A FAILED N/A
Base_Eastern_Interconnect_515GW-Degree two network reduction N/A FAILED N/A

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