Newton method in PowerModels.jl

Hello!

I am trying to run a power flow in PowerModels.jl by using Newton method. I am running compute_ac_pf, but the result of this function is a dictionary containing generation and voltages at the buses, and it does not have a key “solution”. However, I am also interested in obtaining the flows in the lines of the system. Is there any way I can get these results? I am using version 0.17 of PowerModels.jl.

It’s easier to provide help if you show a minimal working example. This post has some helpful tips: Please read: make it easier to help you

The solution key got added in v0.18 of PowerModels.jl, PowerModels v0.18.0 by ccoffrin · Pull Request #768 · lanl-ansi/PowerModels.jl · GitHub, so I suggest you update your code.

1 Like

Hi Mariana, have a look at this docs page, Power Flow · PowerModels it should help you get started in the right direction.

Thank you, @odow and @ccoffrin !! I updated my code to v0.18 of PowerModels.jl and it worked. However, I noticed that when I run the generic power flow, by using the run_pf function with the ACRPowerModel formulation, the calc_branch_flow_ac function doesn’t return updated values for the branch flows. When I use the run_pf function with the ACPPowerModel formulation, or directly the run_ac_pf function, I am able to obtain the correct values for the branch flows. Here is my code:

using PowerModels
using Ipopt

network_data = parse_file("/Users/marianarodrigues/Desktop/Sistema Inicial/teste_novo.raw")
print_summary(network_data)

# ========================= JuMP solution =========================

#result = run_ac_pf(network_data, Ipopt.Optimizer)
result = run_pf(network_data, ACRPowerModel, Ipopt.Optimizer)

# Check that the solver converged:
update_data!(network_data, result["solution"])

flows = calc_branch_flow_ac(network_data)
update_data!(network_data, flows)
print_summary(network_data)