Skip to content

Make robust homotopy LCC-compatible#373

Open
luke-kiernan wants to merge 5 commits into
mainfrom
lk/lcc-homotopy-hessian
Open

Make robust homotopy LCC-compatible#373
luke-kiernan wants to merge 5 commits into
mainfrom
lk/lcc-homotopy-hessian

Conversation

@luke-kiernan

Copy link
Copy Markdown
Collaborator

What the title says. It's not quite as clean as I'd like: some 2nd derivative expressions blow up near the clamp boundary, so I had to modify the starting point of the homotopy to ensure LCC angles are nonzero. However, Claude says that physically meaningful LCCs should have max/min angles that keep them away from those singular points.

Copilot AI left a comment

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.

Pull request overview

This PR extends the RobustHomotopyPowerFlow Hessian assembly to support LCC HVDC components by adding analytic LCC second-derivative blocks, adjusting the robust-homotopy starting point to avoid clamp singularities, and adding tests/docs to validate the new derivatives and solver behavior on LCC cases.

Changes:

  • Add analytic 2nd-derivative helpers for LCC (P_s) and (Q_s) and incorporate their contributions into the robust-homotopy Hessian.
  • Modify robust-homotopy initialization to keep LCC angles away from clamp boundaries; add a post-solve warning for non-physical LCC angles.
  • Expand test coverage (FD checks for LCC 2nd derivatives, asymptotic Hessian checks, enable RH on LCC RAW cases) and add documentation derivations.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/test_utils/common.jl Adjusts synthetic LCC defaults to keep inverter extinction angle off clamp.
test/test_solve_power_flow.jl Stops blanket-skipping RH for LCC tests; documents/skips specific degeneracy subcases for RH.
test/test_robust_power_flow.jl Adds parity tests: RH vs NR on LCC RAW cases.
test/test_lcc_hessian.jl New: FD validation of _d2P_lcc / _d2Q_lcc and clamp-guard behavior.
test/test_homotopy_hessian.jl New: asymptotic check validating homotopy Hessian vs ∇(JᵀF) on an interior LCC point.
src/RobustHomotopy/homotopy_hessian.jl Implements LCC Hessian contributions and adjusts RH x0 for LCC interior angles.
src/power_flow_method.jl Adds _warn_small_lcc_angles warning on convergence.
src/lcc_utils.jl Adds analytic LCC second-derivative helper functions.
src/definitions.jl Adds LCC_SMALL_ANGLE_THRESHOLD constant.
docs/src/explanation/lcc_hessian.md New: derivation/reference for LCC Hessian blocks and clamp behavior.

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

Comment on lines +88 to +90
fb, tb = data.lcc.bus_indices[i]
V_fb, V_tb = x[2 * fb - 1], x[2 * tb - 1]
t_r, t_i = x[offset_lcc + 1], x[offset_lcc + 2]
Comment thread src/RobustHomotopy/homotopy_hessian.jl
Comment thread src/RobustHomotopy/homotopy_hessian.jl Outdated
Comment thread src/definitions.jl Outdated
Comment thread test/test_lcc_hessian.jl Outdated
Comment on lines +1 to +7
# LCC Second Derivatives (Hessian Blocks)

This page derives the second derivatives needed to extend the
[`RobustHomotopyPowerFlow`](@ref) Hessian assembly (and the spectral-radius
diagnostic) to systems with LCC HVDC lines. It is a companion to
[lcc_model.md](lcc_model.md), which lays out the residual and Jacobian rows.

Comment thread docs/src/explanation/lcc_hessian.md Outdated
@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Performance Results

Precompile Time

Main This Branch Delta
2.433 s 2.436 s +0.1%

Solve Time

Polar AC

Test Main This Branch Delta
NewtonRaphsonACPowerFlow First Solve 11.111 s 11.392 s +2.5%
NewtonRaphsonACPowerFlow Second Solve 85.1 ms 88.0 ms +3.4%
RobustHomotopyPowerFlow First Solve 15.083 s 17.091 s +13.3%
RobustHomotopyPowerFlow Second Solve 8.79 s 8.301 s -5.6%
NewtonRaphsonACPowerFlow(iwamoto) First Solve 198.8 ms 198.8 ms -0.0%
NewtonRaphsonACPowerFlow(iwamoto) Second Solve 85.5 ms 84.7 ms -0.9%
TrustRegionACPowerFlow(iwamoto) First Solve 1.628 s 1.613 s -0.9%
TrustRegionACPowerFlow(iwamoto) Second Solve 86.9 ms 85.6 ms -1.5%

Rectangular CI

Test Main This Branch Delta
ACRectangularPowerFlow{NR} First Solve 4.784 s 5.433 s +13.6%
ACRectangularPowerFlow{NR} Second Solve 50.3 ms 40.9 ms -18.7%
ACRectangularPowerFlow{NR}(iwamoto) First Solve 160.1 ms 154.5 ms -3.5%
ACRectangularPowerFlow{NR}(iwamoto) Second Solve 47.3 ms 70.9 ms +50.0%
ACRectangularPowerFlow{TR} First Solve 5.309 s 5.84 s +10.0%
ACRectangularPowerFlow{TR} Second Solve 43.1 ms 66.6 ms +54.6%
ACRectangularPowerFlow{TR}(iwamoto_fallback) First Solve 156.6 ms 154.9 ms -1.0%
ACRectangularPowerFlow{TR}(iwamoto_fallback) Second Solve 42.9 ms 42.6 ms -0.6%

Mixed CPB

Test Main This Branch Delta
ACMixedPowerFlow{NR} First Solve 5.169 s 5.415 s +4.8%
ACMixedPowerFlow{NR} Second Solve 45.1 ms 43.4 ms -3.7%
ACMixedPowerFlow{NR}(iwamoto) First Solve 159.1 ms 629.9 ms +295.9%
ACMixedPowerFlow{NR}(iwamoto) Second Solve 44.5 ms 43.8 ms -1.5%
ACMixedPowerFlow{TR} First Solve 4.876 s 5.347 s +9.7%
ACMixedPowerFlow{TR} Second Solve 78.1 ms 44.8 ms -42.6%
ACMixedPowerFlow{TR}(iwamoto_fallback) First Solve 158.9 ms 158.4 ms -0.3%
ACMixedPowerFlow{TR}(iwamoto_fallback) Second Solve 45.3 ms 65.5 ms +44.8%
ACMixedPowerFlow{LM} First Solve 7.247 s 7.303 s +0.8%
ACMixedPowerFlow{LM} Second Solve 949.6 ms 958.3 ms +0.9%

DC

Test Main This Branch Delta
DCPowerFlow First Solve 4.945 s 5.152 s +4.2%
DCPowerFlow Second Solve 15.6 ms 15.1 ms -3.0%
PTDFDCPowerFlow First Solve 1.699 s 1.693 s -0.4%
PTDFDCPowerFlow Second Solve 73.2 ms 72.8 ms -0.5%
vPTDFDCPowerFlow First Solve 5.178 s 5.181 s +0.1%
vPTDFDCPowerFlow Second Solve 3.297 s 3.289 s -0.2%

luke-kiernan and others added 2 commits May 26, 2026 14:00
- homotopy_x0: use bus_magnitude (not x[2*bus-1]) at PV/REF buses so
  the LCC β/(V·t) threshold uses actual terminal voltage, not P_gen/Q_gen
- expand setpoint_at_rectifier comment to note the pre-existing
  Jacobian-side inconsistency that the Hessian mirrors
- LCC_SMALL_ANGLE_THRESHOLD comment now correctly refers to α not ϕ
- fd_d2 comment now matches the actual 3-point diagonal / 4-point cross stencil
- add lcc_hessian.md to docs/make.jl Explanation section
- rewrite sparsity-pattern paragraph in lcc_hessian.md to distinguish
  network-only / LCC bus / LCC tail rows clearly

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

3 participants