Make robust homotopy LCC-compatible#373
Open
luke-kiernan wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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 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. | ||
|
|
Contributor
Performance ResultsPrecompile Time
Solve TimePolar AC
Rectangular CI
Mixed CPB
DC
|
- 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>
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.
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.