SOCP and SDP solver errors in PowerModelsDistribution.jl

Hello all,

I am trying to use PowerModelsDistribution to solve a SDP and SOCP formulation. Below is my code.

using PowerModelsDistribution
using SCS
Test_Case = parse_file(“C:/ACOPF/Julia/case3balancedbattery.dss”)
scs_solver = optimizer_with_attributes(SCS.Optimizer)
results7 = solve_mc_opf(Test_Case, SDPUBFPowerModel,scs_solver)
results8 = solve_mc_opf(Test_Case, SDPUBFKCLMXPowerModel,scs_solver)

When trying to solve this I get the error “LoadError: BoundsError: attempt to access Float64 at index [2]”. Can someone tell me what I am doing wrong? Do we need to format the OpenDSS file in a special way for SDP and SOCP relaxations?

Thank You!

Can you provide the full error message? Can you share the input file?

Hello odow,

I used the below code

using PowerModelsDistribution
using Pkg
using JuMP
using Hypatia
using Pajarito

case3 = parse_file("C:/ACOPF/Julia/case3balancedbattery.dss") #attached file in .dss format

Hypatia_solver = optimizer_with_attributes(Hypatia.Optimizer)

Pajarito_solver = optimizer_with_attributes(
    Pajarito.Optimizer,
    "oa_solver" => optimizer_with_attributes(
        HiGHS.Optimizer,
        MOI.Silent() => true,
        "mip_feasibility_tolerance" => 1e-8,
        "mip_rel_gap" => 1e-6,
    ),
    "conic_solver" =>
        optimizer_with_attributes(Hypatia.Optimizer, MOI.Silent() => true),
)

############# using SDP ACOPF ###############

result_SDP = PowerModelsDistribution.solve_mc_opf(Test_Case, SDPUBFPowerModel, Pajarito_solver)

############# using SOC ACOPF ##############

result_SOP = PowerModelsDistribution.solve_mc_opf(Test_Case, SOCConicUBFPowerModel, Hypatia_solver);

I tried using different solvers too, but the error is still there.

case3balancedbattery.jl (1.8 KB)

I can reproduce:

julia> using PowerModelsDistribution

julia> import SCS

julia> case = parse_file("/Users/oscardowson/Downloads/case3balancedbattery.dss")
[ PowerModelsDistribution | Info ] : Circuit has been reset with the 'clear' on line 1 in 'case3balancedbattery.dss'
[ PowerModelsDistribution | Info ] : Command 'basefreq=50' on line 2 in 'case3balancedbattery.dss' is not supported, skipping.
[ PowerModelsDistribution | Info ] : Command 'calcvoltagebases' on line 42 in 'case3balancedbattery.dss' is not supported, skipping.
[ PowerModelsDistribution | Info ] : Command 'solve' on line 50 in 'case3balancedbattery.dss' is not supported, skipping.
┌ PowerModelsDistribution | Warning ] : DssMonitor has no field `ppolar`, skipping...
└ @ PowerModelsDistribution ~/.julia/packages/PowerModelsDistribution/EOTxp/src/data_model/transformations/rawdss2dss.jl:67
Dict{String, Any} with 12 entries:
  "conductor_ids"  => [1, 2, 3, 4]
  "bus"            => Dict{String, Any}("primary"=>Dict{String, Any}("rg"=>[0.0], "grou…
  "name"           => "3bus_example"
  "settings"       => Dict{String, Any}("sbase_default"=>100.0, "vbases_default"=>Dict{…
  "files"          => ["/Users/oscardowson/Downloads/case3balancedbattery.dss"]
  "storage"        => Dict{String, Any}("s1"=>Dict{String, Any}("sm_ub"=>5.0, "qex"=>0.…
  "time_series"    => Dict{String, Any}("dailyshape"=>Dict{String, Any}("source_id"=>"l…
  "voltage_source" => Dict{String, Any}("source"=>Dict{String, Any}("source_id"=>"vsour…
  "line"           => Dict{String, Any}("quad"=>Dict{String, Any}("length"=>1.0, "t_con…
  "data_model"     => ENGINEERING
  "load"           => Dict{String, Any}("l2"=>Dict{String, Any}("source_id"=>"load.l2",…
  "linecode"       => Dict{String, Any}("556mcm"=>Dict{String, Any}("b_fr"=>[25.4648 -0…

julia> solve_mc_opf(case, SOCConicUBFPowerModel, SCS.Optimizer)
ERROR: BoundsError: attempt to access Float64 at index [2]
Stacktrace:
  [1] getindex(x::Float64, i::Int64)
    @ Base ./number.jl:98
  [2] variable_mc_storage_current(pm::SOCConicUBFPowerModel; nw::Int64, bounded::Bool, report::Bool)
    @ PowerModelsDistribution ~/.julia/packages/PowerModelsDistribution/EOTxp/src/form/shared.jl:321
  [3] variable_mc_storage_current
    @ ~/.julia/packages/PowerModelsDistribution/EOTxp/src/form/shared.jl:306 [inlined]
  [4] variable_mc_storage_power(pm::SOCConicUBFPowerModel; nw::Int64, bounded::Bool, report::Bool)
    @ PowerModelsDistribution ~/.julia/packages/PowerModelsDistribution/EOTxp/src/core/variable.jl:1069
  [5] variable_mc_storage_power
    @ ~/.julia/packages/PowerModelsDistribution/EOTxp/src/core/variable.jl:1065 [inlined]
  [6] build_mc_opf(pm::SOCConicUBFPowerModel)
    @ PowerModelsDistribution ~/.julia/packages/PowerModelsDistribution/EOTxp/src/prob/opf.jl:177
  [7] instantiate_model(data::Dict{…}, model_type::Type, build_method::typeof(build_mc_opf), ref_add_core!::typeof(ref_add_core!), global_keys::Set{…}, it::Symbol; ref_extensions::Vector{…}, kwargs::@Kwargs{})
    @ InfrastructureModels ~/.julia/packages/InfrastructureModels/C2xBM/src/core/base.jl:370
  [8] instantiate_model
    @ ~/.julia/packages/InfrastructureModels/C2xBM/src/core/base.jl:350 [inlined]
  [9] instantiate_mc_model(data::Dict{…}, model_type::Type, build_method::typeof(build_mc_opf); ref_extensions::Vector{…}, multinetwork::Bool, global_keys::Set{…}, eng2math_extensions::Vector{…}, eng2math_passthrough::Dict{…}, make_pu_extensions::Vector{…}, kwargs::@Kwargs{})
    @ PowerModelsDistribution ~/.julia/packages/PowerModelsDistribution/EOTxp/src/prob/common.jl:119

Did you create the input data file, or is it standard from somewhere? This is either a bug in PowerModelsDistribution, or it is an error in the input data.

I used one of the example opendss files provided in the github folder of PowerModelsDistribution from here.

Cool I’ve opened a GitHub issue: [BUG] BoundsError: attempt to access Float64 at index [2] reading DSS file · Issue #482 · lanl-ansi/PowerModelsDistribution.jl · GitHub

Although I think most folks at LANL are on vacation until mid-Jan.

1 Like