From 57cd8dbd3310de7b34adbc8b04e620bd9606c4b5 Mon Sep 17 00:00:00 2001 From: HaleyRoss Date: Fri, 1 Mar 2024 15:35:57 -0700 Subject: [PATCH 1/5] Remove line to drop loads if const. power is zero. --- src/parsers/power_models_data.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index 893c559bb2..f8d5abada3 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -253,9 +253,9 @@ function read_loads!(sys::System, data, bus_number_to_bus::Dict{Int, ACBus}; kwa sys_mbase = data["baseMVA"] for d_key in keys(data["load"]) d = data["load"][d_key] - if d["pd"] != 0.0 - bus = bus_number_to_bus[d["load_bus"]] + bus = bus_number_to_bus[d["load_bus"]] if data["source_type"] == "pti" + println("HEEEEERE") load = make_standard_load(d, bus, sys_mbase; kwargs...) has_component(StandardLoad, sys, get_name(load)) && throw( DataFormatError( @@ -270,8 +270,7 @@ function read_loads!(sys::System, data, bus_number_to_bus::Dict{Int, ACBus}; kwa ), ) end - add_component!(sys, load; skip_validation = SKIP_PM_VALIDATION) - end + add_component!(sys, load; skip_validation = SKIP_PM_VALIDATION) end end From 2105063576378b183dc8ed783ecaa3c2efce5ff3 Mon Sep 17 00:00:00 2001 From: HaleyRoss Date: Fri, 1 Mar 2024 16:12:22 -0700 Subject: [PATCH 2/5] Remove print line --- src/parsers/power_models_data.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index f8d5abada3..34cb58bed6 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -254,8 +254,7 @@ function read_loads!(sys::System, data, bus_number_to_bus::Dict{Int, ACBus}; kwa for d_key in keys(data["load"]) d = data["load"][d_key] bus = bus_number_to_bus[d["load_bus"]] - if data["source_type"] == "pti" - println("HEEEEERE") + if data["source_type"] == "pti" load = make_standard_load(d, bus, sys_mbase; kwargs...) has_component(StandardLoad, sys, get_name(load)) && throw( DataFormatError( From 89e6e6e7249a543523b672bc277f4924a200ef05 Mon Sep 17 00:00:00 2001 From: HaleyRoss Date: Thu, 14 Mar 2024 09:37:55 -0600 Subject: [PATCH 3/5] change how gen avaialbe is set --- src/parsers/power_models_data.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index 34cb58bed6..56b3a53406 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -483,7 +483,7 @@ function make_thermal_gen(gen_name::AbstractString, d::Dict, bus::ACBus, sys_mba thermal_gen = ThermalStandard(; name = gen_name, status = Bool(d["gen_status"]), - available = true, + available = Bool(d["gen_status"]), bus = bus, active_power = d["pg"] * base_conversion, reactive_power = d["qg"] * base_conversion, From 6fa5fd0ab3579f483a0cf79dfdb1514a08f9082e Mon Sep 17 00:00:00 2001 From: HaleyRoss Date: Tue, 19 Mar 2024 11:14:01 -0600 Subject: [PATCH 4/5] Add PSSE device parsing test --- test/test_parse_psse.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_parse_psse.jl b/test/test_parse_psse.jl index 890f93e8e0..711746ee24 100644 --- a/test/test_parse_psse.jl +++ b/test/test_parse_psse.jl @@ -20,3 +20,19 @@ pm_data.data["bus"] = Dict{String, Any}() @test_throws PowerSystems.DataFormatError System(pm_data) end + +@testset "PSSE Component Parsing" begin + @info "Testing Load Parsing" + sys = build_system(PSYTestSystems, "psse_240_parsing_sys") # current/imedance_power read in natural units during parsing + @test get_current_active_power(get_component(StandardLoad, sys, "load10021")) == 223.71 + @test get_impedance_reactive_power(get_component(StandardLoad, sys, "load10021")) == 583.546 + sys2 = build_system(PSYTestSystems, "psse_Benchmark_4ger_33_2015_sys") # Constant_active/reactive_power read in pu during parsing + @test get_constant_active_power(get_component(StandardLoad, sys2, "load71")) == 9.67 + @test get_constant_reactive_power(get_component(StandardLoad, sys2, "load71")) == 1.0 + + @info "Testing Generator Parsing" + @test get_status(get_component(ThermalStandard, sys, "generator-2438-ND")) == 0 + @test get_available(get_component(ThermalStandard, sys, "generator-2438-ND")) == 0 + @test get_status(get_component(ThermalStandard, sys, "generator-2438-EG")) == 1 + @test get_available(get_component(ThermalStandard, sys, "generator-2438-EG")) == 1 +end \ No newline at end of file From a98291122bf8fc3ed1c1738c2aa9f0e1ef8e0855 Mon Sep 17 00:00:00 2001 From: HaleyRoss Date: Tue, 19 Mar 2024 11:19:54 -0600 Subject: [PATCH 5/5] Formatter changes --- src/parsers/power_models_data.jl | 30 +++++++++++++++--------------- test/test_parse_psse.jl | 11 ++++++----- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index 56b3a53406..edaefa28bf 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -254,21 +254,21 @@ function read_loads!(sys::System, data, bus_number_to_bus::Dict{Int, ACBus}; kwa for d_key in keys(data["load"]) d = data["load"][d_key] bus = bus_number_to_bus[d["load_bus"]] - if data["source_type"] == "pti" - load = make_standard_load(d, bus, sys_mbase; kwargs...) - has_component(StandardLoad, sys, get_name(load)) && throw( - DataFormatError( - "Found duplicate load names of $(get_name(load)), consider formatting names with `load_name_formatter` kwarg", - ), - ) - else - load = make_power_load(d, bus, sys_mbase; kwargs...) - has_component(PowerLoad, sys, get_name(load)) && throw( - DataFormatError( - "Found duplicate load names of $(get_name(load)), consider formatting names with `load_name_formatter` kwarg", - ), - ) - end + if data["source_type"] == "pti" + load = make_standard_load(d, bus, sys_mbase; kwargs...) + has_component(StandardLoad, sys, get_name(load)) && throw( + DataFormatError( + "Found duplicate load names of $(get_name(load)), consider formatting names with `load_name_formatter` kwarg", + ), + ) + else + load = make_power_load(d, bus, sys_mbase; kwargs...) + has_component(PowerLoad, sys, get_name(load)) && throw( + DataFormatError( + "Found duplicate load names of $(get_name(load)), consider formatting names with `load_name_formatter` kwarg", + ), + ) + end add_component!(sys, load; skip_validation = SKIP_PM_VALIDATION) end end diff --git a/test/test_parse_psse.jl b/test/test_parse_psse.jl index 711746ee24..ba1c639f89 100644 --- a/test/test_parse_psse.jl +++ b/test/test_parse_psse.jl @@ -24,15 +24,16 @@ end @testset "PSSE Component Parsing" begin @info "Testing Load Parsing" sys = build_system(PSYTestSystems, "psse_240_parsing_sys") # current/imedance_power read in natural units during parsing - @test get_current_active_power(get_component(StandardLoad, sys, "load10021")) == 223.71 - @test get_impedance_reactive_power(get_component(StandardLoad, sys, "load10021")) == 583.546 + @test get_current_active_power(get_component(StandardLoad, sys, "load10021")) == 223.71 + @test get_impedance_reactive_power(get_component(StandardLoad, sys, "load10021")) == + 583.546 sys2 = build_system(PSYTestSystems, "psse_Benchmark_4ger_33_2015_sys") # Constant_active/reactive_power read in pu during parsing - @test get_constant_active_power(get_component(StandardLoad, sys2, "load71")) == 9.67 - @test get_constant_reactive_power(get_component(StandardLoad, sys2, "load71")) == 1.0 + @test get_constant_active_power(get_component(StandardLoad, sys2, "load71")) == 9.67 + @test get_constant_reactive_power(get_component(StandardLoad, sys2, "load71")) == 1.0 @info "Testing Generator Parsing" @test get_status(get_component(ThermalStandard, sys, "generator-2438-ND")) == 0 @test get_available(get_component(ThermalStandard, sys, "generator-2438-ND")) == 0 @test get_status(get_component(ThermalStandard, sys, "generator-2438-EG")) == 1 @test get_available(get_component(ThermalStandard, sys, "generator-2438-EG")) == 1 -end \ No newline at end of file +end