From 839fa7269ed376e630724fd7ad5820253b8935e0 Mon Sep 17 00:00:00 2001 From: KSepetanc Date: Fri, 1 Nov 2024 17:01:49 +0100 Subject: [PATCH 1/2] Fix PSSE raw import for gen_status at load buses --- src/io/psse.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/psse.jl b/src/io/psse.jl index 356de551..2626d1de 100644 --- a/src/io/psse.jl +++ b/src/io/psse.jl @@ -211,7 +211,7 @@ function _psse2pm_generator!(pm_data::Dict, pti_data::Dict, import_all::Bool) sub_data = Dict{String,Any}() sub_data["gen_bus"] = pop!(gen, "I") - sub_data["gen_status"] = pop!(gen, "STAT") + sub_data["gen_status"] = _get_bus_value(sub_data["gen_bus"], "bus_type", pm_data) == 1 ? begin delete!(gen, "STAT"); 0 end : pop!(gen, "STAT") # In PSSE active generators at bus type 1 are ignored. PQ or PV control mode is controlled by "Machine Control Mode" parameter (Machine Data Record -> Wind Data -> Control Mode) sub_data["pg"] = pop!(gen, "PG") sub_data["qg"] = pop!(gen, "QG") sub_data["vg"] = pop!(gen, "VS") From a7190d8eb665f748531a8fa84ed34f46e76dc548 Mon Sep 17 00:00:00 2001 From: KSepetanc Date: Fri, 15 Nov 2024 12:49:09 +0100 Subject: [PATCH 2/2] Add PSSE generator status test --- test/data/pti/frankenstein_70.raw | 2 +- test/psse.jl | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/data/pti/frankenstein_70.raw b/test/data/pti/frankenstein_70.raw index d47fd519..bcb8e288 100755 --- a/test/data/pti/frankenstein_70.raw +++ b/test/data/pti/frankenstein_70.raw @@ -5,7 +5,7 @@ developed by Carleton Coffrin (cjc@lanl.gov) June 2017 1002,'FAV SPOT 02', 345.0000, 2, 101, 201, 301,1.00000000, 0.000000, 1.10000, 0.90000, 1.10000, 0.90000 1003,'FAV SPOT 03', 24.9000, 2, 101, 201, 301,1.00000000, 0.000000, 1.10000, 0.90000, 1.10000, 0.90000 1004,'FAV SPOT 04', 87.0000, 1, 101, 201, 301,1.05000000, 0.000000, 1.10000, 0.90000, 1.10000, 0.90000 -1005,'FAV PLACE 05', 87.0000, 2, 101, 201, 301,1.00000000, 3.000000, 1.10000, 0.90000, 1.10000, 0.90000 +1005,'FAV PLACE 05', 87.0000, 1, 101, 201, 301,1.00000000, 3.000000, 1.10000, 0.90000, 1.10000, 0.90000 1006,'FAV SPOT 06', 87.0000, 1, 101, 201, 301,1.00000000, -1.000000, 1.10000, 0.90000, 1.10000, 0.90000 1007,'FAV PLACE 07', 230.0000, 1, 101, 201, 301,1.00000000, 2.000000, 1.10000, 0.90000, 1.10000, 0.90000 1008,'FAV PLC 08', 87.0000, 2, 101, 201, 301,0.95000000, 0.000000, 1.10000, 0.90000, 1.10000, 0.90000 diff --git a/test/psse.jl b/test/psse.jl index 5306512c..6b79ec3d 100644 --- a/test/psse.jl +++ b/test/psse.jl @@ -394,7 +394,6 @@ end end end - @testset "transformer status" begin @testset "two-winding transformers" begin data_pti = PowerModels.parse_file("../test/data/pti/case5.raw") @@ -423,7 +422,20 @@ end end end + @testset "generator status" begin + data_pti = PowerModels.parse_file("../test/data/pti/frankenstein_70.raw") + gen_off = Set(["1", "5"]) + for (i,gen) in data_pti["gen"] + if i in gen_off + @test gen["gen_status"] == 0 + else + @test gen["gen_status"] == 1 + end + end + end + + @testset "import all" begin @testset "30-bus case" begin data = PowerModels.parse_file("../test/data/pti/case30.raw"; import_all=true) @@ -540,7 +552,7 @@ end end end - @testset "Impedance and Current Load Conversions" begin + @testset "Impedance and Current Load Conversions" begin data = PowerModels.parse_file("../test/data/pti//parser_test_k.raw") Vm_load = data["bus"]["103"]["vm"] # Test current load only