Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve_pf() does not work with LPACCPowerModel #891

Open
grecht opened this issue Oct 5, 2023 · 3 comments
Open

solve_pf() does not work with LPACCPowerModel #891

grecht opened this issue Oct 5, 2023 · 3 comments

Comments

@grecht
Copy link

grecht commented Oct 5, 2023

Run this small example using PGLIB to reproduce the error:

using PowerModels
using Ipopt 

pglib_path = "../pglib-opf"
case = "pglib_opf_case14_ieee.m"

case_file = joinpath(pglib_path, case)

result_lpac = solve_pf(case_file, LPACCPowerModel, Ipopt.Optimizer)

print_summary(result_lpac["solution"])

It results in the following error:

[info | PowerModels]: removing 3 cost terms from generator 4: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 1: [792.0951, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 5: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 2: [2326.9494, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 3: Float64[]
ERROR: MethodError: no method matching expression_branch_power_ohms_yt_from(::LPACCPowerModel, ::Int64, ::Int64, ::Int64, ::Tuple{Int64, Int64, Int64}, ::Tuple{Int64, Int64, Int64}, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64)
Closest candidates are:
  expression_branch_power_ohms_yt_from(::AbstractACPModel, ::Int64, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\form\acp.jl:234
  expression_branch_power_ohms_yt_from(::AbstractACRModel, ::Int64, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\form\acr.jl:166
  expression_branch_power_ohms_yt_from(::AbstractDCMPPModel, ::Int64, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\form\dcp.jl:103
  ...
Stacktrace:
  [1] expression_branch_power_ohms_yt_from(pm::LPACCPowerModel, i::Int64; nw::Int64)
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\expression_template.jl:88
  [2] expression_branch_power_ohms_yt_from(pm::LPACCPowerModel, i::Int64)
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\expression_template.jl:69
  [3] build_pf(pm::LPACCPowerModel)
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\prob\pf.jl:23
  [4] instantiate_model(data::Dict{String, Any}, model_type::Type, build_method::typeof(build_pf), ref_add_core!::typeof(ref_add_core!), global_keys::Set{String}, it::Symbol; ref_extensions::Vector{Any}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ InfrastructureModels C:\Users\rech_ge\.julia\packages\InfrastructureModels\C2xBM\src\core\base.jl:370
  [5] #instantiate_model#321
    @ C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\base.jl:67 [inlined]
  [6] solve_model(data::Dict{String, Any}, model_type::Type, optimizer::Type, build_method::typeof(build_pf); ref_extensions::Vector{Any}, solution_processors::Vector{Any}, relax_integrality::Bool, multinetwork::Bool, multiconductor::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\base.jl:48
  [7] solve_model(data::Dict{String, Any}, model_type::Type, optimizer::Type, build_method::Function)
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\base.jl:35
  [8] solve_model(file::String, model_type::Type, optimizer::Type, build_method::Function; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\base.jl:27
  [9] solve_model
    @ C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\core\base.jl:26 [inlined]
 [10] #solve_pf#1065
    @ C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\prob\pf.jl:13 [inlined]
 [11] solve_pf(file::String, model_type::Type, optimizer::Type)
    @ PowerModels C:\Users\rech_ge\.julia\packages\PowerModels\bcmVu\src\prob\pf.jl:13
 [12] top-level scope
    @ REPL[8]:1
@ccoffrin
Copy link
Member

ccoffrin commented Oct 5, 2023 via email

@grecht
Copy link
Author

grecht commented Oct 5, 2023

Ah, I see. Thanks!

@ccoffrin
Copy link
Member

ccoffrin commented Oct 7, 2023

I though of a reasonable workaround for this issue.

If you would like to solve a PF problem with a formulation that does not currently support PF you can instead pose your PF problem as an OPF problem where the generator cost functions are constant values or identical linear functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants