Skip to content

Commit

Permalink
Update test with new input format
Browse files Browse the repository at this point in the history
  • Loading branch information
lbonaldo committed Feb 14, 2024
1 parent 1aa5e60 commit 78f0656
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
5 changes: 0 additions & 5 deletions test/ComputeConflicts/Generators_data.csv

This file was deleted.

2 changes: 2 additions & 0 deletions test/ComputeConflicts/Resources/Storage.csv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/ComputeConflicts/Resources/Thermal.csv
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions test/ComputeConflicts/Resources/Vre.csv
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions test/test_time_domain_reduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 5 additions & 1 deletion test/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78f0656

Please sign in to comment.