invenia / OPFSampler.jl

Takes a power grid case and generates OPF samples by changing the input parameters.
Mozilla Public License 2.0
9 stars 3 forks source link

pg dimension #14

Open desktoop opened 3 years ago

desktoop commented 3 years ago

Sorry to bother you... I am trying to get some grid data by using your code. But in the result of RunDCSampler, I found pg dimensions are 2 while i think it should be 6 in case30_ieee. Here is my code:

using Pkg

Pkg.activate("./")
using OPFSampler
using PowerModels
using Random
using JLD2

base_model = PowerModels.parse_file("D:/opf_data/OPFSampler.jl-master/pglib-opf-master/pglib_opf_case30_ieee.m");
grid_dcopf_cleanup!(base_model) # for DC-OPF

params_DC = Dict("case_network" => base_model, "dev_load_pd" => 0.1,
              "dev_gen_max" => 0, "dev_rate_a" => 0, "dev_br_x" => 0);

range = MersenneTwister(12345);
num_of_samples = 2; # number of required OPF samples.
train_example = RunDCSampler(num_of_samples, params_DC; rng = range);

the result contains a warning:

[info | PowerModels]: removing 3 cost terms from generator 4: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 1: [1842.1527999999998, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 5: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 2: [5218.2254, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 6: Float64[]
[info | PowerModels]: removing 3 cost terms from generator 3: Float64[]
Iteration: 1
Sample 1 out of 2 .
Sample 2 out of 2 .
┌ Warning: Passing optimizer attributes as keyword arguments to
│ `Ipopt.Optimizer` is deprecated. Use
│     MOI.set(model, MOI.RawParameter("key"), value)
│ or
│     JuMP.set_optimizer_attribute(model, "key", value)
│ instead.
└ @ Ipopt C:\Users\OptiPlex 7070\.julia\packages\Ipopt\P1XLY\src\MOI_wrapper.jl:88
┌ Warning: Passing optimizer attributes as keyword arguments to
│ `Ipopt.Optimizer` is deprecated. Use
│     MOI.set(model, MOI.RawParameter("key"), value)
│ or
│     JuMP.set_optimizer_attribute(model, "key", value)
│ instead.
└ @ Ipopt C:\Users\OptiPlex 7070\.julia\packages\Ipopt\P1XLY\src\MOI_wrapper.jl:88

pg information:

train_example[1]["OPF_output"]["solution"]["gen"]

Dict{String, Any} with 2 entries:
  "1" => Dict{String, Any}("qg"=>NaN, "pg"=>2.16591)
  "2" => Dict{String, Any}("qg"=>NaN, "pg"=>0.673105)

I run my code in jupyter lab, windows 10.

lsindoni commented 3 years ago

Probably a bit late and maybe a solution has been found, however the case 30 has in fact only two generators (check the info at this University of Illinois page), with the remainder being synchronous condensers. If you open the .m file directly from an editor (thus bypassing the parsing), or check lines 74-83 you'll also see that the generator costs table has only two nontrivial cost curves. So, this is not really an issue of the OPFSampler.jl package per se, rather the conflation of multiple components into the same data structure in the .m file. The number of generators (2) seems to be correct.