PowerModels.jl icon indicating copy to clipboard operation
PowerModels.jl copied to clipboard

Powerflow does not seem to respect qmax and qmin of generators

Open LKuhrmann opened this issue 1 month ago • 3 comments

For generators, I expect qg to be between qmin and qmax if I run power flow (either native or with JuMP), but this does not seem to be the case (see example below).

compute_ac_pf seems to consider qmin and qmax in _assign_qg!, so it seems to be a supported feature (which is good as it is also a rather fundamental aspect of running a power flow study).

What am I missing?

Thanks!

using PowerModels
using Ipopt

network = parse_file("test/data/json/issue_938.json")

network["gen"]["2"]["qmax"] = 0.00001
network["gen"]["2"]["qmin"] = -0.00001
network["gen"]["3"]["qmax"] = 0.00001
network["gen"]["3"]["qmin"] = -0.00001

# with native acpf
sol = compute_ac_pf(network)

@show sol["solution"]["gen"]["2"]["qg"]   #-0.08216957930052783     # I expect it to be between 0.0001 and -0.0001 but it is not. 
@show sol["solution"]["gen"]["3"]["qg"]   #-0.030634548224568306    # I expect it to be between 0.0001 and -0.0001 but it is not.


# with jump acpf
sol =  solve_pf(network, ACPPowerModel, Ipopt.Optimizer)

@show sol["solution"]["gen"]["2"]["qg"]   #-0.08216957930052793     # I expect it to be between 0.0001 and -0.0001 but it is not.
@show sol["solution"]["gen"]["3"]["qg"]   #-0.030634548224568237    # I expect it to be between 0.0001 and -0.0001 but it is not.

LKuhrmann avatar Nov 05 '25 12:11 LKuhrmann