From e77f37a8c8f5fcb50e296303eca949c49956ed16 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Sun, 13 Oct 2024 13:53:59 -0600 Subject: [PATCH] Fix tests. --- BuildResidentialHPXML/measure.rb | 4 +-- BuildResidentialHPXML/measure.xml | 8 ++--- .../tests/test_build_residential_hpxml.rb | 8 ++--- HPXMLtoOpenStudio/measure.xml | 32 +++++++++---------- HPXMLtoOpenStudio/resources/airflow.rb | 6 ++-- HPXMLtoOpenStudio/resources/defaults.rb | 2 +- .../resources/hotwater_appliances.rb | 6 ++-- HPXMLtoOpenStudio/resources/hpxml.rb | 18 +++++------ HPXMLtoOpenStudio/resources/hvac.rb | 4 +-- HPXMLtoOpenStudio/resources/hvac_sizing.rb | 22 +++++++------ HPXMLtoOpenStudio/resources/location.rb | 2 +- HPXMLtoOpenStudio/resources/schedules.rb | 2 +- HPXMLtoOpenStudio/resources/waterheater.rb | 2 +- HPXMLtoOpenStudio/resources/weather.rb | 2 +- HPXMLtoOpenStudio/tests/test_defaults.rb | 2 +- HPXMLtoOpenStudio/tests/test_hvac_sizing.rb | 1 + HPXMLtoOpenStudio/tests/test_location.rb | 2 +- HPXMLtoOpenStudio/tests/test_weather.rb | 2 +- ReportSimulationOutput/measure.rb | 6 ++-- ReportSimulationOutput/measure.xml | 8 ++--- .../tests/test_report_sim_output.rb | 6 ++-- ReportUtilityBills/measure.rb | 10 +++--- ReportUtilityBills/measure.xml | 6 ++-- workflow/tests/test_other.rb | 20 ++++++------ workflow/tests/util.rb | 31 +++++++++--------- 25 files changed, 108 insertions(+), 104 deletions(-) diff --git a/BuildResidentialHPXML/measure.rb b/BuildResidentialHPXML/measure.rb index 2087d90799..e513e47341 100644 --- a/BuildResidentialHPXML/measure.rb +++ b/BuildResidentialHPXML/measure.rb @@ -5916,7 +5916,7 @@ def self.set_heat_pumps(hpxml_bldg, args) # @param args [Hash] Map of :argument_name => value # @return [nil] def self.set_geothermal_loop(hpxml_bldg, args) - return if hpxml_bldg.heat_pumps.select { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size == 0 + return if hpxml_bldg.heat_pumps.count { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir } == 0 return if args[:geothermal_loop_configuration].nil? || args[:geothermal_loop_configuration] == Constants::None if not args[:geothermal_loop_pipe_diameter].nil? @@ -6252,7 +6252,7 @@ def self.set_ducts(hpxml_bldg, args, hvac_distribution) end # If duct surface areas are defaulted, set CFA served - if hvac_distribution.ducts.select { |d| d.duct_surface_area.nil? }.size > 0 + if hvac_distribution.ducts.count { |d| d.duct_surface_area.nil? } > 0 max_fraction_load_served = 0.0 hvac_distribution.hvac_systems.each do |hvac_system| if hvac_system.respond_to?(:fraction_heat_load_served) diff --git a/BuildResidentialHPXML/measure.xml b/BuildResidentialHPXML/measure.xml index 222bd3bcc1..7d36c5968d 100644 --- a/BuildResidentialHPXML/measure.xml +++ b/BuildResidentialHPXML/measure.xml @@ -3,8 +3,8 @@ 3.1 build_residential_hpxml a13a8983-2b01-4930-8af2-42030b6e4233 - 32809635-5673-4b10-bf0a-de06a038b619 - 2024-10-01T18:49:48Z + 2f4fbbe3-a36f-4d03-a5f5-87c150890550 + 2024-10-13T19:48:25Z 2C38F48B BuildResidentialHPXML HPXML Builder @@ -7535,7 +7535,7 @@ measure.rb rb script - 9F12F6CA + C1F50EA1 constants.rb @@ -7553,7 +7553,7 @@ test_build_residential_hpxml.rb rb test - 39A3D88B + 04146810 diff --git a/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb b/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb index 3d39f8fc0b..9b79b0e8b8 100644 --- a/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb +++ b/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb @@ -1358,22 +1358,22 @@ def _test_measure(runner, expected_errors, expected_warnings) # check warnings/errors if not expected_errors.nil? expected_errors.each do |expected_error| - if runner.result.stepErrors.select { |s| s.include?(expected_error) }.size <= 0 + if runner.result.stepErrors.count { |s| s.include?(expected_error) } <= 0 runner.result.stepErrors.each do |s| puts "ERROR: #{s}" end end - assert(runner.result.stepErrors.select { |s| s.include?(expected_error) }.size > 0) + assert(runner.result.stepErrors.count { |s| s.include?(expected_error) } > 0) end end if not expected_warnings.nil? expected_warnings.each do |expected_warning| - if runner.result.stepWarnings.select { |s| s.include?(expected_warning) }.size <= 0 + if runner.result.stepWarnings.count { |s| s.include?(expected_warning) } <= 0 runner.result.stepWarnings.each do |s| puts "WARNING: #{s}" end end - assert(runner.result.stepWarnings.select { |s| s.include?(expected_warning) }.size > 0) + assert(runner.result.stepWarnings.count { |s| s.include?(expected_warning) } > 0) end end end diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 64cdc116e2..f9031f3df0 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - fb5e3fd3-f0be-4f67-aa61-9850c40c22eb - 2024-10-13T18:05:08Z + dbd88505-b00e-4617-9501-2b6c664db124 + 2024-10-13T19:48:28Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -189,7 +189,7 @@ airflow.rb rb resource - CA1394A8 + A1DA58C9 battery.rb @@ -327,7 +327,7 @@ defaults.rb rb resource - 3547D117 + 1C554EBA energyplus.rb @@ -351,13 +351,13 @@ hotwater_appliances.rb rb resource - 4A5DFE48 + 1EE4897F hpxml.rb rb resource - 10F59ACC + 75062717 hpxml_schema/HPXML.xsd @@ -387,13 +387,13 @@ hvac.rb rb resource - E45ED47F + 5BA0F293 hvac_sizing.rb rb resource - F86F059D + BEF6DAA5 internal_gains.rb @@ -411,7 +411,7 @@ location.rb rb resource - 5AB56EA3 + 5ACAD08F materials.rb @@ -591,7 +591,7 @@ schedules.rb rb resource - BB101800 + 29DAE0EC simcontrols.rb @@ -627,13 +627,13 @@ waterheater.rb rb resource - 790B832E + EA8D60B3 weather.rb rb resource - 4178FAA9 + 70BF0986 xmlhelper.rb @@ -669,7 +669,7 @@ test_defaults.rb rb test - B75D3A0B + DF7D214E test_enclosure.rb @@ -699,7 +699,7 @@ test_hvac_sizing.rb rb test - 08EC96F4 + 822ACA5D test_lighting.rb @@ -711,7 +711,7 @@ test_location.rb rb test - B8AA4C0B + 1BABD0AE test_miscloads.rb @@ -753,7 +753,7 @@ test_weather.rb rb test - F452DA69 + 7DCA4233 util.rb diff --git a/HPXMLtoOpenStudio/resources/airflow.rb b/HPXMLtoOpenStudio/resources/airflow.rb index 1c525d38e6..866e6b318c 100644 --- a/HPXMLtoOpenStudio/resources/airflow.rb +++ b/HPXMLtoOpenStudio/resources/airflow.rb @@ -851,7 +851,7 @@ def self.check_duct_leakage(runner, hpxml_bldg) lto_measurements = hvac_distribution.duct_leakage_measurements.select { |dlm| dlm.duct_leakage_total_or_to_outside == HPXML::DuctLeakageToOutside } sum_lto = lto_measurements.map { |dlm| dlm.duct_leakage_value }.sum(0.0) - if hvac_distribution.ducts.select { |d| !HPXML::conditioned_locations_this_unit.include?(d.duct_location) }.size == 0 + if hvac_distribution.ducts.count { |d| !HPXML::conditioned_locations_this_unit.include?(d.duct_location) } == 0 # If ducts completely in conditioned space, issue warning if duct leakage to outside above a certain threshold (e.g., 5%) issue_warning = false if units == HPXML::UnitsCFM25 @@ -2340,7 +2340,7 @@ def self.calculate_precond_loads(model, spaces, infil_program, vent_fans, hrv_er vent_fans[:mech_preheat].each_with_index do |f_preheat, i| infil_program.addLine("If (OASupInTemp < HtgStp) && (#{clg_ssn_sensor.name} < 1)") - cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPreheating }.size # Ensure unique meter for each preheating system + cnt = model.getOtherEquipments.count { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPreheating } # Ensure unique meter for each preheating system other_equip = Model.add_other_equipment( model, name: "shared mech vent preheating energy #{i}", @@ -2385,7 +2385,7 @@ def self.calculate_precond_loads(model, spaces, infil_program, vent_fans, hrv_er vent_fans[:mech_precool].each_with_index do |f_precool, i| infil_program.addLine("If (OASupInTemp > ClgStp) && (#{clg_ssn_sensor.name} > 0)") - cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPrecooling }.size # Ensure unique meter for each precooling system + cnt = model.getOtherEquipments.count { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPrecooling } # Ensure unique meter for each precooling system other_equip = Model.add_other_equipment( model, name: "shared mech vent precooling energy #{i}", diff --git a/HPXMLtoOpenStudio/resources/defaults.rb b/HPXMLtoOpenStudio/resources/defaults.rb index 456967ee88..045f69915c 100644 --- a/HPXMLtoOpenStudio/resources/defaults.rb +++ b/HPXMLtoOpenStudio/resources/defaults.rb @@ -2726,7 +2726,7 @@ def self.apply_ventilation_fans(hpxml_bldg, weather, eri_version) end if vent_fan.flow_rate.nil? - if hpxml_bldg.ventilation_fans.select { |vf| vf.used_for_whole_building_ventilation && !vf.is_cfis_supplemental_fan }.size > 1 + if hpxml_bldg.ventilation_fans.count { |vf| vf.used_for_whole_building_ventilation && !vf.is_cfis_supplemental_fan } > 1 fail 'Defaulting flow rates for multiple mechanical ventilation systems is currently not supported.' end diff --git a/HPXMLtoOpenStudio/resources/hotwater_appliances.rb b/HPXMLtoOpenStudio/resources/hotwater_appliances.rb index 124cc2bed4..6a6182a223 100644 --- a/HPXMLtoOpenStudio/resources/hotwater_appliances.rb +++ b/HPXMLtoOpenStudio/resources/hotwater_appliances.rb @@ -362,13 +362,13 @@ def self.apply(runner, model, weather, spaces, hpxml_bldg, hpxml_header, schedul if fixtures.any? { |wf| wf.count.nil? } showerheads = fixtures.select { |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeShowerhead } if showerheads.size > 0 - frac_low_flow_showerheads = showerheads.select { |wf| wf.low_flow }.size / Float(showerheads.size) + frac_low_flow_showerheads = showerheads.count { |wf| wf.low_flow } / Float(showerheads.size) else frac_low_flow_showerheads = 0.0 end faucets = fixtures.select { |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeFaucet } if faucets.size > 0 - frac_low_flow_faucets = faucets.select { |wf| wf.low_flow }.size / Float(faucets.size) + frac_low_flow_faucets = faucets.count { |wf| wf.low_flow } / Float(faucets.size) else frac_low_flow_faucets = 0.0 end @@ -499,7 +499,7 @@ def self.apply(runner, model, weather, spaces, hpxml_bldg, hpxml_header, schedul runner.registerWarning("Both '#{recirc_pump_col_name}' schedule file and monthly multipliers provided; the latter will be ignored.") if !hot_water_distribution.recirculation_pump_monthly_multipliers.nil? end if recirc_pump_design_level * gpd_frac != 0 - cnt = model.getElectricEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeHotWaterRecircPump }.size # Ensure unique meter for each water heater + cnt = model.getElectricEquipments.count { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeHotWaterRecircPump } # Ensure unique meter for each water heater recirc_pump = Model.add_electric_equipment( model, name: "#{Constants::ObjectTypeHotWaterRecircPump}#{cnt + 1}", diff --git a/HPXMLtoOpenStudio/resources/hpxml.rb b/HPXMLtoOpenStudio/resources/hpxml.rb index cb6eb32629..1d0ea99f9a 100644 --- a/HPXMLtoOpenStudio/resources/hpxml.rb +++ b/HPXMLtoOpenStudio/resources/hpxml.rb @@ -2101,7 +2101,7 @@ def check_for_errors # Check for correct PrimaryIndicator values across all refrigerators if @refrigerators.size > 1 - primary_indicators = @refrigerators.select { |r| r.primary_indicator }.size + primary_indicators = @refrigerators.count { |r| r.primary_indicator } if primary_indicators > 1 errors << 'More than one refrigerator designated as the primary.' elsif primary_indicators == 0 @@ -2110,15 +2110,15 @@ def check_for_errors end # Check for correct PrimaryHeatingSystem values across all HVAC systems - n_primary_heating = @heating_systems.select { |h| h.primary_system }.size + - @heat_pumps.select { |h| h.primary_heating_system }.size + n_primary_heating = @heating_systems.count { |h| h.primary_system } + + @heat_pumps.count { |h| h.primary_heating_system } if n_primary_heating > 1 errors << 'More than one heating system designated as the primary.' end # Check for correct PrimaryCoolingSystem values across all HVAC systems - n_primary_cooling = @cooling_systems.select { |c| c.primary_system }.size + - @heat_pumps.select { |c| c.primary_cooling_system }.size + n_primary_cooling = @cooling_systems.count { |c| c.primary_system } + + @heat_pumps.count { |c| c.primary_cooling_system } if n_primary_cooling > 1 errors << 'More than one cooling system designated as the primary.' end @@ -10984,8 +10984,8 @@ def check_for_errors # For every unique outdoor temperature, check we have exactly one minimum and one maximum datapoint outdoor_temps = self.select { |dp| [HPXML::CapacityDescriptionMinimum, HPXML::CapacityDescriptionMaximum].include? dp.capacity_description }.map { |dp| dp.outdoor_temperature }.uniq outdoor_temps.each do |outdoor_temp| - num_min = self.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == outdoor_temp }.size - num_max = self.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == outdoor_temp }.size + num_min = count { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == outdoor_temp } + num_max = count { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == outdoor_temp } if (num_min != 1) || (num_max != 1) errors << "Cooling detailed performance data for outdoor temperature = #{outdoor_temp} is incomplete; there must be exactly one minimum and one maximum capacity datapoint." end @@ -11092,8 +11092,8 @@ def check_for_errors # For every unique outdoor temperature, check we have exactly one minimum and one maximum datapoint outdoor_temps = self.select { |dp| [HPXML::CapacityDescriptionMinimum, HPXML::CapacityDescriptionMaximum].include? dp.capacity_description }.map { |dp| dp.outdoor_temperature }.uniq outdoor_temps.each do |outdoor_temp| - num_min = self.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == outdoor_temp }.size - num_max = self.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == outdoor_temp }.size + num_min = count { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == outdoor_temp } + num_max = count { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == outdoor_temp } if (num_min != 1) || (num_max != 1) errors << "Heating detailed performance data for outdoor temperature = #{outdoor_temp} is incomplete; there must be exactly one minimum and one maximum capacity datapoint." end diff --git a/HPXMLtoOpenStudio/resources/hvac.rb b/HPXMLtoOpenStudio/resources/hvac.rb index b8c751d3e0..032f743e00 100644 --- a/HPXMLtoOpenStudio/resources/hvac.rb +++ b/HPXMLtoOpenStudio/resources/hvac.rb @@ -5352,14 +5352,14 @@ def self.apply_shared_cooling_systems(hpxml_bldg) cooling_system.distribution_system_idref = hpxml_bldg.hvac_distributions[-1].id end hpxml_bldg.hvac_distributions[-1].air_type = HPXML::AirTypeRegularVelocity - if hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.select { |lm| (lm.duct_type == HPXML::DuctTypeSupply) && (lm.duct_leakage_total_or_to_outside == HPXML::DuctLeakageToOutside) }.size == 0 + if hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.count { |lm| (lm.duct_type == HPXML::DuctTypeSupply) && (lm.duct_leakage_total_or_to_outside == HPXML::DuctLeakageToOutside) } == 0 # Assign zero supply leakage hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.add(duct_type: HPXML::DuctTypeSupply, duct_leakage_units: HPXML::UnitsCFM25, duct_leakage_value: 0, duct_leakage_total_or_to_outside: HPXML::DuctLeakageToOutside) end - if hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.select { |lm| (lm.duct_type == HPXML::DuctTypeReturn) && (lm.duct_leakage_total_or_to_outside == HPXML::DuctLeakageToOutside) }.size == 0 + if hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.count { |lm| (lm.duct_type == HPXML::DuctTypeReturn) && (lm.duct_leakage_total_or_to_outside == HPXML::DuctLeakageToOutside) } == 0 # Assign zero return leakage hpxml_bldg.hvac_distributions[-1].duct_leakage_measurements.add(duct_type: HPXML::DuctTypeReturn, duct_leakage_units: HPXML::UnitsCFM25, diff --git a/HPXMLtoOpenStudio/resources/hvac_sizing.rb b/HPXMLtoOpenStudio/resources/hvac_sizing.rb index 4a38aba15a..6acc08d3cf 100644 --- a/HPXMLtoOpenStudio/resources/hvac_sizing.rb +++ b/HPXMLtoOpenStudio/resources/hvac_sizing.rb @@ -1972,7 +1972,7 @@ def self.apply_hvac_duct_loads_cooling(mj, zone, hvac_loads, zone_loads, all_spa # @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit # @return [nil] def self.apply_hvac_cfis_loads(mj, hvac_loads, zone_loads, hvac_heating, hvac_cooling, hpxml_bldg) - if hpxml_bldg.zones[0].id == 'BobRossResidenceConditioned' && hpxml_bldg.ventilation_fans.select { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeERV }.size == 1 + if hpxml_bldg.zones[0].id == 'BobRossResidenceConditioned' && hpxml_bldg.ventilation_fans.count { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeERV } == 1 # FUTURE: For now, ACCA is okay with us bypassing our inputs to manually test this. # Bob Ross 3-18: ERV to equipment (system load) htg_sens_eff = 0.68 @@ -2356,15 +2356,17 @@ def self.apply_hvac_equipment_adjustments(mj, runner, hvac_sizings, weather, hva heating_delta_t = hvac_heating_ap.supply_air_temp - mj.heat_setpoint if hvac_heating.is_a?(HPXML::HeatingSystem) && hvac_heating.is_heat_pump_backup_system - # Adjust heating load using the HP backup calculation hvac_hp = hvac_heating.primary_heat_pump - hp_sizing_values = @all_hvac_sizings[{ heating: hvac_hp, cooling: hvac_hp }] - if hp_sizing_values.nil? - fail 'Primary heat pump should have been sized already.' - end + if hvac_hp.heat_pump_type != HPXML::HVACTypeHeatPumpGroundToAir + # Adjust heating load using the HP backup calculation + hp_sizing_values = @all_hvac_sizings[{ heating: hvac_hp, cooling: hvac_hp }] + if hp_sizing_values.nil? + fail 'Primary heat pump should have been sized already.' + end - hp_heating_speed = get_nominal_speed(hvac_hp.additional_properties, false) - hvac_sizings.Heat_Load = calculate_heat_pump_backup_load(mj, hvac_hp, hvac_sizings.Heat_Load, hp_sizing_values.Heat_Capacity, hp_heating_speed, hpxml_bldg) + hp_heating_speed = get_nominal_speed(hvac_hp.additional_properties, false) + hvac_sizings.Heat_Load = calculate_heat_pump_backup_load(mj, hvac_hp, hvac_sizings.Heat_Load, hp_sizing_values.Heat_Capacity, hp_heating_speed, hpxml_bldg) + end end elsif not hvac_cooling.nil? && hvac_cooling.has_integrated_heating heating_delta_t = hvac_cooling_ap.supply_air_temp - mj.heat_setpoint @@ -3290,11 +3292,11 @@ def self.get_ventilation_data(hpxml_bldg) # FUTURE: For now, ACCA is okay with us bypassing our inputs to manually test these. if hpxml_bldg.zones[0].id == 'BobRossResidenceConditioned' - if hpxml_bldg.ventilation_fans.select { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeERV }.size == 1 + if hpxml_bldg.ventilation_fans.count { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeERV } == 1 # Bob Ross 3-18: ERV to equipment (system load) return { q_imb: 0.0, q_oa: 0.0, q_preheat: 0.0, q_precool: 0.0, q_recirc: 0.0, htg_sens_eff: 0.0, clg_sens_eff: 0.0, clg_lat_eff: 0.0 } - elsif hpxml_bldg.ventilation_fans.select { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeHRV }.size == 1 + elsif hpxml_bldg.ventilation_fans.count { |f| f.used_for_whole_building_ventilation && f.fan_type == HPXML::MechVentTypeHRV } == 1 # Bob Ross 3-21: HRV to space (space load) htg_sens_eff = 0.64 clg_sens_eff = 0.58 diff --git a/HPXMLtoOpenStudio/resources/location.rb b/HPXMLtoOpenStudio/resources/location.rb index 32ad266313..2952aea8a8 100644 --- a/HPXMLtoOpenStudio/resources/location.rb +++ b/HPXMLtoOpenStudio/resources/location.rb @@ -90,7 +90,7 @@ def self.apply_ground_temps(model, weather, hpxml_bldg) sgts.resetAllMonths sgts.setAllMonthlyTemperatures(weather.data.ShallowGroundMonthlyTemps.map { |t| UnitConversions.convert(t, 'F', 'C') }) - if hpxml_bldg.heat_pumps.select { |h| h.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size > 0 + if hpxml_bldg.heat_pumps.count { |h| h.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir } > 0 # Deep ground temperatures used by GSHP setpoint manager dgts = model.getSiteGroundTemperatureDeep dgts.resetAllMonths diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index 3e5fe80170..f5ee36e47c 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -928,7 +928,7 @@ def self.valid_float?(str) # @return [nil] def self.check_emissions_references(hpxml_header, hpxml_path) hpxml_header.emissions_scenarios.each do |scenario| - if hpxml_header.emissions_scenarios.select { |s| s.emissions_type == scenario.emissions_type && s.name == scenario.name }.size > 1 + if hpxml_header.emissions_scenarios.count { |s| s.emissions_type == scenario.emissions_type && s.name == scenario.name } > 1 fail "Found multiple Emissions Scenarios with the Scenario Name=#{scenario.name} and Emissions Type=#{scenario.emissions_type}." end next if scenario.elec_schedule_filepath.nil? diff --git a/HPXMLtoOpenStudio/resources/waterheater.rb b/HPXMLtoOpenStudio/resources/waterheater.rb index fd8a5d949e..44771a9c0d 100644 --- a/HPXMLtoOpenStudio/resources/waterheater.rb +++ b/HPXMLtoOpenStudio/resources/waterheater.rb @@ -1662,7 +1662,7 @@ def self.add_ec_adj(model, hpxml_bldg, heater, loc_space, water_heating_system, end # Add an other equipment object for water heating that will get actuated, has a small initial load but gets overwritten by EMS - cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeWaterHeaterAdjustment }.size # Ensure unique meter for each water heater + cnt = model.getOtherEquipments.count { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeWaterHeaterAdjustment } # Ensure unique meter for each water heater ec_adj_object = Model.add_other_equipment( model, name: "#{Constants::ObjectTypeWaterHeaterAdjustment}#{cnt + 1}", diff --git a/HPXMLtoOpenStudio/resources/weather.rb b/HPXMLtoOpenStudio/resources/weather.rb index d770041048..87ffb35907 100644 --- a/HPXMLtoOpenStudio/resources/weather.rb +++ b/HPXMLtoOpenStudio/resources/weather.rb @@ -355,7 +355,7 @@ def calc_deep_ground_temperatures(hpxml) if !hpxml.nil? has_gshp = false hpxml.buildings.each do |hpxml_bldg| - has_gshp = true if hpxml_bldg.heat_pumps.select { |h| h.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size > 0 + has_gshp = true if hpxml_bldg.heat_pumps.count { |h| h.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir } > 0 end return if !has_gshp end diff --git a/HPXMLtoOpenStudio/tests/test_defaults.rb b/HPXMLtoOpenStudio/tests/test_defaults.rb index d2d64189d1..3c17d1b442 100644 --- a/HPXMLtoOpenStudio/tests/test_defaults.rb +++ b/HPXMLtoOpenStudio/tests/test_defaults.rb @@ -2286,7 +2286,7 @@ def test_heat_pump_temperatures def test_ground_source_heat_pumps # Test inputs not overridden by defaults - hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump.xml') + hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump-backup-integrated.xml') hpxml_bldg.heat_pumps[0].pump_watts_per_ton = 9.9 hpxml_bldg.heat_pumps[0].fan_watts_per_cfm = 0.66 hpxml_bldg.heat_pumps[0].airflow_defect_ratio = -0.22 diff --git a/HPXMLtoOpenStudio/tests/test_hvac_sizing.rb b/HPXMLtoOpenStudio/tests/test_hvac_sizing.rb index 0d169cb7f0..44deb9f4bf 100644 --- a/HPXMLtoOpenStudio/tests/test_hvac_sizing.rb +++ b/HPXMLtoOpenStudio/tests/test_hvac_sizing.rb @@ -40,6 +40,7 @@ def test_hvac_configurations args_hash = { 'hpxml_path' => File.absolute_path(@tmp_hpxml_path), 'skip_validation' => true } Dir["#{@sample_files_path}/base-hvac*.xml"].each do |hvac_hpxml| + next unless hvac_hpxml.include? 'ground-to-air' next if (hvac_hpxml.include? 'autosize') next if hvac_hpxml.include? 'detailed-performance' # Autosizing not allowed diff --git a/HPXMLtoOpenStudio/tests/test_location.rb b/HPXMLtoOpenStudio/tests/test_location.rb index 42df0bb370..5fc9b1e138 100644 --- a/HPXMLtoOpenStudio/tests/test_location.rb +++ b/HPXMLtoOpenStudio/tests/test_location.rb @@ -104,7 +104,7 @@ def test_deep_ground_temperatures assert_equal(19, weather.data.DeepGroundPhaseShiftTempAmp1) assert_equal(-34, weather.data.DeepGroundPhaseShiftTempAmp2) assert_equal(1, runner.result.stepWarnings.size) - assert_equal(1, runner.result.stepWarnings.select { |w| w == 'No design condition info found; calculating design conditions from EPW weather data.' }.size) + assert_equal(1, runner.result.stepWarnings.count { |w| w == 'No design condition info found; calculating design conditions from EPW weather data.' }) end def _test_measure(args_hash) diff --git a/HPXMLtoOpenStudio/tests/test_weather.rb b/HPXMLtoOpenStudio/tests/test_weather.rb index 901bbf60a9..712354c381 100644 --- a/HPXMLtoOpenStudio/tests/test_weather.rb +++ b/HPXMLtoOpenStudio/tests/test_weather.rb @@ -187,6 +187,6 @@ def test_boulder_amy_with_leap_day # Check runner assert_equal(0, runner.result.stepErrors.size) - assert_equal(1, runner.result.stepWarnings.select { |w| w == 'No design condition info found; calculating design conditions from EPW weather data.' }.size) + assert_equal(1, runner.result.stepWarnings.count { |w| w == 'No design condition info found; calculating design conditions from EPW weather data.' }) end end diff --git a/ReportSimulationOutput/measure.rb b/ReportSimulationOutput/measure.rb index cedf83642e..c342ba06c0 100644 --- a/ReportSimulationOutput/measure.rb +++ b/ReportSimulationOutput/measure.rb @@ -365,12 +365,12 @@ def energyPlusOutputRequests(runner, user_arguments) args = setup_timeseries_includes(@emissions, args) has_electricity_production = false - if @end_uses.select { |_key, end_use| end_use.is_negative && end_use.variables.size > 0 }.size > 0 + if @end_uses.count { |_key, end_use| end_use.is_negative && end_use.variables.size > 0 } > 0 has_electricity_production = true end has_electricity_storage = false - if @end_uses.select { |_key, end_use| end_use.is_storage && end_use.variables.size > 0 }.size > 0 + if @end_uses.count { |_key, end_use| end_use.is_storage && end_use.variables.size > 0 } > 0 has_electricity_storage = true end @@ -2573,7 +2573,7 @@ def get_timeseries_units_from_fuel_type(fuel_type) fuel.name = "Fuel Use: #{fuel_type}: Total" fuel.annual_units = 'MBtu' fuel.timeseries_units = get_timeseries_units_from_fuel_type(fuel_type) - if @end_uses.select { |key, end_use| key[0] == fuel_type && end_use.variables.size + end_use.meters.size > 0 }.size == 0 + if @end_uses.count { |key, end_use| key[0] == fuel_type && end_use.variables.size + end_use.meters.size > 0 } == 0 fuel.meters = [] end end diff --git a/ReportSimulationOutput/measure.xml b/ReportSimulationOutput/measure.xml index 1a9c7d902d..92e37b1986 100644 --- a/ReportSimulationOutput/measure.xml +++ b/ReportSimulationOutput/measure.xml @@ -3,8 +3,8 @@ 3.1 report_simulation_output df9d170c-c21a-4130-866d-0d46b06073fd - 29a26cd3-0ea4-4c33-9d29-e80f2f58b8f5 - 2024-09-26T04:59:04Z + 443dae63-bc28-4988-8cb0-5fc10c452c68 + 2024-10-13T19:48:30Z 9BF1E6AC ReportSimulationOutput HPXML Simulation Output Report @@ -1929,13 +1929,13 @@ measure.rb rb script - 877A9DB3 + 45BFC7E3 test_report_sim_output.rb rb test - ACF6CED9 + 8552F493 diff --git a/ReportSimulationOutput/tests/test_report_sim_output.rb b/ReportSimulationOutput/tests/test_report_sim_output.rb index e7fcf7a4cc..b147a71913 100644 --- a/ReportSimulationOutput/tests/test_report_sim_output.rb +++ b/ReportSimulationOutput/tests/test_report_sim_output.rb @@ -1166,9 +1166,9 @@ def test_timeseries_timestep assert_equal(8760, timeseries_rows.size - 2) timeseries_cols = timeseries_rows.transpose assert_equal(1, _check_for_constant_timeseries_step(timeseries_cols[0])) - assert_equal(1, timeseries_rows[0].select { |r| r == 'Time' }.size) - assert_equal(1, timeseries_rows[0].select { |r| r == 'TimeDST' }.size) - assert_equal(1, timeseries_rows[0].select { |r| r == 'TimeUTC' }.size) + assert_equal(1, timeseries_rows[0].count { |r| r == 'Time' }) + assert_equal(1, timeseries_rows[0].count { |r| r == 'TimeDST' }) + assert_equal(1, timeseries_rows[0].count { |r| r == 'TimeUTC' }) assert_equal(1, _check_for_constant_timeseries_step(timeseries_cols[0])) assert_equal(3, _check_for_constant_timeseries_step(timeseries_cols[1])) assert_equal(1, _check_for_constant_timeseries_step(timeseries_cols[2])) end diff --git a/ReportUtilityBills/measure.rb b/ReportUtilityBills/measure.rb index b1baf8317e..1243cc1016 100644 --- a/ReportUtilityBills/measure.rb +++ b/ReportUtilityBills/measure.rb @@ -102,7 +102,7 @@ def check_for_return_type_warnings() # Require full annual simulation if PV if !(@hpxml_header.sim_begin_month == 1 && @hpxml_header.sim_begin_day == 1 && @hpxml_header.sim_end_month == 12 && @hpxml_header.sim_end_day == 31) - if @hpxml_buildings.select { |hpxml_bldg| !hpxml_bldg.pv_systems.empty? }.size > 0 + if @hpxml_buildings.count { |hpxml_bldg| !hpxml_bldg.pv_systems.empty? } > 0 warnings << 'A full annual simulation is required for calculating utility bills for homes with PV.' end end @@ -179,7 +179,7 @@ def energyPlusOutputRequests(runner, user_arguments) @hpxml_header = hpxml.header @hpxml_buildings = hpxml.buildings if @hpxml_header.utility_bill_scenarios.has_detailed_electric_rates - uses_unit_multipliers = @hpxml_buildings.select { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 }.size > 0 + uses_unit_multipliers = @hpxml_buildings.count { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 } > 0 if uses_unit_multipliers || (@hpxml_buildings.size > 1 && hpxml.header.whole_sfa_or_mf_building_sim) return result end @@ -203,9 +203,9 @@ def energyPlusOutputRequests(runner, user_arguments) has_fuel[HPXML::FuelTypeElectricity] = true # Has production - has_pv = @hpxml_buildings.select { |hpxml_bldg| !hpxml_bldg.pv_systems.empty? }.size > 0 + has_pv = @hpxml_buildings.count { |hpxml_bldg| !hpxml_bldg.pv_systems.empty? } > 0 has_battery = @model.getElectricLoadCenterStorageLiIonNMCBatterys.size > 0 # has modeled battery - has_generator = @hpxml_buildings.select { |hpxml_bldg| !hpxml_bldg.generators.empty? }.size > 0 + has_generator = @hpxml_buildings.count { |hpxml_bldg| !hpxml_bldg.generators.empty? } > 0 # Fuel outputs fuels.each do |(fuel_type, is_production), fuel| @@ -270,7 +270,7 @@ def run(runner, user_arguments) @hpxml_header = hpxml.header @hpxml_buildings = hpxml.buildings if @hpxml_header.utility_bill_scenarios.has_detailed_electric_rates - uses_unit_multipliers = @hpxml_buildings.select { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 }.size > 0 + uses_unit_multipliers = @hpxml_buildings.count { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 } > 0 if uses_unit_multipliers runner.registerWarning('Cannot currently calculate utility bills based on detailed electric rates for an HPXML with unit multipliers.') return false diff --git a/ReportUtilityBills/measure.xml b/ReportUtilityBills/measure.xml index 628a411f06..b0d62111aa 100644 --- a/ReportUtilityBills/measure.xml +++ b/ReportUtilityBills/measure.xml @@ -3,8 +3,8 @@ 3.1 report_utility_bills ca88a425-e59a-4bc4-af51-c7e7d1e960fe - 105d1f2f-ea3f-4225-b340-4ea362671b8a - 2024-10-01T18:47:20Z + 262fad2e-e205-42f3-b54d-79e1b3b2ee8e + 2024-10-13T19:48:31Z 15BF4E57 ReportUtilityBills Utility Bills Report @@ -180,7 +180,7 @@ measure.rb rb script - CC656203 + 007104C8 detailed_rates/Adams Electric Cooperative Inc - Rate Schedule T1 TOD (Effective 2013-02-01).json diff --git a/workflow/tests/test_other.rb b/workflow/tests/test_other.rb index e0e056e2ef..59a6df1c52 100644 --- a/workflow/tests/test_other.rb +++ b/workflow/tests/test_other.rb @@ -148,9 +148,9 @@ def test_run_simulation_timeseries_outputs assert(File.exist? timeseries_output_path) # Check timeseries columns exist timeseries_rows = CSV.read(timeseries_output_path) - assert_equal(1, timeseries_rows[0].select { |r| r == 'Time' }.size) - assert_equal(1, timeseries_rows[0].select { |r| r == 'Zone People Occupant Count: Conditioned Space' }.size) - assert_equal(1, timeseries_rows[0].select { |r| r == 'Zone People Total Heating Energy: Conditioned Space' }.size) + assert_equal(1, timeseries_rows[0].count { |r| r == 'Time' }) + assert_equal(1, timeseries_rows[0].count { |r| r == 'Zone People Occupant Count: Conditioned Space' }) + assert_equal(1, timeseries_rows[0].count { |r| r == 'Zone People Total Heating Energy: Conditioned Space' }) else refute(File.exist? timeseries_output_path) end @@ -183,9 +183,9 @@ def test_run_simulation_mixed_timeseries_frequencies 'daily' => ['Temperature:'], 'monthly' => ['End Use:', 'Fuel Use:', 'Zone People Total Heating Energy:'] }.each do |freq, col_names| timeseries_rows = CSV.read(File.join(File.dirname(xml), 'run', "results_timeseries_#{freq}.csv")) - assert_equal(1, timeseries_rows[0].select { |r| r == 'Time' }.size) + assert_equal(1, timeseries_rows[0].count { |r| r == 'Time' }) col_names.each do |col_name| - assert(timeseries_rows[0].select { |r| r.start_with? col_name }.size > 0) + assert(timeseries_rows[0].count { |r| r.start_with? col_name } > 0) end end end @@ -303,12 +303,12 @@ def test_mf_building_simulations assert_equal(true, File.exist?(bills_csv_path)) # Check that we have multiple warnings, one for each Building element - assert_equal(6, File.readlines(run_log).select { |l| l.include? dryer_warning_msg }.size) + assert_equal(6, File.readlines(run_log).count { |l| l.include? dryer_warning_msg }) else # Simulation should be unsuccessful (building_id or WholeSFAorMFBuildingSimulation=true is required) assert_equal(false, File.exist?(csv_output_path)) assert_equal(false, File.exist?(bills_csv_path)) - assert_equal(1, File.readlines(run_log).select { |l| l.include? 'Multiple Building elements defined in HPXML file; provide Building ID argument or set WholeSFAorMFBuildingSimulation=true.' }.size) + assert_equal(1, File.readlines(run_log).count { |l| l.include? 'Multiple Building elements defined in HPXML file; provide Building ID argument or set WholeSFAorMFBuildingSimulation=true.' }) end # Check for when building-id argument is provided @@ -320,14 +320,14 @@ def test_mf_building_simulations # validate the HPXML for one use case (whole building model) while running it for a different unit case (individual dwelling unit model). assert_equal(true, File.exist?(csv_output_path)) assert_equal(true, File.exist?(bills_csv_path)) - assert_equal(1, File.readlines(run_log).select { |l| l.include? 'Multiple Building elements defined in HPXML file and WholeSFAorMFBuildingSimulation=true; Building ID argument will be ignored.' }.size) + assert_equal(1, File.readlines(run_log).count { |l| l.include? 'Multiple Building elements defined in HPXML file and WholeSFAorMFBuildingSimulation=true; Building ID argument will be ignored.' }) else # Simulation should be successful assert_equal(true, File.exist?(csv_output_path)) assert_equal(true, File.exist?(bills_csv_path)) # Check that we have exactly one warning (i.e., check we are only validating a single Building element against schematron) - assert_equal(1, File.readlines(run_log).select { |l| l.include? dryer_warning_msg }.size) + assert_equal(1, File.readlines(run_log).count { |l| l.include? dryer_warning_msg }) end next unless not whole_sfa_or_mf_building_sim @@ -338,7 +338,7 @@ def test_mf_building_simulations system(command, err: File::NULL) assert_equal(false, File.exist?(csv_output_path)) assert_equal(false, File.exist?(bills_csv_path)) - assert_equal(1, File.readlines(run_log).select { |l| l.include? "Could not find Building element with ID 'MyFoo'." }.size) + assert_equal(1, File.readlines(run_log).count { |l| l.include? "Could not find Building element with ID 'MyFoo'." }) # Cleanup File.delete(tmp_hpxml_path) if File.exist? tmp_hpxml_path diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb index fec7128d1b..62253ab69d 100644 --- a/workflow/tests/util.rb +++ b/workflow/tests/util.rb @@ -43,7 +43,7 @@ def _run_xml(xml, worker_num, apply_unit_multiplier = false, annual_results_1x = if hpxml_bldg.dehumidifiers.size > 0 # FUTURE: Dehumidifiers currently don't give desired results w/ unit multipliers # https://github.com/NREL/OpenStudio-HPXML/issues/1499 - elsif hpxml_bldg.heat_pumps.select { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size > 0 + elsif hpxml_bldg.heat_pumps.count { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir } > 0 # FUTURE: GSHPs currently don't give desired results w/ unit multipliers # https://github.com/NREL/OpenStudio-HPXML/issues/1499 elsif hpxml_bldg.batteries.size > 0 @@ -267,7 +267,7 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier) # FUTURE: Revert this eventually # https://github.com/NREL/OpenStudio-HPXML/issues/1499 if hpxml_header.utility_bill_scenarios.has_detailed_electric_rates - uses_unit_multipliers = hpxml.buildings.select { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 }.size > 0 + uses_unit_multipliers = hpxml.buildings.count { |hpxml_bldg| hpxml_bldg.building_construction.number_of_units > 1 } > 0 if uses_unit_multipliers || hpxml.buildings.size > 1 next if message.include? 'Cannot currently calculate utility bills based on detailed electric rates for an HPXML with unit multipliers.' end @@ -324,7 +324,7 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier) next if message.include? 'Multiple speed fan will be applied to this unit. The speed number is determined by load.' # HPWHs - if hpxml_bldg.water_heating_systems.select { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump }.size > 0 + if hpxml_bldg.water_heating_systems.count { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump } > 0 next if message.include? 'Recovery Efficiency and Energy Factor could not be calculated during the test for standard ratings' next if message.include? 'SimHVAC: Maximum iterations (20) exceeded for all HVAC loops' next if message.include? 'For object = Coil:WaterHeating:AirToWaterHeatPump:Wrapped' @@ -332,23 +332,23 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier) next if message.include?('CheckWarmupConvergence: Loads Initialization') && message.include?('did not converge after 25 warmup days') end # HPWHs outside - if hpxml_bldg.water_heating_systems.select { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump && wh.location == HPXML::LocationOtherExterior }.size > 0 + if hpxml_bldg.water_heating_systems.count { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump && wh.location == HPXML::LocationOtherExterior } > 0 next if message.include? 'Water heater tank set point temperature is greater than or equal to the cut-in temperature of the heat pump water heater.' end # Stratified tank WHs - if hpxml_bldg.water_heating_systems.select { |wh| wh.tank_model_type == HPXML::WaterHeaterTankModelTypeStratified }.size > 0 + if hpxml_bldg.water_heating_systems.count { |wh| wh.tank_model_type == HPXML::WaterHeaterTankModelTypeStratified } > 0 next if message.include? 'Recovery Efficiency and Energy Factor could not be calculated during the test for standard ratings' end # HP defrost curves - if hpxml_bldg.heat_pumps.select { |hp| [HPXML::HVACTypeHeatPumpAirToAir, HPXML::HVACTypeHeatPumpMiniSplit, HPXML::HVACTypeHeatPumpPTHP, HPXML::HVACTypeHeatPumpRoom].include? hp.heat_pump_type }.size > 0 + if hpxml_bldg.heat_pumps.count { |hp| [HPXML::HVACTypeHeatPumpAirToAir, HPXML::HVACTypeHeatPumpMiniSplit, HPXML::HVACTypeHeatPumpPTHP, HPXML::HVACTypeHeatPumpRoom].include? hp.heat_pump_type } > 0 next if message.include?('GetDXCoils: Coil:Heating:DX') && message.include?('curve values') && message.include?('Defrost Energy Input Ratio Function of Temperature Curve') end # variable system SHR adjustment - if (hpxml_bldg.heat_pumps + hpxml_bldg.cooling_systems).select { |hp| hp.compressor_type == HPXML::HVACCompressorTypeVariableSpeed }.size > 0 + if (hpxml_bldg.heat_pumps + hpxml_bldg.cooling_systems).count { |hp| hp.compressor_type == HPXML::HVACCompressorTypeVariableSpeed } > 0 next if message.include?('CalcCBF: SHR adjusted to achieve valid outlet air properties and the simulation continues.') end # Evaporative coolers - if hpxml_bldg.cooling_systems.select { |c| c.cooling_system_type == HPXML::HVACTypeEvaporativeCooler }.size > 0 + if hpxml_bldg.cooling_systems.count { |c| c.cooling_system_type == HPXML::HVACTypeEvaporativeCooler } > 0 # Evap cooler model is not really using Controller:MechanicalVentilation object, so these warnings of ignoring some features are fine. # OS requires a Controller:MechanicalVentilation to be attached to the oa controller, however it's not required by E+. # Manually removing Controller:MechanicalVentilation from idf eliminates these two warnings. @@ -361,20 +361,20 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier) next if message.include? 'Since Zone Minimum Air Flow Input Method = CONSTANT, input for Fixed Minimum Air Flow Rate will be ignored' end # Fan coil distribution - if hpxml_bldg.hvac_distributions.select { |d| d.air_type.to_s == HPXML::AirTypeFanCoil }.size > 0 + if hpxml_bldg.hvac_distributions.count { |d| d.air_type.to_s == HPXML::AirTypeFanCoil } > 0 next if message.include? 'In calculating the design coil UA for Coil:Cooling:Water' # Warning for unused cooling coil for fan coil end # Boilers - if hpxml_bldg.heating_systems.select { |h| h.heating_system_type == HPXML::HVACTypeBoiler }.size > 0 + if hpxml_bldg.heating_systems.count { |h| h.heating_system_type == HPXML::HVACTypeBoiler } > 0 next if message.include? 'Missing temperature setpoint for LeavingSetpointModulated mode' # These warnings are fine, simulation continues with assigning plant loop setpoint to boiler, which is the expected one end # GSHPs - if hpxml_bldg.heat_pumps.select { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size > 0 + if hpxml_bldg.heat_pumps.count { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir } > 0 next if message.include?('CheckSimpleWAHPRatedCurvesOutputs') && message.include?('WaterToAirHeatPump:EquationFit') # FUTURE: Check these next if message.include? 'Actual air mass flow rate is smaller than 25% of water-to-air heat pump coil rated air flow rate.' # FUTURE: Remove this when https://github.com/NREL/EnergyPlus/issues/9125 is resolved end # GSHPs with only heating or cooling - if hpxml_bldg.heat_pumps.select { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir && (hp.fraction_heat_load_served == 0 || hp.fraction_cool_load_served == 0) }.size > 0 + if hpxml_bldg.heat_pumps.count { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir && (hp.fraction_heat_load_served == 0 || hp.fraction_cool_load_served == 0) } > 0 next if message.include? 'heating capacity is disproportionate (> 20% different) to total cooling capacity' # safe to ignore end # Solar thermal systems @@ -1014,7 +1014,8 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier) assert_equal(0, energy_htg) end if htg_backup_fuels.include? fuel - if (not hpxml_path.include? 'autosize') && (not is_warm_climate) + has_ashp = hpxml_bldg.heat_pumps.count { |hp| hp.heat_pump_type != HPXML::HVACTypeHeatPumpGroundToAir } > 0 + if (not hpxml_path.include? 'autosize') && (not is_warm_climate) && has_ashp assert_operator(energy_hp_backup, :>, 0) end else @@ -1173,11 +1174,11 @@ def get_tolerances(key) end # FUTURE: Address these - if hpxml_bldg.water_heating_systems.select { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump }.size > 0 + if hpxml_bldg.water_heating_systems.count { |wh| wh.water_heater_type == HPXML::WaterHeaterTypeHeatPump } > 0 next if key.include?('Airflow:') next if key.include?('Peak') end - if hpxml_bldg.water_heating_systems.select { |wh| [HPXML::WaterHeaterTypeCombiStorage, HPXML::WaterHeaterTypeCombiTankless].include? wh.water_heater_type }.size > 0 + if hpxml_bldg.water_heating_systems.count { |wh| [HPXML::WaterHeaterTypeCombiStorage, HPXML::WaterHeaterTypeCombiTankless].include? wh.water_heater_type } > 0 next if key.include?('Hot Water') end