Skip to content

Commit

Permalink
Add testing for sdr upgrade run with bsb
Browse files Browse the repository at this point in the history
  • Loading branch information
afontani committed Dec 10, 2024
1 parent 2e613cb commit fe7e2eb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_bsb_analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def before_setup
@national_baseline = 'project_national/national_baseline'
@testing_upgrades = 'project_testing/testing_upgrades'
@national_upgrades = 'project_national/national_upgrades'
@sdr_upgrades = 'project_national/sdr_upgrades_tmy3'
end

def test_testing_baseline
Expand Down Expand Up @@ -94,6 +95,32 @@ def test_national_upgrades
assert(_test_timeseries_columns(timeseries))
end

def test_sdr_upgrades
assert(File.exist?(File.join(@sdr_upgrades, 'results_csvs', 'results_up00.csv')))
results = CSV.read(File.join(@sdr_upgrades, 'results_csvs', 'results_up00.csv'), headers: true)

_test_columns(results)

assert(File.exist?(File.join(@sdr_upgrades, 'simulation_output', 'up00', 'bldg0000001', 'run')))
contents = Dir[File.join(@sdr_upgrades, 'simulation_output', 'up00', 'bldg0000001', 'run/*')].collect { |x| File.basename(x) }

_test_contents(contents, false, false)

num_upgrade_scenarios = Dir[File.join(@sdr_upgrades, 'results_csvs', 'results_up*')].count - 1
assert(File.exist?(File.join(@sdr_upgrades, 'results_csvs', "results_up#{num_upgrade_scenarios}.csv")))
results = CSV.read(File.join(@sdr_upgrades, 'results_csvs', "results_up#{num_upgrade_scenarios}.csv"), headers: true)

_test_columns(results, true)

assert(File.exist?(File.join(@sdr_upgrades, 'simulation_output', "up#{num_upgrade_scenarios}", 'bldg0000001', 'run')))
contents = Dir[File.join(@sdr_upgrades, 'simulation_output', "up#{num_upgrade_scenarios}", 'bldg0000001', 'run/*')].collect { |x| File.basename(x) }

_test_contents(contents, true, false)

timeseries = _get_timeseries_columns(Dir[File.join(@sdr_upgrades, 'simulation_output/up*/bldg*/run/results_timeseries.csv')])
assert(_test_timeseries_columns(timeseries))
end

def test_testing_inputs
expected_inputs = CSV.read(File.join('resources', 'data', 'dictionary', 'inputs.csv'), headers: true)
expected_names = expected_inputs['Input Name']
Expand Down

0 comments on commit fe7e2eb

Please sign in to comment.