From a5942d8ddbe4cfdcb78f08847db4ba0a100f370e Mon Sep 17 00:00:00 2001 From: Tengis Dashmunkh Date: Tue, 26 Mar 2024 11:11:38 -0600 Subject: [PATCH] Revert "make inner constructor work" This reverts commit 4b682898f980c00ca8040555a2c853929ea02dfd. --- src/system_descriptor.jl | 2 +- src/system_descriptor_data.jl | 536 +++++++++++++++++----------------- 2 files changed, 269 insertions(+), 269 deletions(-) diff --git a/src/system_descriptor.jl b/src/system_descriptor.jl index 0e96d50..70e41a5 100644 --- a/src/system_descriptor.jl +++ b/src/system_descriptor.jl @@ -3,7 +3,7 @@ struct SystemArgument default::Any allowed_values::Set{<:Any} - function SystemArgument(name, default, allowed_values) + function SystemArgument(; name, default, allowed_values) isempty(allowed_values) && error("allowed_values cannot be empty") new(name, default, allowed_values) end diff --git a/src/system_descriptor_data.jl b/src/system_descriptor_data.jl index b572707..0a0c96b 100644 --- a/src/system_descriptor_data.jl +++ b/src/system_descriptor_data.jl @@ -6,10 +6,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_14bus_pu.jl"), build_function = build_c_sys14, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -20,10 +20,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_14bus_pu.jl"), build_function = build_c_sys14_dc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -34,10 +34,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -48,10 +48,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pjm, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -62,10 +62,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pjm_rt, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -76,20 +76,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_bat, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -100,10 +100,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_dc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -114,10 +114,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -128,10 +128,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hy, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -142,10 +142,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hy_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -156,10 +156,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hy_ems_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -170,10 +170,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_phes_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -184,10 +184,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hy_uc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -198,10 +198,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hy_ems_uc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -212,20 +212,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hyd, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -236,20 +236,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hyd_ems, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -260,15 +260,15 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_il, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -279,10 +279,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_ml, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -293,20 +293,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_re, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -317,10 +317,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_re_only, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -331,20 +331,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_uc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -355,20 +355,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_uc_non_spin, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -379,20 +379,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_uc_re, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -403,20 +403,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pglib, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -427,20 +427,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pwl_uc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -451,10 +451,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pwl_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -465,10 +465,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pwl_ed_nonconvex, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -479,10 +479,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_reg, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -493,20 +493,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_radial, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -554,10 +554,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "5-Bus"), build_function = build_5_bus_hydro_uc_sys, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -582,10 +582,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "5-Bus"), build_function = build_5_bus_hydro_uc_sys_targets, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -617,10 +617,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "RTS_GMLC"), build_function = build_test_RTS_GMLC_sys, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -631,10 +631,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "RTS_GMLC"), build_function = build_test_RTS_GMLC_sys_with_hybrid, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -1168,20 +1168,20 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_bat_ems, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_single_time_series, - false, - Set([true, false]), + SystemArgument(; + name = :add_single_time_series, + default = false, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -1192,15 +1192,15 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_pglib_sim, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), - SystemArgument( - :add_reserves, - false, - Set([true, false]), + SystemArgument(; + name = :add_reserves, + default = false, + allowed_values = Set([true, false]), ), ], ), @@ -1211,10 +1211,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hybrid, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -1225,10 +1225,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hybrid_uc, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -1239,10 +1239,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_hybrid_ed, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ), @@ -1344,10 +1344,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psid_tests", "psse", "AVRs"), build_function = build_psid_psse_test_avr, supported_arguments = [ - SystemArgument( - :avr_type, - "AC1A", - Set(AVAILABLE_PSID_PSSE_AVRS_TEST), + SystemArgument(; + name = :avr_type, + default = "AC1A", + allowed_values = Set(AVAILABLE_PSID_PSSE_AVRS_TEST), ), ], ), @@ -1358,10 +1358,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psid_tests", "psse", "TGs"), build_function = build_psid_psse_test_tg, supported_arguments = [ - SystemArgument( - :tg_type, - "GAST", - Set(AVAILABLE_PSID_PSSE_TGS_TEST), + SystemArgument(; + name = :tg_type, + default = "GAST", + allowed_values = Set(AVAILABLE_PSID_PSSE_TGS_TEST), ), ], ), @@ -1372,10 +1372,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psid_tests", "psse", "GENs"), build_function = build_psid_psse_test_gen, supported_arguments = [ - SystemArgument( - :gen_type, - "GENCLS", - Set(AVAILABLE_PSID_PSSE_GENS_TEST), + SystemArgument(; + name = :gen_type, + default = "GENCLS", + allowed_values = Set(AVAILABLE_PSID_PSSE_GENS_TEST), ), ], ), @@ -1386,10 +1386,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psid_tests", "psse", "PSSs"), build_function = build_psid_psse_test_pss, supported_arguments = [ - SystemArgument( - :pss_type, - "STAB1", - Set(AVAILABLE_PSID_PSSE_PSS_TEST), + SystemArgument(; + name = :pss_type, + default = "STAB1", + allowed_values = Set(AVAILABLE_PSID_PSSE_PSS_TEST), ), ], ), @@ -1656,10 +1656,10 @@ const SYSTEM_CATALOG = [ raw_data = joinpath(DATA_DIR, "psy_data", "data_5bus_pu.jl"), build_function = build_c_sys5_all_components, supported_arguments = [ - SystemArgument( - :add_forecasts, - true, - Set([true, false]), + SystemArgument(; + name = :add_forecasts, + default = true, + allowed_values = Set([true, false]), ), ], ),