From 7889bb5d2218a6db67641c680206790c8497578c Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Mon, 16 Dec 2024 09:57:45 -0700 Subject: [PATCH] Updates HERS test outputs (units, order of files, etc.) to match latest RESNET accreditation forms. --- hpxml-measures/workflow/tests/util.rb | 35 +++++++++------------------ workflow/tests/resnet_hers_test.rb | 6 ++--- workflow/tests/resnet_other_test.rb | 12 +++------ workflow/tests/util.rb | 20 ++++++--------- 4 files changed, 25 insertions(+), 48 deletions(-) diff --git a/hpxml-measures/workflow/tests/util.rb b/hpxml-measures/workflow/tests/util.rb index ef1aa1857..bd2bacdb9 100644 --- a/hpxml-measures/workflow/tests/util.rb +++ b/hpxml-measures/workflow/tests/util.rb @@ -1288,15 +1288,11 @@ def _write_hers_hvac_results(all_results, test_results_csv) all_results = all_results.sort_by { |k, _v| k.downcase }.to_h hvac_energy = {} CSV.open(test_results_csv, 'w') do |csv| - csv << ['Test Case', 'HVAC (kWh or therm)', 'HVAC Fan (kWh)'] + csv << ['Test Case', 'Heat/Cool Energy (MBtu)', 'Fan Energy (MBtu)'] all_results.each do |xml, results| csv << [xml, results[0], results[1]] test_name = File.basename(xml, File.extname(xml)) - if xml.include?('HVAC2a') || xml.include?('HVAC2b') - hvac_energy[test_name] = results[0] / 10.0 + results[1] / 293.08 - else - hvac_energy[test_name] = results[0] + results[1] - end + hvac_energy[test_name] = results[0] + results[1] end end puts "Wrote results to #{test_results_csv}." @@ -1309,20 +1305,11 @@ def _write_hers_dse_results(all_results, test_results_csv) all_results = all_results.sort_by { |k, _v| k.downcase }.to_h dhw_energy = {} CSV.open(test_results_csv, 'w') do |csv| - csv << ['Test Case', 'Heat/Cool (kWh or therm)', 'HVAC Fan (kWh)'] - all_results.each do |xml, results| - next unless ['HVAC3a.xml', 'HVAC3e.xml'].include? xml - - csv << [xml, results[0], results[1]] - test_name = File.basename(xml, File.extname(xml)) - dhw_energy[test_name] = results[0] / 10.0 + results[1] / 293.08 - end + csv << ['Test Case', 'Heat/Cool Energy (MBtu)', 'Fan Energy (MBtu)'] all_results.each do |xml, results| - next if ['HVAC3a.xml', 'HVAC3e.xml'].include? xml - csv << [xml, results[0], results[1]] test_name = File.basename(xml, File.extname(xml)) - dhw_energy[test_name] = results[0] / 10.0 + results[1] / 293.08 + dhw_energy[test_name] = results[0] + results[1] end end puts "Wrote results to #{test_results_csv}." @@ -1335,10 +1322,10 @@ def _write_hers_hot_water_results(all_results, test_results_csv) all_results = all_results.sort_by { |k, _v| k.downcase }.to_h dhw_energy = {} CSV.open(test_results_csv, 'w') do |csv| - csv << ['Test Case', 'DHW Energy (therms)', 'Recirc Pump (kWh)'] + csv << ['Test Case', 'DHW Energy (MBtu)', 'Pump Energy (MBtu)'] all_results.each do |xml, result| wh_energy, recirc_energy = result - csv << [xml, (wh_energy * 10.0).round(1), (recirc_energy * 293.08).round(1)] + csv << [xml, wh_energy, recirc_energy] test_name = File.basename(xml, File.extname(xml)) dhw_energy[test_name] = wh_energy + recirc_energy end @@ -1357,15 +1344,15 @@ def _get_simulation_load_results(results) def _get_simulation_hvac_energy_results(results, is_heat, is_electric_heat) if not is_heat - hvac = UnitConversions.convert(results["End Use: #{FT::Elec}: #{EUT::Cooling} (MBtu)"], 'MBtu', 'kwh').round(2) - hvac_fan = UnitConversions.convert(results["End Use: #{FT::Elec}: #{EUT::CoolingFanPump} (MBtu)"], 'MBtu', 'kwh').round(2) + hvac = results["End Use: #{FT::Elec}: #{EUT::Cooling} (MBtu)"].round(2) + hvac_fan = results["End Use: #{FT::Elec}: #{EUT::CoolingFanPump} (MBtu)"].round(2) else if is_electric_heat - hvac = UnitConversions.convert(results["End Use: #{FT::Elec}: #{EUT::Heating} (MBtu)"], 'MBtu', 'kwh').round(2) + hvac = results["End Use: #{FT::Elec}: #{EUT::Heating} (MBtu)"].round(2) else - hvac = UnitConversions.convert(results["End Use: #{FT::Gas}: #{EUT::Heating} (MBtu)"], 'MBtu', 'therm').round(2) + hvac = results["End Use: #{FT::Gas}: #{EUT::Heating} (MBtu)"].round(2) end - hvac_fan = UnitConversions.convert(results["End Use: #{FT::Elec}: #{EUT::HeatingFanPump} (MBtu)"], 'MBtu', 'kwh').round(2) + hvac_fan = results["End Use: #{FT::Elec}: #{EUT::HeatingFanPump} (MBtu)"].round(2) end assert_operator(hvac, :>, 0) diff --git a/workflow/tests/resnet_hers_test.rb b/workflow/tests/resnet_hers_test.rb index f631bb004..8eb169b30 100644 --- a/workflow/tests/resnet_hers_test.rb +++ b/workflow/tests/resnet_hers_test.rb @@ -49,15 +49,13 @@ def test_resnet_ashrae_140 end def test_resnet_hers_reference_home_auto_generation - version = '2022C' all_results = _test_resnet_hers_reference_home_auto_generation('RESNET_Test_4.2_HERS_AutoGen_Reference_Home', - 'RESNET_Tests/4.2_HERS_AutoGen_Reference_Home', - version) + 'RESNET_Tests/4.2_HERS_AutoGen_Reference_Home') # Check results all_results.each do |xml, results| test_num = File.basename(xml)[0, 2].to_i - _check_reference_home_components(results, test_num, version) + _check_reference_home_components(results, test_num, '2022C') end end diff --git a/workflow/tests/resnet_other_test.rb b/workflow/tests/resnet_other_test.rb index ebd00faf0..121982179 100644 --- a/workflow/tests/resnet_other_test.rb +++ b/workflow/tests/resnet_other_test.rb @@ -19,29 +19,25 @@ def setup end def test_resnet_hers_reference_home_auto_generation_301_2019_pre_addendum_a - version = '2019' all_results = _test_resnet_hers_reference_home_auto_generation('RESNET_Test_Other_HERS_AutoGen_Reference_Home_301_2019_PreAddendumA', - 'RESNET_Tests/Other_HERS_AutoGen_Reference_Home_301_2019_PreAddendumA', - version) + 'RESNET_Tests/Other_HERS_AutoGen_Reference_Home_301_2019_PreAddendumA') # Check results all_results.each do |xml, results| test_num = File.basename(xml)[0, 2].to_i - _check_reference_home_components(results, test_num, version) + _check_reference_home_components(results, test_num, '2019') end end def test_resnet_hers_reference_home_auto_generation_301_2014 # Older test w/ 301-2014 mechanical ventilation acceptance criteria - version = '2014' all_results = _test_resnet_hers_reference_home_auto_generation('RESNET_Test_Other_HERS_AutoGen_Reference_Home_301_2014', - 'RESNET_Tests/Other_HERS_AutoGen_Reference_Home_301_2014', - version) + 'RESNET_Tests/Other_HERS_AutoGen_Reference_Home_301_2014') # Check results all_results.each do |xml, results| test_num = File.basename(xml)[0, 2].to_i - _check_reference_home_components(results, test_num, version) + _check_reference_home_components(results, test_num, '2014') end end diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb index bc19a2a41..23bea8053 100644 --- a/workflow/tests/util.rb +++ b/workflow/tests/util.rb @@ -274,7 +274,7 @@ def _rm_path(path) end end -def _test_resnet_hers_reference_home_auto_generation(test_name, dir_name, version) +def _test_resnet_hers_reference_home_auto_generation(test_name, dir_name) test_results_csv = File.absolute_path(File.join(@test_results_dir, "#{test_name}.csv")) File.delete(test_results_csv) if File.exist? test_results_csv @@ -285,7 +285,7 @@ def _test_resnet_hers_reference_home_auto_generation(test_name, dir_name, versio out_xml = File.join(@test_files_dir, test_name, File.basename(xml), File.basename(xml)) _run_ruleset(Constants::CalcTypeERIReferenceHome, xml, out_xml) test_num = File.basename(xml)[0, 2].to_i - all_results[File.basename(xml)] = _get_reference_home_components(out_xml, test_num, version) + all_results[File.basename(xml)] = _get_reference_home_components(out_xml, test_num) # Update HPXML to override mech vent fan power for eRatio test new_hpxml = HPXML.new(hpxml_path: out_xml) @@ -374,7 +374,7 @@ def _test_resnet_hers_method(test_name, dir_name) return all_results end -def _get_reference_home_components(hpxml, test_num, version) +def _get_reference_home_components(hpxml, test_num) results = {} hpxml = HPXML.new(hpxml_path: hpxml) hpxml_bldg = hpxml.buildings[0] @@ -453,20 +453,15 @@ def _get_reference_home_components(hpxml, test_num, version) results['East window area (ft2)'] = win_areas[90].round(2) results['West window area (ft2)'] = win_areas[270].round(2) results['Window U-Factor'] = win_u.round(2) - if version == '2022C' - results['Window SHGCo'] = win_shgc_htg.round(2) - assert_equal(win_shgc_htg, win_shgc_clg) - else - results['Window SHGCo (heating)'] = win_shgc_htg.round(2) - results['Window SHGCo (cooling)'] = win_shgc_clg.round(2) - end + results['Window SHGCo (heating)'] = win_shgc_htg.round(2) + results['Window SHGCo (cooling)'] = win_shgc_clg.round(2) # Infiltration sla, _ach50 = _get_infiltration(hpxml_bldg) results['SLAo (ft2/ft2)'] = sla.round(5) # Internal gains - xml_it_sens, xml_it_lat = _get_internal_gains(hpxml_bldg, hpxml.header.eri_calculation_version) + xml_it_sens, xml_it_lat = _get_internal_gains(hpxml_bldg, eri_version) results['Sensible Internal gains (Btu/day)'] = xml_it_sens.round(0) results['Latent Internal gains (Btu/day)'] = xml_it_lat.round(0) @@ -670,7 +665,8 @@ def _check_reference_home_components(results, test_num, version) end if version == '2022C' # Pub 002-2024 - assert_equal(0.33, results['Window SHGCo']) + assert_equal(0.33, results['Window SHGCo (heating)']) + assert_equal(0.33, results['Window SHGCo (cooling)']) else assert_equal(0.34, results['Window SHGCo (heating)']) assert_equal(0.28, results['Window SHGCo (cooling)'])