PowerFlows.jl
PowerFlows.jl copied to clipboard
Lk/robust homotopy
I've implemented and tested the "Magnitude Homotopy" approach method described here. There's more detail in #137.
Brief description of their method: let φ(x) equal the sum of 0.5*(v_mag - 1.0)^2 over all PQ buses. Instead of finding the zero of our power balance equations F(x) in one fell swoop, we consider a sequence of functions G_1(x), G_2(x), ... G_n(x) that linearly interpolate between φ(x) and 0.5*dot(F(x), F(x)). We minimize G_1 = φ(x), then use that as a starting point to minimize G_2, and so on, until we're minimizing G_n = 0.5*dot(F(x), F(x)) starting from the minimum of G_{n-1}. Minimize how? This is a least squares problem, so we what Wikipedia calls "Newton's Method in Optimization:" pick a search direction by solving H_G(x) Δx = -∇G(x) where H is the Hessian, then do a line search to figure out how far to step in that direction to get a "good" rate of decrease.
The CI is failing, specifically for windows, due to the MPI.jl backend. Relevant issue
Update on the Windows bug: I discovered that the sequential, MPI-free version of MUMPS.jl is also broken on Windows, but not on Mac. This leads me to think the problem lies in the build_tarballs.jl scripts in Yggdrasil. i.e. the Julia code itself is fine, but the binary artifacts MUMPS_jll and MUMPS_seq_jll aren't. BinaryBuilder.jl emits a couple warnings during the build process, which could point in the right direction. See the above linked issue for details. However, I'm going to let this bug rest for now.
we need a better alternative to Mumps if it creates such a problem
Here's some options:
- Use
Pardiso.jlon Windows andMUMPS.jlon Mac/Linux. That'd require maintaining two separate backends, though. - Use LDLFactorizations.jl However, the second sentence in its readme basically says "don't expect this to be competitive with
MUMPS.jl,HSL.jl, orPardiso.jl." - Use
HSL.jl. Fast and cross-platform, but requires a license and nontrivial build/setup process on Windows (or so says ChatGPT).
edit: SkylineSolvers.jl implements sparse factorizations, but it doesn't look like you can do the symbolic and numeric steps separately.
I've rebased onto psy5 and opened a separate PR. Leaving this branch intact for now, just in case.