From 78f06561ab5a6aa636d96e2bedb2ddd037a10011 Mon Sep 17 00:00:00 2001 From: lbonaldo Date: Mon, 12 Feb 2024 16:13:35 -0500 Subject: [PATCH] Update test with new input format --- test/ComputeConflicts/Generators_data.csv | 5 ----- test/ComputeConflicts/Resources/Storage.csv | 2 ++ test/ComputeConflicts/Resources/Thermal.csv | 2 ++ test/ComputeConflicts/Resources/Vre.csv | 3 +++ test/test_time_domain_reduction.jl | 6 ++++-- test/utilities.jl | 6 +++++- 6 files changed, 16 insertions(+), 8 deletions(-) delete mode 100644 test/ComputeConflicts/Generators_data.csv create mode 100644 test/ComputeConflicts/Resources/Storage.csv create mode 100644 test/ComputeConflicts/Resources/Thermal.csv create mode 100644 test/ComputeConflicts/Resources/Vre.csv diff --git a/test/ComputeConflicts/Generators_data.csv b/test/ComputeConflicts/Generators_data.csv deleted file mode 100644 index 8f0d856757..0000000000 --- a/test/ComputeConflicts/Generators_data.csv +++ /dev/null @@ -1,5 +0,0 @@ -Resource,Zone,THERM,MUST_RUN,STOR,FLEX,HYDRO,VRE,LDS,Num_VRE_Bins,New_Build,Can_Retire,Existing_Cap_MW,Existing_Cap_MWh,Existing_Charge_Cap_MW,Max_Cap_MW,Max_Cap_MWh,Max_Charge_Cap_MW,Min_Cap_MW,Min_Cap_MWh,Min_Charge_Cap_MW,Inv_Cost_per_MWyr,Inv_Cost_per_MWhyr,Inv_Cost_Charge_per_MWyr,Fixed_OM_Cost_per_MWyr,Fixed_OM_Cost_per_MWhyr,Fixed_OM_Cost_Charge_per_MWyr,Var_OM_Cost_per_MWh,Var_OM_Cost_per_MWh_In,Heat_Rate_MMBTU_per_MWh,Fuel,Cap_Size,Start_Cost_per_MW,Start_Fuel_MMBTU_per_MW,Up_Time,Down_Time,Ramp_Up_Percentage,Ramp_Dn_Percentage,Min_Power,Self_Disch,Eff_Up,Eff_Down,Min_Duration,Max_Duration,MaxCapTag_1,MaxCapTag_2,MaxCapTag_3,Resource_Type,CapRes_1,region,cluster -natural_gas_combined_cycle,1,1,0,0,0,0,0,0,0,1,0,0,0,0,-1,-1,-1,0,0,0,65400,0,0,10287,0,0,3.55,0,7.43,NG,250,91,2,6,6,0.64,0.64,0.468,0,1,1,0,0,0,0,0,natural_gas_fired_combined_cycle,0.93,NE,1 -solar_pv,1,0,0,0,0,0,1,0,1,1,0,0,0,0,-1,-1,-1,0,0,0,85300,0,0,18760,0,0,0,0,9.13,None,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,solar_photovoltaic,0.8,NE,1 -onshore_wind,1,0,0,0,0,0,1,0,1,1,0,0,0,0,-1,-1,-1,0,0,0,97200,0,0,43205,0,0,0.1,0,9.12,None,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,onshore_wind_turbine,0.8,NE,1 -battery,1,0,0,1,0,0,0,0,0,1,0,0,0,0,-1,-1,-1,0,0,0,19584,22494,0,4895,5622,0,0.15,0.15,0,None,0,0,0,0,0,1,1,0,0,0.92,0.92,1,10,0,0,1,battery_mid,0.95,NE,0 diff --git a/test/ComputeConflicts/Resources/Storage.csv b/test/ComputeConflicts/Resources/Storage.csv new file mode 100644 index 0000000000..6e066c6823 --- /dev/null +++ b/test/ComputeConflicts/Resources/Storage.csv @@ -0,0 +1,2 @@ +Resource,Zone,Model,New_Build,Can_Retire,Existing_Cap_MW,Existing_Cap_MWh,Max_Cap_MW,Max_Cap_MWh,Min_Cap_MW,Min_Cap_MWh,Inv_Cost_per_MWyr,Inv_Cost_per_MWhyr,Fixed_OM_Cost_per_MWyr,Fixed_OM_Cost_per_MWhyr,Var_OM_Cost_per_MWh,Var_OM_Cost_per_MWh_In,Min_Power,Self_Disch,Eff_Up,Eff_Down,Min_Duration,Max_Duration,Resource_Type,CapRes_1,region,cluster +battery,1,1,1,0,0,0,-1,-1,0,0,19584,22494,4895,5622,0.15,0.15,0,0,0.92,0.92,1,10,battery_mid,0.95,NE,0 \ No newline at end of file diff --git a/test/ComputeConflicts/Resources/Thermal.csv b/test/ComputeConflicts/Resources/Thermal.csv new file mode 100644 index 0000000000..1f56d4b48f --- /dev/null +++ b/test/ComputeConflicts/Resources/Thermal.csv @@ -0,0 +1,2 @@ +Resource,Zone,Model,New_Build,Can_Retire,Existing_Cap_MW,Max_Cap_MW,Min_Cap_MW,Inv_Cost_per_MWyr,Fixed_OM_Cost_per_MWyr,Var_OM_Cost_per_MWh,Heat_Rate_MMBTU_per_MWh,Fuel,Cap_Size,Start_Cost_per_MW,Start_Fuel_MMBTU_per_MW,Up_Time,Down_Time,Ramp_Up_Percentage,Ramp_Dn_Percentage,Min_Power,Resource_Type,CapRes_1,region,cluster +natural_gas_combined_cycle,1,1,1,0,0,-1,0,65400,10287,3.55,7.43,NG,250,91,2,6,6,0.64,0.64,0.468,natural_gas_fired_combined_cycle,0.93,NE,1 \ No newline at end of file diff --git a/test/ComputeConflicts/Resources/Vre.csv b/test/ComputeConflicts/Resources/Vre.csv new file mode 100644 index 0000000000..6e5014b7b4 --- /dev/null +++ b/test/ComputeConflicts/Resources/Vre.csv @@ -0,0 +1,3 @@ +Resource,Zone,Num_VRE_Bins,New_Build,Can_Retire,Existing_Cap_MW,Max_Cap_MW,Min_Cap_MW,Inv_Cost_per_MWyr,Fixed_OM_Cost_per_MWyr,Var_OM_Cost_per_MWh,Heat_Rate_MMBTU_per_MWh,Resource_Type,CapRes_1,region,cluster +solar_pv,1,1,1,0,0,-1,0,85300,18760,0,9.13,solar_photovoltaic,0.8,NE,1 +onshore_wind,1,1,1,0,0,-1,0,97200,43205,0.1,9.12,onshore_wind_turbine,0.8,NE,1 \ No newline at end of file diff --git a/test/test_time_domain_reduction.jl b/test/test_time_domain_reduction.jl index b3a99d652a..d53e6ffb56 100644 --- a/test/test_time_domain_reduction.jl +++ b/test/test_time_domain_reduction.jl @@ -36,14 +36,16 @@ genx_setup = Dict( "MaxCapReq" => 1, "EnergyShareRequirement" => 1, "CO2Cap" => 2, - "ResourcePath" => "Resources", + "ResourcePath" => "resources", + "PolicyPath" => "policies", ) settings = GenX.default_settings() merge!(settings, genx_setup) -clustering_test = +clustering_test = with_logger(ConsoleLogger(stderr, Logging.Warn)) do GenX.cluster_inputs(test_folder, settings_path, settings, random = false)["ClusterObject"] +end # Load true clustering clustering_true = JLD2.load(joinpath(TDR_Results_true, "clusters_true.jld2"))["ClusterObject"] diff --git a/test/utilities.jl b/test/utilities.jl index a7a0953260..cd365bcc31 100644 --- a/test/utilities.jl +++ b/test/utilities.jl @@ -167,12 +167,16 @@ function test_write_output(test_path::AbstractString, genx_setup::Dict, EP::JuMP # True results results_true = joinpath(test_path, "Results_true") inputs["solve_time"] = solvetime_true + + # Merge the genx_setup with the default settings + settings = GenX.default_settings() + merge!(settings, genx_setup) # Write test results results_test = joinpath(test_path, "Results_test") isdir(results_test) && rm(results_test, recursive = true) # Remove test folder if it exists EP, inputs, _ = redirect_stdout(devnull) do - write_outputs(EP, results_test, genx_setup, inputs) + write_outputs(EP, results_test, settings, inputs) end # Compare true and test results