I’m relatively new to both Julia and PowerModels.jl, and I wish to compare different algorithms for solving power flow equations. My objective is to obtain the power flow equations from PowerModels.jl, allowing me to integrate them into various algorithms and compare results with those obtained using JuMP.

In the PowerModels documentation, I haven’t come across a specific function that returns the equations. Does such a function exist, or is do you know an alternative approach to achieve this?

Hi @Jim16, thank for taking a look at PowerModels. To add to the suggestions of @odow, some times folks are looking for raw JuMP models for the OPF problems that PowerModels builds in a more flexible way. Here is a good reference for those,

Another question we get a fair bit it to view the mathematical JuMP model that PowerModels builds for a given function call. In this case you can do a trick like this (I did not test this code),

using PowerModels, JuMP, Ipopt
m = Model()
result = solve_ac_opf(data, Ipopt.Optimizer, jump_model=m)
println(m)

@odow : the best format would be to have them as a function on all the voltage magnitudes and angles, so that solving the pf equations would be the same as finding the roots of the function.

@ccoffrin : I’ll have a look at PowerModelsAnnex, thank you. About the bit of code you shared, I had already used this trick, but I didn’t manage to build an actual function containing the equations of the model. I could only display them.