diff --git a/test/TDR/Generators_data.csv b/test/TDR/Generators_data.csv new file mode 100644 index 0000000000..9393ab0727 --- /dev/null +++ b/test/TDR/Generators_data.csv @@ -0,0 +1,5 @@ +Resource,Zone,THERM,MUST_RUN,STOR,FLEX,HYDRO,VRE,LDS,Num_VRE_Bins,New_Build,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,Hydro_Energy_to_Power_Ratio,Min_Power,Self_Disch,Eff_Up,Eff_Down,Min_Duration,Max_Duration,Max_Flexible_Demand_Advance,Max_Flexible_Demand_Delay,Flexible_Demand_Energy_Eff,Reg_Max,Rsv_Max,Reg_Cost,Rsv_Cost,MaxCapTag_1,MaxCapTag_2,MaxCapTag_3,MinCapTag_1,MinCapTag_2,MinCapTag_3,MGA,Resource_Type,CapRes_1,ESR_1,ESR_2,region,cluster +natural_gas_combined_cycle,1,1,0,0,0,0,0,0,0,1,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,0.468,0,1,1,0,0,0,0,1,0.25,0.5,0,0,0,0,0,0,0,0,1,natural_gas_fired_combined_cycle,0.93,0,0,NE,1 +solar_pv,1,0,0,0,0,0,1,0,1,1,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,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,solar_photovoltaic,0.8,1,1,NE,1 +onshore_wind,1,0,0,0,0,0,1,0,1,1,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,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,onshore_wind_turbine,0.8,1,1,NE,1 +battery,1,0,0,1,0,0,0,0,0,1,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,0.92,0.92,1,10,0,0,1,0,0,0,0,0,0,1,0,0,1,0,battery_mid,0.95,0,0,NE,0 diff --git a/test/TDR/clusters_true.jld2 b/test/TDR/clusters_true.jld2 new file mode 100644 index 0000000000..577756f73d Binary files /dev/null and b/test/TDR/clusters_true.jld2 differ diff --git a/test/time_domain_reduction.jl b/test/time_domain_reduction.jl new file mode 100644 index 0000000000..d813047bfe --- /dev/null +++ b/test/time_domain_reduction.jl @@ -0,0 +1,43 @@ +module TestTDR + +import Test, GenX, JLD2, Clustering + +# suppress printing +console_out = stdout +redirect_stdout(devnull) + +test_folder = settings_path = "TDR" + +if isdir(joinpath(test_folder, "TDR_Results")) + rm(joinpath(test_folder, "TDR_Results"), recursive=true) +end + +# Inputs for cluster_inputs function +genx_setup = Dict() +genx_setup["NetworkExpansion"] = 0 +genx_setup["TimeDomainReduction"] = 1 +genx_setup["TimeDomainReductionFolder"] = "TDR_Results" +genx_setup["MultiStage"] = 0 +genx_setup["UCommit"] = 2 +genx_setup["CapacityReserveMargin"] = 1 +genx_setup["Reserves"] = 0 +genx_setup["MinCapReq"] = 1 +genx_setup["MaxCapReq"] = 1 +genx_setup["EnergyShareRequirement"] = 1 +genx_setup["CO2Cap"] = 2 + +clustering_test = GenX.cluster_inputs(test_folder, settings_path, genx_setup)["ClusterObject"] + +# Load true clustering +clustering_true = JLD2.load(joinpath(test_folder,"clusters_true.jld2"))["ClusterObject"] + +# Clustering validation +R = Clustering.randindex(clustering_test, clustering_true)[2] +I = Clustering.mutualinfo(clustering_test, clustering_true) + +# restore printing +redirect_stdout(console_out) +Test.@test R > 0.9 # Rand index should be close to 1 +Test.@test I > 0.8 # Mutual information should be close to 1 + +end # module TestTDR \ No newline at end of file