Skip to content

Commit

Permalink
Update test_upgrade_results
Browse files Browse the repository at this point in the history
  • Loading branch information
afontani committed Jan 6, 2025
1 parent f4f7dd9 commit 1f5eac1
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions test/test_analysis_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,20 @@ def test_baseline_results
def test_upgrades_results
columns = ['report_simulation_output.energy_use_total_m_btu']

['national', 'testing'].each do |project|
results_csvs = Dir[File.join(@buildstock_directory, "buildstockbatch/project_#{project}/#{project}_upgrades/results_csvs/results_up*.csv")]
assert_equal(1, results_csvs.size)
buildstockbatch_path = results_csvs[0]
buildstockbatch = CSV.read(buildstockbatch_path, headers: true)
results_csvs = Dir[File.join(@buildstock_directory, "project_national/sdr_upgrades_tmy3/results_csvs/results_up*.csv")]
assert_equal(17, results_csvs.size)
buildstockbatch_path = results_csvs[16]
buildstockbatch = CSV.read(buildstockbatch_path, headers: true)

run_analysis_path = File.join(@buildstock_directory, "run_analysis/project_#{project}/results-PackageUpgrade.csv")
run_analysis = CSV.read(run_analysis_path, headers: true)
run_analysis_path = File.join(@buildstock_directory, "sdr_upgrades_tmy3/results-EnvelopeOnlyLightTouchEnvelope.csv")
run_analysis = CSV.read(run_analysis_path, headers: true)

columns.each do |col|
buildstockbatch_sum = buildstockbatch[col].map { |v| Float(v) }.sum
run_analysis_sum = run_analysis[col].map { |v| Float(v) }.sum
columns.each do |col|
buildstockbatch_sum = buildstockbatch[col].map { |v| Float(v) }.sum
run_analysis_sum = run_analysis[col].map { |v| Float(v) }.sum

assert_equal(buildstockbatch[col].size, run_analysis[col].size)
assert_in_epsilon(buildstockbatch_sum, run_analysis_sum, 0.01)
end
assert_equal(buildstockbatch[col].size, run_analysis[col].size)
assert_in_epsilon(buildstockbatch_sum, run_analysis_sum, 0.01)
end
end
end

0 comments on commit 1f5eac1

Please sign in to comment.