From efeaa3701c5bc92f856e55e5ce901f89cc786d39 Mon Sep 17 00:00:00 2001 From: JanghyunJK Date: Fri, 18 Apr 2025 15:46:57 -0600 Subject: [PATCH 1/6] cooling coil obj conversion first draft --- .../upgrade_hvac_add_heat_pump_rtu/measure.rb | 78 ++++++++++++++----- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb index 41b7963a2..b2317ee95 100644 --- a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb +++ b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb @@ -680,19 +680,38 @@ def set_cooling_coil_stages(model, runner, stage_flows_cooling, stage_caps_cooli else # define multi speed cooling coil - new_dx_cooling_coil = OpenStudio::Model::CoilCoolingDXMultiSpeed.new(model) + #################################################################################### + # BEFORE + #################################################################################### + # new_dx_cooling_coil = OpenStudio::Model::CoilCoolingDXMultiSpeed.new(model) + # new_dx_cooling_coil.setName("#{air_loop_hvac.name} Heat Pump Cooling Coil") + # new_dx_cooling_coil.setCondenserType('AirCooled') + # new_dx_cooling_coil.setAvailabilitySchedule(always_on) # NA + # new_dx_cooling_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-25) + # new_dx_cooling_coil.setApplyPartLoadFractiontoSpeedsGreaterthan1(enable_cycling_losses_above_lowest_speed) # NA + # new_dx_cooling_coil.setApplyLatentDegradationtoSpeedsGreaterthan1(false) # NA + # new_dx_cooling_coil.setFuelType('Electricity') # NA + # new_dx_cooling_coil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(4.4) + # # methods from "TECHNICAL SUPPORT DOCUMENT: ENERGY EFFICIENCY PROGRAM FOR CONSUMER PRODUCTS AND COMMERCIAL AND INDUSTRIAL EQUIPMENT AIR-COOLED COMMERCIAL UNITARY AIR CONDITIONERS AND COMMERCIAL UNITARY HEAT PUMPS" + # crankcase_heater_power = ((60 * (stage_caps_cooling[rated_stage_num_cooling] * 0.0002843451 / 10)**0.67)) + # new_dx_cooling_coil.setCrankcaseHeaterCapacity(crankcase_heater_power) + # new_dx_cooling_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-25) + #################################################################################### + # AFTER + #################################################################################### + new_dx_cooling_coil = OpenStudio::Model::CoilCoolingDXVariableSpeed.new(model) new_dx_cooling_coil.setName("#{air_loop_hvac.name} Heat Pump Cooling Coil") new_dx_cooling_coil.setCondenserType('AirCooled') - new_dx_cooling_coil.setAvailabilitySchedule(always_on) new_dx_cooling_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-25) - new_dx_cooling_coil.setApplyPartLoadFractiontoSpeedsGreaterthan1(enable_cycling_losses_above_lowest_speed) - new_dx_cooling_coil.setApplyLatentDegradationtoSpeedsGreaterthan1(false) - new_dx_cooling_coil.setFuelType('Electricity') new_dx_cooling_coil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(4.4) # methods from "TECHNICAL SUPPORT DOCUMENT: ENERGY EFFICIENCY PROGRAM FOR CONSUMER PRODUCTS AND COMMERCIAL AND INDUSTRIAL EQUIPMENT AIR-COOLED COMMERCIAL UNITARY AIR CONDITIONERS AND COMMERCIAL UNITARY HEAT PUMPS" crankcase_heater_power = ((60 * (stage_caps_cooling[rated_stage_num_cooling] * 0.0002843451 / 10)**0.67)) new_dx_cooling_coil.setCrankcaseHeaterCapacity(crankcase_heater_power) new_dx_cooling_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-25) + new_dx_cooling_coil.setNominalTimeforCondensatetoBeginLeavingtheCoil(1000) + new_dx_cooling_coil.setInitialMoistureEvaporationRateDividedbySteadyStateACLatentCapacity(1.5) + new_dx_cooling_coil.setLatentCapacityTimeConstant(45) + new_dx_cooling_coil.autosizeEvaporativeCondenserPumpRatedPowerConsumption # loop through stages stage_caps_cooling.sort.each do |stage, cap| @@ -703,26 +722,45 @@ def set_cooling_coil_stages(model, runner, stage_flows_cooling, stage_caps_cooli applied_stage = stage_caps_cooling.reject { |_k, v| v == false }.keys.min if cap == false # add speed data for each stage - dx_coil_speed_data = OpenStudio::Model::CoilCoolingDXMultiSpeedStageData.new(model) - dx_coil_speed_data.setGrossRatedTotalCoolingCapacity(stage_caps_cooling[applied_stage]) - dx_coil_speed_data.setGrossRatedSensibleHeatRatio(stage_gross_rated_sensible_heat_ratio_cooling[applied_stage]) - dx_coil_speed_data.setRatedAirFlowRate(stage_flows_cooling[applied_stage]) - dx_coil_speed_data.setGrossRatedCoolingCOP(final_rated_cooling_cop * stage_rated_cop_frac_cooling[applied_stage]) + #################################################################################### + # BEFORE + #################################################################################### + # dx_coil_speed_data = OpenStudio::Model::CoilCoolingDXMultiSpeedStageData.new(model) + # dx_coil_speed_data.setGrossRatedTotalCoolingCapacity(stage_caps_cooling[applied_stage]) + # dx_coil_speed_data.setGrossRatedSensibleHeatRatio(stage_gross_rated_sensible_heat_ratio_cooling[applied_stage]) + # dx_coil_speed_data.setRatedAirFlowRate(stage_flows_cooling[applied_stage]) + # dx_coil_speed_data.setGrossRatedCoolingCOP(final_rated_cooling_cop * stage_rated_cop_frac_cooling[applied_stage]) + # dx_coil_speed_data.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(773.3) + # dx_coil_speed_data.setTotalCoolingCapacityFunctionofTemperatureCurve(cool_cap_ft_curve_stages[applied_stage]) + # dx_coil_speed_data.setTotalCoolingCapacityFunctionofFlowFractionCurve(cool_cap_ff_curve_stages[applied_stage]) + # dx_coil_speed_data.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft_curve_stages[applied_stage]) + # dx_coil_speed_data.setEnergyInputRatioFunctionofFlowFractionCurve(cool_eir_ff_curve_stages[applied_stage]) + # dx_coil_speed_data.setPartLoadFractionCorrelationCurve(cool_plf_fplr1) + # dx_coil_speed_data.setEvaporativeCondenserEffectiveness(0.9) + # dx_coil_speed_data.setNominalTimeforCondensateRemovaltoBegin(1000) + # dx_coil_speed_data.setRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity(1.5) + # dx_coil_speed_data.setLatentCapacityTimeConstant(45) + # dx_coil_speed_data.autosizeEvaporativeCondenserAirFlowRate + # dx_coil_speed_data.autosizeRatedEvaporativeCondenserPumpPowerConsumption + #################################################################################### + # AFTER + #################################################################################### + dx_coil_speed_data = OpenStudio::Model::CoilCoolingDXVariableSpeedSpeedData.new(model) + dx_coil_speed_data.setReferenceUnitGrossRatedTotalCoolingCapacity(stage_caps_cooling[applied_stage]) + dx_coil_speed_data.setReferenceUnitGrossRatedSensibleHeatRatio(stage_gross_rated_sensible_heat_ratio_cooling[applied_stage]) + dx_coil_speed_data.setReferenceUnitRatedAirFlowRate(stage_flows_cooling[applied_stage]) + dx_coil_speed_data.setReferenceUnitGrossRatedCoolingCOP(final_rated_cooling_cop * stage_rated_cop_frac_cooling[applied_stage]) dx_coil_speed_data.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(773.3) dx_coil_speed_data.setTotalCoolingCapacityFunctionofTemperatureCurve(cool_cap_ft_curve_stages[applied_stage]) - dx_coil_speed_data.setTotalCoolingCapacityFunctionofFlowFractionCurve(cool_cap_ff_curve_stages[applied_stage]) + dx_coil_speed_data.setTotalCoolingCapacityFunctionofAirFlowFractionCurve(cool_cap_ff_curve_stages[applied_stage]) dx_coil_speed_data.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft_curve_stages[applied_stage]) - dx_coil_speed_data.setEnergyInputRatioFunctionofFlowFractionCurve(cool_eir_ff_curve_stages[applied_stage]) - dx_coil_speed_data.setPartLoadFractionCorrelationCurve(cool_plf_fplr1) - dx_coil_speed_data.setEvaporativeCondenserEffectiveness(0.9) - dx_coil_speed_data.setNominalTimeforCondensateRemovaltoBegin(1000) - dx_coil_speed_data.setRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity(1.5) - dx_coil_speed_data.setLatentCapacityTimeConstant(45) - dx_coil_speed_data.autosizeEvaporativeCondenserAirFlowRate - dx_coil_speed_data.autosizeRatedEvaporativeCondenserPumpPowerConsumption + dx_coil_speed_data.setEnergyInputRatioFunctionofAirFlowFractionCurve(cool_eir_ff_curve_stages[applied_stage]) + dx_coil_speed_data.setEnergyPartLoadFractionCurve(cool_plf_fplr1) + # dx_coil_speed_data.setEvaporativeCondenserEffectiveness(0.9) # NA + # dx_coil_speed_data.autosizeEvaporativeCondenserAirFlowRate # NA # add speed data to multispeed coil object - new_dx_cooling_coil.addStage(dx_coil_speed_data) # unless stage_caps_heating[stage] == false + new_dx_cooling_coil.addSpeed(dx_coil_speed_data) # unless stage_caps_heating[stage] == false end end new_dx_cooling_coil From 4680ae8c06769f3218a3e43a071ab2053bb8c758 Mon Sep 17 00:00:00 2001 From: JanghyunJK Date: Fri, 18 Apr 2025 16:04:24 -0600 Subject: [PATCH 2/6] heating coil obj conversion first draft + misc fix --- .../upgrade_hvac_add_heat_pump_rtu/measure.rb | 68 +++++++++++++++---- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb index b2317ee95..fdfe578c1 100644 --- a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb +++ b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb @@ -711,7 +711,8 @@ def set_cooling_coil_stages(model, runner, stage_flows_cooling, stage_caps_cooli new_dx_cooling_coil.setNominalTimeforCondensatetoBeginLeavingtheCoil(1000) new_dx_cooling_coil.setInitialMoistureEvaporationRateDividedbySteadyStateACLatentCapacity(1.5) new_dx_cooling_coil.setLatentCapacityTimeConstant(45) - new_dx_cooling_coil.autosizeEvaporativeCondenserPumpRatedPowerConsumption + new_dx_cooling_coil.setEnergyPartLoadFractionCurve(cool_plf_fplr1) + # new_dx_cooling_coil.autosizeEvaporativeCondenserPumpRatedPowerConsumption # NA, not used when air-cooled # loop through stages stage_caps_cooling.sort.each do |stage, cap| @@ -755,7 +756,6 @@ def set_cooling_coil_stages(model, runner, stage_flows_cooling, stage_caps_cooli dx_coil_speed_data.setTotalCoolingCapacityFunctionofAirFlowFractionCurve(cool_cap_ff_curve_stages[applied_stage]) dx_coil_speed_data.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft_curve_stages[applied_stage]) dx_coil_speed_data.setEnergyInputRatioFunctionofAirFlowFractionCurve(cool_eir_ff_curve_stages[applied_stage]) - dx_coil_speed_data.setEnergyPartLoadFractionCurve(cool_plf_fplr1) # dx_coil_speed_data.setEvaporativeCondenserEffectiveness(0.9) # NA # dx_coil_speed_data.autosizeEvaporativeCondenserAirFlowRate # NA @@ -814,7 +814,29 @@ def set_heating_coil_stages(model, runner, stage_flows_heating, stage_caps_heati # use multi speed DX heating coil if multiple speeds are defined else # define multi speed heating coil - new_dx_heating_coil = OpenStudio::Model::CoilHeatingDXMultiSpeed.new(model) + #################################################################################### + # BEFORE + #################################################################################### + # new_dx_heating_coil = OpenStudio::Model::CoilHeatingDXMultiSpeed.new(model) + # new_dx_heating_coil.setName("#{air_loop_hvac.name} Heat Pump heating Coil") + # new_dx_heating_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(OpenStudio.convert(hp_min_comp_lockout_temp_f, 'F', 'C').get) + # new_dx_heating_coil.setAvailabilitySchedule(always_on) + # new_dx_heating_coil.setApplyPartLoadFractiontoSpeedsGreaterthan1(enable_cycling_losses_above_lowest_speed) + # new_dx_heating_coil.setFuelType('Electricity') + # # methods from "TECHNICAL SUPPORT DOCUMENT: ENERGY EFFICIENCY PROGRAM FOR CONSUMER PRODUCTS AND COMMERCIAL AND INDUSTRIAL EQUIPMENT AIR-COOLED COMMERCIAL UNITARY AIR CONDITIONERS AND COMMERCIAL UNITARY HEAT PUMPS" + # crankcase_heater_power = ((60 * (stage_caps_heating[rated_stage_num_heating] * 0.0002843451 / 10)**0.67)) + # new_dx_heating_coil.setCrankcaseHeaterCapacity(crankcase_heater_power) + # new_dx_heating_coil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(4.4) + # new_dx_heating_coil.setDefrostEnergyInputRatioFunctionofTemperatureCurve(defrost_eir) + # new_dx_heating_coil.setMaximumOutdoorDryBulbTemperatureforDefrostOperation(4.444) + # new_dx_heating_coil.setDefrostStrategy('ReverseCycle') + # new_dx_heating_coil.setDefrostControl('OnDemand') + # new_dx_heating_coil.setDefrostTimePeriodFraction(0.058333) + # new_dx_heating_coil.setFuelType('Electricity') + #################################################################################### + # AFTER + #################################################################################### + new_dx_heating_coil = OpenStudio::Model::CoilHeatingDXVariableSpeed .new(model) new_dx_heating_coil.setName("#{air_loop_hvac.name} Heat Pump heating Coil") new_dx_heating_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(OpenStudio.convert( hp_min_comp_lockout_temp_f, 'F', 'C' @@ -831,7 +853,8 @@ def set_heating_coil_stages(model, runner, stage_flows_heating, stage_caps_heati new_dx_heating_coil.setDefrostStrategy('ReverseCycle') new_dx_heating_coil.setDefrostControl('OnDemand') new_dx_heating_coil.setDefrostTimePeriodFraction(0.058333) - new_dx_heating_coil.setFuelType('Electricity') + # new_dx_heating_coil.setFuelType('Electricity') # NA + new_dx_heating_coil.setEnergyPartLoadFractionCurve(heat_plf_fplr1) # loop through stages stage_caps_heating.sort.each do |stage, cap| @@ -843,20 +866,37 @@ def set_heating_coil_stages(model, runner, stage_flows_heating, stage_caps_heati applied_stage = stage_caps_heating.reject { |_k, v| v == false }.keys.min if cap == false # add speed data for each stage - dx_coil_speed_data = OpenStudio::Model::CoilHeatingDXMultiSpeedStageData.new(model) - dx_coil_speed_data.setGrossRatedHeatingCapacity(stage_caps_heating[applied_stage]) - dx_coil_speed_data.setGrossRatedHeatingCOP(final_rated_heating_cop * _stage_rated_cop_frac_heating[applied_stage]) - dx_coil_speed_data.setRatedAirFlowRate(stage_flows_heating[applied_stage]) - dx_coil_speed_data.setRatedSupplyAirFanPowerPerVolumeFlowRate2017(773.3) - dx_coil_speed_data.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft_curve_stages[applied_stage]) + #################################################################################### + # BEFORE + #################################################################################### + # dx_coil_speed_data = OpenStudio::Model::CoilHeatingDXMultiSpeedStageData.new(model) + # dx_coil_speed_data.setGrossRatedHeatingCapacity(stage_caps_heating[applied_stage]) + # dx_coil_speed_data.setGrossRatedHeatingCOP(final_rated_heating_cop * _stage_rated_cop_frac_heating[applied_stage]) + # dx_coil_speed_data.setRatedAirFlowRate(stage_flows_heating[applied_stage]) + # dx_coil_speed_data.setRatedSupplyAirFanPowerPerVolumeFlowRate2017(773.3) + # dx_coil_speed_data.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft_curve_stages[applied_stage]) + # # set performance curves + # dx_coil_speed_data.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft_curve_stages[applied_stage]) + # dx_coil_speed_data.setHeatingCapacityFunctionofFlowFractionCurve(heat_cap_ff_curve_stages[applied_stage]) + # dx_coil_speed_data.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft_curve_stages[applied_stage]) + # dx_coil_speed_data.setEnergyInputRatioFunctionofFlowFractionCurve(heat_eir_ff_curve_stages[applied_stage]) + # dx_coil_speed_data.setPartLoadFractionCorrelationCurve(heat_plf_fplr1) + #################################################################################### + # AFTER + #################################################################################### + dx_coil_speed_data = OpenStudio::Model::CoilHeatingDXVariableSpeedSpeedData.new(model) + dx_coil_speed_data.setReferenceUnitGrossRatedHeatingCapacity(stage_caps_heating[applied_stage]) + dx_coil_speed_data.setReferenceUnitGrossRatedHeatingCOP(final_rated_heating_cop * _stage_rated_cop_frac_heating[applied_stage]) + dx_coil_speed_data.setReferenceUnitRatedAirFlowRate(stage_flows_heating[applied_stage]) + dx_coil_speed_data.setRatedSupplyFanPowerPerVolumeFlowRate2017(773.3) # set performance curves dx_coil_speed_data.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft_curve_stages[applied_stage]) - dx_coil_speed_data.setHeatingCapacityFunctionofFlowFractionCurve(heat_cap_ff_curve_stages[applied_stage]) + dx_coil_speed_data.setTotalHeatingCapacityFunctionofAirFlowFractionCurve(heat_cap_ff_curve_stages[applied_stage]) dx_coil_speed_data.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft_curve_stages[applied_stage]) - dx_coil_speed_data.setEnergyInputRatioFunctionofFlowFractionCurve(heat_eir_ff_curve_stages[applied_stage]) - dx_coil_speed_data.setPartLoadFractionCorrelationCurve(heat_plf_fplr1) + dx_coil_speed_data.setEnergyInputRatioFunctionofAirFlowFractionCurve(heat_eir_ff_curve_stages[applied_stage]) + # add speed data to multispeed coil object - new_dx_heating_coil.addStage(dx_coil_speed_data) # falseunless stage_caps_cooling[stage] == false # temporary 'unless' until bug fix for (https://github.com/NREL/OpenStudio/issues/5277) + new_dx_heating_coil.addSpeed(dx_coil_speed_data) # falseunless stage_caps_cooling[stage] == false # temporary 'unless' until bug fix for (https://github.com/NREL/OpenStudio/issues/5277) end end new_dx_heating_coil From 9b42846b286af07bb9f024ac6585b8b96ee05c2d Mon Sep 17 00:00:00 2001 From: JanghyunJK Date: Sat, 19 Apr 2025 12:09:13 -0600 Subject: [PATCH 3/6] unit test update for multi-to-var coil conversion --- .../tests/measure_test.rb | 434 +++++++++--------- 1 file changed, 217 insertions(+), 217 deletions(-) diff --git a/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb b/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb index b58d2e408..35049b2b2 100644 --- a/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb +++ b/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb @@ -342,7 +342,7 @@ def calc_cfm_per_ton_singlespdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_m def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_max) # get relevant heating coils - coils_heating = model.getCoilHeatingDXMultiSpeedStageDatas + coils_heating = model.getCoilHeatingDXVariableSpeedSpeedDatas # check if there is at least one coil refute_equal(coils_heating.size, 0) @@ -351,9 +351,9 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma coils_heating.each do |heating_coil| # get coil specs if heating_coil.grossRatedHeatingCapacity.is_initialized - rated_capacity_w = heating_coil.grossRatedHeatingCapacity.get + rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity end - rated_airflow_m_3_per_sec = heating_coil.ratedAirFlowRate.get if heating_coil.ratedAirFlowRate.is_initialized + rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate if heating_coil.ratedAirFlowRate.is_initialized # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -368,7 +368,7 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_max) # get cooling coils - coils_cooling = model.getCoilCoolingDXMultiSpeedStageDatas + coils_cooling = model.getCoilCoolingDXVariableSpeedSpeedDatas # check if there is at least one coil refute_equal(coils_cooling.size, 0) @@ -377,9 +377,9 @@ def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_ma coils_cooling.each do |cooling_coil| # get coil specs if cooling_coil.grossRatedTotalCoolingCapacity.is_initialized - rated_capacity_w = cooling_coil.grossRatedTotalCoolingCapacity.get + rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity end - rated_airflow_m_3_per_sec = cooling_coil.ratedAirFlowRate.get if cooling_coil.ratedAirFlowRate.is_initialized + rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate if cooling_coil.ratedAirFlowRate.is_initialized # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -547,29 +547,29 @@ def verify_hp_rtu(test_name, model, measure, argument_map, osm_path, epw_path) # ***heating*** # assert new unitary systems all have multispeed DX heating coils htg_coil = system.heatingCoil.get - assert(htg_coil.to_CoilHeatingDXMultiSpeed.is_initialized) - htg_coil = htg_coil.to_CoilHeatingDXMultiSpeed.get + assert(htg_coil.to_CoilHeatingDXVariableSpeed.is_initialized) + htg_coil = htg_coil.to_CoilHeatingDXVariableSpeed.get # assert multispeed heating coil has 4 stages - assert_equal(htg_coil.numberOfStages, 4) - htg_coil_spd4 = htg_coil.stages[3] + assert_equal(htg_coil.speeds.size, 4) + htg_coil_spd4 = htg_coil.speeds[3] # assert speed 4 flowrate matches design flow rate htg_dsn_flowrate = system.supplyAirFlowRateDuringHeatingOperation - assert_in_delta(htg_dsn_flowrate.to_f, htg_coil_spd4.ratedAirFlowRate.get, 0.000001) + assert_in_delta(htg_dsn_flowrate.to_f, htg_coil_spd4.referenceUnitRatedAirFlowRate, 0.000001) # assert flow rate reduces for lower speeds - htg_coil_spd3 = htg_coil.stages[2] - htg_coil_spd2 = htg_coil.stages[1] - htg_coil_spd1 = htg_coil.stages[0] - assert(htg_coil_spd4.ratedAirFlowRate.get > htg_coil_spd3.ratedAirFlowRate.get) - assert(htg_coil_spd3.ratedAirFlowRate.get > htg_coil_spd2.ratedAirFlowRate.get) - assert(htg_coil_spd2.ratedAirFlowRate.get > htg_coil_spd1.ratedAirFlowRate.get) + htg_coil_spd3 = htg_coil.speeds[2] + htg_coil_spd2 = htg_coil.speeds[1] + htg_coil_spd1 = htg_coil.speeds[0] + assert(htg_coil_spd4.referenceUnitRatedAirFlowRate > htg_coil_spd3.referenceUnitRatedAirFlowRate) + assert(htg_coil_spd3.referenceUnitRatedAirFlowRate > htg_coil_spd2.referenceUnitRatedAirFlowRate) + assert(htg_coil_spd2.referenceUnitRatedAirFlowRate > htg_coil_spd1.referenceUnitRatedAirFlowRate) # assert capacity reduces for lower speeds - assert(htg_coil_spd4.grossRatedHeatingCapacity.get > htg_coil_spd3.grossRatedHeatingCapacity.get) - assert(htg_coil_spd3.grossRatedHeatingCapacity.get > htg_coil_spd2.grossRatedHeatingCapacity.get) - assert(htg_coil_spd2.grossRatedHeatingCapacity.get > htg_coil_spd1.grossRatedHeatingCapacity.get) + assert(htg_coil_spd4.referenceUnitGrossRatedHeatingCapacity > htg_coil_spd3.referenceUnitGrossRatedHeatingCapacity) + assert(htg_coil_spd3.referenceUnitGrossRatedHeatingCapacity > htg_coil_spd2.referenceUnitGrossRatedHeatingCapacity) + assert(htg_coil_spd2.referenceUnitGrossRatedHeatingCapacity > htg_coil_spd1.referenceUnitGrossRatedHeatingCapacity) # assert supplemental heating coil type matches user-specified electric resistance sup_htg_coil = system.supplementalHeatingCoil.get @@ -578,29 +578,29 @@ def verify_hp_rtu(test_name, model, measure, argument_map, osm_path, epw_path) # ***cooling*** # assert new unitary systems all have multispeed DX cooling coils clg_coil = system.coolingCoil.get - assert(clg_coil.to_CoilCoolingDXMultiSpeed.is_initialized) - clg_coil = clg_coil.to_CoilCoolingDXMultiSpeed.get + assert(clg_coil.to_CoilCoolingDXVariableSpeed.is_initialized) + clg_coil = clg_coil.to_CoilCoolingDXVariableSpeed.get # assert multispeed heating coil has 4 stages - assert_equal(clg_coil.numberOfStages, 4) - clg_coil_spd4 = clg_coil.stages[3] + assert_equal(clg_coil.speeds.size, 4) + clg_coil_spd4 = clg_coil.speeds[3] # assert speed 4 flowrate matches design flow rate clg_dsn_flowrate = system.supplyAirFlowRateDuringCoolingOperation - assert_in_delta(clg_dsn_flowrate.to_f, clg_coil_spd4.ratedAirFlowRate.get, 0.000001) + assert_in_delta(clg_dsn_flowrate.to_f, clg_coil_spd4.referenceUnitRatedAirFlowRate, 0.000001) # assert flow rate reduces for lower speeds - clg_coil_spd3 = clg_coil.stages[2] - clg_coil_spd2 = clg_coil.stages[1] - clg_coil_spd1 = clg_coil.stages[0] - assert(clg_coil_spd4.ratedAirFlowRate.get > clg_coil_spd3.ratedAirFlowRate.get) - assert(clg_coil_spd3.ratedAirFlowRate.get > clg_coil_spd2.ratedAirFlowRate.get) - assert(clg_coil_spd2.ratedAirFlowRate.get > clg_coil_spd1.ratedAirFlowRate.get) + clg_coil_spd3 = clg_coil.speeds[2] + clg_coil_spd2 = clg_coil.speeds[1] + clg_coil_spd1 = clg_coil.speeds[0] + assert(clg_coil_spd4.referenceUnitRatedAirFlowRate > clg_coil_spd3.referenceUnitRatedAirFlowRate) + assert(clg_coil_spd3.referenceUnitRatedAirFlowRate > clg_coil_spd2.referenceUnitRatedAirFlowRate) + assert(clg_coil_spd2.referenceUnitRatedAirFlowRate > clg_coil_spd1.referenceUnitRatedAirFlowRate) # assert capacity reduces for lower speeds - assert(clg_coil_spd4.grossRatedTotalCoolingCapacity.get > clg_coil_spd3.grossRatedTotalCoolingCapacity.get) - assert(clg_coil_spd3.grossRatedTotalCoolingCapacity.get > clg_coil_spd2.grossRatedTotalCoolingCapacity.get) - assert(clg_coil_spd2.grossRatedTotalCoolingCapacity.get > clg_coil_spd1.grossRatedTotalCoolingCapacity.get) + assert(clg_coil_spd4.referenceUnitGrossRatedTotalCoolingCapacity > clg_coil_spd3.referenceUnitGrossRatedTotalCoolingCapacity) + assert(clg_coil_spd3.referenceUnitGrossRatedTotalCoolingCapacity > clg_coil_spd2.referenceUnitGrossRatedTotalCoolingCapacity) + assert(clg_coil_spd2.referenceUnitGrossRatedTotalCoolingCapacity > clg_coil_spd1.referenceUnitGrossRatedTotalCoolingCapacity) end result end @@ -653,14 +653,14 @@ def get_cooling_coil_capacity_and_cop(model, coil) raise "'Rated High Speed COP' not available for DX coil '#{coil.name}'." end end - elsif coil.to_CoilCoolingDXMultiSpeed.is_initialized - coil = coil.to_CoilCoolingDXMultiSpeed.get + elsif coil.to_CoilCoolingDXVariableSpeed.is_initialized + coil = coil.to_CoilCoolingDXVariableSpeed.get # capacity and cop, use cop at highest capacity temp_capacity_w = 0.0 - coil.stages.each do |stage| + coil.speeds.each do |stage| if stage.grossRatedTotalCoolingCapacity.is_initialized - temp_capacity_w = stage.grossRatedTotalCoolingCapacity.get + temp_capacity_w = stage.referenceUnitGrossRatedTotalCoolingCapacity elsif stage.autosizedGrossRatedTotalCoolingCapacity.is_initialized temp_capacity_w = stage.autosizedGrossRatedTotalCoolingCapacity.get else @@ -690,7 +690,7 @@ def get_cooling_coil_capacity_and_cop(model, coil) capacity_w = temp_capacity_w if temp_capacity_w > capacity_w end else - raise 'Design capacity is only available for DX cooling coil types CoilCoolingDXSingleSpeed, CoilCoolingDXTwoSpeed, CoilCoolingDXMultiSpeed, CoilCoolingDXVariableSpeed.' + raise 'Design capacity is only available for DX cooling coil types CoilCoolingDXSingleSpeed, CoilCoolingDXTwoSpeed, CoilCoolingDXVariableSpeed, CoilCoolingDXVariableSpeed.' end return capacity_w, coil_design_cop @@ -712,12 +712,12 @@ def get_heating_coil_capacity_and_cop(model, coil) # get rated cop and cop at lower temperatures coil_design_cop = coil.ratedCOP - elsif coil.to_CoilHeatingDXMultiSpeed.is_initialized - coil = coil.to_CoilHeatingDXMultiSpeed.get + elsif coil.to_CoilHeatingDXVariableSpeed.is_initialized + coil = coil.to_CoilHeatingDXVariableSpeed.get temp_capacity_w = 0.0 - coil.stages.each do |stage| + coil.speeds.each do |stage| if stage.grossRatedHeatingCapacity.is_initialized - temp_capacity_w = stage.grossRatedHeatingCapacity.get + temp_capacity_w = stage.referenceUnitGrossRatedHeatingCapacity elsif stage.autosizedGrossRatedHeatingCapacity.is_initialized temp_capacity_w = stage.autosizedGrossRatedHeatingCapacity.get else @@ -904,7 +904,7 @@ def calc_cfm_per_ton_singlespdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_m def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_max) # get relevant heating coils - coils_heating = model.getCoilHeatingDXMultiSpeedStageDatas + coils_heating = model.getCoilHeatingDXVariableSpeedSpeedDatas # check if there is at least one coil refute_equal(coils_heating.size, 0) @@ -913,9 +913,9 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma coils_heating.each do |heating_coil| # get coil specs if heating_coil.grossRatedHeatingCapacity.is_initialized - rated_capacity_w = heating_coil.grossRatedHeatingCapacity.get + rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity end - rated_airflow_m_3_per_sec = heating_coil.ratedAirFlowRate.get if heating_coil.ratedAirFlowRate.is_initialized + rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate if heating_coil.ratedAirFlowRate.is_initialized # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -930,7 +930,7 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_max) # get cooling coils - coils_cooling = model.getCoilCoolingDXMultiSpeedStageDatas + coils_cooling = model.getCoilCoolingDXVariableSpeedSpeedDatas # check if there is at least one coil refute_equal(coils_cooling.size, 0) @@ -939,9 +939,9 @@ def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_ma coils_cooling.each do |cooling_coil| # get coil specs if cooling_coil.grossRatedTotalCoolingCapacity.is_initialized - rated_capacity_w = cooling_coil.grossRatedTotalCoolingCapacity.get + rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity end - rated_airflow_m_3_per_sec = cooling_coil.ratedAirFlowRate.get if cooling_coil.ratedAirFlowRate.is_initialized + rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate if cooling_coil.ratedAirFlowRate.is_initialized # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -1057,190 +1057,190 @@ def verify_cfm_per_ton(model, result) # end # end - # ########################################################################## - # This section tests upsizing algorithm - # tests compare: - # 1) regularly sized model versus upsized model in cold region - # 2) regularly sized model versus upsized model in hot region - def test_sizing_model_in_alaska - osm_name = 'small_office_psz_not_hard_sized.osm' - epw_name = 'USA_AK_Fairbanks.Intl.AP.702610_TMY3.epw' - - test_name = 'test_sizing_model_in_alaska' - - lookup_table_test = { - 'table_name': 'c_cap_high_T', - 'ind1': 22.22, - 'ind2': 29.44, - 'dep': 1.1677 - } - - puts "\n######\nTEST:#{osm_name}\n######\n" - - osm_path = model_input_path(osm_name) - epw_path = epw_input_path(epw_name) - - # Create an instance of the measure - measure = AddHeatPumpRtu.new - - # Load the model; only used here for populating arguments - model = load_model(osm_path) - - # get arguments - arguments = measure.arguments(model) - argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) - - # populate specific argument for testing - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - case arg.name - when 'sizing_run' - sizing_run = arguments[idx].clone - sizing_run.setValue(true) - argument_map[arg.name] = sizing_run - when 'hprtu_scenario' - hprtu_scenario = arguments[idx].clone - hprtu_scenario.setValue('two_speed_standard_eff') # variable_speed_high_eff, two_speed_standard_eff - argument_map[arg.name] = hprtu_scenario - else - argument_map[arg.name] = temp_arg_var - end - end - - # populate specific argument for testing: regular sizing scenario - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - if arg.name == 'performance_oversizing_factor' - performance_oversizing_factor = arguments[idx].clone - performance_oversizing_factor.setValue(0.0) - argument_map[arg.name] = performance_oversizing_factor - end - end - - # Apply the measure to the model and optionally run the model - result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - model = load_model(model_output_path("#{test_name}_b")) - - # get sizing info from regular sized model - sizing_summary_reference = get_sizing_summary(model) - - # populate specific argument for testing: upsizing scenario - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - if arg.name == 'performance_oversizing_factor' - performance_oversizing_factor = arguments[idx].clone - performance_oversizing_factor.setValue(0.25) - argument_map[arg.name] = performance_oversizing_factor - end - end - - # Apply the measure to the model and optionally run the model - result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - model = load_model(model_output_path("#{test_name}_a")) - - # check performance category - performance_category = nil - result.stepValues.each do |input_arg| - next unless input_arg.name == 'hprtu_scenario' - performance_category = input_arg.valueAsString - end - - # test lookup table values - runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new) - if performance_category == 'two_speed_standard_eff' - # Check if lookup table is available - lookup_table_name = lookup_table_test[:table_name] - #table_multivar_lookups = model.getTableMultiVariableLookups - table_multivar_lookups = model.getTableLookups - lookup_table = table_multivar_lookups.find { |table| table.name.to_s == lookup_table_name } - refute_nil(lookup_table, "Cannot find table named #{lookup_table_name} from model.") + # # ########################################################################## + # # This section tests upsizing algorithm + # # tests compare: + # # 1) regularly sized model versus upsized model in cold region + # # 2) regularly sized model versus upsized model in hot region + # def test_sizing_model_in_alaska + # osm_name = 'small_office_psz_not_hard_sized.osm' + # epw_name = 'USA_AK_Fairbanks.Intl.AP.702610_TMY3.epw' + + # test_name = 'test_sizing_model_in_alaska' + + # lookup_table_test = { + # 'table_name': 'c_cap_high_T', + # 'ind1': 22.22, + # 'ind2': 29.44, + # 'dep': 1.1677 + # } - # Compare table lookup value against hard-coded values - dep_var_ref = lookup_table_test[:dep] - dep_var = AddHeatPumpRtu.get_dep_var_from_lookup_table_with_interpolation(runner, lookup_table, lookup_table_test[:ind1], lookup_table_test[:ind2]) - # puts("### lookup table test") - # puts("--- lookup_table_name = #{lookup_table_name}") - # puts("--- input_var1 = #{lookup_table_test[:ind1]} | input_var2 = #{lookup_table_test[:ind2]}") - # puts("--- dep_var reference = #{dep_var_ref} | dep_var from model = #{dep_var}") - assert_in_epsilon(dep_var_ref, dep_var, 0.001, "Table lookup value test didn't pass: table name = #{lookup_table_name} | ind_var1 = #{lookup_table_test[:ind1]} | ind_var2 = #{lookup_table_test[:ind2]} | expected #{dep_var_ref} but got #{dep_var}") - end + # puts "\n######\nTEST:#{osm_name}\n######\n" + + # osm_path = model_input_path(osm_name) + # epw_path = epw_input_path(epw_name) + + # # Create an instance of the measure + # measure = AddHeatPumpRtu.new + + # # Load the model; only used here for populating arguments + # model = load_model(osm_path) + + # # get arguments + # arguments = measure.arguments(model) + # argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) + + # # populate specific argument for testing + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # case arg.name + # when 'sizing_run' + # sizing_run = arguments[idx].clone + # sizing_run.setValue(true) + # argument_map[arg.name] = sizing_run + # when 'hprtu_scenario' + # hprtu_scenario = arguments[idx].clone + # hprtu_scenario.setValue('two_speed_standard_eff') # variable_speed_high_eff, two_speed_standard_eff + # argument_map[arg.name] = hprtu_scenario + # else + # argument_map[arg.name] = temp_arg_var + # end + # end - # compare sizing summary of upsizing model with regular sized model - check_sizing_results_upsizing(model, sizing_summary_reference) - end + # # populate specific argument for testing: regular sizing scenario + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # if arg.name == 'performance_oversizing_factor' + # performance_oversizing_factor = arguments[idx].clone + # performance_oversizing_factor.setValue(0.0) + # argument_map[arg.name] = performance_oversizing_factor + # end + # end - def test_sizing_model_in_hawaii - osm_name = 'small_office_psz_not_hard_sized.osm' - epw_name = 'USA_HI_Honolulu.Intl.AP.911820_TMY3.epw' + # # Apply the measure to the model and optionally run the model + # result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + # model = load_model(model_output_path("#{test_name}_b")) - test_name = 'test_sizing_model_in_hawaii' + # # get sizing info from regular sized model + # sizing_summary_reference = get_sizing_summary(model) - puts "\n######\nTEST:#{osm_name}\n######\n" + # # populate specific argument for testing: upsizing scenario + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # if arg.name == 'performance_oversizing_factor' + # performance_oversizing_factor = arguments[idx].clone + # performance_oversizing_factor.setValue(0.25) + # argument_map[arg.name] = performance_oversizing_factor + # end + # end - osm_path = model_input_path(osm_name) - epw_path = epw_input_path(epw_name) + # # Apply the measure to the model and optionally run the model + # result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + # model = load_model(model_output_path("#{test_name}_a")) - # Create an instance of the measure - measure = AddHeatPumpRtu.new + # # check performance category + # performance_category = nil + # result.stepValues.each do |input_arg| + # next unless input_arg.name == 'hprtu_scenario' + # performance_category = input_arg.valueAsString + # end - # Load the model; only used here for populating arguments - model = load_model(osm_path) + # # test lookup table values + # runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new) + # if performance_category == 'two_speed_standard_eff' + # # Check if lookup table is available + # lookup_table_name = lookup_table_test[:table_name] + # #table_multivar_lookups = model.getTableMultiVariableLookups + # table_multivar_lookups = model.getTableLookups + # lookup_table = table_multivar_lookups.find { |table| table.name.to_s == lookup_table_name } + # refute_nil(lookup_table, "Cannot find table named #{lookup_table_name} from model.") + + # # Compare table lookup value against hard-coded values + # dep_var_ref = lookup_table_test[:dep] + # dep_var = AddHeatPumpRtu.get_dep_var_from_lookup_table_with_interpolation(runner, lookup_table, lookup_table_test[:ind1], lookup_table_test[:ind2]) + # # puts("### lookup table test") + # # puts("--- lookup_table_name = #{lookup_table_name}") + # # puts("--- input_var1 = #{lookup_table_test[:ind1]} | input_var2 = #{lookup_table_test[:ind2]}") + # # puts("--- dep_var reference = #{dep_var_ref} | dep_var from model = #{dep_var}") + # assert_in_epsilon(dep_var_ref, dep_var, 0.001, "Table lookup value test didn't pass: table name = #{lookup_table_name} | ind_var1 = #{lookup_table_test[:ind1]} | ind_var2 = #{lookup_table_test[:ind2]} | expected #{dep_var_ref} but got #{dep_var}") + # end - # get arguments - arguments = measure.arguments(model) - argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) + # # compare sizing summary of upsizing model with regular sized model + # check_sizing_results_upsizing(model, sizing_summary_reference) + # end - # populate specific argument for testing - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - case arg.name - when 'sizing_run' - sizing_run = arguments[idx].clone - sizing_run.setValue(true) - argument_map[arg.name] = sizing_run - when 'hprtu_scenario' - hprtu_scenario = arguments[idx].clone - hprtu_scenario.setValue('variable_speed_high_eff') # variable_speed_high_eff, two_speed_standard_eff - argument_map[arg.name] = hprtu_scenario - else - argument_map[arg.name] = temp_arg_var - end - end + # def test_sizing_model_in_hawaii + # osm_name = 'small_office_psz_not_hard_sized.osm' + # epw_name = 'USA_HI_Honolulu.Intl.AP.911820_TMY3.epw' + + # test_name = 'test_sizing_model_in_hawaii' + + # puts "\n######\nTEST:#{osm_name}\n######\n" + + # osm_path = model_input_path(osm_name) + # epw_path = epw_input_path(epw_name) + + # # Create an instance of the measure + # measure = AddHeatPumpRtu.new + + # # Load the model; only used here for populating arguments + # model = load_model(osm_path) + + # # get arguments + # arguments = measure.arguments(model) + # argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) + + # # populate specific argument for testing + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # case arg.name + # when 'sizing_run' + # sizing_run = arguments[idx].clone + # sizing_run.setValue(true) + # argument_map[arg.name] = sizing_run + # when 'hprtu_scenario' + # hprtu_scenario = arguments[idx].clone + # hprtu_scenario.setValue('variable_speed_high_eff') # variable_speed_high_eff, two_speed_standard_eff + # argument_map[arg.name] = hprtu_scenario + # else + # argument_map[arg.name] = temp_arg_var + # end + # end - # populate specific argument for testing: regular sizing scenario - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - if arg.name == 'performance_oversizing_factor' - performance_oversizing_factor = arguments[idx].clone - performance_oversizing_factor.setValue(0.0) - argument_map[arg.name] = performance_oversizing_factor - end - end + # # populate specific argument for testing: regular sizing scenario + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # if arg.name == 'performance_oversizing_factor' + # performance_oversizing_factor = arguments[idx].clone + # performance_oversizing_factor.setValue(0.0) + # argument_map[arg.name] = performance_oversizing_factor + # end + # end - # Apply the measure to the model and optionally run the model - result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - model = load_model(model_output_path("#{test_name}_b")) + # # Apply the measure to the model and optionally run the model + # result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + # model = load_model(model_output_path("#{test_name}_b")) - # get sizing info from regular sized model - sizing_summary_reference = get_sizing_summary(model) + # # get sizing info from regular sized model + # sizing_summary_reference = get_sizing_summary(model) - # populate specific argument for testing: upsizing scenario - arguments.each_with_index do |arg, idx| - temp_arg_var = arg.clone - if arg.name == 'performance_oversizing_factor' - performance_oversizing_factor = arguments[idx].clone - performance_oversizing_factor.setValue(0.25) - argument_map[arg.name] = performance_oversizing_factor - end - end + # # populate specific argument for testing: upsizing scenario + # arguments.each_with_index do |arg, idx| + # temp_arg_var = arg.clone + # if arg.name == 'performance_oversizing_factor' + # performance_oversizing_factor = arguments[idx].clone + # performance_oversizing_factor.setValue(0.25) + # argument_map[arg.name] = performance_oversizing_factor + # end + # end - # Apply the measure to the model and optionally run the model - result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - model = load_model(model_output_path("#{test_name}_a")) + # # Apply the measure to the model and optionally run the model + # result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + # model = load_model(model_output_path("#{test_name}_a")) - # compare sizing summary of upsizing model with regular sized model - check_sizing_results_no_upsizing(model, sizing_summary_reference) - end + # # compare sizing summary of upsizing model with regular sized model + # check_sizing_results_no_upsizing(model, sizing_summary_reference) + # end # ########################################################################## # This section tests proper application of measure on fully applicable models From 24d93f7a1d0d2534b839503d11ddbbb5f2faabf0 Mon Sep 17 00:00:00 2001 From: "Janghyun(JK)Kim" Date: Tue, 22 Apr 2025 11:54:52 -0600 Subject: [PATCH 4/6] revise upsizing airflow --- resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb index fdfe578c1..632c49192 100644 --- a/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb +++ b/resources/measures/upgrade_hvac_add_heat_pump_rtu/measure.rb @@ -2237,8 +2237,8 @@ def run(model, runner, user_arguments) upsize_factor = (dx_rated_htg_cap_applied - orig_clg_coil_gross_cap) / orig_clg_coil_gross_cap # upsize airflow accordingly - # design_heating_airflow_m_3_per_s *= (1 + upsize_factor) - # design_cooling_airflow_m_3_per_s *= (1 + upsize_factor) + design_heating_airflow_m_3_per_s *= (1 + upsize_factor) + design_cooling_airflow_m_3_per_s *= (1 + upsize_factor) if debug_verbose runner.registerInfo('sizing summary: before rated cfm/ton adjustmant') From 45b6a2ecb28420040d082eb7ae1d35b61d144c08 Mon Sep 17 00:00:00 2001 From: "Janghyun(JK)Kim" Date: Wed, 23 Apr 2025 07:33:37 -0600 Subject: [PATCH 5/6] revise unit test for multi to var spd coil conversion --- .../tests/measure_test.rb | 413 ++++++++---------- 1 file changed, 183 insertions(+), 230 deletions(-) diff --git a/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb b/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb index 35049b2b2..8f1953e80 100644 --- a/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb +++ b/resources/measures/upgrade_hvac_add_heat_pump_rtu/tests/measure_test.rb @@ -350,10 +350,8 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma # calc cfm/ton coils_heating.each do |heating_coil| # get coil specs - if heating_coil.grossRatedHeatingCapacity.is_initialized - rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity - end - rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate if heating_coil.ratedAirFlowRate.is_initialized + rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity + rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -376,10 +374,8 @@ def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_ma # calc cfm/ton coils_cooling.each do |cooling_coil| # get coil specs - if cooling_coil.grossRatedTotalCoolingCapacity.is_initialized - rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity - end - rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate if cooling_coil.ratedAirFlowRate.is_initialized + rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity + rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -659,31 +655,10 @@ def get_cooling_coil_capacity_and_cop(model, coil) # capacity and cop, use cop at highest capacity temp_capacity_w = 0.0 coil.speeds.each do |stage| - if stage.grossRatedTotalCoolingCapacity.is_initialized - temp_capacity_w = stage.referenceUnitGrossRatedTotalCoolingCapacity - elsif stage.autosizedGrossRatedTotalCoolingCapacity.is_initialized - temp_capacity_w = stage.autosizedGrossRatedTotalCoolingCapacity.get - else - raise "Cooling coil capacity not available for coil stage '#{stage.name}'." - end + temp_capacity_w = stage.referenceUnitGrossRatedTotalCoolingCapacity # update cop if highest capacity - temp_coil_design_cop = stage.grossRatedCoolingCOP - coil_design_cop = temp_coil_design_cop if temp_capacity_w >= capacity_w - - # update if highest capacity - capacity_w = temp_capacity_w if temp_capacity_w > capacity_w - end - elsif coil.to_CoilCoolingDXVariableSpeed.is_initialized - coil = coil.to_CoilCoolingDXVariableSpeed.get - - # capacity and cop, use cop at highest capacity - temp_capacity_w = 0.0 - coil.speeds.each do |speed| - temp_capacity_w = speed.referenceUnitGrossRatedTotalCoolingCapacity - - # update cop if highest capacity - temp_coil_design_cop = speed.referenceUnitGrossRatedCoolingCOP + temp_coil_design_cop = stage.referenceUnitGrossRatedCoolingCOP coil_design_cop = temp_coil_design_cop if temp_capacity_w >= capacity_w # update if highest capacity @@ -716,30 +691,11 @@ def get_heating_coil_capacity_and_cop(model, coil) coil = coil.to_CoilHeatingDXVariableSpeed.get temp_capacity_w = 0.0 coil.speeds.each do |stage| - if stage.grossRatedHeatingCapacity.is_initialized - temp_capacity_w = stage.referenceUnitGrossRatedHeatingCapacity - elsif stage.autosizedGrossRatedHeatingCapacity.is_initialized - temp_capacity_w = stage.autosizedGrossRatedHeatingCapacity.get - else - raise "Heating coil capacity not available for coil stage '#{stage.name}'." - end - - # get cop and cop at lower temperatures - # pick cop at highest capacity - temp_coil_design_cop = stage.grossRatedHeatingCOP - coil_design_cop = temp_coil_design_cop if temp_capacity_w >= capacity_w - - # update if highest capacity - capacity_w = temp_capacity_w if temp_capacity_w > capacity_w - end - elsif coil.to_CoilHeatingDXVariableSpeed.is_initialized - coil = coil.to_CoilHeatingDXVariableSpeed.get - coil.speeds.each do |speed| - temp_capacity_w = speed.referenceUnitGrossRatedHeatingCapacity + temp_capacity_w = stage.referenceUnitGrossRatedHeatingCapacity # get cop and cop at lower temperatures # pick cop at highest capacity - temp_coil_design_cop = speed.referenceUnitGrossRatedHeatingCOP + temp_coil_design_cop = stage.referenceUnitGrossRatedHeatingCOP coil_design_cop = temp_coil_design_cop if temp_capacity_w >= capacity_w # update if highest capacity @@ -864,7 +820,8 @@ def check_sizing_results_upsizing(model, sizing_summary_reference) # check airflow value_before = sizing_summary_reference['AirLoopHVAC'][name_obj]['designSupplyAirFlowRate'] value_after = airloophvac.designSupplyAirFlowRate.get - assert_in_epsilon(value_after, value_before, 0.01, "values difference not within threshold: AirLoopHVAC | #{name_obj} | designSupplyAirFlowRate") + increased_airflow = value_after - value_before > 0 + assert(true, increased_airflow, "airflow not increased with upsizing: value_after = #{value_after} | value_before = #{value_before} | designSupplyAirFlowRate") end model.getControllerOutdoorAirs.each do |ctrloa| name_obj = ctrloa.name.to_s @@ -912,10 +869,8 @@ def calc_cfm_per_ton_multispdcoil_heating(model, cfm_per_ton_min, cfm_per_ton_ma # calc cfm/ton coils_heating.each do |heating_coil| # get coil specs - if heating_coil.grossRatedHeatingCapacity.is_initialized - rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity - end - rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate if heating_coil.ratedAirFlowRate.is_initialized + rated_capacity_w = heating_coil.referenceUnitGrossRatedHeatingCapacity + rated_airflow_m_3_per_sec = heating_coil.referenceUnitRatedAirFlowRate # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -938,10 +893,8 @@ def calc_cfm_per_ton_multispdcoil_cooling(model, cfm_per_ton_min, cfm_per_ton_ma # calc cfm/ton coils_cooling.each do |cooling_coil| # get coil specs - if cooling_coil.grossRatedTotalCoolingCapacity.is_initialized - rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity - end - rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate if cooling_coil.ratedAirFlowRate.is_initialized + rated_capacity_w = cooling_coil.referenceUnitGrossRatedTotalCoolingCapacity + rated_airflow_m_3_per_sec = cooling_coil.referenceUnitRatedAirFlowRate # calc relevant metrics rated_capacity_ton = OpenStudio.convert(rated_capacity_w, 'W', 'ton').get @@ -1057,190 +1010,190 @@ def verify_cfm_per_ton(model, result) # end # end - # # ########################################################################## - # # This section tests upsizing algorithm - # # tests compare: - # # 1) regularly sized model versus upsized model in cold region - # # 2) regularly sized model versus upsized model in hot region - # def test_sizing_model_in_alaska - # osm_name = 'small_office_psz_not_hard_sized.osm' - # epw_name = 'USA_AK_Fairbanks.Intl.AP.702610_TMY3.epw' - - # test_name = 'test_sizing_model_in_alaska' - - # lookup_table_test = { - # 'table_name': 'c_cap_high_T', - # 'ind1': 22.22, - # 'ind2': 29.44, - # 'dep': 1.1677 - # } + # ########################################################################## + # This section tests upsizing algorithm + # tests compare: + # 1) regularly sized model versus upsized model in cold region + # 2) regularly sized model versus upsized model in hot region + def test_sizing_model_in_alaska + osm_name = 'small_office_psz_not_hard_sized.osm' + epw_name = 'USA_AK_Fairbanks.Intl.AP.702610_TMY3.epw' - # puts "\n######\nTEST:#{osm_name}\n######\n" - - # osm_path = model_input_path(osm_name) - # epw_path = epw_input_path(epw_name) - - # # Create an instance of the measure - # measure = AddHeatPumpRtu.new - - # # Load the model; only used here for populating arguments - # model = load_model(osm_path) - - # # get arguments - # arguments = measure.arguments(model) - # argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) - - # # populate specific argument for testing - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # case arg.name - # when 'sizing_run' - # sizing_run = arguments[idx].clone - # sizing_run.setValue(true) - # argument_map[arg.name] = sizing_run - # when 'hprtu_scenario' - # hprtu_scenario = arguments[idx].clone - # hprtu_scenario.setValue('two_speed_standard_eff') # variable_speed_high_eff, two_speed_standard_eff - # argument_map[arg.name] = hprtu_scenario - # else - # argument_map[arg.name] = temp_arg_var - # end - # end + test_name = 'test_sizing_model_in_alaska' - # # populate specific argument for testing: regular sizing scenario - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # if arg.name == 'performance_oversizing_factor' - # performance_oversizing_factor = arguments[idx].clone - # performance_oversizing_factor.setValue(0.0) - # argument_map[arg.name] = performance_oversizing_factor - # end - # end + lookup_table_test = { + 'table_name': 'c_cap_high_T', + 'ind1': 22.22, + 'ind2': 29.44, + 'dep': 1.1677 + } - # # Apply the measure to the model and optionally run the model - # result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - # model = load_model(model_output_path("#{test_name}_b")) + puts "\n######\nTEST:#{osm_name}\n######\n" - # # get sizing info from regular sized model - # sizing_summary_reference = get_sizing_summary(model) + osm_path = model_input_path(osm_name) + epw_path = epw_input_path(epw_name) - # # populate specific argument for testing: upsizing scenario - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # if arg.name == 'performance_oversizing_factor' - # performance_oversizing_factor = arguments[idx].clone - # performance_oversizing_factor.setValue(0.25) - # argument_map[arg.name] = performance_oversizing_factor - # end - # end + # Create an instance of the measure + measure = AddHeatPumpRtu.new - # # Apply the measure to the model and optionally run the model - # result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - # model = load_model(model_output_path("#{test_name}_a")) + # Load the model; only used here for populating arguments + model = load_model(osm_path) - # # check performance category - # performance_category = nil - # result.stepValues.each do |input_arg| - # next unless input_arg.name == 'hprtu_scenario' - # performance_category = input_arg.valueAsString - # end + # get arguments + arguments = measure.arguments(model) + argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) - # # test lookup table values - # runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new) - # if performance_category == 'two_speed_standard_eff' - # # Check if lookup table is available - # lookup_table_name = lookup_table_test[:table_name] - # #table_multivar_lookups = model.getTableMultiVariableLookups - # table_multivar_lookups = model.getTableLookups - # lookup_table = table_multivar_lookups.find { |table| table.name.to_s == lookup_table_name } - # refute_nil(lookup_table, "Cannot find table named #{lookup_table_name} from model.") - - # # Compare table lookup value against hard-coded values - # dep_var_ref = lookup_table_test[:dep] - # dep_var = AddHeatPumpRtu.get_dep_var_from_lookup_table_with_interpolation(runner, lookup_table, lookup_table_test[:ind1], lookup_table_test[:ind2]) - # # puts("### lookup table test") - # # puts("--- lookup_table_name = #{lookup_table_name}") - # # puts("--- input_var1 = #{lookup_table_test[:ind1]} | input_var2 = #{lookup_table_test[:ind2]}") - # # puts("--- dep_var reference = #{dep_var_ref} | dep_var from model = #{dep_var}") - # assert_in_epsilon(dep_var_ref, dep_var, 0.001, "Table lookup value test didn't pass: table name = #{lookup_table_name} | ind_var1 = #{lookup_table_test[:ind1]} | ind_var2 = #{lookup_table_test[:ind2]} | expected #{dep_var_ref} but got #{dep_var}") - # end + # populate specific argument for testing + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + case arg.name + when 'sizing_run' + sizing_run = arguments[idx].clone + sizing_run.setValue(true) + argument_map[arg.name] = sizing_run + when 'hprtu_scenario' + hprtu_scenario = arguments[idx].clone + hprtu_scenario.setValue('two_speed_standard_eff') # variable_speed_high_eff, two_speed_standard_eff + argument_map[arg.name] = hprtu_scenario + else + argument_map[arg.name] = temp_arg_var + end + end - # # compare sizing summary of upsizing model with regular sized model - # check_sizing_results_upsizing(model, sizing_summary_reference) - # end + # populate specific argument for testing: regular sizing scenario + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + if arg.name == 'performance_oversizing_factor' + performance_oversizing_factor = arguments[idx].clone + performance_oversizing_factor.setValue(0.0) + argument_map[arg.name] = performance_oversizing_factor + end + end - # def test_sizing_model_in_hawaii - # osm_name = 'small_office_psz_not_hard_sized.osm' - # epw_name = 'USA_HI_Honolulu.Intl.AP.911820_TMY3.epw' - - # test_name = 'test_sizing_model_in_hawaii' - - # puts "\n######\nTEST:#{osm_name}\n######\n" - - # osm_path = model_input_path(osm_name) - # epw_path = epw_input_path(epw_name) - - # # Create an instance of the measure - # measure = AddHeatPumpRtu.new - - # # Load the model; only used here for populating arguments - # model = load_model(osm_path) - - # # get arguments - # arguments = measure.arguments(model) - # argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) - - # # populate specific argument for testing - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # case arg.name - # when 'sizing_run' - # sizing_run = arguments[idx].clone - # sizing_run.setValue(true) - # argument_map[arg.name] = sizing_run - # when 'hprtu_scenario' - # hprtu_scenario = arguments[idx].clone - # hprtu_scenario.setValue('variable_speed_high_eff') # variable_speed_high_eff, two_speed_standard_eff - # argument_map[arg.name] = hprtu_scenario - # else - # argument_map[arg.name] = temp_arg_var - # end - # end + # Apply the measure to the model and optionally run the model + result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + model = load_model(model_output_path("#{test_name}_b")) - # # populate specific argument for testing: regular sizing scenario - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # if arg.name == 'performance_oversizing_factor' - # performance_oversizing_factor = arguments[idx].clone - # performance_oversizing_factor.setValue(0.0) - # argument_map[arg.name] = performance_oversizing_factor - # end - # end + # get sizing info from regular sized model + sizing_summary_reference = get_sizing_summary(model) + + # populate specific argument for testing: upsizing scenario + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + if arg.name == 'performance_oversizing_factor' + performance_oversizing_factor = arguments[idx].clone + performance_oversizing_factor.setValue(0.25) + argument_map[arg.name] = performance_oversizing_factor + end + end - # # Apply the measure to the model and optionally run the model - # result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - # model = load_model(model_output_path("#{test_name}_b")) + # Apply the measure to the model and optionally run the model + result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + model = load_model(model_output_path("#{test_name}_a")) - # # get sizing info from regular sized model - # sizing_summary_reference = get_sizing_summary(model) + # check performance category + performance_category = nil + result.stepValues.each do |input_arg| + next unless input_arg.name == 'hprtu_scenario' + performance_category = input_arg.valueAsString + end - # # populate specific argument for testing: upsizing scenario - # arguments.each_with_index do |arg, idx| - # temp_arg_var = arg.clone - # if arg.name == 'performance_oversizing_factor' - # performance_oversizing_factor = arguments[idx].clone - # performance_oversizing_factor.setValue(0.25) - # argument_map[arg.name] = performance_oversizing_factor - # end - # end + # test lookup table values + runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new) + if performance_category == 'two_speed_standard_eff' + # Check if lookup table is available + lookup_table_name = lookup_table_test[:table_name] + #table_multivar_lookups = model.getTableMultiVariableLookups + table_multivar_lookups = model.getTableLookups + lookup_table = table_multivar_lookups.find { |table| table.name.to_s == lookup_table_name } + refute_nil(lookup_table, "Cannot find table named #{lookup_table_name} from model.") + + # Compare table lookup value against hard-coded values + dep_var_ref = lookup_table_test[:dep] + dep_var = AddHeatPumpRtu.get_dep_var_from_lookup_table_with_interpolation(runner, lookup_table, lookup_table_test[:ind1], lookup_table_test[:ind2]) + # puts("### lookup table test") + # puts("--- lookup_table_name = #{lookup_table_name}") + # puts("--- input_var1 = #{lookup_table_test[:ind1]} | input_var2 = #{lookup_table_test[:ind2]}") + # puts("--- dep_var reference = #{dep_var_ref} | dep_var from model = #{dep_var}") + assert_in_epsilon(dep_var_ref, dep_var, 0.001, "Table lookup value test didn't pass: table name = #{lookup_table_name} | ind_var1 = #{lookup_table_test[:ind1]} | ind_var2 = #{lookup_table_test[:ind2]} | expected #{dep_var_ref} but got #{dep_var}") + end - # # Apply the measure to the model and optionally run the model - # result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) - # model = load_model(model_output_path("#{test_name}_a")) + # compare sizing summary of upsizing model with regular sized model + check_sizing_results_upsizing(model, sizing_summary_reference) + end - # # compare sizing summary of upsizing model with regular sized model - # check_sizing_results_no_upsizing(model, sizing_summary_reference) - # end + def test_sizing_model_in_hawaii + osm_name = 'small_office_psz_not_hard_sized.osm' + epw_name = 'USA_HI_Honolulu.Intl.AP.911820_TMY3.epw' + + test_name = 'test_sizing_model_in_hawaii' + + puts "\n######\nTEST:#{osm_name}\n######\n" + + osm_path = model_input_path(osm_name) + epw_path = epw_input_path(epw_name) + + # Create an instance of the measure + measure = AddHeatPumpRtu.new + + # Load the model; only used here for populating arguments + model = load_model(osm_path) + + # get arguments + arguments = measure.arguments(model) + argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) + + # populate specific argument for testing + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + case arg.name + when 'sizing_run' + sizing_run = arguments[idx].clone + sizing_run.setValue(true) + argument_map[arg.name] = sizing_run + when 'hprtu_scenario' + hprtu_scenario = arguments[idx].clone + hprtu_scenario.setValue('variable_speed_high_eff') # variable_speed_high_eff, two_speed_standard_eff + argument_map[arg.name] = hprtu_scenario + else + argument_map[arg.name] = temp_arg_var + end + end + + # populate specific argument for testing: regular sizing scenario + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + if arg.name == 'performance_oversizing_factor' + performance_oversizing_factor = arguments[idx].clone + performance_oversizing_factor.setValue(0.0) + argument_map[arg.name] = performance_oversizing_factor + end + end + + # Apply the measure to the model and optionally run the model + result = set_weather_and_apply_measure_and_run("#{test_name}_b", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + model = load_model(model_output_path("#{test_name}_b")) + + # get sizing info from regular sized model + sizing_summary_reference = get_sizing_summary(model) + + # populate specific argument for testing: upsizing scenario + arguments.each_with_index do |arg, idx| + temp_arg_var = arg.clone + if arg.name == 'performance_oversizing_factor' + performance_oversizing_factor = arguments[idx].clone + performance_oversizing_factor.setValue(0.25) + argument_map[arg.name] = performance_oversizing_factor + end + end + + # Apply the measure to the model and optionally run the model + result = set_weather_and_apply_measure_and_run("#{test_name}_a", measure, argument_map, osm_path, epw_path, run_model: false, apply: true) + model = load_model(model_output_path("#{test_name}_a")) + + # compare sizing summary of upsizing model with regular sized model + check_sizing_results_no_upsizing(model, sizing_summary_reference) + end # ########################################################################## # This section tests proper application of measure on fully applicable models @@ -1584,7 +1537,7 @@ def test_380_full_service_restaurant_psz_gas_coil # assert non kitchen spaces contain multispeed DX heating coils nonkitchen_htg_coils_final.each do |htg_coil| - assert(htg_coil.to_CoilHeatingDXMultiSpeed.is_initialized) + assert(htg_coil.to_CoilHeatingDXVariableSpeed.is_initialized) end # assert kitchen spaces still contain gas coils From 777b159e6290a181c9831031adad0ebb912ee1ec Mon Sep 17 00:00:00 2001 From: "Janghyun(JK)Kim" Date: Wed, 23 Apr 2025 12:29:43 -0600 Subject: [PATCH 6/6] stage to speed for var spd coil obj --- measures/comstock_sensitivity_reports/measure.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/measures/comstock_sensitivity_reports/measure.rb b/measures/comstock_sensitivity_reports/measure.rb index 6898ea92f..4b93cf472 100644 --- a/measures/comstock_sensitivity_reports/measure.rb +++ b/measures/comstock_sensitivity_reports/measure.rb @@ -572,7 +572,7 @@ def get_heating_coil_capacity_and_cop(runner, model, coil) temp_capacity_w = speed.referenceUnitGrossRatedHeatingCapacity # get capacity and capacity at lower temperatures - cap_curve = stage.heatingCapacityFunctionofTemperatureCurve + cap_curve = speed.heatingCapacityFunctionofTemperatureCurve if cap_curve.to_CurveCubic.is_initialized coil_cap_17F = cap_curve.evaluate(OpenStudio.convert(17.0, 'F', 'C').get) capacity_17F_w = capacity_w * coil_cap_17F if temp_capacity_w >= capacity_w