Class: Standard Abstract

Inherits:
Object
  • Object
show all
Includes:
CoilDX, CoolingTower, Fan, PrototypeFan, Pump
Defined in:
lib/openstudio-standards/standards/standard.rb,
lib/openstudio-standards/standards/Standards.Model.rb,
lib/openstudio-standards/standards/Standards.Motor.rb,
lib/openstudio-standards/standards/Standards.Space.rb,
lib/openstudio-standards/standards/Standards.People.rb,
lib/openstudio-standards/standards/Standards.Surface.rb,
lib/openstudio-standards/standards/Standards.PlantLoop.rb,
lib/openstudio-standards/standards/Standards.SpaceType.rb,
lib/openstudio-standards/standards/Standards.SubSurface.rb,
lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb,
lib/openstudio-standards/standards/Standards.FluidCooler.rb,
lib/openstudio-standards/standards/Standards.ThermalZone.rb,
lib/openstudio-standards/standards/Standards.Ventilation.rb,
lib/openstudio-standards/standards/Standards.PlanarSurface.rb,
lib/openstudio-standards/standards/Standards.BoilerHotWater.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingGas.rb,
lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb,
lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb,
lib/openstudio-standards/standards/Standards.FanVariableVolume.rb,
lib/openstudio-standards/standards/Standards.PumpVariableSpeed.rb,
lib/openstudio-standards/standards/Standards.ZoneHVACComponent.rb,
lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb,
lib/openstudio-standards/standards/Standards.ServiceWaterHeating.rb,
lib/openstudio-standards/standards/Standards.CoolingTowerTwoSpeed.rb,
lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb,
lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb,
lib/openstudio-standards/prototypes/common/prototype_space_type_map.rb,
lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingDXMultiSpeed.rb,
lib/openstudio-standards/standards/Standards.CoolingTowerSingleSpeed.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb,
lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb,
lib/openstudio-standards/standards/Standards.CoolingTowerVariableSpeed.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.Model.hvac.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoolingTower.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.SizingSystem.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanZoneExhaust.rb,
lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.Model.elevators.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb,
lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb,
lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb,
lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.AirTerminalSingleDuctVAVReheat.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb

Overview

This class is abstract.

This abstract class holds generic methods that many energy standards would commonly use. Many of the methods in this class apply efficiency values from the OpenStudio-Standards spreadsheet. If a method in this class is redefined by a subclass, the implementation in the subclass is used.

Direct Known Subclasses

ASHRAE901, ASHRAE901PRM, CBES, DEER, ICCIECC, NECB2011, OEESC

Constant Summary collapse

STANDARDS_LIST =

A list of available Standards subclasses that can be created using the Standard.build() method.

{}

Instance Attribute Summary collapse

Model collapse

Motor collapse

Space collapse

People collapse

Surface collapse

PlantLoop collapse

SpaceType collapse

SubSurface collapse

AirLoopHVAC collapse

FluidCooler collapse

ThermalZone collapse

Ventilation collapse

PlanarSurface collapse

BoilerHotWater collapse

CoilHeatingGas collapse

ScheduleRuleset collapse

WaterHeaterMixed collapse

ZoneHVACComponent collapse

ChillerElectricEIR collapse

HeatExchangerSensLat collapse

CoilCoolingDXMultiSpeed collapse

CoilHeatingDXMultiSpeed collapse

CoilHeatingGasMultiStage collapse

Cooling Tower collapse

Sizing System collapse

hvac_systems collapse

refrigeration collapse

AirTerminalSingleDuctVAVReheat collapse

AirConditionerVariableRefrigerantFlow collapse

AirTerminalSingleDuctParallelPIUReheat collapse

CoilCoolingWaterToAirHeatPumpEquationFit collapse

CoilHeatingWaterToAirHeatPumpEquationFit collapse

HeatExchangerAirToAirSensibleAndLatent collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PrototypeFan

#prototype_fan_apply_prototype_fan_efficiency

Methods included from CoilDX

#coil_dx_cap_fflow, #coil_dx_cap_ft, #coil_dx_eir_fflow, #coil_dx_eir_ft, #coil_dx_electric_power_phase, #coil_dx_find_search_criteria, #coil_dx_packaged_terminal_application, #coil_dx_plf_fplr

Methods included from CoolingTower

#cooling_tower_apply_minimum_power_per_flow, #cooling_tower_apply_minimum_power_per_flow_gpm_limit

Methods included from Pump

#pump_apply_prm_pressure_rise_and_motor_efficiency, #pump_apply_standard_minimum_motor_efficiency, #pump_standard_minimum_motor_efficiency_and_size

Methods included from Fan

#fan_adjust_pressure_rise_to_meet_fan_power, #fan_apply_standard_minimum_motor_efficiency, #fan_baseline_impeller_efficiency, #fan_brake_horsepower, #fan_change_impeller_efficiency, #fan_change_motor_efficiency, #fan_design_air_flow, #fan_fanpower, #fan_motor_horsepower, #fan_rated_w_per_cfm, #fan_small_fan?, #fan_standard_minimum_motor_efficiency_and_size

Constructor Details

#initializeStandard

set up template class variable.



44
45
46
# File 'lib/openstudio-standards/standards/standard.rb', line 44

def initialize
  super()
end

Instance Attribute Details

#space_multiplier_mapObject

Returns the value of attribute space_multiplier_map.



6
7
8
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 6

def space_multiplier_map
  @space_multiplier_map
end

#standards_dataObject

Returns the value of attribute standards_data.



7
8
9
# File 'lib/openstudio-standards/standards/standard.rb', line 7

def standards_data
  @standards_data
end

#templateObject (readonly)

Returns the value of attribute template.



8
9
10
# File 'lib/openstudio-standards/standards/standard.rb', line 8

def template
  @template
end

Class Method Details

.build(name) ⇒ Object

Create an instance of a Standard by passing it's name

Examples:

Create a new Standard object by name

standard = Standard.build('NECB2011')

Parameters:

  • name (String)

    the name of the Standard to build. valid choices are: DOE Pre-1980, DOE 1980-2004, 90.1-2004, 90.1-2007, 90.1-2010, 90.1-2013, 90.1-2016, 90.1-2019, NREL ZNE Ready 2017, NECB2011



34
35
36
37
38
39
40
41
# File 'lib/openstudio-standards/standards/standard.rb', line 34

def self.build(name)
  if STANDARDS_LIST[name].nil?
    raise "ERROR: Did not find a class called '#{name}' to create in #{JSON.pretty_generate(STANDARDS_LIST)}"
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.standard', "Using OpenStudio Standards version #{OpenstudioStandards::VERSION} with template #{name}.")
  return STANDARDS_LIST[name].new
end

.register_standard(name) ⇒ Object

Add the standard to the STANDARDS_LIST.



22
23
24
# File 'lib/openstudio-standards/standards/standard.rb', line 22

def self.register_standard(name)
  STANDARDS_LIST[name] = self
end

Instance Method Details

#adjust_sizing_system(air_loop_hvac, dsgn_temps, type_of_load_sizing: 'Sensible', min_sys_airflow_ratio: 0.3, sizing_option: 'Coincident') ⇒ OpenStudio::Model::SizingSystem

Prototype SizingSystem object

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • dsgn_temps (Hash)

    a hash of design temperature lookups from standard_design_sizing_temperatures

Returns:

  • (OpenStudio::Model::SizingSystem)

    sizing system object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.SizingSystem.rb', line 9

def adjust_sizing_system(air_loop_hvac,
                         dsgn_temps,
                         type_of_load_sizing: 'Sensible',
                         min_sys_airflow_ratio: 0.3,
                         sizing_option: 'Coincident')

  # adjust sizing system defaults
  sizing_system = air_loop_hvac.sizingSystem
  sizing_system.setTypeofLoadtoSizeOn(type_of_load_sizing)
  sizing_system.autosizeDesignOutdoorAirFlowRate
  sizing_system.setPreheatDesignTemperature(dsgn_temps['prehtg_dsgn_sup_air_temp_c'])
  sizing_system.setPrecoolDesignTemperature(dsgn_temps['preclg_dsgn_sup_air_temp_c'])
  sizing_system.setCentralCoolingDesignSupplyAirTemperature(dsgn_temps['clg_dsgn_sup_air_temp_c'])
  sizing_system.setCentralHeatingDesignSupplyAirTemperature(dsgn_temps['htg_dsgn_sup_air_temp_c'])
  sizing_system.setPreheatDesignHumidityRatio(0.008)
  sizing_system.setPrecoolDesignHumidityRatio(0.008)
  sizing_system.setCentralCoolingDesignSupplyAirHumidityRatio(0.0085)
  sizing_system.setCentralHeatingDesignSupplyAirHumidityRatio(0.0080)
  if air_loop_hvac.model.version < OpenStudio::VersionString.new('2.7.0')
    sizing_system.setMinimumSystemAirFlowRatio(min_sys_airflow_ratio)
  else
    sizing_system.setCentralHeatingMaximumSystemAirFlowRatio(min_sys_airflow_ratio)
  end
  sizing_system.setSizingOption(sizing_option)
  sizing_system.setAllOutdoorAirinCooling(false)
  sizing_system.setAllOutdoorAirinHeating(false)
  sizing_system.setSystemOutdoorAirMethod('ZoneSum')
  sizing_system.setCoolingDesignAirFlowMethod('DesignDay')
  sizing_system.setHeatingDesignAirFlowMethod('DesignDay')

  return sizing_system
end

#air_conditioner_variable_refrigerant_flow_apply_efficiency_and_curves(air_conditioner_variable_refrigerant_flow) ⇒ Boolean

Finds lookup object in standards and return minimum thermal efficiency

Parameters:

  • air_conditioner_variable_refrigerant_flow (OpenStudio::Model::AirConditionerVariableRefrigerantFlow)

    vrf unit

Returns:

  • (Boolean)

    returns true if successful, false if not



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb', line 30

def air_conditioner_variable_refrigerant_flow_apply_efficiency_and_curves(air_conditioner_variable_refrigerant_flow)
  successfully_set_all_properties = false

  # Define the criteria to find the vrf properties
  # in the hvac standards data set.
  search_criteria = air_conditioner_variable_refrigerant_flow_find_search_criteria(air_conditioner_variable_refrigerant_flow)

  # Get the capacity
  capacity_w = OpenstudioStandards::HVAC.air_conditioner_variable_refrigerant_flow_get_cooling_capacity(air_conditioner_variable_refrigerant_flow)

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get the vrf properties
  search_criteria['equipment_type'] << 'CoolingMode'
  vrf_props_cooling = model_find_object(standards_data['vrfs'], search_criteria, capacity_btu_per_hr)
  unless vrf_props_cooling
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{air_conditioner_variable_refrigerant_flow.name}, cannot find VRF cooling properties with search criteria #{search_criteria}, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end
  search_criteria['equipment_type'].sub('Cooling', 'Heating')
  vrf_props_heating = model_find_object(standards_data['vrfs'], search_criteria, capacity_btu_per_hr)
  unless vrf_props_heating
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{air_conditioner_variable_refrigerant_flow.name}, cannot find VRF heating properties with search criteria #{search_criteria}, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency standards
  cooling_cop = nil
  heating_cop = nil

  # If specified as SEER
  unless vrf_props_cooling['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = vrf_props_cooling['minimum_seasonal_energy_efficiency_ratio']
    cooling_cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as SEER2
  # TODO: assumed to be the same as SEER for now
  unless vrf_props_cooling['minimum_seasonal_energy_efficiency_ratio_2'].nil?
    min_seer = vrf_props_cooling['minimum_seasonal_energy_efficiency_ratio_2']
    cooling_cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless vrf_props_cooling['minimum_energy_efficiency_ratio'].nil?
    min_eer = vrf_props_cooling['minimum_energy_efficiency_ratio']
    cooling_cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as EER2
  # TODO: assumed to be the same as EER for now
  unless vrf_props_cooling['minimum_energy_efficiency_ratio_2'].nil?
    min_eer = vrf_props_cooling['minimum_energy_efficiency_ratio_2']
    cooling_cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as HSPF
  unless vrf_props_heating['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = vrf_props_heating['minimum_heating_seasonal_performance_factor']
    heating_cop = OpenstudioStandards::HVAC.hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_hspf.round(1)}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; HSPF = #{min_hspf}")
  end

  # If specified as HSPF2
  # TODO: assumed to be the same as HSPF for now
  unless vrf_props_heating['minimum_heating_seasonal_performance_factor_2'].nil?
    min_hspf = vrf_props_heating['minimum_heating_seasonal_performance_factor_2']
    heating_cop = OpenstudioStandards::HVAC.hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_hspf.round(1)}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; HSPF = #{min_hspf}")
  end

  # If specified as COP
  unless vrf_props_heating['minimum_coefficient_of_performance_heating'].nil?
    min_coph = vrf_props_heating['minimum_coefficient_of_performance_heating']
    heating_cop = OpenstudioStandards::HVAC.cop_heating_to_cop_heating_no_fan(min_coph, OpenStudio.convert(capacity_kbtu_per_hr, 'kBtu/hr', 'W').get)
    new_comp_name = "#{air_conditioner_variable_refrigerant_flow.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_coph.round(1)}COPH"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{air_conditioner_variable_refrigerant_flow.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COPH = #{min_coph}")
  end

  # Set the name
  air_conditioner_variable_refrigerant_flow.setName(new_comp_name)

  # Set the efficiency values
  unless cooling_cop.nil?
    air_conditioner_variable_refrigerant_flow.setGrossRatedCoolingCOP(cooling_cop)
  end
  unless heating_cop.nil?
    air_conditioner_variable_refrigerant_flow.setGrossRatedHeatingCOP(heating_cop)
  end

  return successfully_set_all_properties
end

#air_conditioner_variable_refrigerant_flow_find_search_criteria(air_conditioner_variable_refrigerant_flow) ⇒ Hash

find search criteria

Parameters:

  • air_conditioner_variable_refrigerant_flow (OpenStudio::Model::AirConditionerVariableRefrigerantFlow)

    vrf object

Returns:

  • (Hash)

    used for standards_lookup_table(model)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb', line 8

def air_conditioner_variable_refrigerant_flow_find_search_criteria(air_conditioner_variable_refrigerant_flow)
  # Define the criteria to find the boiler properties
  # in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template

  search_criteria['subcategory'] = 'VRF multisplit system'
  if air_conditioner_variable_refrigerant_flow.condenserType == 'AirCooled'
    search_criteria['equipment_type'] = 'AirCooled'
  elsif air_conditioner_variable_refrigerant_flow.condenserType == 'WaterCooled'
    search_criteria['equipment_type'] = 'WaterSource'
  else
    search_criteria['equipment_type'] = ''
  end

  return search_criteria
end

#air_loop_hvac_add_motorized_oa_damper(air_loop_hvac, min_occ_pct = 0.05, occ_sch = nil) ⇒ Boolean

Add a motorized damper by modifying the OA schedule to require zero OA during unoccupied hours. This means that even during morning warmup or nightcyling, no OA will be brought into the building, lowering heating/cooling load. If no occupancy schedule is supplied, one will be created. In this case, occupied is defined as the total percent occupancy for the loop for all zones served. If the OA schedule is already other than Always On, will assume that this schedule reflects a motorized OA damper and not change.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • min_occ_pct (Double) (defaults to: 0.05)

    the fractional value below which the system will be considered unoccupied.

  • occ_sch (OpenStudio::Model::Schedule) (defaults to: nil)

    the occupancy schedule. If not supplied, one will be created based on the supplied occupancy threshold.

Returns:

  • (Boolean)

    returns true if successful, false if not



2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2857

def air_loop_hvac_add_motorized_oa_damper(air_loop_hvac, min_occ_pct = 0.05, occ_sch = nil)
  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir

  # Get the current min OA schedule and do nothing
  # if it is already set to something other than Always On
  if oa_control.minimumOutdoorAirSchedule.is_initialized
    min_oa_sch = oa_control.minimumOutdoorAirSchedule.get
    unless min_oa_sch == air_loop_hvac.model.alwaysOnDiscreteSchedule
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Min OA damper schedule is already set to #{min_oa_sch.name}, assume this includes correct motorized OA damper control.")
      return true
    end
  end

  # Get the airloop occupancy schedule if none supplied
  # or if the supplied availability schedule is Always On, implying
  # that the availability schedule does not reflect occupancy.
  if occ_sch.nil? || occ_sch == air_loop_hvac.model.alwaysOnDiscreteSchedule
    occ_sch = air_loop_hvac_get_occupancy_schedule(air_loop_hvac, occupied_percentage_threshold: min_occ_pct)
    flh = OpenstudioStandards::Schedules.schedule_get_equivalent_full_load_hours(occ_sch)
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Annual occupied hours = #{flh.round} hr/yr, assuming a #{min_occ_pct} occupancy threshold.  This schedule will be used to close OA damper during unoccupied hours.")
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Setting motorized OA damper schedule to #{occ_sch.name}.")
  end

  # Set the minimum OA schedule to follow occupancy
  oa_control.setMinimumOutdoorAirSchedule(occ_sch)

  return true
end

#air_loop_hvac_adjust_minimum_vav_damper_positions(air_loop_hvac) ⇒ Boolean

TODO:

Add exception logic for systems serving parking garage, warehouse, or multifamily

Adjust minimum VAV damper positions and set minimum design system outdoor air flow

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2020

def air_loop_hvac_adjust_minimum_vav_damper_positions(air_loop_hvac)
  # Do not apply the adjustment to some of the system in
  # the hospital and outpatient which have their minimum
  # damper position determined based on AIA 2001 ventilation
  # requirements
  if (@instvarbuilding_type == 'Hospital' && (air_loop_hvac.name.to_s.include?('VAV_ER') || air_loop_hvac.name.to_s.include?('VAV_ICU') ||
                                              air_loop_hvac.name.to_s.include?('VAV_OR') || air_loop_hvac.name.to_s.include?('VAV_LABS') ||
                                              air_loop_hvac.name.to_s.include?('VAV_PATRMS'))) ||
     (@instvarbuilding_type == 'Outpatient' && air_loop_hvac.name.to_s.include?('Outpatient F1'))

    return true
  end

  # Total uncorrected outdoor airflow rate
  v_ou = 0.0
  air_loop_hvac.thermalZones.each do |zone|
    # Vou is the system uncorrected outdoor airflow:
    # Zone airflow is multiplied by the zone multiplier
    v_ou += OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone) * zone.multiplier.to_f
  end

  v_ou_cfm = OpenStudio.convert(v_ou, 'm^3/s', 'cfm').get

  # System primary airflow rate (whether autosized or hard-sized)
  v_ps = 0.0

  v_ps = if air_loop_hvac.designSupplyAirFlowRate.is_initialized
           air_loop_hvac.designSupplyAirFlowRate.get
         elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
           air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
         end
  v_ps_cfm = OpenStudio.convert(v_ps, 'm^3/s', 'cfm').get

  # Average outdoor air fraction
  x_s = v_ou / v_ps

  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: v_ou = #{v_ou_cfm.round} cfm, v_ps = #{v_ps_cfm.round} cfm, x_s = #{x_s.round(2)}.")

  # Determine the zone ventilation effectiveness
  # for every zone on the system.
  # When ventilation effectiveness is too low,
  # increase the minimum damper position.
  e_vzs = []
  e_vzs_adj = []
  num_zones_adj = 0

  # Retrieve the sum of the zone minimum primary airflow
  if air_loop_hvac.model.version < OpenStudio::VersionString.new('3.6.0')
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required AirLoopHVAC method .autosizedSumMinimumHeatingAirFlowRates is not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
  elsif air_loop_hvac.autosizedSumMinimumHeatingAirFlowRates.is_initialized
    vpz_min_sum = air_loop_hvac.autosizedSumMinimumHeatingAirFlowRates.get
  else
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "autosizedSumMinimumHeatingAirFlowRates is not available for air loop #{air_loop_hvac}.")
  end

  air_loop_hvac.thermalZones.sort.each do |zone|
    # Breathing zone airflow rate
    v_bz = OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone)

    # Zone air distribution, assumed 1 per PNNL
    e_z = 1.0

    # Zone airflow rate
    v_oz = v_bz / e_z

    # Primary design airflow rate
    # max of heating and cooling
    # design air flow rates
    v_pz = 0.0

    # error if zone autosized methods are not available
    if air_loop_hvac.model.version < OpenStudio::VersionString.new('3.6.0')
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required ThermalZone method .autosizedCoolingDesignAirFlowRate and .autosizedHeatingDesignAirFlowRate are not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
    end

    clg_dsn_flow = zone.autosizedCoolingDesignAirFlowRate
    if clg_dsn_flow.is_initialized
      clg_dsn_flow = clg_dsn_flow.get
      if clg_dsn_flow > v_pz
        v_pz = clg_dsn_flow
      end
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: #{zone.name}, zone CoolingDesignAirFlowRate could not be found.")
    end
    htg_dsn_flow = zone.autosizedHeatingDesignAirFlowRate
    if htg_dsn_flow.is_initialized
      htg_dsn_flow = htg_dsn_flow.get
      if htg_dsn_flow > v_pz
        v_pz = htg_dsn_flow
      end
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: #{zone.name}, zone HeatingDesignAirFlowRate could not be found.")
    end

    if v_pz.zero?
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: #{zone.name}, neither the CoolingDesignAirFlowRate nor the HeatingDesignAirFlowRate could be found. The primary design air flow rate, v_pz, is zero. The zone may be missing a DesignSpecificationOutdoorAir object, or both heating and cooling load may be zero.")
    end

    # Get the minimum damper position
    mdp_term = 1.0
    min_zn_flow = 0.0
    zone.equipment.each do |equip|
      if equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.is_initialized
        term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.get
        mdp_term = term.zoneMinimumAirFlowFraction
      elsif equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized
        term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
        mdp_term = term.zoneMinimumAirFlowFraction
      elsif equip.to_AirTerminalSingleDuctVAVNoReheat.is_initialized
        term = equip.to_AirTerminalSingleDuctVAVNoReheat.get
        if term.constantMinimumAirFlowFraction.is_initialized
          mdp_term = term.constantMinimumAirFlowFraction.get
        end
      elsif equip.to_AirTerminalSingleDuctVAVReheat.is_initialized
        term = equip.to_AirTerminalSingleDuctVAVReheat.get
        if term.constantMinimumAirFlowFraction.is_initialized
          mdp_term = term.constantMinimumAirFlowFraction.get
        end
        if term.fixedMinimumAirFlowRate.is_initialized
          min_zn_flow = term.fixedMinimumAirFlowRate.get
        end
      end
    end

    # Zone ventilation efficiency calculation is computed
    # on a per zone basis, the zone primary airflow is
    # adjusted to removed the zone multiplier
    v_pz /= zone.multiplier.to_f

    # For VAV Reheat terminals, min flow is greater of mdp
    # and min flow rate / design flow rate.
    mdp = mdp_term
    mdp_oa = min_zn_flow / v_pz
    if min_zn_flow > 0.0
      mdp = [mdp_term, mdp_oa].max.round(2)
    end

    # Zone minimum discharge airflow rate
    v_dz = v_pz * mdp

    # Zone discharge air fraction
    z_d = v_dz.zero? || v_oz.zero? ? 0.0 : v_oz / v_dz

    # Zone ventilation effectiveness
    e_vz = 1.0 + x_s - z_d

    # Store the ventilation effectiveness
    e_vzs << e_vz

    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Zone #{zone.name} v_oz = #{v_oz.round(2)} m^3/s, v_pz = #{v_pz.round(2)} m^3/s, v_dz = #{v_dz.round(2)}, z_d = #{z_d.round(2)}.")

    # Check the ventilation effectiveness against
    # the minimum limit per PNNL and increase
    # as necessary.
    if e_vz < 0.6

      # Adjusted discharge air fraction
      z_d_adj = 1.0 + x_s - 0.6

      # Adjusted min discharge airflow rate
      v_dz_adj = v_oz / z_d_adj

      # Adjusted minimum damper position
      # default to 0.2 if either values are zero
      mdp_adj = v_dz_adj.zero? || v_pz.zero? ? 0.2 : v_dz_adj / v_pz

      # Don't allow values > 1
      if mdp_adj > 1.0
        mdp_adj = 1.0
      end

      # Zone ventilation effectiveness
      e_vz_adj = 1.0 + x_s - z_d_adj

      # Store the ventilation effectiveness
      e_vzs_adj << e_vz_adj
      # Round the minimum damper position to avoid nondeterministic results
      # at the ~13th decimal place, which can cause regression errors
      mdp_adj = mdp_adj.round(11)

      # Set the adjusted minimum damper position
      air_loop_hvac_set_minimum_damper_position(zone, mdp_adj)

      num_zones_adj += 1

      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Zone #{zone.name} has a ventilation effectiveness of #{e_vz.round(2)}.  Increasing to #{e_vz_adj.round(2)} by increasing minimum damper position from #{mdp.round(2)} to #{mdp_adj.round(2)}.")

    else
      # Store the unadjusted value
      e_vzs_adj << e_vz
    end
  end

  # Min system zone ventilation effectiveness
  e_v = e_vzs.min

  # Total system outdoor intake flow rate
  v_ot = v_ou / e_v
  v_ot_cfm = OpenStudio.convert(v_ot, 'm^3/s', 'cfm').get

  # Min system zone ventilation effectiveness
  e_v_adj = e_vzs_adj.min

  # Total system outdoor intake flow rate
  v_ot_adj = v_ou / e_v_adj
  v_ot_adj_cfm = OpenStudio.convert(v_ot_adj, 'm^3/s', 'cfm').get

  # Adjust minimum damper position if the sum of maximum
  # zone airflow are lower than the calculated system
  # outdoor air intake
  if v_ot_adj > vpz_min_sum && v_ot_adj > 0

    # Retrieve the sum of the zone maximum air flow rates
    if air_loop_hvac.model.version < OpenStudio::VersionString.new('3.6.0')
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required AirLoopHVAC method .autosizedSumAirTerminalMaxAirFlowRate is not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
    elsif air_loop_hvac.autosizedSumAirTerminalMaxAirFlowRate.is_initialized
      v_max = air_loop_hvac.autosizedSumAirTerminalMaxAirFlowRate.get
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "autosizedSumAirTerminalMaxAirFlowRate is not available for air loop #{air_loop_hvac}.")
    end

    mdp_adj = [v_ot_adj / v_max, 1].min
    air_loop_hvac.thermalZones.sort.each do |zone|
      air_loop_hvac_set_minimum_damper_position(zone, mdp_adj)
    end
  end

  # Report out the results of the multizone calculations
  if num_zones_adj > 0
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: the multizone outdoor air calculation method was applied.  A simple summation of the zone outdoor air requirements gives a value of #{v_ou_cfm.round} cfm.  Applying the multizone method gives a value of #{v_ot_cfm.round} cfm, with an original system ventilation effectiveness of #{e_v.round(2)}.  After increasing the minimum damper position in #{num_zones_adj} critical zones, the resulting requirement is #{v_ot_adj_cfm.round} cfm with a system ventilation effectiveness of #{e_v_adj.round(2)}.")
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: the multizone outdoor air calculation method was applied.  A simple summation of the zone requirements gives a value of #{v_ou_cfm.round} cfm.  However, applying the multizone method requires #{v_ot_adj_cfm.round} cfm based on the ventilation effectiveness of the system.")
  end

  # Hard-size the sizing:system
  # object with the calculated min OA flow rate
  sizing_system = air_loop_hvac.sizingSystem
  sizing_system.setDesignOutdoorAirFlowRate(v_ot_adj)
  sizing_system.setSystemOutdoorAirMethod('ZoneSum')

  return true
end

#air_loop_hvac_adjust_minimum_vav_damper_positions_outpatient(air_loop_hvac) ⇒ Boolean

For critical zones of Outpatient, if the minimum airflow rate required by the accreditation standard (AIA 2001) is significantly less than the autosized peak design airflow in any of the three climate zones (Houston, Baltimore and Burlington), the minimum airflow fraction of the terminal units is reduced to the value: "required minimum airflow rate / autosized peak design flow" Reference: <Achieving the 30% Goal: Energy and Cost Savings Analysis of ASHRAE Standard 90.1-2010> Page109-111 For implementation purpose, since it is time-consuming to perform autosizing in three climate zones, just use the results of the current climate zone

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2297

def air_loop_hvac_adjust_minimum_vav_damper_positions_outpatient(air_loop_hvac)
  air_loop_hvac.model.getSpaces.sort.each do |space|
    zone = space.thermalZone.get
    sizing_zone = zone.sizingZone
    space_area = space.floorArea
    next if sizing_zone.coolingDesignAirFlowMethod == 'DesignDay'

    if sizing_zone.coolingDesignAirFlowMethod == 'DesignDayWithLimit'
      minimum_airflow_per_zone_floor_area = sizing_zone.coolingMinimumAirFlowperZoneFloorArea
      minimum_airflow_per_zone = minimum_airflow_per_zone_floor_area * space_area
      # get the autosized maximum air flow of the VAV terminal
      zone.equipment.each do |equip|
        if equip.to_AirTerminalSingleDuctVAVReheat.is_initialized
          vav_terminal = equip.to_AirTerminalSingleDuctVAVReheat.get
          rated_maximum_flow_rate = vav_terminal.autosizedMaximumAirFlowRate.get
          # compare the VAV autosized maximum airflow with the minimum airflow rate required by the accreditation standard
          ratio = minimum_airflow_per_zone / rated_maximum_flow_rate

          # round to avoid results variances in sizing runs
          ratio = ratio.round(11)

          if ratio >= 0.95
            vav_terminal.setConstantMinimumAirFlowFraction(1)
          elsif ratio < 0.95
            vav_terminal.setConstantMinimumAirFlowFraction(ratio)
          end
        end
      end
    end
  end
  return true
end

#air_loop_hvac_allowable_system_brake_horsepower(air_loop_hvac) ⇒ Double

Determine the allowable fan system brake horsepower Per Table 6.5.3.1.1A

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    allowable fan system brake horsepower, in units of horsepower



487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 487

def air_loop_hvac_allowable_system_brake_horsepower(air_loop_hvac)
  # Get design supply air flow rate (whether autosized or hard-sized)
  dsn_air_flow_m3_per_s = 0
  dsn_air_flow_cfm = 0
  if air_loop_hvac.designSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.designSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Hard sized Design Supply Air Flow Rate.")
  elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Autosized Design Supply Air Flow Rate.")
  end

  # Get the fan limitation pressure drop adjustment bhp
  fan_pwr_adjustment_bhp = air_loop_hvac_fan_power_limitation_pressure_drop_adjustment_brake_horsepower(air_loop_hvac)

  # Determine the number of zones the system serves
  num_zones_served = air_loop_hvac.thermalZones.size

  # Get the supply air fan and determine whether VAV or CAV system.
  # Assume that supply air fan is fan closest to the demand outlet node.
  # The fan may be inside of a piece of unitary equipment.
  fan_pwr_limit_type = nil
  air_loop_hvac.supplyComponents.reverse.each do |comp|
    if comp.to_FanConstantVolume.is_initialized || comp.to_FanOnOff.is_initialized
      fan_pwr_limit_type = 'constant volume'
    elsif comp.to_FanVariableVolume.is_initialized
      fan_pwr_limit_type = 'variable volume'
    elsif comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized
      fan = comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get.supplyAirFan
      if fan.to_FanConstantVolume.is_initialized || fan.to_FanOnOff.is_initialized
        fan_pwr_limit_type = 'constant volume'
      elsif fan.to_FanVariableVolume.is_initialized
        fan_pwr_limit_type = 'variable volume'
      end
    elsif comp.to_AirLoopHVACUnitarySystem.is_initialized
      fan = comp.to_AirLoopHVACUnitarySystem.get.supplyFan.get
      if fan.to_FanConstantVolume.is_initialized || fan.to_FanOnOff.is_initialized
        fan_pwr_limit_type = 'constant volume'
      elsif fan.to_FanVariableVolume.is_initialized
        fan_pwr_limit_type = 'variable volume'
      end
    end
  end

  # For 90.1-2010, single-zone VAV systems use the
  # constant volume limitation per 6.5.3.1.1
  if template == 'ASHRAE 90.1-2010' && fan_pwr_limit_type == 'variable volume' && num_zones_served == 1
    fan_pwr_limit_type = 'constant volume'
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Using the constant volume limitation because single-zone VAV system.")
  end

  # Calculate the Allowable Fan System brake horsepower per Table G3.1.2.9
  allowable_fan_bhp = 0
  if fan_pwr_limit_type == 'constant volume'
    if dsn_air_flow_cfm > 0
      allowable_fan_bhp = (dsn_air_flow_cfm * 0.00094) + fan_pwr_adjustment_bhp
    else
      allowable_fan_bhp = 0.00094
    end
  elsif fan_pwr_limit_type == 'variable volume'
    if dsn_air_flow_cfm > 0
      allowable_fan_bhp = (dsn_air_flow_cfm * 0.0013) + fan_pwr_adjustment_bhp
    else
      allowable_fan_bhp = 0.0013
    end
  end
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Allowable brake horsepower = #{allowable_fan_bhp.round(2)}HP based on #{dsn_air_flow_cfm.round} cfm and #{fan_pwr_adjustment_bhp.round(2)} bhp of adjustment.")

  # Calculate and report the total area for debugging/testing
  floor_area_served_m2 = air_loop_hvac_floor_area_served(air_loop_hvac)

  if floor_area_served_m2.zero?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "AirLoopHVAC #{air_loop_hvac.name} serves zero floor area. Check that it has thermal zones attached to it, and that they have non-zero floor area'.")
    return allowable_fan_bhp
  end

  floor_area_served_ft2 = OpenStudio.convert(floor_area_served_m2, 'm^2', 'ft^2').get
  cfm_per_ft2 = dsn_air_flow_cfm / floor_area_served_ft2

  if allowable_fan_bhp.zero?
    cfm_per_hp = 0
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "AirLoopHVAC #{air_loop_hvac.name} has zero allowable fan bhp, probably due to zero design air flow cfm'.")
  else
    cfm_per_hp = dsn_air_flow_cfm / allowable_fan_bhp
  end
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: area served = #{floor_area_served_ft2.round} ft^2.")
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: flow per area = #{cfm_per_ft2.round} cfm/ft^2.")
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: flow per hp = #{cfm_per_hp.round} cfm/hp.")

  return allowable_fan_bhp
end

#air_loop_hvac_apply_baseline_fan_pressure_rise(air_loop_hvac) ⇒ Boolean

Set the fan pressure rises that will result in the system hitting the baseline allowable fan power

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 668

def air_loop_hvac_apply_baseline_fan_pressure_rise(air_loop_hvac)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name}-Setting #{template} baseline fan power.")

  # Get the total system bhp from the proposed system, including terminal fans
  proposed_sys_bhp = air_loop_hvac_system_fan_brake_horsepower(air_loop_hvac, true)

  # Get the allowable fan brake horsepower
  allowable_fan_bhp = air_loop_hvac_allowable_system_brake_horsepower(air_loop_hvac)

  # Get the fan power limitation from proposed system
  fan_pwr_adjustment_bhp = air_loop_hvac_fan_power_limitation_pressure_drop_adjustment_brake_horsepower(air_loop_hvac)

  # Subtract the fan power adjustment
  allowable_fan_bhp -= fan_pwr_adjustment_bhp

  # Get all fans
  fans = air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac)

  # @todo improve description
  # Loop through the fans, changing the pressure rise
  # until the fan bhp is the same percentage of the baseline allowable bhp
  # as it was on the proposed system.
  fans.each do |fan|
    # @todo Yixing Check the model of the Fan Coil Unit
    next if fan.name.to_s.include?('Fan Coil fan')
    next if fan.name.to_s.include?('UnitHeater Fan')

    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', fan.name.to_s)

    # Get the bhp of the fan on the proposed system
    proposed_fan_bhp = fan_brake_horsepower(fan)

    # Get the bhp of the fan on the proposed system
    proposed_fan_bhp_frac = proposed_fan_bhp / proposed_sys_bhp

    # Determine the target bhp of the fan on the baseline system
    baseline_fan_bhp = proposed_fan_bhp_frac * allowable_fan_bhp
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "* #{baseline_fan_bhp.round(1)} bhp = Baseline fan brake horsepower.")

    # Set the baseline impeller eff of the fan,
    # preserving the proposed motor eff.
    baseline_impeller_eff = fan_baseline_impeller_efficiency(fan)
    fan_change_impeller_efficiency(fan, baseline_impeller_eff)
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "* #{(baseline_impeller_eff * 100).round(1)}% = Baseline fan impeller efficiency.")

    # Set the baseline motor efficiency for the specified bhp
    baseline_motor_eff = fan.standardMinimumMotorEfficiency(standards, allowable_fan_bhp)
    fan_change_motor_efficiency(fan, baseline_motor_eff)

    # Get design supply air flow rate (whether autosized or hard-sized)
    dsn_air_flow_m3_per_s = 0
    if fan.designSupplyAirFlowRate.is_initialized
      dsn_air_flow_m3_per_s = fan.designSupplyAirFlowRate.get
      dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = User entered Design Supply Air Flow Rate.")
    elsif fan.autosizedDesignSupplyAirFlowRate.is_initialized
      dsn_air_flow_m3_per_s = fan.autosizedDesignSupplyAirFlowRate.get
      dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Autosized Design Supply Air Flow Rate.")
    end

    # Determine the fan pressure rise that will result in the target bhp
    # pressure_rise_pa = fan_bhp*746 / fan_motor_eff*fan_total_eff / dsn_air_flow_m3_per_s
    baseline_pressure_rise_pa = baseline_fan_bhp * 746 / fan.motorEfficiency * fan.fanEfficiency / dsn_air_flow_m3_per_s
    baseline_pressure_rise_in_wc = OpenStudio.convert(fan_pressure_rise_pa, 'Pa', 'inH_{2}O').get
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "* #{fan_pressure_rise_in_wc.round(2)} in w.c. = Pressure drop to achieve allowable fan power.")

    # Calculate the bhp of the fan to make sure it matches
    calc_bhp = fan_brake_horsepower(fan)
    if ((calc_bhp - baseline_fan_bhp) / baseline_fan_bhp).abs > 0.02
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "#{fan.name} baseline fan bhp supposed to be #{baseline_fan_bhp}, but is #{calc_bhp}.")
    end
  end

  # Calculate the total bhp of the system to make sure it matches the goal
  calc_sys_bhp = air_loop_hvac_system_fan_brake_horsepower(air_loop_hvac, false)
  return true unless ((calc_sys_bhp - allowable_fan_bhp) / allowable_fan_bhp).abs > 0.02

  OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} baseline system bhp supposed to be #{allowable_fan_bhp}, but is #{calc_sys_bhp}.")
  return false
end

#air_loop_hvac_apply_economizer_integration(air_loop_hvac, climate_zone) ⇒ Boolean

Note:

this method assumes you previously checked that an economizer is required at all via #economizer_required?

For systems required to have an economizer, set the economizer to integrated on non-integrated per the standard.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1151

def air_loop_hvac_apply_economizer_integration(air_loop_hvac, climate_zone)
  # Determine if an integrated economizer is required
  integrated_economizer_required = air_loop_hvac_integrated_economizer_required?(air_loop_hvac, climate_zone)

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem

  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  # Apply integrated or non-integrated economizer
  if integrated_economizer_required
    oa_control.setLockoutType('LockoutWithHeating')
  else
    # If the airloop include hyrdronic cooling coils,
    # prevent economizer from operating at and above SAT,
    # similar to a non-integrated economizer. This is done
    # because LockoutWithCompressor doesn't work with hydronic
    # coils
    if air_loop_hvac_include_hydronic_cooling_coil?(air_loop_hvac)
      oa_control.setLockoutType('LockoutWithHeating')
      oa_control.setEconomizerMaximumLimitDryBulbTemperature(standard_design_sizing_temperatures['clg_dsgn_sup_air_temp_c'])
    else
      oa_control.setLockoutType('LockoutWithCompressor')
    end
  end

  return true
end

#air_loop_hvac_apply_economizer_limits(air_loop_hvac, climate_zone) ⇒ Boolean

Set the economizer limits per the standard. Limits are based on the economizer type currently specified in the ControllerOutdoorAir object on this air loop.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1030

def air_loop_hvac_apply_economizer_limits(air_loop_hvac, climate_zone)
  # EnergyPlus economizer types
  # 'NoEconomizer'
  # 'FixedDryBulb'
  # 'FixedEnthalpy'
  # 'DifferentialDryBulb'
  # 'DifferentialEnthalpy'
  # 'FixedDewPointAndDryBulb'
  # 'ElectronicEnthalpy'
  # 'DifferentialDryBulbAndEnthalpy'

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  economizer_type = oa_control.getEconomizerControlType

  # Return false if no economizer is present
  if economizer_type == 'NoEconomizer'
    return false
  end

  # Reset the limits
  oa_control.resetEconomizerMaximumLimitDryBulbTemperature
  oa_control.resetEconomizerMaximumLimitEnthalpy
  oa_control.resetEconomizerMaximumLimitDewpointTemperature
  oa_control.resetEconomizerMinimumLimitDryBulbTemperature

  # Determine the limits
  drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f = air_loop_hvac_economizer_limits(air_loop_hvac, climate_zone)

  # Do nothing if no limits were specified
  if drybulb_limit_f.nil? && enthalpy_limit_btu_per_lb.nil? && dewpoint_limit_f.nil?
    return false
  end

  # Set the limits
  case economizer_type
  when 'FixedDryBulb'
    if drybulb_limit_f
      drybulb_limit_c = OpenStudio.convert(drybulb_limit_f, 'F', 'C').get
      oa_control.setEconomizerMaximumLimitDryBulbTemperature(drybulb_limit_c)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, dry bulb limit = #{drybulb_limit_f}F")
    end
    # Some templates include fixed enthalpy limits in addition to fixed dry bulb limits
    if enthalpy_limit_btu_per_lb
      enthalpy_limit_j_per_kg = OpenStudio.convert(enthalpy_limit_btu_per_lb, 'Btu/lb', 'J/kg').get
      oa_control.setEconomizerMaximumLimitEnthalpy(enthalpy_limit_j_per_kg)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: additional economizer enthalpy limit = #{enthalpy_limit_btu_per_lb}Btu/lb")
    end
  when 'FixedEnthalpy'
    if enthalpy_limit_btu_per_lb
      enthalpy_limit_j_per_kg = OpenStudio.convert(enthalpy_limit_btu_per_lb, 'Btu/lb', 'J/kg').get
      oa_control.setEconomizerMaximumLimitEnthalpy(enthalpy_limit_j_per_kg)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, enthalpy limit = #{enthalpy_limit_btu_per_lb}Btu/lb")
    end
  when 'FixedDewPointAndDryBulb'
    if drybulb_limit_f && dewpoint_limit_f
      drybulb_limit_c = OpenStudio.convert(drybulb_limit_f, 'F', 'C').get
      dewpoint_limit_c = OpenStudio.convert(dewpoint_limit_f, 'F', 'C').get
      oa_control.setEconomizerMaximumLimitDryBulbTemperature(drybulb_limit_c)
      oa_control.setEconomizerMaximumLimitDewpointTemperature(dewpoint_limit_c)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, dry bulb limit = #{drybulb_limit_f}F, dew-point limit = #{dewpoint_limit_f}F")
    end
  end

  return true
end

#air_loop_hvac_apply_energy_recovery_ventilator(air_loop_hvac, climate_zone) ⇒ Boolean

TODO:

Add exception logic for systems serving parking garage, warehouse, or multifamily

Add an ERV to this airloop

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1809

def air_loop_hvac_apply_energy_recovery_ventilator(air_loop_hvac, climate_zone)
  # Get the OA system
  oa_system = nil
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV cannot be added because the system has no OA intake.")
    return false
  end

  # Get the existing ERV or create an ERV and add it to the OA system
  erv = nil
  air_loop_hvac.supplyComponents.each do |supply_comp|
    if supply_comp.to_HeatExchangerAirToAirSensibleAndLatent.is_initialized
      erv = supply_comp.to_HeatExchangerAirToAirSensibleAndLatent.get
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, adjusting properties for existing ERV #{erv.name} instead of adding another one.")
    end
  end
  if erv.nil?
    erv = OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent.new(air_loop_hvac.model)
    erv.addToNode(oa_system.outboardOANode.get)
  end

  # Determine whether to use an ERV and HRV and heat exchanger style
  erv_type = air_loop_hvac_energy_recovery_ventilator_type(air_loop_hvac, climate_zone)
  heat_exchanger_type = air_loop_hvac_energy_recovery_ventilator_heat_exchanger_type(air_loop_hvac)
  erv.setName("#{air_loop_hvac.name} #{erv_type}")
  erv.setHeatExchangerType(heat_exchanger_type)

  # apply heat exchanger efficiencies
  air_loop_hvac_apply_energy_recovery_ventilator_efficiency(erv, erv_type: erv_type, heat_exchanger_type: heat_exchanger_type)

  # Apply the prototype heat exchanger power assumptions for rotary style heat exchangers
  heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_nominal_electric_power(erv)

  # add economizer lockout
  erv.setSupplyAirOutletTemperatureControl(true)
  erv.setEconomizerLockout(true)

  # add defrost
  erv.setFrostControlType('ExhaustOnly')
  erv.setThresholdTemperature(-23.3) # -10F
  erv.setInitialDefrostTimeFraction(0.167)
  erv.setRateofDefrostTimeFractionIncrease(1.44)

  # Add a setpoint manager OA pretreat to control the ERV
  spm_oa_pretreat = OpenStudio::Model::SetpointManagerOutdoorAirPretreat.new(air_loop_hvac.model)
  spm_oa_pretreat.setMinimumSetpointTemperature(-99.0)
  spm_oa_pretreat.setMaximumSetpointTemperature(99.0)
  spm_oa_pretreat.setMinimumSetpointHumidityRatio(0.00001)
  spm_oa_pretreat.setMaximumSetpointHumidityRatio(1.0)
  # Reference setpoint node and mixed air stream node are outlet node of the OA system
  mixed_air_node = oa_system.mixedAirModelObject.get.to_Node.get
  spm_oa_pretreat.setReferenceSetpointNode(mixed_air_node)
  spm_oa_pretreat.setMixedAirStreamNode(mixed_air_node)
  # Outdoor air node is the outboard OA node of the OA system
  spm_oa_pretreat.setOutdoorAirStreamNode(oa_system.outboardOANode.get)
  # Return air node is the inlet node of the OA system
  return_air_node = oa_system.returnAirModelObject.get.to_Node.get
  spm_oa_pretreat.setReturnAirStreamNode(return_air_node)
  # Attach to the outlet of the ERV
  erv_outlet = erv.primaryAirOutletModelObject.get.to_Node.get
  spm_oa_pretreat.addToNode(erv_outlet)

  # Determine if the system is a DOAS based on whether there is 100% OA in heating and cooling sizing.
  is_doas = false
  sizing_system = air_loop_hvac.sizingSystem
  if sizing_system.allOutdoorAirinCooling && sizing_system.allOutdoorAirinHeating
    is_doas = true
  end

  # Set the bypass control type
  # If DOAS system, BypassWhenWithinEconomizerLimits
  # to disable ERV during economizing.
  # Otherwise, BypassWhenOAFlowGreaterThanMinimum
  # to disable ERV during economizing and when OA
  # is also greater than minimum.
  bypass_ctrl_type = if is_doas
                       'BypassWhenWithinEconomizerLimits'
                     else
                       'BypassWhenOAFlowGreaterThanMinimum'
                     end
  oa_system.getControllerOutdoorAir.setHeatRecoveryBypassControlType(bypass_ctrl_type)

  return true
end

#air_loop_hvac_apply_energy_recovery_ventilator_efficiency(erv, erv_type: 'ERV', heat_exchanger_type: 'Rotary') ⇒ OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent

Apply efficiency values to the erv

Parameters:

  • erv (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    erv to apply efficiency values

  • erv_type (String) (defaults to: 'ERV')

    erv type ERV or HRV

  • heat_exchanger_type (String) (defaults to: 'Rotary')

    heat exchanger type Rotary or Plate

Returns:

  • (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    erv to apply efficiency values



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1902

def air_loop_hvac_apply_energy_recovery_ventilator_efficiency(erv, erv_type: 'ERV', heat_exchanger_type: 'Rotary')
  if erv.model.version < OpenStudio::VersionString.new('3.8.0')
    erv.setSensibleEffectivenessat100HeatingAirFlow(0.7)
    erv.setLatentEffectivenessat100HeatingAirFlow(0.6)
    erv.setSensibleEffectivenessat75HeatingAirFlow(0.7)
    erv.setLatentEffectivenessat75HeatingAirFlow(0.6)
    erv.setSensibleEffectivenessat100CoolingAirFlow(0.75)
    erv.setLatentEffectivenessat100CoolingAirFlow(0.6)
    erv.setSensibleEffectivenessat75CoolingAirFlow(0.75)
    erv.setLatentEffectivenessat75CoolingAirFlow(0.6)
  else
    values = Hash.new{|hash, key| hash[key] = Hash.new}
    values['Sensible Heating'][0.75] = 0.7
    values['Sensible Heating'][1.0] = 0.7
    values['Latent Heating'][0.75] = 0.6
    values['Latent Heating'][1.0] = 0.6
    values['Sensible Cooling'][0.75] = 0.75
    values['Sensible Cooling'][1.0] = 0.75
    values['Latent Cooling'][0.75] = 0.6
    values['Latent Cooling'][1.0] = 0.6
    erv = OpenstudioStandards::HVAC.heat_exchanger_air_to_air_set_effectiveness_values(erv, defaults: false, values: values)
  end
  return erv
end

#air_loop_hvac_apply_maximum_reheat_temperature(air_loop_hvac, max_reheat_c) ⇒ Boolean

Sets the maximum reheat temperature to the specified value for all reheat terminals (of any type) on the loop.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • max_reheat_c (Double)

    the maximum reheat temperature, in degrees Celsius

Returns:

  • (Boolean)

    returns true if successful, false if not



3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3566

def air_loop_hvac_apply_maximum_reheat_temperature(air_loop_hvac, max_reheat_c)
  air_loop_hvac.demandComponents.each do |sc|
    if sc.to_AirTerminalSingleDuctConstantVolumeReheat.is_initialized
      term = sc.to_AirTerminalSingleDuctConstantVolumeReheat.get
      term.setMaximumReheatAirTemperature(max_reheat_c)
    elsif sc.to_AirTerminalSingleDuctParallelPIUReheat.is_initialized
      # No control option available
    elsif sc.to_AirTerminalSingleDuctSeriesPIUReheat.is_initialized
      # No control option available
    elsif sc.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized
      term = sc.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
      term.setMaximumReheatAirTemperature(max_reheat_c)
    elsif sc.to_AirTerminalSingleDuctVAVReheat.is_initialized
      term = sc.to_AirTerminalSingleDuctVAVReheat.get
      term.setMaximumReheatAirTemperature(max_reheat_c)
    end
  end

  max_reheat_f = OpenStudio.convert(max_reheat_c, 'C', 'F').get
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: reheat terminal maximum set to #{max_reheat_f.round} F.")

  return true
end

#air_loop_hvac_apply_minimum_vav_damper_positions(air_loop_hvac, has_ddc = true) ⇒ Boolean

Set the minimum VAV damper positions.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • has_ddc (Boolean) (defaults to: true)

    if true, will assume that there is DDC control of vav terminals. If false, assumes otherwise.

Returns:

  • (Boolean)

    returns true if successful, false if not



2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2000

def air_loop_hvac_apply_minimum_vav_damper_positions(air_loop_hvac, has_ddc = true)
  air_loop_hvac.thermalZones.each do |zone|
    zone.equipment.each do |equip|
      if equip.to_AirTerminalSingleDuctVAVReheat.is_initialized
        zone_oa = OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone)
        vav_terminal = equip.to_AirTerminalSingleDuctVAVReheat.get
        air_terminal_single_duct_vav_reheat_apply_minimum_damper_position(vav_terminal, zone_oa, has_ddc)
      end
    end
  end

  return true
end

#air_loop_hvac_apply_multizone_vav_outdoor_air_sizing(air_loop_hvac) ⇒ Object

TODO:

move building-type-specific code to Prototype classes

Apply multizone vav outdoor air method and adjust multizone VAV damper positions to achieve a system minimum ventilation effectiveness of 0.6 per PNNL. Hard-size the resulting min OA into the sizing:system object.

return [Boolean] returns true if successful, false if not

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 11

def air_loop_hvac_apply_multizone_vav_outdoor_air_sizing(air_loop_hvac)
  # First time adjustment:
  # Only applies to multi-zone vav systems
  # exclusion: for Outpatient: (1) both AHU1 and AHU2 in 'DOE Ref Pre-1980' and 'DOE Ref 1980-2004'
  # (2) AHU1 in 2004-2019
  # @todo refactor: move building-type-specific code to Prototype classes
  if air_loop_hvac_multizone_vav_system?(air_loop_hvac) && !(air_loop_hvac.name.to_s.include? 'Outpatient F1')
    air_loop_hvac_adjust_minimum_vav_damper_positions(air_loop_hvac)
  end

  return true
end

#air_loop_hvac_apply_prm_baseline_controls(air_loop_hvac, climate_zone) ⇒ Boolean

Apply all PRM baseline required controls to the airloop. Only applies those controls that differ from the normal prescriptive controls, which are added via air_loop_hvac_apply_standard_controls(air_loop_hvac, climate_zone)

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 194

def air_loop_hvac_apply_prm_baseline_controls(air_loop_hvac, climate_zone)
  # Economizers
  if air_loop_hvac_prm_baseline_economizer_required?(air_loop_hvac, climate_zone)
    air_loop_hvac_apply_prm_baseline_economizer(air_loop_hvac, climate_zone)
  else
    # Make sure if economizer is not required then the OA controller should have No Economizer
    oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
    if oa_sys.is_initialized
      oa_sys.get.getControllerOutdoorAir.setEconomizerControlType('NoEconomizer')
    end
  end

  # Multizone VAV Systems
  if air_loop_hvac_multizone_vav_system?(air_loop_hvac)

    # VSD no Static Pressure Reset on all VAV systems
    # per G3.1.3.15
    air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac).each do |fan|
      if fan.to_FanVariableVolume.is_initialized
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Setting fan part load curve per G3.1.3.15.")
        OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Fixed Static Pressure Setpoint')
      end
    end

    # SAT Reset
    # G3.1.3.12 SAT reset required for all Multizone VAV systems,
    # even if not required by prescriptive section.
    air_loop_hvac_enable_supply_air_temperature_reset_warmest_zone(air_loop_hvac)

  end

  # Unoccupied shutdown
  occ_threshold = air_loop_hvac_unoccupied_threshold
  air_loop_hvac_enable_unoccupied_fan_shutoff(air_loop_hvac, occ_threshold)

  return true
end

#air_loop_hvac_apply_prm_baseline_economizer(air_loop_hvac, climate_zone) ⇒ Boolean

Apply the PRM economizer type and set temperature limits

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1443

def air_loop_hvac_apply_prm_baseline_economizer(air_loop_hvac, climate_zone)
  # EnergyPlus economizer types
  # 'NoEconomizer'
  # 'FixedDryBulb'
  # 'FixedEnthalpy'
  # 'DifferentialDryBulb'
  # 'DifferentialEnthalpy'
  # 'FixedDewPointAndDryBulb'
  # 'ElectronicEnthalpy'
  # 'DifferentialDryBulbAndEnthalpy'

  # Determine the type and limits
  economizer_type, drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f = air_loop_hvac_prm_economizer_type_and_limits(air_loop_hvac, climate_zone)

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir

  # Set the economizer type
  oa_control.setEconomizerControlType(economizer_type)

  # Reset the limits
  oa_control.resetEconomizerMaximumLimitDryBulbTemperature
  oa_control.resetEconomizerMaximumLimitEnthalpy
  oa_control.resetEconomizerMaximumLimitDewpointTemperature
  oa_control.resetEconomizerMinimumLimitDryBulbTemperature

  # Set the limits
  case economizer_type
  when 'FixedDryBulb'
    if drybulb_limit_f
      drybulb_limit_c = OpenStudio.convert(drybulb_limit_f, 'F', 'C').get
      oa_control.setEconomizerMaximumLimitDryBulbTemperature(drybulb_limit_c)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, dry bulb limit = #{drybulb_limit_f}F")
    end
  when 'FixedEnthalpy'
    if enthalpy_limit_btu_per_lb
      enthalpy_limit_j_per_kg = OpenStudio.convert(enthalpy_limit_btu_per_lb, 'Btu/lb', 'J/kg').get
      oa_control.setEconomizerMaximumLimitEnthalpy(enthalpy_limit_j_per_kg)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, enthalpy limit = #{enthalpy_limit_btu_per_lb}Btu/lb")
    end
  when 'FixedDewPointAndDryBulb'
    if drybulb_limit_f && dewpoint_limit_f
      drybulb_limit_c = OpenStudio.convert(drybulb_limit_f, 'F', 'C').get
      dewpoint_limit_c = OpenStudio.convert(dewpoint_limit_f, 'F', 'C').get
      oa_control.setEconomizerMaximumLimitDryBulbTemperature(drybulb_limit_c)
      oa_control.setEconomizerMaximumLimitDewpointTemperature(dewpoint_limit_c)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer type = #{economizer_type}, dry bulb limit = #{drybulb_limit_f}F, dew-point limit = #{dewpoint_limit_f}F")
    end
  end

  return true
end

#air_loop_hvac_apply_prm_baseline_fan_power(air_loop_hvac) ⇒ Object

TODO:

Figure out how to split fan power between multiple fans if the proposed model had multiple fans (supply, return, exhaust, etc.)

Calculate and apply the performance rating method baseline fan power to this air loop. Fan motor efficiency will be set, and then fan pressure rise adjusted so that the fan power is the maximum allowable. Also adjusts the fan power and flow rates of any parallel PIU terminals on the system. return [Boolean] true if successful, false if not

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 387

def air_loop_hvac_apply_prm_baseline_fan_power(air_loop_hvac)
  # Main AHU fans

  # Calculate the allowable fan motor bhp
  # for the entire airloop.
  allowable_fan_bhp = air_loop_hvac_allowable_system_brake_horsepower(air_loop_hvac)

  # Divide the allowable power evenly between the fans
  # on this airloop.
  all_fans = air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac)
  allowable_fan_bhp /= all_fans.size

  # Set the motor efficiencies
  # for all fans based on the calculated
  # allowed brake hp.  Then calculate the allowable
  # fan power for each fan and adjust
  # the fan pressure rise accordingly
  all_fans.each do |fan|
    fan_apply_standard_minimum_motor_efficiency(fan, allowable_fan_bhp)
    allowable_power_w = allowable_fan_bhp * 746 / fan.motorEfficiency
    fan_adjust_pressure_rise_to_meet_fan_power(fan, allowable_power_w)
  end

  # Fan powered terminal fans

  # Adjust each terminal fan
  air_loop_hvac.demandComponents.each do |dc|
    next if dc.to_AirTerminalSingleDuctParallelPIUReheat.empty?

    pfp_term = dc.to_AirTerminalSingleDuctParallelPIUReheat.get
    air_terminal_single_duct_parallel_piu_reheat_apply_prm_baseline_fan_power(pfp_term)
  end

  return true
end

#air_loop_hvac_apply_prm_sizing_temperatures(air_loop_hvac) ⇒ Boolean

Set the system sizing properties based on the zone sizing information

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3594

def air_loop_hvac_apply_prm_sizing_temperatures(air_loop_hvac)
  # Get the design heating and cooling SAT information
  # for all zones served by the system.
  htg_setpts_c = []
  clg_setpts_c = []
  air_loop_hvac.thermalZones.each do |zone|
    sizing_zone = zone.sizingZone
    htg_setpts_c << sizing_zone.zoneHeatingDesignSupplyAirTemperature
    clg_setpts_c << sizing_zone.zoneCoolingDesignSupplyAirTemperature
  end

  # Cooling SAT set to minimum zone cooling design SAT
  clg_sat_c = clg_setpts_c.min

  # If the system has terminal reheat,
  # heating SAT is set to the same value as cooling SAT
  # and the terminals are expected to do the heating.
  # If not, heating SAT set to maximum zone heating design SAT.
  has_term_rht = air_loop_hvac_terminal_reheat?(air_loop_hvac)
  htg_sat_c = if has_term_rht
                clg_sat_c
              else
                htg_setpts_c.max
              end

  # Set the central SAT values
  sizing_system = air_loop_hvac.sizingSystem
  sizing_system.setCentralCoolingDesignSupplyAirTemperature(clg_sat_c)
  sizing_system.setCentralHeatingDesignSupplyAirTemperature(htg_sat_c)

  clg_sat_f = OpenStudio.convert(clg_sat_c, 'C', 'F').get
  htg_sat_f = OpenStudio.convert(htg_sat_c, 'C', 'F').get
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: central heating SAT set to #{htg_sat_f.round} F, cooling SAT set to #{clg_sat_f.round} F.")

  # If it's a terminal reheat system, set the reheat terminal setpoints too
  if has_term_rht
    rht_c = htg_setpts_c.max
    air_loop_hvac_apply_maximum_reheat_temperature(air_loop_hvac, rht_c)
  end

  return true
end

#air_loop_hvac_apply_single_zone_controls(air_loop_hvac, climate_zone) ⇒ Boolean

Generate the EMS used to implement the economizer and staging controls for packaged single zone units.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2938

def air_loop_hvac_apply_single_zone_controls(air_loop_hvac, climate_zone)
  # These controls only apply to systems with DX cooling
  unless air_loop_hvac_dx_cooling?(air_loop_hvac)
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Single zone controls not applicable because no DX cooling.")
    return true
  end

  # Number of stages is determined by the template
  num_stages = air_loop_hvac_single_zone_controls_num_stages(air_loop_hvac, climate_zone)

  # If zero stages, no special control is required
  if num_stages.zero?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: No special economizer controls were modeled.")
    return true
  end

  # Fan control program only used for systems with two-stage DX coils
  fan_control = air_loop_hvac_multi_stage_dx_cooling?(air_loop_hvac)

  # Scrub special characters from the system name
  snc = OpenstudioStandards::HVAC.ems_friendly_name(air_loop_hvac.name)

  # Get the zone name
  zone = air_loop_hvac.thermalZones[0]
  zn_name_clean = OpenstudioStandards::HVAC.ems_friendly_name(zone.name)

  # Zone air node
  zone_air_node = zone.zoneAirNode

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  oa_node = oa_sys.outboardOANode.get

  # Get the name of the min oa schedule
  min_oa_sch = if oa_control.minimumOutdoorAirSchedule.is_initialized
                 oa_control.minimumOutdoorAirSchedule.get
               else
                 air_loop_hvac.model.alwaysOnDiscreteSchedule
               end

  # Create an economizer maximum OA fraction schedule with
  # a maximum of 70% to reflect damper leakage per PNNL
  max_oa_sch = set_maximum_fraction_outdoor_air_schedule(air_loop_hvac, oa_control, snc) unless air_loop_hvac_has_simple_transfer_air?(air_loop_hvac)

  # Get the supply fan
  if air_loop_hvac.supplyFan.empty?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: No supply fan found, cannot apply DX fan/economizer control.")
    return false
  end
  fan = air_loop_hvac.supplyFan.get

  # Supply outlet node
  sup_out_node = air_loop_hvac.supplyOutletNode

  # DX Cooling Coil
  dx_coil = nil
  air_loop_hvac.supplyComponents.each do |equip|
    if equip.to_CoilCoolingDXSingleSpeed.is_initialized
      dx_coil = equip.to_CoilCoolingDXSingleSpeed.get
    elsif equip.to_CoilCoolingDXTwoSpeed.is_initialized
      dx_coil = equip.to_CoilCoolingDXTwoSpeed.get
    end
  end
  if dx_coil.nil?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: No DX cooling coil found, cannot apply DX fan/economizer control.")
    return false
  end

  # Heating Coil
  htg_coil = nil
  air_loop_hvac.supplyComponents.each do |equip|
    if equip.to_CoilHeatingGas.is_initialized
      htg_coil = equip.to_CoilHeatingGas.get
    elsif equip.to_CoilHeatingElectric.is_initialized
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: electric heating coil was found, cannot apply DX fan/economizer control.")
      return false
    elsif equip.to_CoilHeatingWater.is_initialized
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: hot water heating coil was found found, cannot apply DX fan/economizer control.")
      return false
    end
  end
  if htg_coil.nil?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: No heating coil found, cannot apply DX fan/economizer control.")
    return false
  end

  ### EMS shared by both programs ###
  # Sensors
  oat_db_c_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Site Outdoor Air Drybulb Temperature')
  oat_db_c_sen.setName('OATF')
  oat_db_c_sen.setKeyName('Environment')

  oat_wb_c_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Site Outdoor Air Wetbulb Temperature')
  oat_wb_c_sen.setName('OAWBC')
  oat_wb_c_sen.setKeyName('Environment')

  oa_sch_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Schedule Value')
  oa_sch_sen.setName("#{snc}_OASch")
  oa_sch_sen.setKeyName(min_oa_sch.handle.to_s)

  oa_flow_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'System Node Mass Flow Rate')
  oa_flow_sen.setName("#{snc}_OAFlowMass")
  oa_flow_sen.setKeyName(oa_node.handle.to_s)

  dat_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'System Node Setpoint Temperature')
  dat_sen.setName("#{snc}_DATRqd")
  dat_sen.setKeyName(sup_out_node.handle.to_s)

  # Internal Variables
  oa_flow_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(air_loop_hvac.model, 'Outdoor Air Controller Minimum Mass Flow Rate')
  oa_flow_var.setName("#{snc}_OADesignMass")
  oa_flow_var.setInternalDataIndexKeyName(oa_control.handle.to_s)

  # Global Variables
  gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_NumberofStages")

  # Programs
  num_stg_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(air_loop_hvac.model)
  num_stg_prg.setName("#{snc}_SetNumberofStages")
  num_stg_prg_body = <<-EMS
    SET #{snc}_NumberofStages = #{num_stages}
  EMS
  num_stg_prg.setBody(num_stg_prg_body)

  # Program Calling Managers
  setup_mgr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(air_loop_hvac.model)
  setup_mgr.setName("#{snc}_SetNumberofStagesCallingManager")
  setup_mgr.setCallingPoint('BeginNewEnvironment')
  setup_mgr.addProgram(num_stg_prg)

  ### Fan Control ###
  if fan_control

    ### Economizer Control ###
    # Actuators
    econ_eff_act = OpenStudio::Model::EnergyManagementSystemActuator.new(max_oa_sch, 'Schedule:Year', 'Schedule Value')
    econ_eff_act.setName("#{snc}_TimestepEconEff")

    # Programs
    econ_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(air_loop_hvac.model)
    econ_prg.setName("#{snc}_EconomizerCTRLProg")
    econ_prg_body = <<-EMS
      SET #{econ_eff_act.handle} = 0.7
      SET MaxE = 0.7
      SET #{dat_sen.handle} = (#{dat_sen.handle}*1.8)+32
      SET OATF = (#{oat_db_c_sen.handle}*1.8)+32
      SET OAwbF = (#{oat_wb_c_sen.handle}*1.8)+32
      IF #{oa_flow_sen.handle} > (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
        SET EconoActive = 1
      ELSE
        SET EconoActive = 0
      ENDIF
      SET dTNeeded = 75-#{dat_sen.handle}
      SET CoolDesdT = ((98*0.15)+(75*(1-0.15)))-55
      SET CoolLoad = dTNeeded/ CoolDesdT
      IF CoolLoad > 1
        SET CoolLoad = 1
      ELSEIF CoolLoad < 0
        SET CoolLoad = 0
      ENDIF
      IF EconoActive == 1
        SET Stage = #{snc}_NumberofStages
        IF Stage == 2
          IF CoolLoad < 0.6
            SET #{econ_eff_act.handle} = MaxE
          ELSE
            SET ECOEff = 0-2.18919863612305
            SET ECOEff = ECOEff+(0-0.674461284910428*CoolLoad)
            SET ECOEff = ECOEff+(0.000459106275872404*(OATF^2))
            SET ECOEff = ECOEff+(0-0.00000484778537945252*(OATF^3))
            SET ECOEff = ECOEff+(0.182915713033586*OAwbF)
            SET ECOEff = ECOEff+(0-0.00382838660261133*(OAwbF^2))
            SET ECOEff = ECOEff+(0.0000255567460240583*(OAwbF^3))
            SET #{econ_eff_act.handle} = ECOEff
          ENDIF
        ELSE
          SET ECOEff = 2.36337942464462
          SET ECOEff = ECOEff+(0-0.409939515512619*CoolLoad)
          SET ECOEff = ECOEff+(0-0.0565205596792225*OAwbF)
          SET ECOEff = ECOEff+(0-0.0000632612294169389*(OATF^2))
          SET #{econ_eff_act.handle} = ECOEff+(0.000571724868775081*(OAwbF^2))
        ENDIF
        IF #{econ_eff_act.handle} > MaxE
          SET #{econ_eff_act.handle} = MaxE
        ELSEIF #{econ_eff_act.handle} < (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
          SET #{econ_eff_act.handle} = (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
        ENDIF
      ENDIF
    EMS
    econ_prg.setBody(econ_prg_body)

    # Program Calling Managers
    econ_mgr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(air_loop_hvac.model)
    econ_mgr.setName("#{snc}_EcoManager")
    econ_mgr.setCallingPoint('InsideHVACSystemIterationLoop')
    econ_mgr.addProgram(econ_prg)

    # Sensors
    zn_temp_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'System Node Temperature')
    zn_temp_sen.setName("#{zn_name_clean}_Temp")
    zn_temp_sen.setKeyName(zone_air_node.handle.to_s)

    htg_rtf_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Heating Coil Runtime Fraction')
    htg_rtf_sen.setName("#{snc}_HeatingRTF")
    htg_rtf_sen.setKeyName(htg_coil.handle.to_s)

    clg_rtf_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Cooling Coil Runtime Fraction')
    clg_rtf_sen.setName("#{snc}_RTF")
    clg_rtf_sen.setKeyName(dx_coil.handle.to_s)

    spd_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Coil System Compressor Speed Ratio')
    spd_sen.setName("#{snc}_SpeedRatio")
    spd_sen.setKeyName("#{dx_coil.handle} CoilSystem")

    # Internal Variables
    fan_pres_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(air_loop_hvac.model, 'Fan Nominal Pressure Rise')
    fan_pres_var.setName("#{snc}_FanDesignPressure")
    fan_pres_var.setInternalDataIndexKeyName(fan.handle.to_s)

    dsn_flow_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(air_loop_hvac.model, 'Outdoor Air Controller Maximum Mass Flow Rate')
    dsn_flow_var.setName("#{snc}_DesignFlowMass")
    dsn_flow_var.setInternalDataIndexKeyName(oa_control.handle.to_s)

    # Actuators
    fan_pres_act = OpenStudio::Model::EnergyManagementSystemActuator.new(fan, 'Fan', 'Fan Pressure Rise')
    fan_pres_act.setName("#{snc}_FanPressure")

    # Global Variables
    gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_FanPwrExp")
    gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_Stg1Spd")
    gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_Stg2Spd")
    gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_HeatSpeed")
    gvar = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(air_loop_hvac.model, "#{snc}_VenSpeed")

    # Programs
    fan_par_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(air_loop_hvac.model)
    fan_par_prg.setName("#{snc}_SetFanPar")
    fan_par_prg_body = <<-EMS
      IF #{snc}_NumberofStages == 1
        Return
      ENDIF
      SET #{snc}_FanPwrExp = 2.2
      SET OAFrac = #{oa_flow_sen.handle}/#{dsn_flow_var.handle}
      IF  OAFrac < 0.66
        SET #{snc}_VenSpeed = 0.66
        SET #{snc}_Stg1Spd = 0.66
      ELSE
        SET #{snc}_VenSpeed = OAFrac
        SET #{snc}_Stg1Spd = OAFrac
      ENDIF
      SET #{snc}_Stg2Spd = 1.0
      SET #{snc}_HeatSpeed = 1.0
    EMS
    fan_par_prg.setBody(fan_par_prg_body)

    fan_ctrl_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(air_loop_hvac.model)
    fan_ctrl_prg.setName("#{snc}_FanControl")
    fan_ctrl_prg_body = <<-EMS
      IF #{snc}_NumberofStages == 1
        Return
      ENDIF
      IF #{htg_rtf_sen.handle} > 0
        SET Heating = #{htg_rtf_sen.handle}
        SET Ven = 1-#{htg_rtf_sen.handle}
        SET Eco = 0
        SET Stage1 = 0
        SET Stage2 = 0
      ELSE
        SET Heating = 0
        SET EcoSpeed = #{snc}_VenSpeed
        IF #{spd_sen.handle} == 0
          IF #{clg_rtf_sen.handle} > 0
            SET Stage1 = #{clg_rtf_sen.handle}
            SET Stage2 = 0
            SET Ven = 1-#{clg_rtf_sen.handle}
            SET Eco = 0
            IF #{oa_flow_sen.handle} > (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
              SET #{snc}_Stg1Spd = 1.0
            ENDIF
          ELSE
            SET Stage1 = 0
            SET Stage2 = 0
            IF #{oa_flow_sen.handle} > (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
              SET Eco = 1.0
              SET Ven = 0
              !Calculate the expected discharge air temperature if the system runs at its low speed
              SET ExpDAT = #{dat_sen.handle}-(1-#{snc}_VenSpeed)*#{zn_temp_sen.handle}
              SET ExpDAT = ExpDAT/#{snc}_VenSpeed
              IF #{oat_db_c_sen.handle} > ExpDAT
                SET EcoSpeed = #{snc}_Stg2Spd
              ENDIF
            ELSE
              SET Eco = 0
              SET Ven = 1.0
            ENDIF
          ENDIF
        ELSE
          SET Stage1 = 1-#{spd_sen.handle}
          SET Stage2 = #{spd_sen.handle}
          SET Ven = 0
          SET Eco = 0
          IF #{oa_flow_sen.handle} > (#{oa_flow_var.handle}*#{oa_sch_sen.handle})
            SET #{snc}_Stg1Spd = 1.0
          ENDIF
        ENDIF
      ENDIF
      ! For each mode (percent time in mode)*(fanSpeer^PwrExp) is the contribution to weighted fan power over time step
      SET FPR = Ven*(#{snc}_VenSpeed ^ #{snc}_FanPwrExp)
      SET FPR = FPR+Eco*(EcoSpeed^#{snc}_FanPwrExp)
      SET FPR1 = Stage1*(#{snc}_Stg1Spd^#{snc}_FanPwrExp)
      SET FPR = FPR+FPR1
      SET FPR2 = Stage2*(#{snc}_Stg2Spd^#{snc}_FanPwrExp)
      SET FPR = FPR+FPR2
      SET FPR3 = Heating*(#{snc}_HeatSpeed^#{snc}_FanPwrExp)
      SET FanPwrRatio = FPR+ FPR3
      ! system fan power is directly proportional to static pressure so this change linearly adjusts fan energy for speed control
      SET #{fan_pres_act.handle} = #{fan_pres_var.handle}*FanPwrRatio
    EMS
    fan_ctrl_prg.setBody(fan_ctrl_prg_body)

    # Program Calling Managers
    # Note that num_stg_prg must be listed before fan_par_prg
    # because it initializes a variable used by fan_par_prg.
    setup_mgr.addProgram(fan_par_prg)

    fan_ctrl_mgr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(air_loop_hvac.model)
    fan_ctrl_mgr.setName("#{snc}_FanMainManager")
    fan_ctrl_mgr.setCallingPoint('BeginTimestepBeforePredictor')
    fan_ctrl_mgr.addProgram(fan_ctrl_prg)

  end

  return true
end

#air_loop_hvac_apply_standard_controls(air_loop_hvac, climate_zone) ⇒ Boolean

TODO:

optimum start

TODO:

night damper shutoff

TODO:

nightcycle control

TODO:

night fan shutoff

Apply all standard required controls to the airloop

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if successful, false if not



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 33

def air_loop_hvac_apply_standard_controls(air_loop_hvac, climate_zone)
  # Unoccupied shutdown
  # Apply this before ERV because it modifies annual hours of operation which can impact ERV requirements
  if air_loop_hvac_unoccupied_fan_shutoff_required?(air_loop_hvac)
    occ_threshold = air_loop_hvac_unoccupied_threshold
    air_loop_hvac_enable_unoccupied_fan_shutoff(air_loop_hvac, min_occ_pct = occ_threshold)
  else
    air_loop_hvac.setAvailabilitySchedule(air_loop_hvac.model.alwaysOnDiscreteSchedule)
  end

  # Energy Recovery Ventilation
  if air_loop_hvac_energy_recovery_ventilator_required?(air_loop_hvac, climate_zone)
    air_loop_hvac_apply_energy_recovery_ventilator(air_loop_hvac, climate_zone)
  end

  # Economizers
  air_loop_hvac_apply_economizer_limits(air_loop_hvac, climate_zone)
  air_loop_hvac_apply_economizer_integration(air_loop_hvac, climate_zone)

  # Multizone VAV Systems
  if air_loop_hvac_multizone_vav_system?(air_loop_hvac)

    # VAV Reheat Control
    air_loop_hvac_apply_vav_damper_action(air_loop_hvac)

    # Multizone VAV Optimization
    # This rule does not apply to two hospital and one outpatient systems
    unless (@instvarbuilding_type == 'Hospital' && (air_loop_hvac.name.to_s.include?('VAV_ER') || air_loop_hvac.name.to_s.include?('VAV_ICU') ||
           air_loop_hvac.name.to_s.include?('VAV_OR') || air_loop_hvac.name.to_s.include?('VAV_LABS') ||
           air_loop_hvac.name.to_s.include?('VAV_PATRMS'))) ||
           (@instvarbuilding_type == 'Outpatient' && air_loop_hvac.name.to_s.include?('Outpatient F1'))
      if air_loop_hvac_multizone_vav_optimization_required?(air_loop_hvac, climate_zone)
        air_loop_hvac_enable_multizone_vav_optimization(air_loop_hvac)
      else
        air_loop_hvac_disable_multizone_vav_optimization(air_loop_hvac)
      end
    end

    # Static Pressure Reset
    # Per 5.2.2.16 (Halverson et al 2014), all multiple zone VAV systems are assumed to have DDC for all years of DOE 90.1 prototypes, so the has_ddc is not used any more.
    air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac).each do |fan|
      if fan.to_FanVariableVolume.is_initialized
        plr_req = fan_variable_volume_part_load_fan_power_limitation?(fan)
        # Part Load Fan Pressure Control
        if plr_req
          vsd_curve_type = air_loop_hvac_set_vsd_curve_type
          OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: vsd_curve_type)
        # No Part Load Fan Pressure Control
        else
          OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Discharge Dampers')
        end
      else
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{fan}: This is not a multizone VAV fan system.")
      end
    end

    ## # Static Pressure Reset
    ## # assume no systems have DDC control of VAV terminals
    ## has_ddc = false
    ## spr_req = air_loop_hvac_static_pressure_reset_required?(air_loop_hvac, template, has_ddc)
    ## air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac).each do |fan|
    ##   if fan.to_FanVariableVolume.is_initialized
    ##     plr_req = fan_variable_volume_part_load_fan_power_limitation?(fan, template)
    ##     # Part Load Fan Pressure Control & Static Pressure Reset
    ##     if plr_req && spr_req
    ##       OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Static Pressure Setpoint Reset')
    ##     # Part Load Fan Pressure Control only
    ##     elsif plr_req && !spr_req
    ##       OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Fixed Static Pressure Setpoint')
    ##     # Static Pressure Reset only
    ##     elsif !plr_req && spr_req
    ##       OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Fixed Static Pressure Setpoint')
    ##     # No Control Required
    ##     else
    ##       OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Multi Zone VAV with Airfoil or Backward Incline riding the curve')
    ##     end
    ##   else
    ##     OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "For #{name}: there is a constant volume fan on a multizone vav system.  Cannot apply static pressure reset controls.")
    ##   end
    ## end
  end

  # DCV
  if air_loop_hvac_demand_control_ventilation_required?(air_loop_hvac, climate_zone)
    air_loop_hvac_enable_demand_control_ventilation(air_loop_hvac, climate_zone)
    # For systems that require DCV,
    # all individual zones that require DCV preserve
    # both per-area and per-person OA requirements.
    # Other zones have OA requirements converted
    # to per-area values only so DCV performance is only
    # based on the subset of zones that required DCV.
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Converting ventilation requirements to per-area for all zones served that do not require DCV.")
    air_loop_hvac.thermalZones.sort.each do |zone|
      unless thermal_zone_demand_control_ventilation_required?(zone, climate_zone)
        OpenstudioStandards::ThermalZone.thermal_zone_convert_outdoor_air_to_per_area(zone)
      end
    end
  end

  # SAT reset
  if air_loop_hvac_supply_air_temperature_reset_required?(air_loop_hvac, climate_zone)
    reset_type = air_loop_hvac_supply_air_temperature_reset_type(air_loop_hvac)
    case reset_type
      when 'warmest_zone'
        air_loop_hvac_enable_supply_air_temperature_reset_warmest_zone(air_loop_hvac)
      when 'oa'
        air_loop_hvac_enable_supply_air_temperature_reset_outdoor_temperature(air_loop_hvac)
      else
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "No SAT reset for #{air_loop_hvac.name}.")
    end
  end

  # Motorized OA damper
  if air_loop_hvac_motorized_oa_damper_required?(air_loop_hvac, climate_zone)
    # Assume that the availability schedule has already been
    # set to reflect occupancy and use this for the OA damper.
    occ_threshold = air_loop_hvac_unoccupied_threshold
    air_loop_hvac_add_motorized_oa_damper(air_loop_hvac, occ_threshold, air_loop_hvac.availabilitySchedule)
  else
    air_loop_hvac_remove_motorized_oa_damper(air_loop_hvac)
  end

  # Optimum Start
  air_loop_hvac_enable_optimum_start(air_loop_hvac) if air_loop_hvac_optimum_start_required?(air_loop_hvac)

  # Single zone systems
  if air_loop_hvac.thermalZones.size == 1
    air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac).each do |fan|
      if fan.to_FanVariableVolume.is_initialized
        OpenstudioStandards::HVAC.fan_variable_volume_set_control_type(fan, control_type: 'Single Zone VAV')
      end
    end
    air_loop_hvac_apply_single_zone_controls(air_loop_hvac, climate_zone)
  end

  # Standby mode occupancy control
  unless air_loop_hvac.thermalZones.empty?
    thermal_zones = air_loop_hvac.thermalZones

    standby_mode_spaces = []
    thermal_zones.sort.each do |thermal_zone|
      thermal_zone.spaces.sort.each do |space|
        if space_occupancy_standby_mode_required?(space)
          standby_mode_spaces << space
        end
      end
    end

    if !standby_mode_spaces.empty?
      air_loop_hvac_standby_mode_occupancy_control(air_loop_hvac, standby_mode_spaces)
    end
  end
end

#air_loop_hvac_apply_vav_damper_action(air_loop_hvac) ⇒ Boolean

TODO:

see if this impacts the sizing run.

Set the VAV damper control to single maximum or dual maximum control depending on the standard.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2703

def air_loop_hvac_apply_vav_damper_action(air_loop_hvac)
  damper_action = air_loop_hvac_vav_damper_action(air_loop_hvac)

  # Interpret this as an EnergyPlus input
  damper_action_eplus = nil
  if damper_action == 'Single Maximum'
    damper_action_eplus = 'Normal'
  elsif damper_action == 'Dual Maximum'
    # EnergyPlus 8.7 changed the meaning of 'Reverse'.
    # For versions of OpenStudio using E+ 8.6 or lower
    damper_action_eplus = if air_loop_hvac.model.version < OpenStudio::VersionString.new('2.0.5')
                            'Reverse'
                          # For versions of OpenStudio using E+ 8.7 or higher
                          else
                            'ReverseWithLimits'
                          end
  end

  # Set the control for any VAV reheat terminals on this airloop.
  control_type_set = false
  air_loop_hvac.demandComponents.each do |equip|
    if equip.to_AirTerminalSingleDuctVAVReheat.is_initialized
      term = equip.to_AirTerminalSingleDuctVAVReheat.get
      # Dual maximum only applies to terminals with HW reheat coils
      if damper_action == 'Dual Maximum'
        if term.reheatCoil.to_CoilHeatingWater.is_initialized
          term.setDamperHeatingAction(damper_action_eplus)
          control_type_set = true
          term.setMaximumFlowFractionDuringReheat(0.5)
        end
      else
        term.setDamperHeatingAction(damper_action_eplus)
        control_type_set = true
      end
    end
  end

  if control_type_set
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: VAV damper action was set to #{damper_action} control.")
  end

  return true
end

#air_loop_hvac_data_center_area_served(air_loop_hvac) ⇒ Double

TODO:

Add an is_data_center field to the standards space type spreadsheet instead of relying on the standards space type name to identify a data center.

Determine how much data center area the airloop serves.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    the area of data center is served in m^2.



3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3519

def air_loop_hvac_data_center_area_served(air_loop_hvac)
  dc_area_m2 = 0.0

  air_loop_hvac.thermalZones.each do |zone|
    zone.spaces.each do |space|
      # Skip spaces with no space type
      next if space.spaceType.empty?

      space_type = space.spaceType.get

      # Skip spaces with no standards space type
      next if space_type.standardsSpaceType.empty?

      standards_space_type = space_type.standardsSpaceType.get
      # Counts as a data center if the name includes 'data'
      if standards_space_type.downcase.include?('data center') || standards_space_type.downcase.include?('datacenter')
        dc_area_m2 += space.floorArea
      end
      std_bldg_type = space.spaceType.get.standardsBuildingType.get
      if std_bldg_type.downcase.include?('datacenter') && standards_space_type.downcase.include?('computerroom')
        dc_area_m2 += space.floorArea
      end
    end
  end

  return dc_area_m2
end

#air_loop_hvac_dcv_required_when_erv(air_loop_hvac) ⇒ Boolean

Determine if the standard has an exception for demand control ventilation when an energy recovery device is present. Defaults to true.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



2430
2431
2432
2433
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2430

def air_loop_hvac_dcv_required_when_erv(air_loop_hvac)
  dcv_required_when_erv_present = false
  return dcv_required_when_erv_present
end

#air_loop_hvac_demand_control_ventilation_limits(air_loop_hvac) ⇒ Array<Double>

Determines the OA flow rates above which an economizer is required. Two separate rates, one for systems with an economizer and another for systems without. Defaults to pre-1980 logic, where the limits are zero for both types.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Array<Double>)

    [min_oa_without_economizer_cfm, min_oa_with_economizer_cfm]



2419
2420
2421
2422
2423
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2419

def air_loop_hvac_demand_control_ventilation_limits(air_loop_hvac)
  min_oa_without_economizer_cfm = 0
  min_oa_with_economizer_cfm = 0
  return [min_oa_without_economizer_cfm, min_oa_with_economizer_cfm]
end

#air_loop_hvac_demand_control_ventilation_required?(air_loop_hvac, climate_zone) ⇒ Boolean

TODO:

Add exception logic for systems that serve multifamily, parking garage, warehouse

Determine if demand control ventilation (DCV) is required for this air loop.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2336

def air_loop_hvac_demand_control_ventilation_required?(air_loop_hvac, climate_zone)
  dcv_required = false

  # OA flow limits
  min_oa_without_economizer_cfm, min_oa_with_economizer_cfm = air_loop_hvac_demand_control_ventilation_limits(air_loop_hvac)

  # If the limits are zero for both, DCV not required
  if min_oa_without_economizer_cfm.zero? && min_oa_with_economizer_cfm.zero?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{template} #{climate_zone}:  #{air_loop_hvac.name}: DCV is not required for any system.")
    return dcv_required
  end

  # Check if the system has an ERV
  if air_loop_hvac_energy_recovery?(air_loop_hvac)
    # May or may not be required for systems that have an ERV
    if air_loop_hvac_dcv_required_when_erv(air_loop_hvac)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV may be required although the system has Energy Recovery.")
    else
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV is not required since the system has Energy Recovery.")
      return dcv_required
    end
  end

  # Get the min OA flow rate
  oa_flow_m3_per_s = 0
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    if controller_oa.minimumOutdoorAirFlowRate.is_initialized
      oa_flow_m3_per_s = controller_oa.minimumOutdoorAirFlowRate.get
    elsif controller_oa.autosizedMinimumOutdoorAirFlowRate.is_initialized
      oa_flow_m3_per_s = controller_oa.autosizedMinimumOutdoorAirFlowRate.get
    end
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, DCV not applicable because it has no OA intake.")
    return dcv_required
  end
  oa_flow_cfm = OpenStudio.convert(oa_flow_m3_per_s, 'm^3/s', 'cfm').get

  # Check for min OA without an economizer OR has economizer
  if oa_flow_cfm < min_oa_without_economizer_cfm && air_loop_hvac_economizer?(air_loop_hvac) == false
    # Message if doesn't pass OA limit
    if oa_flow_cfm < min_oa_without_economizer_cfm
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV is not required since the system min oa flow is #{oa_flow_cfm.round} cfm, less than the minimum of #{min_oa_without_economizer_cfm.round} cfm.")
    end
    # Message if doesn't have economizer
    if air_loop_hvac_economizer?(air_loop_hvac) == false
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV is not required since the system does not have an economizer.")
    end
    return dcv_required
  end

  # If has economizer, cfm limit is lower
  if oa_flow_cfm < min_oa_with_economizer_cfm && air_loop_hvac_economizer?(air_loop_hvac)
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV is not required since the system has an economizer, but the min oa flow is #{oa_flow_cfm.round} cfm, less than the minimum of #{min_oa_with_economizer_cfm.round} cfm for systems with an economizer.")
    return dcv_required
  end

  # Check area and density limits
  # for all of zones on the loop
  any_zones_req_dcv = false
  air_loop_hvac.thermalZones.sort.each do |zone|
    if thermal_zone_demand_control_ventilation_required?(zone, climate_zone)
      any_zones_req_dcv = true
      break
    end
  end
  unless any_zones_req_dcv
    return dcv_required
  end

  # If here, DCV is required
  dcv_required = true

  return dcv_required
end

#air_loop_hvac_disable_multizone_vav_optimization(air_loop_hvac) ⇒ Boolean

Disable multizone vav optimization by changing the Outdoor Air Method in the Controller:MechanicalVentilation object to 'ZoneSum'

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1969

def air_loop_hvac_disable_multizone_vav_optimization(air_loop_hvac)
  # Disable multizone vav optimization
  # at each timestep.
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    controller_mv = controller_oa.controllerMechanicalVentilation
    controller_mv.setSystemOutdoorAirMethod('ZoneSum')
    controller_oa.autosizeMinimumOutdoorAirFlowRate
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, cannot disable multizone vav optimization because the system has no OA intake.")
    return false
  end
end

#air_loop_hvac_dx_cooling?(air_loop_hvac) ⇒ Boolean

Determine if this Air Loop uses DX cooling.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if uses DX cooling, false if not



3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3666

def air_loop_hvac_dx_cooling?(air_loop_hvac)
  dx_clg = false

  # Check for all DX coil types
  dx_types = [
    'OS_Coil_Cooling_DX_MultiSpeed',
    'OS_Coil_Cooling_DX_SingleSpeed',
    'OS_Coil_Cooling_DX_TwoSpeed',
    'OS_Coil_Cooling_DX_TwoStageWithHumidityControlMode',
    'OS_Coil_Cooling_DX_VariableRefrigerantFlow',
    'OS_Coil_Cooling_DX_VariableSpeed',
    'OS_CoilSystem_Cooling_DX_HeatExchangerAssisted'
  ]

  air_loop_hvac.supplyComponents.each do |component|
    # Get the object type, getting the internal coil
    # type if inside a unitary system.
    obj_type = component.iddObjectType.valueName.to_s
    case obj_type
    when 'OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass'
      component = component.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir'
      component = component.to_AirLoopHVACUnitaryHeatPumpAirToAir.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeed'
      component = component.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitarySystem'
      component = component.to_AirLoopHVACUnitarySystem.get
      if component.coolingCoil.is_initialized
        obj_type = component.coolingCoil.get.iddObjectType.valueName.to_s
      end
    end
    # See if the object type is a DX coil
    if dx_types.include?(obj_type)
      dx_clg = true
      break # Stop if find a DX coil
    end
  end

  return dx_clg
end

#air_loop_hvac_economizer?(air_loop_hvac) ⇒ Boolean

Determine if the system has an economizer

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2574

def air_loop_hvac_economizer?(air_loop_hvac)
  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  economizer_type = oa_control.getEconomizerControlType

  # Return false if no economizer is present
  return false if economizer_type == 'NoEconomizer'

  return true
end

#air_loop_hvac_economizer_limits(air_loop_hvac, climate_zone) ⇒ Array<Double>

Determine the limits for the type of economizer present on the AirLoopHVAC, if any.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Array<Double>)

    [drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f]



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1106

def air_loop_hvac_economizer_limits(air_loop_hvac, climate_zone)
  drybulb_limit_f = nil
  enthalpy_limit_btu_per_lb = nil
  dewpoint_limit_f = nil

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return [nil, nil, nil] unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  economizer_type = oa_control.getEconomizerControlType

  case economizer_type
  when 'NoEconomizer'
    return [nil, nil, nil]
  when 'FixedDryBulb'
    # Process climate zone:
    # Moisture regime is not needed for climate zone 8
    climate_zone = climate_zone.split('-')[-1]
    climate_zone = '8' if climate_zone.include?('8')

    search_criteria = {
      'template' => template,
      'climate_zone' => climate_zone
    }
    econ_limits = model_find_object(standards_data['economizers'], search_criteria)
    drybulb_limit_f = econ_limits['fixed_dry_bulb_high_limit_shutoff_temp']
  when 'FixedEnthalpy'
    enthalpy_limit_btu_per_lb = 28.0
  when 'FixedDewPointAndDryBulb'
    drybulb_limit_f = 75.0
    dewpoint_limit_f = 55.0
  end

  return [drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f]
end

#air_loop_hvac_economizer_required?(air_loop_hvac, climate_zone) ⇒ Boolean

Determine whether or not this system is required to have an economizer.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if an economizer is required, false if not



949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 949

def air_loop_hvac_economizer_required?(air_loop_hvac, climate_zone)
  economizer_required = false

  # skip systems without outdoor air
  return economizer_required unless air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized

  # Determine if the system serves residential spaces
  is_res = false
  if air_loop_hvac_residential_area_served(air_loop_hvac) > 0
    is_res = true
  end

  # Determine if the airloop serves any computer rooms
  # / data centers, which changes the economizer.
  is_dc = false
  if air_loop_hvac_data_center_area_served(air_loop_hvac) > 0
    is_dc = true
  end

  # Process climate zone:
  # Moisture regime is not needed for climate zone 8
  climate_zone = climate_zone.split('-')[-1]
  climate_zone = '8' if climate_zone.include?('8')

  # Retrieve economizer limits from JSON
  search_criteria = {
    'template' => template,
    'climate_zone' => climate_zone,
    'data_center' => is_dc
  }
  econ_limits = model_find_object(standards_data['economizers'], search_criteria)
  if econ_limits.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "Cannot find economizer limits for template '#{template}' and climate zone '#{climate_zone}', assuming no economizer required.")
    return economizer_required
  end

  # Determine the minimum capacity and whether or not it is a data center
  minimum_capacity_btu_per_hr = econ_limits['minimum_capacity']

  # A big number of btu per hr as the minimum requirement if nil in spreadsheet
  infinity_btu_per_hr = 999_999_999_999
  minimum_capacity_btu_per_hr = infinity_btu_per_hr if minimum_capacity_btu_per_hr.nil?

  # Exception valid for 90.1-2004 (6.5.1.(e)) through 90.1-2019 (6.5.1.4)
  if is_res
    minimum_capacity_btu_per_hr *= 5
  end

  # Check whether the system requires an economizer by comparing
  # the system capacity to the minimum capacity.
  total_cooling_capacity_w = air_loop_hvac_total_cooling_capacity(air_loop_hvac)
  total_cooling_capacity_btu_per_hr = OpenStudio.convert(total_cooling_capacity_w, 'W', 'Btu/hr').get

  if total_cooling_capacity_btu_per_hr >= minimum_capacity_btu_per_hr
    if is_dc
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} requires an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr exceeds the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr for data centers.")
    elsif is_res
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} requires an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr exceeds the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr for residential spaces.")
    else
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} requires an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr exceeds the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr.")
    end
    economizer_required = true
  else
    if is_dc
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} does not require an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr is less than the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr for data centers.")
    elsif is_res
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} requires an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr exceeds the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr for residential spaces.")
    else
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} does not require an economizer because the total cooling capacity of #{total_cooling_capacity_btu_per_hr.round} Btu/hr is less than the minimum capacity of #{minimum_capacity_btu_per_hr.round} Btu/hr.")
    end
  end

  return economizer_required
end

#air_loop_hvac_economizer_type_allowable?(air_loop_hvac, climate_zone) ⇒ Boolean

Check the economizer type currently specified in the ControllerOutdoorAir object on this air loop is acceptable per the standard. Defaults to 90.1-2007 logic.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if allowable, if the system has no economizer or no OA system Returns false if the economizer type is not allowable.



1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1564

def air_loop_hvac_economizer_type_allowable?(air_loop_hvac, climate_zone)
  # EnergyPlus economizer types
  # 'NoEconomizer'
  # 'FixedDryBulb'
  # 'FixedEnthalpy'
  # 'DifferentialDryBulb'
  # 'DifferentialEnthalpy'
  # 'FixedDewPointAndDryBulb'
  # 'ElectronicEnthalpy'
  # 'DifferentialDryBulbAndEnthalpy'

  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return true unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir
  economizer_type = oa_control.getEconomizerControlType

  # Return true if no economizer is present
  return true if economizer_type == 'NoEconomizer'

  # Determine the prohibited types
  prohibited_types = []
  case climate_zone
  when 'ASHRAE 169-2006-0B',
       'ASHRAE 169-2006-1B',
       'ASHRAE 169-2006-2B',
       'ASHRAE 169-2006-3B',
       'ASHRAE 169-2006-3C',
       'ASHRAE 169-2006-4B',
       'ASHRAE 169-2006-4C',
       'ASHRAE 169-2006-5B',
       'ASHRAE 169-2006-6B',
       'ASHRAE 169-2006-7A',
       'ASHRAE 169-2006-7B',
       'ASHRAE 169-2006-8A',
       'ASHRAE 169-2006-8B',
       'ASHRAE 169-2013-0B',
       'ASHRAE 169-2013-1B',
       'ASHRAE 169-2013-2B',
       'ASHRAE 169-2013-3B',
       'ASHRAE 169-2013-3C',
       'ASHRAE 169-2013-4B',
       'ASHRAE 169-2013-4C',
       'ASHRAE 169-2013-5B',
       'ASHRAE 169-2013-6B',
       'ASHRAE 169-2013-7A',
       'ASHRAE 169-2013-7B',
       'ASHRAE 169-2013-8A',
       'ASHRAE 169-2013-8B'
    prohibited_types = ['FixedEnthalpy']
  when 'ASHRAE 169-2006-0A',
       'ASHRAE 169-2006-1A',
       'ASHRAE 169-2006-2A',
       'ASHRAE 169-2006-3A',
       'ASHRAE 169-2006-4A',
       'ASHRAE 169-2013-0A',
       'ASHRAE 169-2013-1A',
       'ASHRAE 169-2013-2A',
       'ASHRAE 169-2013-3A',
       'ASHRAE 169-2013-4A'
    prohibited_types = ['DifferentialDryBulb']
  when 'ASHRAE 169-2006-5A',
       'ASHRAE 169-2006-6A',
       'ASHRAE 169-2013-5A',
       'ASHRAE 169-2013-6A'
    prohibited_types = []
  end

  # Check if the specified type is allowed
  economizer_type_allowed = true
  if prohibited_types.include?(economizer_type)
    economizer_type_allowed = false
  end

  return economizer_type_allowed
end

#air_loop_hvac_enable_demand_control_ventilation(air_loop_hvac, climate_zone) ⇒ Boolean

Enable demand control ventilation (DCV) for this air loop. Zones on this loop that require DCV preserve both per-area and per-person OA reqs. Other zones have OA reqs converted to per-area values only so that DCV won't impact these zones.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2442

def air_loop_hvac_enable_demand_control_ventilation(air_loop_hvac, climate_zone)
  # Get the OA intake
  controller_oa = nil
  controller_mv = nil
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    controller_mv = controller_oa.controllerMechanicalVentilation
    if controller_mv.demandControlledVentilation == true
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: DCV was already enabled.")
      return true
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Could not enable DCV since the system has no OA intake.")
    return false
  end

  # Change the min flow rate in the controller outdoor air
  controller_oa.setMinimumOutdoorAirFlowRate(0.0)

  # Enable DCV in the controller mechanical ventilation
  controller_mv.setDemandControlledVentilation(true)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Enabled DCV.")

  return true
end

#air_loop_hvac_enable_multizone_vav_optimization(air_loop_hvac) ⇒ Boolean

Enable multizone vav optimization by changing the Outdoor Air Method in the Controller:MechanicalVentilation object to 'VentilationRateProcedure'

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1944

def air_loop_hvac_enable_multizone_vav_optimization(air_loop_hvac)
  # Enable multizone vav optimization
  # at each timestep.
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    controller_mv = controller_oa.controllerMechanicalVentilation
    if air_loop_hvac.model.version < OpenStudio::VersionString.new('3.3.0')
      controller_mv.setSystemOutdoorAirMethod('VentilationRateProcedure')
    else
      controller_mv.setSystemOutdoorAirMethod('Standard62.1VentilationRateProcedureWithLimit')
    end
    # Change the min flow rate in the controller outdoor air
    controller_oa.setMinimumOutdoorAirFlowRate(0.0)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, cannot enable multizone vav optimization because the system has no OA intake.")
    return false
  end
end

#air_loop_hvac_enable_optimum_start(air_loop_hvac) ⇒ Boolean

Adds optimum start control to the airloop.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 272

def air_loop_hvac_enable_optimum_start(air_loop_hvac)
  # Get the heating and cooling setpoint schedules
  # for all zones on this airloop.
  htg_clg_schs = []
  air_loop_hvac.thermalZones.each do |zone|
    # Skip zones with no thermostat
    next if zone.thermostatSetpointDualSetpoint.empty?

    # Get the heating and cooling setpoint schedules
    tstat = zone.thermostatSetpointDualSetpoint.get
    htg_sch = nil
    if tstat.heatingSetpointTemperatureSchedule.is_initialized
      htg_sch = tstat.heatingSetpointTemperatureSchedule.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{zone.name}: Cannot find a heating setpoint schedule for this zone, cannot apply optimum start control.")
      next
    end
    clg_sch = nil
    if tstat.coolingSetpointTemperatureSchedule.is_initialized
      clg_sch = tstat.coolingSetpointTemperatureSchedule.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{zone.name}: Cannot find a cooling setpoint schedule for this zone, cannot apply optimum start control.")
      next
    end
    htg_clg_schs << [htg_sch, clg_sch]
  end

  # Clean name of airloop
  loop_name_clean = OpenstudioStandards::HVAC.ems_friendly_name(air_loop_hvac.name)

  # Sensors
  oat_db_c_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(air_loop_hvac.model, 'Site Outdoor Air Drybulb Temperature')
  oat_db_c_sen.setName('OAT')
  oat_db_c_sen.setKeyName('Environment')

  # Make a program for each unique set of schedules.
  # For most air loops, all zones will have the same
  # pair of schedules.
  htg_clg_schs.uniq.each_with_index do |htg_clg_sch, i|
    htg_sch = htg_clg_sch[0]
    clg_sch = htg_clg_sch[1]

    if htg_sch.to_ScheduleConstant.is_initialized
      htg_sch_type = 'Schedule:Constant'
    elsif htg_sch.to_ScheduleCompact.is_initialized
      htg_sch_type = 'Schedule:Compact'
    else
      htg_sch_type = 'Schedule:Year'
    end

    if clg_sch.to_ScheduleCompact.is_initialized
      clg_sch_type = 'Schedule:Constant'
    elsif clg_sch.to_ScheduleCompact.is_initialized
      clg_sch_type = 'Schedule:Compact'
    else
      clg_sch_type = 'Schedule:Year'
    end

    # Actuators
    htg_sch_act = OpenStudio::Model::EnergyManagementSystemActuator.new(htg_sch, htg_sch_type, 'Schedule Value')
    htg_sch_act.setName("#{loop_name_clean}_HtgSch#{i}")

    clg_sch_act = OpenStudio::Model::EnergyManagementSystemActuator.new(clg_sch, clg_sch_type, 'Schedule Value')
    clg_sch_act.setName("#{loop_name_clean}_ClgSch#{i}")

    # Programs
    optstart_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(air_loop_hvac.model)
    optstart_prg.setName("#{loop_name_clean}_OptimumStartProg#{i}")
    optstart_prg_body = <<-EMS
    IF DaylightSavings==0 && DayOfWeek>1 && Hour==5 && #{oat_db_c_sen.handle}<23.9 && #{oat_db_c_sen.handle}>1.7
      SET #{clg_sch_act.handle} = 29.4
      SET #{htg_sch_act.handle} = 15.6
    ELSEIF DaylightSavings==0 && DayOfWeek==1 && Hour==7 && #{oat_db_c_sen.handle}<23.9 && #{oat_db_c_sen.handle}>1.7
      SET #{clg_sch_act.handle} = 29.4
      SET #{htg_sch_act.handle} = 15.6
    ELSEIF DaylightSavings==1 && DayOfWeek>1 && Hour==4 && #{oat_db_c_sen.handle}<23.9 && #{oat_db_c_sen.handle}>1.7
      SET #{clg_sch_act.handle} = 29.4
      SET #{htg_sch_act.handle} = 15.6
    ELSEIF DaylightSavings==1 && DayOfWeek==1 && Hour==6 && #{oat_db_c_sen.handle}<23.9 && #{oat_db_c_sen.handle}>1.7
      SET #{clg_sch_act.handle} = 29.4
      SET #{htg_sch_act.handle} = 15.6
    ELSE
      SET #{clg_sch_act.handle} = NULL
      SET #{htg_sch_act.handle} = NULL
    ENDIF
    EMS
    optstart_prg.setBody(optstart_prg_body)

    # Program Calling Managers
    setup_mgr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(air_loop_hvac.model)
    setup_mgr.setName("#{loop_name_clean}_OptimumStartCallingManager#{i}")
    setup_mgr.setCallingPoint('BeginTimestepBeforePredictor')
    setup_mgr.addProgram(optstart_prg)
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Optimum start control enabled.")

  return true
end

#air_loop_hvac_enable_supply_air_temperature_reset_delta(air_loop_hvac) ⇒ Double

Determines supply air temperature (SAT) temperature. Defaults to 90.1-2007, 5 delta-F (R)

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    the SAT reset amount in degrees Rankine



2519
2520
2521
2522
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2519

def air_loop_hvac_enable_supply_air_temperature_reset_delta(air_loop_hvac)
  sat_reset_r = 5.0
  return sat_reset_r
end

#air_loop_hvac_enable_supply_air_temperature_reset_outdoor_temperature(air_loop_hvac) ⇒ Boolean

Enable supply air temperature (SAT) reset based on outdoor air conditions. SAT will be kept at the current design temperature when outdoor air is above 70F, increased by 5F when outdoor air is below 50F, and reset linearly when outdoor air is between 50F and 70F.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2531

def air_loop_hvac_enable_supply_air_temperature_reset_outdoor_temperature(air_loop_hvac)
  # for AHU1 in Outpatient, SAT is 52F constant, no reset
  return true if air_loop_hvac.name.get == 'PVAV Outpatient F1'

  # Get the current setpoint and calculate
  # the new setpoint.
  sizing_system = air_loop_hvac.sizingSystem
  sat_at_hi_oat_c = sizing_system.centralCoolingDesignSupplyAirTemperature
  sat_at_hi_oat_f = OpenStudio.convert(sat_at_hi_oat_c, 'C', 'F').get
  # 5F increase when it's cold outside,
  # and therefore less cooling capacity is likely required.
  increase_f = air_loop_hvac_enable_supply_air_temperature_reset_delta(air_loop_hvac)
  sat_at_lo_oat_f = sat_at_hi_oat_f + increase_f
  sat_at_lo_oat_c = OpenStudio.convert(sat_at_lo_oat_f, 'F', 'C').get

  # Define the high and low outdoor air temperatures
  lo_oat_f = 50
  lo_oat_c = OpenStudio.convert(lo_oat_f, 'F', 'C').get
  hi_oat_f = 70
  hi_oat_c = OpenStudio.convert(hi_oat_f, 'F', 'C').get

  # Create a setpoint manager
  sat_oa_reset = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(air_loop_hvac.model)
  sat_oa_reset.setName("#{air_loop_hvac.name} SAT Reset")
  sat_oa_reset.setControlVariable('Temperature')
  sat_oa_reset.setSetpointatOutdoorLowTemperature(sat_at_lo_oat_c)
  sat_oa_reset.setOutdoorLowTemperature(lo_oat_c)
  sat_oa_reset.setSetpointatOutdoorHighTemperature(sat_at_hi_oat_c)
  sat_oa_reset.setOutdoorHighTemperature(hi_oat_c)

  # Attach the setpoint manager to the
  # supply outlet node of the system.
  sat_oa_reset.addToNode(air_loop_hvac.supplyOutletNode)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Supply air temperature reset was enabled.  When OAT is greater than #{hi_oat_f.round}F, SAT is #{sat_at_hi_oat_f.round}F.  When OAT is less than #{lo_oat_f.round}F, SAT is #{sat_at_lo_oat_f.round}F.  It varies linearly in between these points.")

  return true
end

#air_loop_hvac_enable_supply_air_temperature_reset_warmest_zone(air_loop_hvac) ⇒ Boolean

Enable supply air temperature (SAT) reset based on the cooling demand of the warmest zone.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2484

def air_loop_hvac_enable_supply_air_temperature_reset_warmest_zone(air_loop_hvac)
  # Get the current setpoint and calculate
  # the new setpoint.
  sizing_system = air_loop_hvac.sizingSystem
  design_sat_c = sizing_system.centralCoolingDesignSupplyAirTemperature
  design_sat_f = OpenStudio.convert(design_sat_c, 'C', 'F').get

  # Get the SAT reset delta
  sat_reset_r = air_loop_hvac_enable_supply_air_temperature_reset_delta(air_loop_hvac)
  sat_reset_k = OpenStudio.convert(sat_reset_r, 'R', 'K').get

  max_sat_f = design_sat_f + sat_reset_r
  max_sat_c = design_sat_c + sat_reset_k

  # Create a setpoint manager
  sat_warmest_reset = OpenStudio::Model::SetpointManagerWarmest.new(air_loop_hvac.model)
  sat_warmest_reset.setName("#{air_loop_hvac.name} SAT Warmest Reset")
  sat_warmest_reset.setStrategy('MaximumTemperature')
  sat_warmest_reset.setMinimumSetpointTemperature(design_sat_c)
  sat_warmest_reset.setMaximumSetpointTemperature(max_sat_c)

  # Attach the setpoint manager to the
  # supply outlet node of the system.
  sat_warmest_reset.addToNode(air_loop_hvac.supplyOutletNode)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Supply air temperature reset was enabled using a SPM Warmest with a min SAT of #{design_sat_f.round}F and a max SAT of #{max_sat_f.round}F.")

  return true
end

#air_loop_hvac_enable_unoccupied_fan_shutoff(air_loop_hvac, min_occ_pct = 0.05) ⇒ Boolean

Shut off the system during unoccupied periods. During these times, systems will cycle on briefly if temperature drifts below setpoint. If the system already has a schedule other than Always-On, no change will be made. If the system has an Always-On schedule assigned, a new schedule will be created. In this case, occupied is defined as the total percent occupancy for the loop for all zones served.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • min_occ_pct (Double) (defaults to: 0.05)

    the fractional value below which the system will be considered unoccupied.

Returns:

  • (Boolean)

    returns true if successful, false if not



3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3363

def air_loop_hvac_enable_unoccupied_fan_shutoff(air_loop_hvac, min_occ_pct = 0.05)
  # Set the system to night cycle
  # The fan of a parallel PIU terminal are set to only cycle during heating operation
  # This is achieved using the CycleOnAnyCoolingOrHeatingZone; During cooling operation
  # the load is met by running the central system which stays off during heating
  # operation
  air_loop_hvac.setNightCycleControlType('CycleOnAny')
  if air_loop_hvac_has_parallel_piu_air_terminals?(air_loop_hvac)
    avail_mgrs = air_loop_hvac.availabilityManagers
    if !avail_mgrs.nil?
      avail_mgrs.each do |avail_mgr|
        if avail_mgr.to_AvailabilityManagerNightCycle.is_initialized
          avail_mgr_nc = avail_mgr.to_AvailabilityManagerNightCycle.get
          avail_mgr_nc.setControlType('CycleOnAnyCoolingOrHeatingZone')
          zones = air_loop_hvac.thermalZones
          avail_mgr_nc.setCoolingControlThermalZones(zones)
          avail_mgr_nc.setHeatingZoneFansOnlyThermalZones(zones)
        end
      end
    end
  end

  model = air_loop_hvac.model
  # Check if schedule was stored in an additionalProperties field of the air loop
  air_loop_name = air_loop_hvac.name
  if air_loop_hvac.hasAdditionalProperties && air_loop_hvac.additionalProperties.hasFeature('fan_sched_name')
    fan_sched_name = air_loop_hvac.additionalProperties.getFeatureAsString('fan_sched_name').get
    fan_sched = model.getScheduleRulesetByName(fan_sched_name).get
    air_loop_hvac.setAvailabilitySchedule(fan_sched)
    return true
  end

  # Check if already using a schedule other than always on
  avail_sch = air_loop_hvac.availabilitySchedule
  unless avail_sch == air_loop_hvac.model.alwaysOnDiscreteSchedule
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Availability schedule is already set to #{avail_sch.name}.  Will assume this includes unoccupied shut down; no changes will be made.")
    return true
  end

  # Get the airloop occupancy schedule
  loop_occ_sch = air_loop_hvac_get_occupancy_schedule(air_loop_hvac, occupied_percentage_threshold: min_occ_pct)
  flh = OpenstudioStandards::Schedules.schedule_get_equivalent_full_load_hours(loop_occ_sch)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Annual occupied hours = #{flh.round} hr/yr, assuming a #{min_occ_pct} occupancy threshold.  This schedule will be used as the HVAC operation schedule.")

  # Set HVAC availability schedule to follow occupancy
  air_loop_hvac.setAvailabilitySchedule(loop_occ_sch)
  air_loop_hvac.supplyComponents.each do |comp|
    if comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.is_initialized
      comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get.setSupplyAirFanOperatingModeSchedule(loop_occ_sch)
    elsif comp.to_AirLoopHVACUnitarySystem.is_initialized
      comp.to_AirLoopHVACUnitarySystem.get.setSupplyAirFanOperatingModeSchedule(loop_occ_sch)
    end
  end

  return true
end

#air_loop_hvac_energy_recovery?(air_loop_hvac) ⇒ Boolean

Determine if the system has energy recovery already

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if an ERV is present, false if not



2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2664

def air_loop_hvac_energy_recovery?(air_loop_hvac)
  has_erv = false

  # Get the OA system
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  # Find any ERV on the OA system
  oa_sys = oa_sys.get
  oa_sys.oaComponents.each do |oa_comp|
    if oa_comp.to_HeatExchangerAirToAirSensibleAndLatent.is_initialized
      has_erv = true
    end
  end

  return has_erv
end

#air_loop_hvac_energy_recovery_ventilator_flow_limit(air_loop_hvac, climate_zone, pct_oa) ⇒ Double

Determine the airflow limits that govern whether or not an ERV is required. Based on climate zone and % OA. Defaults to DOE Ref Pre-1980, not required.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

  • pct_oa (Double)

    percentage of outdoor air

Returns:

  • (Double)

    the flow rate above which an ERV is required. if nil, ERV is never required.



1755
1756
1757
1758
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1755

def air_loop_hvac_energy_recovery_ventilator_flow_limit(air_loop_hvac, climate_zone, pct_oa)
  erv_cfm = nil # Not required
  return erv_cfm
end

#air_loop_hvac_energy_recovery_ventilator_heat_exchanger_type(air_loop_hvac) ⇒ String

Determine whether to use a Plate-Frame or Rotary Wheel style ERV depending on air loop outdoor air flow rate Defaults to Rotary.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:



1777
1778
1779
1780
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1777

def air_loop_hvac_energy_recovery_ventilator_heat_exchanger_type(air_loop_hvac)
  heat_exchanger_type = 'Rotary'
  return heat_exchanger_type
end

#air_loop_hvac_energy_recovery_ventilator_required?(air_loop_hvac, climate_zone) ⇒ Boolean

TODO:

Add exception logic for systems serving parking garage, warehouse, or multifamily

Check if ERV is required on this airloop.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1649

def air_loop_hvac_energy_recovery_ventilator_required?(air_loop_hvac, climate_zone)
  # ERV Not Applicable for AHUs that serve
  # parking garage, warehouse, or multifamily
  # if space_types_served_names.include?('PNNL_Asset_Rating_Apartment_Space_Type') ||
  # space_types_served_names.include?('PNNL_Asset_Rating_LowRiseApartment_Space_Type') ||
  # space_types_served_names.include?('PNNL_Asset_Rating_ParkingGarage_Space_Type') ||
  # space_types_served_names.include?('PNNL_Asset_Rating_Warehouse_Space_Type')
  # OpenStudio::logFree(OpenStudio::Info, "openstudio.standards.AirLoopHVAC", "For #{self.name}, ERV not applicable because it because it serves parking garage, warehouse, or multifamily.")
  # return false
  # end

  erv_required = nil
  # ERV not applicable for medical AHUs (AHU1 in Outpatient), per AIA 2001 - 7.31.D2.
  # @todo refactor: move building type specific code
  if air_loop_hvac.name.to_s.include? 'Outpatient F1'
    erv_required = false
    return erv_required
  end

  # ERV not applicable for medical AHUs, per AIA 2001 - 7.31.D2.
  if air_loop_hvac.name.to_s.include? 'VAV_ER'
    erv_required = false
    return erv_required
  elsif air_loop_hvac.name.to_s.include? 'VAV_OR'
    erv_required = false
    return erv_required
  end
  case template
  when '90.1-2004', '90.1-2007'
    # @todo Refactor figure out how to remove this.
    if air_loop_hvac.name.to_s.include? 'VAV_ICU'
      erv_required = false
      return erv_required
    elsif air_loop_hvac.name.to_s.include? 'VAV_PATRMS'
      erv_required = false
      return erv_required
    end
  end

  # ERV Not Applicable for AHUs that have DCV or that have no OA intake.
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    controller_mv = controller_oa.controllerMechanicalVentilation
    if controller_mv.demandControlledVentilation == true
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV not applicable because DCV enabled.")
      return false
    end
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV not applicable because it has no OA intake.")
    return false
  end

  # Get the AHU design supply air flow rate
  dsn_flow_m3_per_s = nil
  if air_loop_hvac.designSupplyAirFlowRate.is_initialized
    dsn_flow_m3_per_s = air_loop_hvac.designSupplyAirFlowRate.get
  elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
    dsn_flow_m3_per_s = air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} design supply air flow rate is not available, cannot apply efficiency standard.")
    return false
  end
  dsn_flow_cfm = OpenStudio.convert(dsn_flow_m3_per_s, 'm^3/s', 'cfm').get

  # Get the minimum OA flow rate
  min_oa_flow_m3_per_s = nil
  if controller_oa.minimumOutdoorAirFlowRate.is_initialized
    min_oa_flow_m3_per_s = controller_oa.minimumOutdoorAirFlowRate.get
  elsif controller_oa.autosizedMinimumOutdoorAirFlowRate.is_initialized
    min_oa_flow_m3_per_s = controller_oa.autosizedMinimumOutdoorAirFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{controller_oa.name}: minimum OA flow rate is not available, cannot apply efficiency standard.")
    return false
  end
  min_oa_flow_cfm = OpenStudio.convert(min_oa_flow_m3_per_s, 'm^3/s', 'cfm').get

  # Calculate the percent OA at design airflow
  pct_oa = min_oa_flow_m3_per_s / dsn_flow_m3_per_s

  # Determine the airflow limit
  erv_cfm = air_loop_hvac_energy_recovery_ventilator_flow_limit(air_loop_hvac, climate_zone, pct_oa)

  # Determine if an ERV is required
  if erv_cfm.nil?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV not required based on #{(pct_oa * 100).round}% OA flow, design supply air flow of #{dsn_flow_cfm.round}cfm, and climate zone #{climate_zone}.")
    erv_required = false
  elsif dsn_flow_cfm < erv_cfm
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV not required based on #{(pct_oa * 100).round}% OA flow, design supply air flow of #{dsn_flow_cfm.round}cfm, and climate zone #{climate_zone}. Does not exceed minimum flow requirement of #{erv_cfm}cfm.")
    erv_required = false
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV required based on #{(pct_oa * 100).round}% OA flow, design supply air flow of #{dsn_flow_cfm.round}cfm, and climate zone #{climate_zone}. Exceeds minimum flow requirement of #{erv_cfm}cfm.")
    erv_required = true
  end

  return erv_required
end

#air_loop_hvac_energy_recovery_ventilator_type(air_loop_hvac, climate_zone) ⇒ String

Determine whether to apply an Energy Recovery Ventilator 'ERV' or a Heat Recovery Ventilator 'HRV' depending on the climate zone Defaults to ERV.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:



1767
1768
1769
1770
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1767

def air_loop_hvac_energy_recovery_ventilator_type(air_loop_hvac, climate_zone)
  erv_type = 'ERV'
  return erv_type
end

#air_loop_hvac_fan_power_limitation_pressure_drop_adjustment_brake_horsepower(air_loop_hvac) ⇒ Double

TODO:

Determine the presence of MERV filters and other stuff in Table 6.5.3.1.1B. May need to extend AirLoopHVAC data model

Determine the fan power limitation pressure drop adjustment Per Table 6.5.3.1.1B

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    fan power limitation pressure drop adjustment, in units of horsepower



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 429

def air_loop_hvac_fan_power_limitation_pressure_drop_adjustment_brake_horsepower(air_loop_hvac)
  # Get design supply air flow rate (whether autosized or hard-sized)
  dsn_air_flow_m3_per_s = 0
  dsn_air_flow_cfm = 0
  if air_loop_hvac.designSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.designSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Hard sized Design Supply Air Flow Rate.")
  elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Autosized Design Supply Air Flow Rate.")
  end

  # @todo determine the presence of MERV filters and other stuff
  # in Table 6.5.3.1.1B
  # perhaps need to extend AirLoopHVAC data model
  has_fully_ducted_return_and_or_exhaust_air_systems = false
  has_merv_9_through_12 = false
  has_merv_13_through_15 = false

  # Calculate Fan Power Limitation Pressure Drop Adjustment (in wc)
  fan_pwr_adjustment_in_wc = 0

  # Fully ducted return and/or exhaust air systems
  if has_fully_ducted_return_and_or_exhaust_air_systems
    adj_in_wc = 0.5
    fan_pwr_adjustment_in_wc += adj_in_wc
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "--Added #{adj_in_wc} in wc for Fully ducted return and/or exhaust air systems")
  end

  # MERV 9 through 12
  if has_merv_9_through_12
    adj_in_wc = 0.5
    fan_pwr_adjustment_in_wc += adj_in_wc
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "--Added #{adj_in_wc} in wc for Particulate Filtration Credit: MERV 9 through 12")
  end

  # MERV 13 through 15
  if has_merv_13_through_15
    adj_in_wc = 0.9
    fan_pwr_adjustment_in_wc += adj_in_wc
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "--Added #{adj_in_wc} in wc for Particulate Filtration Credit: MERV 13 through 15")
  end

  # Convert the pressure drop adjustment to brake horsepower (bhp)
  # assuming that all supply air passes through all devices
  fan_pwr_adjustment_bhp = fan_pwr_adjustment_in_wc * dsn_air_flow_cfm / 4131
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Fan Power Limitation Pressure Drop Adjustment = #{fan_pwr_adjustment_bhp.round(2)} bhp")

  return fan_pwr_adjustment_bhp
end

#air_loop_hvac_find_design_supply_air_flow_rate(air_loop_hvac) ⇒ Double

find design_supply_air_flow_rate

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    design supply air flow rate in m^3/s



3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3472

def air_loop_hvac_find_design_supply_air_flow_rate(air_loop_hvac)
  # Get the design_supply_air_flow_rate
  design_supply_air_flow_rate = nil
  if air_loop_hvac.designSupplyAirFlowRate.is_initialized
    design_supply_air_flow_rate = air_loop_hvac.designSupplyAirFlowRate.get
  elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
    design_supply_air_flow_rate = air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} design supply air flow rate is not available.")
  end

  return design_supply_air_flow_rate
end

#air_loop_hvac_floor_area_served(air_loop_hvac) ⇒ Object

Calculate the total floor area of all zones attached to the air loop, in m^2.

return [Double] the total floor area of all zones attached to the air loop in m^2.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop



3424
3425
3426
3427
3428
3429
3430
3431
3432
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3424

def air_loop_hvac_floor_area_served(air_loop_hvac)
  total_area = 0.0

  air_loop_hvac.thermalZones.each do |zone|
    total_area += zone.floorArea
  end

  return total_area
end

#air_loop_hvac_floor_area_served_exterior_zones(air_loop_hvac) ⇒ Object

Calculate the total floor area of all zones attached to the air loop that have at least one exterior surface, in m^2.

return [Double] the total floor area of all zones attached to the air loop in m^2.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop



3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3455

def air_loop_hvac_floor_area_served_exterior_zones(air_loop_hvac)
  total_area = 0.0

  air_loop_hvac.thermalZones.each do |zone|
    # Skip zones that have no exterior surface area
    next if zone.exteriorSurfaceArea.zero?

    total_area += zone.floorArea
  end

  return total_area
end

#air_loop_hvac_floor_area_served_interior_zones(air_loop_hvac) ⇒ Object

Calculate the total floor area of all zones attached to the air loop that have no exterior surfaces, in m^2.

return [Double] the total floor area of all zones attached to the air loop in m^2.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop



3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3438

def air_loop_hvac_floor_area_served_interior_zones(air_loop_hvac)
  total_area = 0.0

  air_loop_hvac.thermalZones.each do |zone|
    # Skip zones that have exterior surface area
    next if zone.exteriorSurfaceArea > 0

    total_area += zone.floorArea
  end

  return total_area
end

#air_loop_hvac_get_occupancy_schedule(air_loop_hvac, occupied_percentage_threshold: 0.05) ⇒ ScheduleRuleset

This method creates a new discrete fractional schedule ruleset. The value is set to one when occupancy across all zones is greater than or equal to the occupied_percentage_threshold, and zero all other times. This method is designed to use the total number of people on the airloop, so if there is a zone that is continuously occupied by a few people, but other zones that are intermittently occupied by many people, the first zone doesn't drive the entire system.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • occupied_percentage_threshold (Double) (defaults to: 0.05)

    the minimum fraction (0 to 1) that counts as occupied

Returns:

  • (ScheduleRuleset)

    a ScheduleRuleset where 0 = unoccupied, 1 = occupied



2925
2926
2927
2928
2929
2930
2931
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2925

def air_loop_hvac_get_occupancy_schedule(air_loop_hvac, occupied_percentage_threshold: 0.05)
  # Create combined occupancy schedule of every space in every zone served by this airloop
  sch_ruleset = OpenstudioStandards::ThermalZone.thermal_zones_get_occupancy_schedule(air_loop_hvac.thermalZones,
                                                                                      sch_name: "#{air_loop_hvac.name} Occ Sch",
                                                                                      occupied_percentage_threshold: occupied_percentage_threshold)
  return sch_ruleset
end

#air_loop_hvac_get_relief_fan_power(air_loop) ⇒ Double

Get relief fan power for airloop

Parameters:

  • air_loop (OpenStudio::Model::AirLoopHVAC)

    AirLoopHVAC object

Returns:

  • (Double)

    Fan power



3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3843

def air_loop_hvac_get_relief_fan_power(air_loop)
  relief_fan_power = 0

  if air_loop.reliefFan.is_initialized
    # Get return fan
    fan = air_loop.reliefFan.get

    # Get fan object
    if fan.to_FanConstantVolume.is_initialized
      fan = fan.to_FanConstantVolume.get
    elsif fan.to_FanVariableVolume.is_initialized
      fan = fan.to_FanVariableVolume.get
    elsif fan.to_FanOnOff.is_initialized
      fan = fan.to_FanOnOff.get
    end

    # Get fan power
    relief_fan_power += fan_fanpower(fan)
  end

  return relief_fan_power
end

#air_loop_hvac_get_return_fan_power(air_loop) ⇒ Double

Get return fan power for airloop

Parameters:

  • air_loop (OpenStudio::Model::AirLoopHVAC)

    AirLoopHVAC object

Returns:

  • (Double)

    Fan power



3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3758

def air_loop_hvac_get_return_fan_power(air_loop)
  return_fan_power = 0

  if air_loop.returnFan.is_initialized
    # Get return fan
    fan = air_loop.returnFan.get

    # Get fan object
    if fan.to_FanConstantVolume.is_initialized
      fan = fan.to_FanConstantVolume.get
    elsif fan.to_FanVariableVolume.is_initialized
      fan = fan.to_FanVariableVolume.get
    elsif fan.to_FanOnOff.is_initialized
      fan = fan.to_FanOnOff.get
    end

    # Get fan power
    return_fan_power += fan_fanpower(fan)
  end

  return return_fan_power
end

#air_loop_hvac_get_supply_fan(air_loop) ⇒ Object

Get supply fan for airloop

Parameters:

  • air_loop (OpenStudio::Model::AirLoopHVAC)

    AirLoopHVAC object

Returns:

  • fan



3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3803

def air_loop_hvac_get_supply_fan(air_loop)
  fan = nil
  if air_loop.supplyFan.is_initialized
    # Get return fan
    fan = air_loop.supplyFan.get

    # Get fan object
    if fan.to_FanConstantVolume.is_initialized
      fan = fan.to_FanConstantVolume.get
    elsif fan.to_FanVariableVolume.is_initialized
      fan = fan.to_FanVariableVolume.get
    elsif fan.to_FanOnOff.is_initialized
      fan = fan.to_FanOnOff.get
    end

  else
    air_loop.supplyComponents.each do |comp|
      if comp.to_AirLoopHVACUnitarySystem.is_initialized
        fan = comp.to_AirLoopHVACUnitarySystem.get.supplyFan
        next if fan.empty?

        # Get fan object
        fan = fan.get
        if fan.to_FanConstantVolume.is_initialized
          fan = fan.to_FanConstantVolume.get
        elsif fan.to_FanVariableVolume.is_initialized
          fan = fan.to_FanVariableVolume.get
        elsif fan.to_FanOnOff.is_initialized
          fan = fan.to_FanOnOff.get
        end
      end
    end
  end
  return fan
end

#air_loop_hvac_get_supply_fan_power(air_loop) ⇒ Double

Get supply fan power for airloop

Parameters:

  • air_loop (OpenStudio::Model::AirLoopHVAC)

    AirLoopHVAC object

Returns:

  • (Double)

    Fan power



3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3785

def air_loop_hvac_get_supply_fan_power(air_loop)
  supply_fan_power = 0

  # Get fan
  fan = air_loop_hvac_get_supply_fan(air_loop)

  if !fan.nil?
    # Get fan power
    supply_fan_power += fan_fanpower(fan)
  end

  return supply_fan_power
end

#air_loop_hvac_has_parallel_piu_air_terminals?(air_loop_hvac) ⇒ Boolean

Determine if the air loop serves parallel PIU air terminals

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)


3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3339

def air_loop_hvac_has_parallel_piu_air_terminals?(air_loop_hvac)
  has_parallel_piu_terminals = false
  air_loop_hvac.thermalZones.each do |zone|
    zone.equipment.each do |equipment|
      # Get the object type
      obj_type = equipment.iddObjectType.valueName.to_s
      if obj_type == 'OS_AirTerminal_SingleDuct_ParallelPIU_Reheat'
        return true
      end
    end
  end

  return has_parallel_piu_terminals
end

#air_loop_hvac_has_simple_transfer_air?(air_loop_hvac) ⇒ Boolean

Checks if zones served by the air loop use zone exhaust fan a simplified approach to model transfer air

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    OpenStudio AirLoopHVAC object

Returns:

  • (Boolean)

    true if simple transfer air is modeled, false otherwise



3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3901

def air_loop_hvac_has_simple_transfer_air?(air_loop_hvac)
  simple_transfer_air = false
  zones = air_loop_hvac.thermalZones
  zones_name = []
  zones.each do |zone|
    zones_name << zone.name.to_s
  end
  air_loop_hvac.model.getFanZoneExhausts.sort.each do |exhaust_fan|
    if (zones_name.include? exhaust_fan.thermalZone.get.name.to_s) && exhaust_fan.balancedExhaustFractionSchedule.is_initialized
      simple_transfer_air = true
    end
  end
  return simple_transfer_air
end

#air_loop_hvac_humidifier_count(air_loop_hvac) ⇒ Integer

Determine how many humidifies are on the airloop

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Integer)

    the number of humidifiers



3551
3552
3553
3554
3555
3556
3557
3558
3559
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3551

def air_loop_hvac_humidifier_count(air_loop_hvac)
  humidifiers = 0
  air_loop_hvac.supplyComponents.each do |cmp|
    if cmp.to_HumidifierSteamElectric.is_initialized
      humidifiers += 1
    end
  end
  return humidifiers
end

#air_loop_hvac_include_cooling_coil?(air_loop_hvac) ⇒ Boolean

Determine if the airloop includes cooling coils

Returns:

  • (Boolean)

    returns true if cooling coils are included on the airloop



1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1196

def air_loop_hvac_include_cooling_coil?(air_loop_hvac)
  air_loop_hvac.supplyComponents.each do |comp|
    return true if comp.to_CoilCoolingWater.is_initialized
    return true if comp.to_CoilCoolingWater.is_initialized
    return true if comp.to_CoilCoolingCooledBeam.is_initialized
    return true if comp.to_CoilCoolingDXMultiSpeed.is_initialized
    return true if comp.to_CoilCoolingDXSingleSpeed.is_initialized
    return true if comp.to_CoilCoolingDXTwoSpeed.is_initialized
    return true if comp.to_CoilCoolingDXTwoStageWithHumidityControlMode.is_initialized
    return true if comp.to_CoilCoolingDXVariableRefrigerantFlow.is_initialized
    return true if comp.to_CoilCoolingDXVariableSpeed.is_initialized
    return true if comp.to_CoilCoolingFourPipeBeam.is_initialized
    return true if comp.to_CoilCoolingLowTempRadiantConstFlow.is_initialized
    return true if comp.to_CoilCoolingLowTempRadiantVarFlow.is_initialized
    return true if comp.to_CoilCoolingWater.is_initialized
    return true if comp.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
    return true if comp.to_CoilCoolingWaterToAirHeatPumpVariableSpeedEquationFit.is_initialized

    if comp.to_AirLoopHVACUnitarySystem.is_initialized
      unitary_system = comp.to_AirLoopHVACUnitarySystem.get
      if unitary_system.coolingCoil.is_initialized
        cooling_coil = unitary_system.coolingCoil.get
        return true if cooling_coil.to_CoilCoolingWater.is_initialized
        return true if cooling_coil.to_CoilCoolingWater.is_initialized
        return true if cooling_coil.to_CoilCoolingCooledBeam.is_initialized
        return true if cooling_coil.to_CoilCoolingDXMultiSpeed.is_initialized
        return true if cooling_coil.to_CoilCoolingDXSingleSpeed.is_initialized
        return true if cooling_coil.to_CoilCoolingDXTwoSpeed.is_initialized
        return true if cooling_coil.to_CoilCoolingDXTwoStageWithHumidityControlMode.is_initialized
        return true if cooling_coil.to_CoilCoolingDXVariableRefrigerantFlow.is_initialized
        return true if cooling_coil.to_CoilCoolingDXVariableSpeed.is_initialized
        return true if cooling_coil.to_CoilCoolingFourPipeBeam.is_initialized
        return true if cooling_coil.to_CoilCoolingLowTempRadiantConstFlow.is_initialized
        return true if cooling_coil.to_CoilCoolingLowTempRadiantVarFlow.is_initialized
        return true if cooling_coil.to_CoilCoolingWater.is_initialized
        return true if cooling_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
        return true if cooling_coil.to_CoilCoolingWaterToAirHeatPumpVariableSpeedEquationFit.is_initialized
      end
    end
  end
  return false
end

#air_loop_hvac_include_economizer?(air_loop_hvac) ⇒ Boolean

Determine if the airloop includes an air-economizer

Returns:

  • (Boolean)

    returns true if the airloop has an air-economizer



1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1253

def air_loop_hvac_include_economizer?(air_loop_hvac)
  return false unless air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized

  # Get OA system
  air_loop_hvac_oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get

  # Get OA controller
  air_loop_hvac_oa_controller = air_loop_hvac_oa_system.getControllerOutdoorAir

  # Get economizer type
  economizer_type = air_loop_hvac_oa_controller.getEconomizerControlType.to_s
  return false if economizer_type == 'NoEconomizer'

  return true
end

#air_loop_hvac_include_evaporative_cooler?(air_loop_hvac) ⇒ Boolean

Determine if the airloop includes evaporative coolers

Returns:

  • (Boolean)

    returns true if evaporative coolers are included on the airloop



1242
1243
1244
1245
1246
1247
1248
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1242

def air_loop_hvac_include_evaporative_cooler?(air_loop_hvac)
  air_loop_hvac.supplyComponents.each do |comp|
    return true if comp.to_EvaporativeCoolerDirectResearchSpecial.is_initialized
    return true if comp.to_EvaporativeCoolerIndirectResearchSpecial.is_initialized
  end
  return false
end

#air_loop_hvac_include_hydronic_cooling_coil?(air_loop_hvac) ⇒ Boolean

Determine if the airloop includes hydronic cooling coils

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if hydronic cooling coils are included on the airloop



1186
1187
1188
1189
1190
1191
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1186

def air_loop_hvac_include_hydronic_cooling_coil?(air_loop_hvac)
  air_loop_hvac.supplyComponents.each do |comp|
    return true if comp.to_CoilCoolingWater.is_initialized
  end
  return false
end

#air_loop_hvac_include_unitary_system?(air_loop_hvac) ⇒ Boolean

Determine if the air loop includes a unitary system

Returns:

  • (Boolean)

    returns true if a unitary system is included on the air loop



1289
1290
1291
1292
1293
1294
1295
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1289

def air_loop_hvac_include_unitary_system?(air_loop_hvac)
  air_loop_hvac.supplyComponents.each do |comp|
    return true if comp.to_AirLoopHVACUnitarySystem.is_initialized
  end

  return false
end

#air_loop_hvac_include_wshp?(air_loop_hvac) ⇒ Boolean

Determine if the airloop includes WSHP cooling coils

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if WSHP cooling coils are included on the airloop



1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1273

def air_loop_hvac_include_wshp?(air_loop_hvac)
  air_loop_hvac.supplyComponents.each do |comp|
    return true if comp.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized

    if comp.to_AirLoopHVACUnitarySystem.is_initialized
      clg_coil = comp.to_AirLoopHVACUnitarySystem.get.coolingCoil.get
      return true if clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized

    end
  end
  return false
end

#air_loop_hvac_integrated_economizer_required?(air_loop_hvac, climate_zone) ⇒ Boolean

Determine if the system economizer must be integrated or not. Default logic is from 90.1-2004.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1303

def air_loop_hvac_integrated_economizer_required?(air_loop_hvac, climate_zone)
  # Determine if it is a VAV system
  is_vav = air_loop_hvac_vav_system?(air_loop_hvac)

  # Determine the number of zones the system serves
  num_zones_served = air_loop_hvac.thermalZones.size

  minimum_capacity_btu_per_hr = 65_000
  minimum_capacity_w = OpenStudio.convert(minimum_capacity_btu_per_hr, 'Btu/hr', 'W').get
  # 6.5.1.3 Integrated Economizer Control
  # Exception a, DX VAV systems
  if is_vav == true && num_zones_served > 1
    integrated_economizer_required = false
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: non-integrated economizer per 6.5.1.3 exception a, DX VAV system.")
    # Exception b, DX units less than 65,000 Btu/hr
  elsif air_loop_hvac_total_cooling_capacity(air_loop_hvac) < minimum_capacity_w
    integrated_economizer_required = false
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: non-integrated economizer per 6.5.1.3 exception b, DX system less than #{minimum_capacity_btu_per_hr}Btu/hr.")
  else
    # Exception c, Systems in climate zones 1,2,3a,4a,5a,5b,6,7,8
    case climate_zone
    when 'ASHRAE 169-2006-0A',
         'ASHRAE 169-2006-0B',
         'ASHRAE 169-2006-1A',
         'ASHRAE 169-2006-1B',
         'ASHRAE 169-2006-2A',
         'ASHRAE 169-2006-2B',
         'ASHRAE 169-2006-3A',
         'ASHRAE 169-2006-4A',
         'ASHRAE 169-2006-5A',
         'ASHRAE 169-2006-5B',
         'ASHRAE 169-2006-6A',
         'ASHRAE 169-2006-6B',
         'ASHRAE 169-2006-7A',
         'ASHRAE 169-2006-7B',
         'ASHRAE 169-2006-8A',
         'ASHRAE 169-2006-8B',
         'ASHRAE 169-2013-0A',
         'ASHRAE 169-2013-0B',
         'ASHRAE 169-2013-1A',
         'ASHRAE 169-2013-1B',
         'ASHRAE 169-2013-2A',
         'ASHRAE 169-2013-2B',
         'ASHRAE 169-2013-3A',
         'ASHRAE 169-2013-4A',
         'ASHRAE 169-2013-5A',
         'ASHRAE 169-2013-5B',
         'ASHRAE 169-2013-6A',
         'ASHRAE 169-2013-6B',
         'ASHRAE 169-2013-7A',
         'ASHRAE 169-2013-7B',
         'ASHRAE 169-2013-8A',
         'ASHRAE 169-2013-8B'
      integrated_economizer_required = false
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: non-integrated economizer per 6.5.1.3 exception c, climate zone #{climate_zone}.")
    when 'ASHRAE 169-2006-3B',
         'ASHRAE 169-2006-3C',
         'ASHRAE 169-2006-4B',
         'ASHRAE 169-2006-4C',
         'ASHRAE 169-2006-5C',
         'ASHRAE 169-2013-3B',
         'ASHRAE 169-2013-3C',
         'ASHRAE 169-2013-4B',
         'ASHRAE 169-2013-4C',
         'ASHRAE 169-2013-5C'
      integrated_economizer_required = true
    end
  end

  return integrated_economizer_required
end

#air_loop_hvac_minimum_zone_ventilation_efficiency(air_loop_hvac) ⇒ Object

Determine minimum ventilation efficiency for zones. This is used to decrease the overall system minimum OA flow rate such that a few zones do not drive the overall system OA flow rate too high.



1988
1989
1990
1991
1992
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1988

def air_loop_hvac_minimum_zone_ventilation_efficiency(air_loop_hvac)
  min_ventilation_efficiency = 0.6

  return min_ventilation_efficiency
end

#air_loop_hvac_motorized_oa_damper_limits(air_loop_hvac, climate_zone) ⇒ Array<Double>

Determine the air flow and number of story limits for whether motorized OA damper is required. Defaults to DOE Ref Pre-1980 logic (never required).

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Array<Double>)

    [minimum_oa_flow_cfm, maximum_stories]. If both nil, never required



2838
2839
2840
2841
2842
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2838

def air_loop_hvac_motorized_oa_damper_limits(air_loop_hvac, climate_zone)
  minimum_oa_flow_cfm = nil
  maximum_stories = nil
  return [minimum_oa_flow_cfm, maximum_stories]
end

#air_loop_hvac_motorized_oa_damper_required?(air_loop_hvac, climate_zone) ⇒ Boolean

Determine if a motorized OA damper is required

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2762

def air_loop_hvac_motorized_oa_damper_required?(air_loop_hvac, climate_zone)
  motorized_oa_damper_required = false

  # @todo refactor: Remove building type dependent logic
  if air_loop_hvac.name.to_s.include? 'Outpatient F1'
    motorized_oa_damper_required = true
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: always has a damper, the minimum OA schedule is the same as airloop availability schedule.")
    return motorized_oa_damper_required
  end

  # If the system has an economizer, it must have a motorized damper.
  if air_loop_hvac_economizer?(air_loop_hvac)
    motorized_oa_damper_required = true
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Because the system has an economizer, it requires a motorized OA damper.")
    return motorized_oa_damper_required
  end

  # Determine the exceptions based on
  # number of stories, climate zone, and
  # outdoor air intake rates.
  minimum_oa_flow_cfm, maximum_stories = air_loop_hvac_motorized_oa_damper_limits(air_loop_hvac, climate_zone)

  # Assuming that buildings not requiring this always
  # used backdraft gravity dampers
  if minimum_oa_flow_cfm.nil? && maximum_stories.nil?
    return motorized_oa_damper_required
  end

  # Get the number of stories
  num_stories = air_loop_hvac.model.getBuildingStorys.size

  # Check the number of stories exception,
  # which is climate-zone dependent.
  if num_stories < maximum_stories
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Motorized OA damper not required because the building has #{num_stories} stories, less than the minimum of #{maximum_stories} stories for climate zone #{climate_zone}.")
    return motorized_oa_damper_required
  end

  # Get the min OA flow rate
  oa_flow_m3_per_s = 0
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_system = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
    controller_oa = oa_system.getControllerOutdoorAir
    if controller_oa.minimumOutdoorAirFlowRate.is_initialized
      oa_flow_m3_per_s = controller_oa.minimumOutdoorAirFlowRate.get
    elsif controller_oa.autosizedMinimumOutdoorAirFlowRate.is_initialized
      oa_flow_m3_per_s = controller_oa.autosizedMinimumOutdoorAirFlowRate.get
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Could not determine the minimum OA flow rate, cannot determine if a motorized OA damper is required.")
      return motorized_oa_damper_required
    end
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, Motorized OA damper not applicable because it has no OA intake.")
    return motorized_oa_damper_required
  end
  oa_flow_cfm = OpenStudio.convert(oa_flow_m3_per_s, 'm^3/s', 'cfm').get

  # Check the OA flow rate exception
  if oa_flow_cfm < minimum_oa_flow_cfm
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Motorized OA damper not required because the system OA intake of #{oa_flow_cfm.round} cfm is less than the minimum threshold of #{minimum_oa_flow_cfm} cfm.")
    return motorized_oa_damper_required
  end

  # If here, motorized damper is required
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Motorized OA damper is required because the building has #{num_stories} stories which is greater than or equal to the minimum of #{maximum_stories} stories for climate zone #{climate_zone}, and the system OA intake of #{oa_flow_cfm.round} cfm is greater than or equal to the minimum threshold of #{minimum_oa_flow_cfm} cfm. ")
  motorized_oa_damper_required = true

  return motorized_oa_damper_required
end

#air_loop_hvac_multi_stage_dx_cooling?(air_loop_hvac) ⇒ Boolean

Determine if this Air Loop uses multi-stage DX cooling.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if uses multi-stage DX cooling, false if not



3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3714

def air_loop_hvac_multi_stage_dx_cooling?(air_loop_hvac)
  dx_clg = false

  # Check for all DX coil types
  dx_types = [
    'OS_Coil_Cooling_DX_MultiSpeed',
    'OS_Coil_Cooling_DX_TwoSpeed',
    'OS_Coil_Cooling_DX_TwoStageWithHumidityControlMode'
  ]

  air_loop_hvac.supplyComponents.each do |component|
    # Get the object type, getting the internal coil
    # type if inside a unitary system.
    obj_type = component.iddObjectType.valueName.to_s
    case obj_type
    when 'OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass'
      component = component.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir'
      component = component.to_AirLoopHVACUnitaryHeatPumpAirToAir.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeed'
      component = component.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get
      obj_type = component.coolingCoil.iddObjectType.valueName.to_s
    when 'OS_AirLoopHVAC_UnitarySystem'
      component = component.to_AirLoopHVACUnitarySystem.get
      if component.coolingCoil.is_initialized
        obj_type = component.coolingCoil.get.iddObjectType.valueName.to_s
      end
    end
    # See if the object type is a DX coil
    if dx_types.include?(obj_type)
      dx_clg = true
      break # Stop if find a DX coil
    end
  end

  return dx_clg
end

#air_loop_hvac_multizone_vav_optimization_required?(air_loop_hvac, climate_zone) ⇒ Boolean

TODO:

Add exception logic for systems with AIA healthcare ventilation requirements dual duct systems

Determine if multizone vav optimization is required. Defaults to 90.1-2007 logic, where it is not required.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



1934
1935
1936
1937
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1934

def air_loop_hvac_multizone_vav_optimization_required?(air_loop_hvac, climate_zone)
  multizone_opt_required = false
  return multizone_opt_required
end

#air_loop_hvac_multizone_vav_system?(air_loop_hvac) ⇒ Boolean

Determine if the system is a multizone VAV system

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if multizone vav, false if not



2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2620

def air_loop_hvac_multizone_vav_system?(air_loop_hvac)
  multizone_vav_system = false

  # Must serve more than 1 zone
  if air_loop_hvac.thermalZones.size < 2
    return multizone_vav_system
  end

  # Must be a variable volume system
  is_vav = air_loop_hvac_vav_system?(air_loop_hvac)
  if is_vav == false
    return multizone_vav_system
  end

  # If here, it's a multizone VAV system
  multizone_vav_system = true

  return multizone_vav_system
end

#air_loop_hvac_optimum_start_required?(air_loop_hvac) ⇒ Boolean

Determines if optimum start control is required. Defaults to 90.1-2004 logic, which requires optimum start if > 10,000 cfm

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 237

def air_loop_hvac_optimum_start_required?(air_loop_hvac)
  opt_start_required = false

  # data centers don't require optimum start as generally not occupied
  return opt_start_required if air_loop_hvac.name.to_s.include?('CRAH') ||
                               air_loop_hvac.name.to_s.include?('CRAC')

  # Get design supply air flow rate (whether autosized or hard-sized)
  dsn_air_flow_m3_per_s = 0
  dsn_air_flow_cfm = 0
  if air_loop_hvac.designSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.designSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Hard sized Design Supply Air Flow Rate.")
  elsif air_loop_hvac.autosizedDesignSupplyAirFlowRate.is_initialized
    dsn_air_flow_m3_per_s = air_loop_hvac.autosizedDesignSupplyAirFlowRate.get
    dsn_air_flow_cfm = OpenStudio.convert(dsn_air_flow_m3_per_s, 'm^3/s', 'cfm').get
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirLoopHVAC', "* #{dsn_air_flow_cfm.round} cfm = Autosized Design Supply Air Flow Rate.")
  end
  # Optimum start per 6.4.3.3.3, only required if > 10,000 cfm
  cfm_limit = 10_000
  if dsn_air_flow_cfm > cfm_limit
    opt_start_required = true
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Optimum start is required since design flow rate of #{dsn_air_flow_cfm.round} cfm exceeds the limit of #{cfm_limit} cfm.")
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Optimum start is not required since design flow rate of #{dsn_air_flow_cfm.round} cfm is below the limit of #{cfm_limit} cfm.")
  end

  return opt_start_required
end

#air_loop_hvac_prm_baseline_economizer_required?(air_loop_hvac, climate_zone) ⇒ Boolean

Determine if an economizer is required per the PRM. Default logic from 90.1-2007

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1381

def air_loop_hvac_prm_baseline_economizer_required?(air_loop_hvac, climate_zone)
  economizer_required = false

  # A big number of ft2 as the minimum requirement
  infinity_ft2 = 999_999_999_999
  min_int_area_served_ft2 = infinity_ft2
  min_ext_area_served_ft2 = infinity_ft2

  # Determine the minimum capacity that requires an economizer
  case climate_zone
  when 'ASHRAE 169-2006-0A',
       'ASHRAE 169-2006-0B',
       'ASHRAE 169-2006-1A',
       'ASHRAE 169-2006-1B',
       'ASHRAE 169-2006-2A',
       'ASHRAE 169-2006-3A',
       'ASHRAE 169-2006-4A',
       'ASHRAE 169-2013-0A',
       'ASHRAE 169-2013-0B',
       'ASHRAE 169-2013-1A',
       'ASHRAE 169-2013-1B',
       'ASHRAE 169-2013-2A',
       'ASHRAE 169-2013-3A',
       'ASHRAE 169-2013-4A'
    min_int_area_served_ft2 = infinity_ft2 # No requirement
    min_ext_area_served_ft2 = infinity_ft2 # No requirement
  else
    min_int_area_served_ft2 = 0 # Always required
    min_ext_area_served_ft2 = 0 # Always required
  end

  # Check whether the system requires an economizer by comparing
  # the system capacity to the minimum capacity.
  min_int_area_served_m2 = OpenStudio.convert(min_int_area_served_ft2, 'ft^2', 'm^2').get
  min_ext_area_served_m2 = OpenStudio.convert(min_ext_area_served_ft2, 'ft^2', 'm^2').get

  # Get the interior and exterior area served
  int_area_served_m2 = air_loop_hvac_floor_area_served_interior_zones(air_loop_hvac)
  ext_area_served_m2 = air_loop_hvac_floor_area_served_exterior_zones(air_loop_hvac)

  # Check the floor area exception
  if int_area_served_m2 < min_int_area_served_m2 && ext_area_served_m2 < min_ext_area_served_m2
    if min_int_area_served_ft2 == infinity_ft2 && min_ext_area_served_ft2 == infinity_ft2
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer not required for climate zone #{climate_zone}.")
    else
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer not required for because the interior area served of #{int_area_served_m2} ft2 is less than the minimum of #{min_int_area_served_m2} and the perimeter area served of #{ext_area_served_m2} ft2 is less than the minimum of #{min_ext_area_served_m2} for climate zone #{climate_zone}.")
    end
    return economizer_required
  end

  # If here, economizer required
  economizer_required = true
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Economizer required for the performance rating method baseline.")

  return economizer_required
end

#air_loop_hvac_prm_economizer_type_and_limits(air_loop_hvac, climate_zone) ⇒ Array<Double>

Determine the economizer type and limits for the the PRM Defaults to 90.1-2007 logic.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Array<Double>)

    [economizer_type, drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f]



1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1506

def air_loop_hvac_prm_economizer_type_and_limits(air_loop_hvac, climate_zone)
  economizer_type = 'NoEconomizer'
  drybulb_limit_f = nil
  enthalpy_limit_btu_per_lb = nil
  dewpoint_limit_f = nil

  case climate_zone
  when 'ASHRAE 169-2006-0B',
       'ASHRAE 169-2006-1B',
       'ASHRAE 169-2006-2B',
       'ASHRAE 169-2006-3B',
       'ASHRAE 169-2006-3C',
       'ASHRAE 169-2006-4B',
       'ASHRAE 169-2006-4C',
       'ASHRAE 169-2006-5B',
       'ASHRAE 169-2006-5C',
       'ASHRAE 169-2006-6B',
       'ASHRAE 169-2006-7B',
       'ASHRAE 169-2006-8A',
       'ASHRAE 169-2006-8B',
       'ASHRAE 169-2013-0B',
       'ASHRAE 169-2013-1B',
       'ASHRAE 169-2013-2B',
       'ASHRAE 169-2013-3B',
       'ASHRAE 169-2013-3C',
       'ASHRAE 169-2013-4B',
       'ASHRAE 169-2013-4C',
       'ASHRAE 169-2013-5B',
       'ASHRAE 169-2013-5C',
       'ASHRAE 169-2013-6B',
       'ASHRAE 169-2013-7B',
       'ASHRAE 169-2013-8A',
       'ASHRAE 169-2013-8B'
    economizer_type = 'FixedDryBulb'
    drybulb_limit_f = 75
  when 'ASHRAE 169-2006-5A',
       'ASHRAE 169-2006-6A',
       'ASHRAE 169-2006-7A',
       'ASHRAE 169-2013-5A',
       'ASHRAE 169-2013-6A',
       'ASHRAE 169-2013-7A'
    economizer_type = 'FixedDryBulb'
    drybulb_limit_f = 70
  else
    economizer_type = 'FixedDryBulb'
    drybulb_limit_f = 65
  end

  return [economizer_type, drybulb_limit_f, enthalpy_limit_btu_per_lb, dewpoint_limit_f]
end

#air_loop_hvac_remove_erv(air_loop_hvac) ⇒ Object



1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 1782

def air_loop_hvac_remove_erv(air_loop_hvac)
  # Get the OA system
  oa_sys = nil
  if air_loop_hvac.airLoopHVACOutdoorAirSystem.is_initialized
    oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem.get
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}, ERV cannot be removed because the system has no OA intake.")
    return false
  end

  # Get the existing ERV or create an ERV and add it to the OA system
  oa_sys.oaComponents.each do |oa_comp|
    if oa_comp.to_HeatExchangerAirToAirSensibleAndLatent.is_initialized
      erv = oa_comp.to_HeatExchangerAirToAirSensibleAndLatent.get
      erv.remove
    end
  end

  return true
end

#air_loop_hvac_remove_motorized_oa_damper(air_loop_hvac) ⇒ Boolean

Remove a motorized OA damper by modifying the OA schedule to require full OA at all times. Whenever the fan operates, the damper will be open and OA will be brought into the building. This reflects the use of a backdraft gravity damper, and increases building loads unnecessarily during unoccupied hours.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if successful, false if not



2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2900

def air_loop_hvac_remove_motorized_oa_damper(air_loop_hvac)
  # Get the OA system and OA controller
  oa_sys = air_loop_hvac.airLoopHVACOutdoorAirSystem
  return false unless oa_sys.is_initialized

  oa_sys = oa_sys.get
  oa_control = oa_sys.getControllerOutdoorAir

  # Set the minimum OA schedule to always 1 (100%)
  oa_control.setMinimumOutdoorAirSchedule(air_loop_hvac.model.alwaysOnDiscreteSchedule)

  return true
end

#air_loop_hvac_residential_area_served(air_loop_hvac) ⇒ Double

Determine how much residential area the airloop serves

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    residential area served in m^2



3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3490

def air_loop_hvac_residential_area_served(air_loop_hvac)
  res_area = 0.0

  air_loop_hvac.thermalZones.each do |zone|
    zone.spaces.each do |space|
      # Skip spaces with no space type
      next if space.spaceType.empty?

      space_type = space.spaceType.get

      # Skip spaces with no standards space type
      next if space_type.standardsSpaceType.empty?

      standards_space_type = space_type.standardsSpaceType.get
      if standards_space_type.downcase.include?('apartment') || standards_space_type.downcase.include?('guestroom') || standards_space_type.downcase.include?('patroom')
        res_area += space.floorArea
      end
    end
  end

  return res_area
end

#air_loop_hvac_return_air_plenum(air_loop_hvac) ⇒ OpenStudio::Model::ThermalZone

Get the return air plenum zone object for an air loop, if it exists

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    OpenStudio AirLoopHVAC object

Returns:

  • (OpenStudio::Model::ThermalZone)

    OpenStudio thermal zone object of the return air plenum zone when an air loop uses a return air plenum, nil otherwise



3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3921

def air_loop_hvac_return_air_plenum(air_loop_hvac)
  # Get return air node
  return_air_node = air_loop_hvac.demandOutletNode

  # Check if node is connected to a return plenum object
  air_loop_hvac.model.getAirLoopHVACReturnPlenums.each do |return_plenum|
    air_loop_hvac.model.getAirLoopHVACZoneMixers.each do |zone_air_mixer|
      inlets = zone_air_mixer.inletModelObjects
      inlets.each do |inlet|
        if (inlet.to_Node.get == return_plenum.outletModelObject.get.to_Node.get) && (zone_air_mixer.outletModelObject.get.to_Node.get == return_air_node)
          return return_plenum.thermalZone.get
        end
      end
    end
  end

  return nil
end

#air_loop_hvac_set_minimum_damper_position(zone, mdp) ⇒ Boolean

Set an air terminal's minimum damper position

Parameters:

Returns:

  • (Boolean)

    returns true if successful, false if not



2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2268

def air_loop_hvac_set_minimum_damper_position(zone, mdp)
  zone.equipment.each do |equip|
    if equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.is_initialized
      term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.get
      term.setZoneMinimumAirFlowFraction(mdp)
    elsif equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized
      term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
      term.setZoneMinimumAirFlowFraction(mdp)
    elsif equip.to_AirTerminalSingleDuctVAVNoReheat.is_initialized
      term = equip.to_AirTerminalSingleDuctVAVNoReheat.get
      term.setConstantMinimumAirFlowFraction(mdp)
    elsif equip.to_AirTerminalSingleDuctVAVReheat.is_initialized
      term = equip.to_AirTerminalSingleDuctVAVReheat.get
      term.setConstantMinimumAirFlowFraction(mdp)
    end
  end

  return true
end

#air_loop_hvac_set_vsd_curve_typeString name of appropriate curve for this code version

Set default fan curve to be VSD with static pressure reset

Returns:

  • (String name of appropriate curve for this code version)

    String name of appropriate curve for this code version



374
375
376
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 374

def air_loop_hvac_set_vsd_curve_type
  return 'Multi Zone VAV with Static Pressure Setpoint Reset'
end

#air_loop_hvac_single_zone_controls_num_stages(air_loop_hvac, climate_zone) ⇒ Integer

Determine the number of stages that should be used as controls for single zone DX systems. Defaults to zero, which means that no special single zone control is required.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Integer)

    the number of stages: 0, 1, 2



3283
3284
3285
3286
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3283

def air_loop_hvac_single_zone_controls_num_stages(air_loop_hvac, climate_zone)
  num_stages = 0
  return num_stages
end

#air_loop_hvac_standby_mode_occupancy_control(air_loop_hvac, standby_mode_spaces) ⇒ Boolean

Add occupant standby controls to air loop When the thermostat schedule is setup or setback the ventilation is shutoff. Currently this is done by scheduling air terminal dampers (so load can still be met) and cycling unitary system fans

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    OpenStudio AirLoopHVAC object

  • standby_mode_spaces (Array<OpenStudio::Model::Space>)

    List of all spaces required to have standby mode controls

Returns:

  • (Boolean)

    true if sucessful, false otherwise



3875
3876
3877
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3875

def air_loop_hvac_standby_mode_occupancy_control(air_loop_hvac, standby_mode_spaces)
  return true
end

#air_loop_hvac_static_pressure_reset_required?(air_loop_hvac, has_ddc) ⇒ Boolean

TODO:

Instead of requiring the input of whether a system has DDC control of VAV terminals or not, determine this from the system itself. This may require additional information be added to the OpenStudio data model.

Determine if static pressure reset is required for this system. For 90.1, this determination needs information about whether or not the system has DDC control over the VAV terminals. Defaults to 90.1-2007 logic.

return [Boolean] returns true if static pressure reset is required, false if not

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • has_ddc (Boolean)

    whether or not the system has DDC control over VAV terminals.

Returns:

  • (Boolean)


3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3301

def air_loop_hvac_static_pressure_reset_required?(air_loop_hvac, has_ddc)
  sp_reset_required = false

  if has_ddc
    sp_reset_required = true
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Static pressure reset is required because the system has DDC control of VAV terminals.")
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: Static pressure reset not required because the system does not have DDC control of VAV terminals.")
  end

  return sp_reset_required
end

#air_loop_hvac_supply_air_temperature_reset_required?(air_loop_hvac, climate_zone) ⇒ Boolean

Determine if the system required supply air temperature (SAT) reset. Defaults to 90.1-2007, no SAT reset required.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

Returns:

  • (Boolean)

    returns true if required, false if not



2475
2476
2477
2478
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2475

def air_loop_hvac_supply_air_temperature_reset_required?(air_loop_hvac, climate_zone)
  is_sat_reset_required = false
  return is_sat_reset_required
end

#air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac) ⇒ Array

Get all of the supply, return, exhaust, and relief fans on this system

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Array)

    an array of FanConstantVolume, FanVariableVolume, and FanOnOff objects



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 585

def air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac)
  # Fans on the supply side of the airloop directly, or inside of unitary equipment.
  fans = []
  sup_and_oa_comps = air_loop_hvac.supplyComponents
  sup_and_oa_comps += air_loop_hvac.oaComponents
  sup_and_oa_comps.each do |comp|
    if comp.to_FanConstantVolume.is_initialized
      fans << comp.to_FanConstantVolume.get
    elsif comp.to_FanVariableVolume.is_initialized
      fans << comp.to_FanVariableVolume.get
    elsif comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized
      sup_fan = comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get.supplyAirFan
      if sup_fan.to_FanConstantVolume.is_initialized
        fans << sup_fan.to_FanConstantVolume.get
      elsif sup_fan.to_FanOnOff.is_initialized
        fans << sup_fan.to_FanOnOff.get
      end
    elsif comp.to_AirLoopHVACUnitarySystem.is_initialized
      sup_fan = comp.to_AirLoopHVACUnitarySystem.get.supplyFan
      next if sup_fan.empty?

      sup_fan = sup_fan.get
      if sup_fan.to_FanConstantVolume.is_initialized
        fans << sup_fan.to_FanConstantVolume.get
      elsif sup_fan.to_FanOnOff.is_initialized
        fans << sup_fan.to_FanOnOff.get
      elsif sup_fan.to_FanVariableVolume.is_initialized
        fans << sup_fan.to_FanVariableVolume.get
      end
    end
  end

  return fans
end

#air_loop_hvac_system_fan_brake_horsepower(air_loop_hvac, include_terminal_fans = true) ⇒ Double

Determine the total brake horsepower of the fans on the system with or without the fans inside of fan powered terminals.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

  • include_terminal_fans (Boolean) (defaults to: true)

    if true, power from fan powered terminals will be included

Returns:

  • (Double)

    total brake horsepower of the fans on the system, in units of horsepower



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 626

def air_loop_hvac_system_fan_brake_horsepower(air_loop_hvac, include_terminal_fans = true)
  # @todo get the template from the parent model itself?
  # Or not because maybe you want to see the difference between two standards?
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name}-Determining #{template} allowable system fan power.")

  # Get all fans
  fans = []
  # Supply, exhaust, relief, and return fans
  fans += air_loop_hvac_supply_return_exhaust_relief_fans(air_loop_hvac)

  # Fans inside of fan-powered terminals
  if include_terminal_fans
    air_loop_hvac.demandComponents.each do |comp|
      if comp.to_AirTerminalSingleDuctSeriesPIUReheat.is_initialized
        term_fan = comp.to_AirTerminalSingleDuctSeriesPIUReheat.get.supplyAirFan
        if term_fan.to_FanConstantVolume.is_initialized
          fans << term_fan.to_FanConstantVolume.get
        end
      elsif comp.to_AirTerminalSingleDuctParallelPIUReheat.is_initialized
        term_fan = comp.to_AirTerminalSingleDuctParallelPIUReheat.get.fan
        if term_fan.to_FanConstantVolume.is_initialized
          fans << term_fan.to_FanConstantVolume.get
        end
      end
    end
  end

  # Loop through all fans on the system and
  # sum up their brake horsepower values.
  sys_fan_bhp = 0
  fans.sort.each do |fan|
    sys_fan_bhp += fan_brake_horsepower(fan)
  end

  return sys_fan_bhp
end

#air_loop_hvac_system_multiplier(air_loop_hvac) ⇒ Integer

Determine if every zone on the system has an identical multiplier. If so, return this number. If not, return 1.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Integer)

    an integer representing the system multiplier.



3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3642

def air_loop_hvac_system_multiplier(air_loop_hvac)
  mult = 1

  # Get all the zone multipliers
  zn_mults = []
  air_loop_hvac.thermalZones.each do |zone|
    zn_mults << zone.multiplier
  end

  # Warn if there are different multipliers
  uniq_mults = zn_mults.uniq
  if uniq_mults.size > 1
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name}: not all zones on the system have an identical zone multiplier.  Multipliers are: #{uniq_mults.join(', ')}.")
  else
    mult = uniq_mults[0]
  end

  return mult
end

#air_loop_hvac_terminal_reheat?(air_loop_hvac) ⇒ Boolean

Determine if the system has terminal reheat

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if has one or more reheat terminals, false if it doesn't



2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2644

def air_loop_hvac_terminal_reheat?(air_loop_hvac)
  has_term_rht = false
  air_loop_hvac.demandComponents.each do |sc|
    if sc.to_AirTerminalSingleDuctConstantVolumeReheat.is_initialized ||
       sc.to_AirTerminalSingleDuctParallelPIUReheat.is_initialized ||
       sc.to_AirTerminalSingleDuctSeriesPIUReheat.is_initialized ||
       sc.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized ||
       sc.to_AirTerminalSingleDuctVAVReheat.is_initialized
      has_term_rht = true
      break
    end
  end

  return has_term_rht
end

#air_loop_hvac_total_cooling_capacity(air_loop_hvac) ⇒ Double

TODO:

Change to pull water coil nominal capacity instead of design load; not a huge difference, but water coil nominal capacity not available in sizing table.

TODO:

Handle all additional cooling coil types. Currently only handles CoilCoolingDXSingleSpeed, CoilCoolingDXTwoSpeed, and CoilCoolingWater

Get the total cooling capacity for the air loop

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Double)

    total cooling capacity in watts



756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 756

def air_loop_hvac_total_cooling_capacity(air_loop_hvac)
  # Sum the cooling capacity for all cooling components
  # on the airloop, which may be inside of unitary systems.
  total_cooling_capacity_w = 0
  air_loop_hvac.supplyComponents.each do |sc|
    # CoilCoolingDXSingleSpeed
    if sc.to_CoilCoolingDXSingleSpeed.is_initialized
      coil = sc.to_CoilCoolingDXSingleSpeed.get
      if coil.ratedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.ratedTotalCoolingCapacity.get
      elsif coil.autosizedRatedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.autosizedRatedTotalCoolingCapacity.get
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
      end
    elsif sc.to_CoilCoolingDXTwoSpeed.is_initialized
      coil = sc.to_CoilCoolingDXTwoSpeed.get
      if coil.ratedHighSpeedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.ratedHighSpeedTotalCoolingCapacity.get
      elsif coil.autosizedRatedHighSpeedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.autosizedRatedHighSpeedTotalCoolingCapacity.get
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
      end
      # CoilCoolingWater
    elsif sc.to_CoilCoolingWater.is_initialized
      coil = sc.to_CoilCoolingWater.get
      # error if the design coil capacity method isn't available
      if coil.model.version < OpenStudio::VersionString.new('3.6.0')
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required CoilCoolingWater method .autosizedDesignCoilLoad is not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
      end
      if coil.autosizedDesignCoilLoad.is_initialized
        # @todo Change to pull water coil nominal capacity instead of design load
        total_cooling_capacity_w += coil.autosizedDesignCoilLoad.get
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
      end
      # CoilCoolingWaterToAirHeatPumpEquationFit
    elsif sc.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
      coil = sc.to_CoilCoolingWaterToAirHeatPumpEquationFit.get
      if coil.ratedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.ratedTotalCoolingCapacity.get
      elsif coil.autosizedRatedTotalCoolingCapacity.is_initialized
        total_cooling_capacity_w += coil.autosizedRatedTotalCoolingCapacity.get
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
      end
    elsif sc.to_AirLoopHVACUnitarySystem.is_initialized
      unitary = sc.to_AirLoopHVACUnitarySystem.get
      if unitary.coolingCoil.is_initialized
        clg_coil = unitary.coolingCoil.get
        # CoilCoolingDXSingleSpeed
        if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized
          coil = clg_coil.to_CoilCoolingDXSingleSpeed.get
          if coil.ratedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.ratedTotalCoolingCapacity.get
          elsif coil.autosizedRatedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.autosizedRatedTotalCoolingCapacity.get
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
          end
        # CoilCoolingDXTwoSpeed
        elsif clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized
          coil = clg_coil.to_CoilCoolingDXTwoSpeed.get
          if coil.ratedHighSpeedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.ratedHighSpeedTotalCoolingCapacity.get
          elsif coil.autosizedRatedHighSpeedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.autosizedRatedHighSpeedTotalCoolingCapacity.get
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
          end
        # CoilCoolingWater
        elsif clg_coil.to_CoilCoolingWater.is_initialized
          coil = clg_coil.to_CoilCoolingWater.get
          # error if the design coil capacity method isn't available
          if coil.model.version < OpenStudio::VersionString.new('3.6.0')
            OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required CoilCoolingWater method .autosizedDesignCoilLoad is not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
          end
          if coil.autosizedDesignCoilLoad.is_initialized
            # @todo Change to pull water coil nominal capacity instead of design load
            total_cooling_capacity_w += coil.autosizedDesignCoilLoad.get
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
          end
        # CoilCoolingWaterToAirHeatPumpEquationFit
        elsif clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
          coil = clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.get
          if coil.ratedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.ratedTotalCoolingCapacity.get
          elsif coil.autosizedRatedTotalCoolingCapacity.is_initialized
            total_cooling_capacity_w += coil.autosizedRatedTotalCoolingCapacity.get
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
          end
        end
      end
    elsif sc.to_AirLoopHVACUnitaryHeatPumpAirToAir.is_initialized
      unitary = sc.to_AirLoopHVACUnitaryHeatPumpAirToAir.get
      clg_coil = unitary.coolingCoil
      # CoilCoolingDXSingleSpeed
      if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized
        coil = clg_coil.to_CoilCoolingDXSingleSpeed.get
        if coil.ratedTotalCoolingCapacity.is_initialized
          total_cooling_capacity_w += coil.ratedTotalCoolingCapacity.get
        elsif coil.autosizedRatedTotalCoolingCapacity.is_initialized
          total_cooling_capacity_w += coil.autosizedRatedTotalCoolingCapacity.get
        else
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
        end
      # CoilCoolingDXTwoSpeed
      elsif clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized
        coil = clg_coil.to_CoilCoolingDXTwoSpeed.get
        if coil.ratedHighSpeedTotalCoolingCapacity.is_initialized
          total_cooling_capacity_w += coil.ratedHighSpeedTotalCoolingCapacity.get
        elsif coil.autosizedRatedHighSpeedTotalCoolingCapacity.is_initialized
          total_cooling_capacity_w += coil.autosizedRatedHighSpeedTotalCoolingCapacity.get
        else
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
        end
      # CoilCoolingWater
      elsif clg_coil.to_CoilCoolingWater.is_initialized
        coil = clg_coil.to_CoilCoolingWater.get
        # error if the design coil capacity method isn't available
        if coil.model.version < OpenStudio::VersionString.new('3.6.0')
          OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.AirLoopHVAC', 'Required CoilCoolingWater method .autosizedDesignCoilLoad is not available in pre-OpenStudio 3.6.0 versions. Use a more recent version of OpenStudio.')
        end
        if coil.autosizedDesignCoilLoad.is_initialized
          # @todo Change to pull water coil nominal capacity instead of design load
          total_cooling_capacity_w += coil.autosizedDesignCoilLoad.get
        else
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
        end
      end
    elsif sc.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.is_initialized
      unitary = sc.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get
      clg_coil = unitary.coolingCoil
      # CoilCoolingDXMultSpeed
      if clg_coil.to_CoilCoolingDXMultiSpeed.is_initialized
        coil = clg_coil.to_CoilCoolingDXMultiSpeed.get
        total_cooling_capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_multi_speed_get_capacity(coil)
      end
    elsif sc.to_CoilCoolingDXVariableSpeed.is_initialized
      coil = sc.to_CoilCoolingDXVariableSpeed.get
      if coil.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
        # autosized capacity needs to be corrected for actual flow rate and fan power
        sys_fans = []
        air_loop_hvac.supplyComponents.each do |comp|
          if comp.to_FanConstantVolume.is_initialized
            sys_fans << comp.to_FanConstantVolume.get
          elsif comp.to_FanVariableVolume.is_initialized
            sys_fans << comp.to_FanVariableVolume.get
          end
        end
        max_pd = 0.0
        supply_fan = nil
        sys_fans.each do |fan|
          if fan.pressureRise.to_f > max_pd
            max_pd = fan.pressureRise.to_f
            supply_fan = fan # assume supply fan has higher pressure drop
          end
        end
        fan_power = supply_fan.autosizedMaximumFlowRate.to_f * supply_fan.pressureRise.to_f / supply_fan.fanTotalEfficiency.to_f
        nominal_cooling_capacity_w = coil.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.to_f
        nominal_flow_rate_factor = supply_fan.autosizedMaximumFlowRate.to_f / coil.autosizedRatedAirFlowRateAtSelectedNominalSpeedLevel.to_f
        fan_power_adjustment_w = fan_power / coil.speeds.last.referenceUnitGrossRatedSensibleHeatRatio.to_f
        total_cooling_capacity_w += (nominal_cooling_capacity_w * nominal_flow_rate_factor) + fan_power_adjustment_w
      elsif coil.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
        total_cooling_capacity_w += coil.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.to_f
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop_hvac.name} capacity of #{coil.name} is not available, total cooling capacity of air loop will be incorrect when applying standard.")
      end
    elsif sc.to_CoilCoolingDXMultiSpeed.is_initialized ||
          sc.to_CoilCoolingCooledBeam.is_initialized ||
          sc.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized ||
          sc.to_AirLoopHVACUnitarySystem.is_initialized
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "#{air_loop_hvac.name} has a cooling coil named #{sc.name}, whose type is not yet covered by economizer checks.")
      # CoilCoolingDXMultiSpeed
      # CoilCoolingCooledBeam
      # CoilCoolingWaterToAirHeatPumpEquationFit
      # AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass
      # AirLoopHVACUnitaryHeatPumpAirToAir
      # AirLoopHVACUnitarySystem
    end
  end

  return total_cooling_capacity_w
end

#air_loop_hvac_unitary_system?(air_loop_hvac) ⇒ Boolean

Determine if the air loop is a unitary system

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if a unitary system is present, false if not



2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2686

def air_loop_hvac_unitary_system?(air_loop_hvac)
  is_unitary_system = false
  air_loop_hvac.supplyComponents.each do |component|
    obj_type = component.iddObjectType.valueName.to_s
    case obj_type
    when 'OS_AirLoopHVAC_UnitarySystem', 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir', 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeed', 'OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass'
      is_unitary_system = true
    end
  end
  return is_unitary_system
end

#air_loop_hvac_unoccupied_fan_shutoff_required?(air_loop_hvac) ⇒ Boolean

Determine if a system's fans must shut off when not required. Per ASHRAE 90.1 section 6.4.3.3, HVAC systems are required to have off-hour controls

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if required, false if not



3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3319

def air_loop_hvac_unoccupied_fan_shutoff_required?(air_loop_hvac)
  shutoff_required = true

  # Determine if the airloop serves any computer rooms or data centers, which default to always on.
  if air_loop_hvac_data_center_area_served(air_loop_hvac) > 0
    shutoff_required = false
  end

  return shutoff_required
end

#air_loop_hvac_unoccupied_thresholdDouble

Default occupancy fraction threshold for determining if the spaces on the air loop are occupied

Returns:

  • (Double)

    threshold at which the air loop space are considered unoccupied



3332
3333
3334
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 3332

def air_loop_hvac_unoccupied_threshold
  return 0.15
end

#air_loop_hvac_vav_damper_action(air_loop_hvac) ⇒ String

Determine whether the VAV damper control is single maximum or dual maximum control. Defaults to 90.1-2007.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (String)

    the damper control type: Single Maximum, Dual Maximum



2752
2753
2754
2755
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2752

def air_loop_hvac_vav_damper_action(air_loop_hvac)
  damper_action = 'Dual Maximum'
  return damper_action
end

#air_loop_hvac_vav_system?(air_loop_hvac) ⇒ Boolean

Determine if the system is a VAV system based on the fan which may be inside of a unitary system.

Parameters:

  • air_loop_hvac (OpenStudio::Model::AirLoopHVAC)

    air loop

Returns:

  • (Boolean)

    returns true if vav system, false if not



2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
# File 'lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb', line 2593

def air_loop_hvac_vav_system?(air_loop_hvac)
  is_vav = false
  air_loop_hvac.supplyComponents.reverse.each do |comp|
    if comp.to_FanVariableVolume.is_initialized
      is_vav = true
    elsif comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized
      fan = comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get.supplyAirFan
      if fan.to_FanVariableVolume.is_initialized
        is_vav = true
      end
    elsif comp.to_AirLoopHVACUnitarySystem.is_initialized
      fan = comp.to_AirLoopHVACUnitarySystem.get.supplyFan
      if fan.is_initialized
        if fan.get.to_FanVariableVolume.is_initialized
          is_vav = true
        end
      end
    end
  end

  return is_vav
end

#air_terminal_single_duct_parallel_piu_reheat_apply_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat, zone_min_oa = nil) ⇒ Boolean

Set the minimum primary air flow fraction based on OA rate of the space and the template.

Parameters:

  • air_terminal_single_duct_parallel_piu_reheat (OpenStudio::Model::AirTerminalSingleDuctParallelPIUReheat)

    the air terminal object

  • zone_min_oa (Double) (defaults to: nil)

    the zone outdoor air flow rate, in m^3/s.

Returns:

  • (Boolean)

    returns true if successful, false if not



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb', line 94

def air_terminal_single_duct_parallel_piu_reheat_apply_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat, zone_min_oa = nil)
  # Minimum primary air flow
  min_primary_airflow_frac = air_terminal_single_duct_parallel_reheat_piu_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat)
  air_terminal_single_duct_parallel_piu_reheat.setMinimumPrimaryAirFlowFraction(min_primary_airflow_frac)
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirTerminalSingleDuctParallelPIUReheat', "For #{air_terminal_single_duct_parallel_piu_reheat.name}: set minimum primary air flow fraction to #{min_primary_airflow_frac}.")

  # Minimum OA flow rate
  # If specified, set the primary air flow fraction as
  unless zone_min_oa.nil?
    min_primary_airflow_frac = [min_primary_airflow_frac, zone_min_oa / air_terminal_single_duct_parallel_piu_reheat.autosizedMaximumPrimaryAirFlowRate.get].max
    air_terminal_single_duct_parallel_piu_reheat.setMinimumPrimaryAirFlowFraction(min_primary_airflow_frac)
  end

  return true
end

#air_terminal_single_duct_parallel_piu_reheat_apply_prm_baseline_fan_power(air_terminal_single_duct_parallel_piu_reheat) ⇒ Boolean

Sets the fan power of a PIU fan based on the W/cfm specified in the standard.

Parameters:

  • air_terminal_single_duct_parallel_piu_reheat (OpenStudio::Model::AirTerminalSingleDuctParallelPIUReheat)

    air terminal object

Returns:

  • (Boolean)

    returns true if successful, false if not



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb', line 8

def air_terminal_single_duct_parallel_piu_reheat_apply_prm_baseline_fan_power(air_terminal_single_duct_parallel_piu_reheat)
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirTerminalSingleDuctParallelPIUReheat', "Setting PIU fan power for #{air_terminal_single_duct_parallel_piu_reheat.name}.")

  # Determine the fan sizing flow rate, min flow rate,
  # and W/cfm
  sec_flow_frac = 0.5
  min_flow_frac = air_terminal_single_duct_parallel_reheat_piu_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat)
  fan_efficacy_w_per_cfm = 0.35

  # Set the fan on flow fraction
  unless air_terminal_single_duct_parallel_piu_reheat_fan_on_flow_fraction.nil?
    air_terminal_single_duct_parallel_piu_reheat.setFanOnFlowFraction(air_terminal_single_duct_parallel_piu_reheat_fan_on_flow_fraction)
  end

  # Convert efficacy to metric
  # 1 cfm = 0.0004719 m^3/s
  fan_efficacy_w_per_m3_per_s = fan_efficacy_w_per_cfm / 0.0004719

  # Get the maximum flow rate through the terminal
  max_primary_air_flow_rate = nil
  if air_terminal_single_duct_parallel_piu_reheat.maximumPrimaryAirFlowRate.is_initialized
    max_primary_air_flow_rate = air_terminal_single_duct_parallel_piu_reheat.maximumPrimaryAirFlowRate.get
  elsif air_terminal_single_duct_parallel_piu_reheat.autosizedMaximumPrimaryAirFlowRate.is_initialized
    max_primary_air_flow_rate = air_terminal_single_duct_parallel_piu_reheat.autosizedMaximumPrimaryAirFlowRate.get
  end

  # Set the max secondary air flow rate
  max_sec_flow_rate_m3_per_s = max_primary_air_flow_rate * sec_flow_frac
  air_terminal_single_duct_parallel_piu_reheat.setMaximumSecondaryAirFlowRate(max_sec_flow_rate_m3_per_s)
  max_sec_flow_rate_cfm = OpenStudio.convert(max_sec_flow_rate_m3_per_s, 'm^3/s', 'ft^3/min').get

  # Set the minimum flow fraction
  air_terminal_single_duct_parallel_piu_reheat.setMinimumPrimaryAirFlowFraction(min_flow_frac)

  # Get the fan
  fan = air_terminal_single_duct_parallel_piu_reheat.fan.to_FanConstantVolume.get

  # Set the impeller efficiency
  fan_change_impeller_efficiency(fan, fan_baseline_impeller_efficiency(fan))

  # Set the motor efficiency, preserving the impeller efficency.
  # For terminal fans, a bhp lookup of 0.5bhp is always used because
  # they are assumed to represent a series of small fans in reality.
  fan_apply_standard_minimum_motor_efficiency(fan, fan_brake_horsepower(fan))

  # Calculate a new pressure rise to hit the target W/cfm
  fan_tot_eff = fan.fanEfficiency
  fan_rise_new_pa = fan_efficacy_w_per_m3_per_s * fan_tot_eff
  fan.setPressureRise(fan_rise_new_pa)

  # Calculate the newly set efficacy
  fan_power_new_w = fan_rise_new_pa * max_sec_flow_rate_m3_per_s / fan_tot_eff
  fan_efficacy_new_w_per_cfm = fan_power_new_w / max_sec_flow_rate_cfm
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirTerminalSingleDuctParallelPIUReheat', "For #{air_terminal_single_duct_parallel_piu_reheat.name}: fan efficacy set to #{fan_efficacy_new_w_per_cfm.round(2)} W/cfm.")

  return true
end

#air_terminal_single_duct_parallel_piu_reheat_fan_on_flow_fractionDouble

Return the fan on flow fraction for a parallel PIU terminal.

When returning nil, the fan on flow fraction will be set to be autosize in the EnergyPlus model; OpenStudio assumes that the default is "autosize". When autosized, this input is set to be the same as the minimum primary air flow fraction which means that the secondary fan will be on when the primary air flow is at the minimum flow fraction.

Returns:

  • (Double)

    returns nil or a float representing the fraction



76
77
78
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb', line 76

def air_terminal_single_duct_parallel_piu_reheat_fan_on_flow_fraction
  return nil
end

#air_terminal_single_duct_parallel_reheat_piu_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat) ⇒ Double

Specifies the minimum primary air flow fraction for PFB boxes.

Parameters:

  • air_terminal_single_duct_parallel_piu_reheat (OpenStudio::Model::AirTerminalSingleDuctParallelPIUReheat)

    air terminal object

Returns:

  • (Double)

    minimum primaru air flow fraction



84
85
86
87
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb', line 84

def air_terminal_single_duct_parallel_reheat_piu_minimum_primary_airflow_fraction(air_terminal_single_duct_parallel_piu_reheat)
  min_primary_airflow_fraction = 0.3
  return min_primary_airflow_fraction
end

#air_terminal_single_duct_vav_reheat_apply_initial_prototype_damper_position(air_terminal_single_duct_vav_reheat, zone_oa_per_area) ⇒ Boolean

Set the initial minimum damper position based on OA rate of the space and the template. Defaults to basic behavior, but this method is overridden by all of the ASHRAE-based templates. Zones with low OA per area get lower initial guesses. Final position will be adjusted upward as necessary by Standards.AirLoopHVAC.apply_minimum_vav_damper_positions

Parameters:

  • air_terminal_single_duct_vav_reheat (OpenStudio::Model::AirTerminalSingleDuctVAVReheat)

    the air terminal object

  • zone_oa_per_area (Double)

    the zone outdoor air per area in m^3/s*m^2

Returns:

  • (Boolean)

    returns true if successful, false if not



11
12
13
14
15
16
17
18
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.AirTerminalSingleDuctVAVReheat.rb', line 11

def air_terminal_single_duct_vav_reheat_apply_initial_prototype_damper_position(air_terminal_single_duct_vav_reheat, zone_oa_per_area)
  min_damper_position = 0.3

  # Set the minimum flow fraction
  air_terminal_single_duct_vav_reheat.setConstantMinimumAirFlowFraction(min_damper_position)

  return true
end

#air_terminal_single_duct_vav_reheat_apply_minimum_damper_position(air_terminal_single_duct_vav_reheat, zone_min_oa = nil, has_ddc = true) ⇒ Boolean

TODO:

remove exception where older vintages don't have minimum positions adjusted.

Set the minimum damper position based on OA rate of the space and the template. Zones with low OA per area get lower initial guesses. Final position will be adjusted upward as necessary by Standards.AirLoopHVAC.adjust_minimum_vav_damper_positions

Parameters:

  • air_terminal_single_duct_vav_reheat (OpenStudio::Model::AirTerminalSingleDuctVAVReheat)

    the air terminal object

  • zone_min_oa (Double) (defaults to: nil)

    the zone outdoor air flow rate, in m^3/s. If supplied, this will be set as a minimum limit in addition to the minimum damper position. EnergyPlus will use the larger of the two values during sizing.

  • has_ddc (Boolean) (defaults to: true)

    whether or not there is DDC control of the VAV terminal, which impacts the minimum damper position requirement.

Returns:

  • (Boolean)

    returns true if successful, false if not



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb', line 16

def air_terminal_single_duct_vav_reheat_apply_minimum_damper_position(air_terminal_single_duct_vav_reheat, zone_min_oa = nil, has_ddc = true)
  # Minimum damper position
  min_damper_position = air_terminal_single_duct_vav_reheat_minimum_damper_position(air_terminal_single_duct_vav_reheat, has_ddc)
  air_terminal_single_duct_vav_reheat.setConstantMinimumAirFlowFraction(min_damper_position)
  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.AirTerminalSingleDuctVAVReheat', "For #{air_terminal_single_duct_vav_reheat.name}: set minimum damper position to #{min_damper_position}.")

  # Minimum OA flow rate
  # If specified, will also add this limit
  # and the larger of the two will be used
  # for sizing.
  unless zone_min_oa.nil?
    air_terminal_single_duct_vav_reheat.setFixedMinimumAirFlowRate(zone_min_oa)
  end

  return true
end

#air_terminal_single_duct_vav_reheat_minimum_damper_position(air_terminal_single_duct_vav_reheat, has_ddc = false) ⇒ Double

Specifies the minimum damper position for VAV dampers. Defaults to 30%

Parameters:

  • air_terminal_single_duct_vav_reheat (OpenStudio::Model::AirTerminalSingleDuctVAVReheat)

    the air terminal object

  • has_ddc (Boolean) (defaults to: false)

    whether or not there is DDC control of the VAV terminal in question

Returns:

  • (Double)

    minimum damper position



39
40
41
42
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb', line 39

def air_terminal_single_duct_vav_reheat_minimum_damper_position(air_terminal_single_duct_vav_reheat, has_ddc = false)
  min_damper_position = 0.3
  return min_damper_position
end

#air_terminal_single_duct_vav_reheat_set_heating_cap(air_terminal_single_duct_vav_reheat) ⇒ Boolean

Sets the capacity of the reheat coil based on the minimum flow fraction, and the maximum flow rate.

Parameters:

  • air_terminal_single_duct_vav_reheat (OpenStudio::Model::AirTerminalSingleDuctVAVReheat)

    the air terminal object

Returns:

  • (Boolean)

    returns true if successful, false if not



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb', line 48

def air_terminal_single_duct_vav_reheat_set_heating_cap(air_terminal_single_duct_vav_reheat)
  flow_rate_fraction = 0.0
  if air_terminal_single_duct_vav_reheat.constantMinimumAirFlowFraction.is_initialized
    flow_rate_fraction = air_terminal_single_duct_vav_reheat.constantMinimumAirFlowFraction.get
  end
  return false unless air_terminal_single_duct_vav_reheat.reheatCoil.to_CoilHeatingWater.is_initialized

  reheat_coil = air_terminal_single_duct_vav_reheat.reheatCoil.to_CoilHeatingWater.get
  if reheat_coil.autosizedRatedCapacity.to_f < 1.0e-6
    cap = 1.2 * 1000.0 * flow_rate_fraction * air_terminal_single_duct_vav_reheat.autosizedMaximumAirFlowRate.to_f * (18.0 - 13.0)
    reheat_coil.setPerformanceInputMethod('NominalCapacity')
    reheat_coil.setRatedCapacity(cap)
    air_terminal_single_duct_vav_reheat.setMaximumReheatAirTemperature(18.0)
  end
  return true
end

#apply_lighting_schedule(space_type, space_type_properties, default_sch_set) ⇒ Boolean

applies a lighting schedule to a space type

Parameters:

  • space_type (OpenStudio::Model::SpaceType)

    space type object

  • space_type_properties (Hash)

    hash of space type properties

  • default_sch_set (OpenStudio::Model::DefaultScheduleSet)

    default schedule set

Returns:

  • (Boolean)

    returns true if successful, false if not



534
535
536
537
538
539
540
541
# File 'lib/openstudio-standards/standards/Standards.SpaceType.rb', line 534

def apply_lighting_schedule(space_type, space_type_properties, default_sch_set)
  lighting_sch = space_type_properties['lighting_schedule']
  return false if lighting_sch.nil?

  default_sch_set.setLightingSchedule(model_add_schedule(space_type.model, lighting_sch))
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.SpaceType', "#{space_type.name} set lighting schedule to #{lighting_sch}.")
  return true
end

#apply_limit_to_subsurface_ratio(model, ratio, surface_type = 'Wall') ⇒ Boolean

This method will limit the subsurface of a given surface_type ("Wall" or "RoofCeiling") to the ratio for the building. This method only reduces subsurface sizes at most.

Parameters:

Returns:

  • (Boolean)

    returns true if successful, false if not



5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5576

def apply_limit_to_subsurface_ratio(model, ratio, surface_type = 'Wall')
  fdwr = get_outdoor_subsurface_ratio(model, surface_type)
  if fdwr <= ratio
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Building FDWR of #{fdwr} is already lower than limit of #{ratio.round}%.")
    return true
  end
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Reducing the size of all windows (by shrinking to centroid) to reduce window area down to the limit of #{ratio.round}%.")
  # Determine the factors by which to reduce the window / door area
  mult = ratio / fdwr
  # Reduce the window area if any of the categories necessary
  model.getSpaces.sort.each do |space|
    # Loop through all surfaces in this space
    space.surfaces.sort.each do |surface|
      # Skip non-outdoor surfaces
      next unless surface.outsideBoundaryCondition == 'Outdoors'
      # Skip non-walls
      next unless surface.surfaceType == surface_type

      # Subsurfaces in this surface
      surface.subSurfaces.sort.each do |ss|
        # Reduce the size of the window
        red = 1.0 - mult
        OpenstudioStandards::Geometry.sub_surface_reduce_area_by_percent_by_shrinking_toward_centroid(ss, red)
      end
    end
  end
  return true
end

#boiler_get_eff_fplr(boiler_hot_water) ⇒ String

Determine what part load efficiency degredation curve should be used for a boiler

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

Returns:

  • (String)

    returns name of the boiler curve to be used, or nil if not applicable



98
99
100
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 98

def boiler_get_eff_fplr(boiler_hot_water)
  return 'Boiler Constant Efficiency Curve'
end

#boiler_hot_water_apply_efficiency_and_curves(boiler_hot_water) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

Returns:

  • (Boolean)

    returns true if successful, false if not



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 106

def boiler_hot_water_apply_efficiency_and_curves(boiler_hot_water)
  successfully_set_all_properties = false

  # Define the criteria to find the boiler properties
  # in the hvac standards data set.
  search_criteria = boiler_hot_water_find_search_criteria(boiler_hot_water)
  fuel_type = search_criteria['fuel_type']
  fluid_type = search_criteria['fluid_type']

  # Get the capacity
  capacity_w = OpenstudioStandards::HVAC.boiler_hot_water_get_capacity(boiler_hot_water)

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get the boiler properties
  blr_props = model_find_object(standards_data['boilers'], search_criteria, capacity_btu_per_hr)
  unless blr_props
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name}, cannot find boiler properties with search criteria #{search_criteria}, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get and assign boiler part load efficiency degradation curve
  eff_fplr = nil
  if blr_props['efffplr']
    eff_fplr = model_add_curve(boiler_hot_water.model, blr_props['efffplr'])
  else
    eff_fplr_curve_name = boiler_get_eff_fplr(boiler_hot_water)
    eff_fplr = model_add_curve(boiler_hot_water.model, eff_fplr_curve_name)
  end
  if eff_fplr
    boiler_hot_water.setNormalizedBoilerEfficiencyCurve(eff_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name}, cannot find eff_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Get the minimum efficiency standards
  thermal_eff = nil

  # If specified as AFUE
  unless blr_props['minimum_annual_fuel_utilization_efficiency'].nil?
    min_afue = blr_props['minimum_annual_fuel_utilization_efficiency']
    thermal_eff = OpenstudioStandards::HVAC.afue_to_thermal_eff(min_afue)
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_afue} AFUE"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; AFUE = #{min_afue}")
  end

  # If specified as thermal efficiency
  unless blr_props['minimum_thermal_efficiency'].nil?
    thermal_eff = blr_props['minimum_thermal_efficiency']
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{thermal_eff} Thermal Eff"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; Thermal Efficiency = #{thermal_eff}")
  end

  # If specified as combustion efficiency
  unless blr_props['minimum_combustion_efficiency'].nil?
    min_comb_eff = blr_props['minimum_combustion_efficiency']
    thermal_eff = OpenstudioStandards::HVAC.combustion_eff_to_thermal_eff(min_comb_eff)
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_comb_eff} Combustion Eff"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; Combustion Efficiency = #{min_comb_eff}")
  end

  # Set the name
  boiler_hot_water.setName(new_comp_name)

  # Set the efficiency values
  unless thermal_eff.nil?
    boiler_hot_water.setNominalThermalEfficiency(thermal_eff)
  end

  return successfully_set_all_properties
end

#boiler_hot_water_find_search_criteria(boiler_hot_water) ⇒ Hash

find search criteria

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

Returns:

  • (Hash)

    used for standards_lookup_table(model)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 8

def boiler_hot_water_find_search_criteria(boiler_hot_water)
  # Define the criteria to find the boiler properties
  # in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template

  # Get fuel type
  fuel_type = nil
  case boiler_hot_water.fuelType
  when 'NaturalGas'
    fuel_type = 'NaturalGas'
  when 'Electricity'
    fuel_type = 'Electric'
  when 'FuelOilNo1', 'FuelOilNo2'
    fuel_type = 'Oil'
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name}, a fuel type of #{fuel_type} is not yet supported.  Assuming 'NaturalGas'.")
    fuel_type = 'NaturalGas'
  end

  search_criteria['fuel_type'] = fuel_type

  # Get the fluid type
  fluid_type = 'Hot Water'
  search_criteria['fluid_type'] = fluid_type

  return search_criteria
end

#boiler_hot_water_standard_minimum_thermal_efficiency(boiler_hot_water, rename = false) ⇒ Double

Finds lookup object in standards and return minimum thermal efficiency

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

  • rename (Boolean) (defaults to: false)

    if true, rename the boiler to include the new capacity and efficiency

Returns:

  • (Double)

    minimum thermal efficiency



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 42

def boiler_hot_water_standard_minimum_thermal_efficiency(boiler_hot_water, rename = false)
  # Get the boiler properties
  search_criteria = boiler_hot_water_find_search_criteria(boiler_hot_water)
  capacity_w = OpenstudioStandards::HVAC.boiler_hot_water_get_capacity(boiler_hot_water)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get the minimum efficiency standards
  thermal_eff = nil

  # Get the boiler properties
  blr_props = model_find_object(standards_data['boilers'], search_criteria, capacity_btu_per_hr)
  unless blr_props
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name}, cannot find boiler properties, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  fuel_type = blr_props['fuel_type']
  fluid_type = blr_props['fluid_type']

  # If specified as AFUE
  unless blr_props['minimum_annual_fuel_utilization_efficiency'].nil?
    min_afue = blr_props['minimum_annual_fuel_utilization_efficiency']
    thermal_eff = OpenstudioStandards::HVAC.afue_to_thermal_eff(min_afue)
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_afue} AFUE"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; AFUE = #{min_afue}")
  end

  # If specified as thermal efficiency
  unless blr_props['minimum_thermal_efficiency'].nil?
    thermal_eff = blr_props['minimum_thermal_efficiency']
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{thermal_eff} Thermal Eff"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; Thermal Efficiency = #{thermal_eff}")
  end

  # If specified as combustion efficiency
  unless blr_props['minimum_combustion_efficiency'].nil?
    min_comb_eff = blr_props['minimum_combustion_efficiency']
    thermal_eff = OpenstudioStandards::HVAC.combustion_eff_to_thermal_eff(min_comb_eff)
    new_comp_name = "#{boiler_hot_water.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_comb_eff} Combustion Eff"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.BoilerHotWater', "For #{template}: #{boiler_hot_water.name}: #{fuel_type} #{fluid_type} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; Combustion Efficiency = #{min_comb_eff}")
  end

  # Rename
  if rename
    boiler_hot_water.setName(new_comp_name)
  end

  return thermal_eff
end

#chiller_electric_eir_apply_efficiency_and_curves(chiller_electric_eir, clg_tower_objs) ⇒ Boolean

TODO:

remove clg_tower_objs parameter if unused

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

  • clg_tower_objs (Array)

    cooling towers, currently unused

Returns:

  • (Boolean)

    returns true if successful, false if not



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 192

def chiller_electric_eir_apply_efficiency_and_curves(chiller_electric_eir, clg_tower_objs)
  chillers = standards_data['chillers']

  # Define the criteria to find the chiller properties
  # in the hvac standards data set.
  search_criteria = chiller_electric_eir_find_search_criteria(chiller_electric_eir)
  cooling_type = search_criteria['cooling_type']
  condenser_type = search_criteria['condenser_type']
  compressor_type = search_criteria['compressor_type']
  compliance_path = search_criteria['compliance_path']

  # Get the chiller capacity
  capacity_w = OpenstudioStandards::HVAC.chiller_electric_get_capacity(chiller_electric_eir)

  # Convert capacity to tons
  capacity_tons = OpenStudio.convert(capacity_w, 'W', 'ton').get

  # Get the chiller properties
  chlr_props = model_find_object(chillers, search_criteria, capacity_tons, Date.today)
  cop = nil
  if chlr_props.nil?
    search_criteria.delete('compliance_path')
    compliance_path = nil
    chlr_props = model_find_object(standards_data['chillers'], search_criteria, capacity_tons, Date.today)
  end
  if chlr_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find chiller properties using #{search_criteria}, cannot apply standard efficiencies or curves.")
    return false
  else
    if !chlr_props['minimum_coefficient_of_performance'].nil?
      cop = chlr_props['minimum_coefficient_of_performance']
    elsif !chlr_props['minimum_energy_efficiency_ratio'].nil?
      cop = OpenstudioStandards::HVAC.eer_to_cop(chlr_props['minimum_energy_efficiency_ratio'])
    elsif !chlr_props['minimum_kilowatts_per_tons'].nil?
      cop = OpenstudioStandards::HVAC.kw_per_ton_to_cop(chlr_props['minimum_kilowatts_per_tons'])
    end
    if cop.nil?
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find minimum full load efficiency.")
      return false
    end
  end

  # Make the CAPFT curve
  cool_cap_f_t_name = chiller_electric_eir_get_cap_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, capacity_tons, compliance_path)
  if cool_cap_f_t_name.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find performance curve describing the capacity of the chiller as a function of temperature, will not be set.")
    successfully_set_all_properties = false
  else
    cool_cap_f_t = model_add_curve(chiller_electric_eir.model, cool_cap_f_t_name)
    if cool_cap_f_t
      chiller_electric_eir.setCoolingCapacityFunctionOfTemperature(cool_cap_f_t)
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, the performance curve describing the capacity of the chiller as a function of temperature could not be found.")
      successfully_set_all_properties = false
    end
  end

  # Make the EIRFT curve
  cool_eir_f_t_name = chiller_electric_eir_get_eir_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, capacity_tons, compliance_path)
  if cool_eir_f_t_name.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find performance curve describing the EIR of the chiller as a function of temperature, will not be set.")
    successfully_set_all_properties = false
  else
    cool_eir_f_t = model_add_curve(chiller_electric_eir.model, cool_eir_f_t_name)
    if cool_eir_f_t
      chiller_electric_eir.setElectricInputToCoolingOutputRatioFunctionOfTemperature(cool_eir_f_t)
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, the performance curve describing the EIR of the chiller as a function of temperature could not be found.")
      successfully_set_all_properties = false
    end
  end

  # Make the EIRFPLR curve
  cool_eir_f_plr_name = chiller_electric_eir_get_eir_f_plr_curve_name(chiller_electric_eir, compressor_type, cooling_type, capacity_tons, compliance_path)
  if cool_eir_f_plr_name.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find performance curve describing the EIR of the chiller as a function of part load ratio, will not be set.")
    successfully_set_all_properties = false
  else
    cool_plf_f_plr = model_add_curve(chiller_electric_eir.model, cool_eir_f_plr_name)
    if cool_plf_f_plr
      chiller_electric_eir.setElectricInputToCoolingOutputRatioFunctionOfPLR(cool_plf_f_plr)
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, the performance curve describing the EIR of the chiller as a function of part load ratio could not be found.")
      successfully_set_all_properties = false
    end
  end

  # Set the efficiency value
  if cop.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find minimum full load efficiency, will not be set.")
    successfully_set_all_properties = false
  else
    chiller_electric_eir.setReferenceCOP(cop)
    kw_per_ton = OpenstudioStandards::HVAC.cop_to_kw_per_ton(cop)
  end

  # Append the name with size and kw/ton
  chiller_electric_eir.setName("#{chiller_electric_eir.name} #{capacity_tons.round}tons #{kw_per_ton.round(3)}kW/ton")
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.ChillerElectricEIR', "For #{template}: #{chiller_electric_eir.name}: #{cooling_type} #{condenser_type} #{compressor_type} Capacity = #{capacity_tons.round}tons; COP = #{cop.round(1)} (#{kw_per_ton.round(3)}kW/ton)")

  return successfully_set_all_properties
end

#chiller_electric_eir_find_search_criteria(chiller_electric_eir) ⇒ Hash

Finds the search criteria

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

Returns:

  • (Hash)

    has for search criteria to be used for find object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 8

def chiller_electric_eir_find_search_criteria(chiller_electric_eir)
  search_criteria = {}
  search_criteria['template'] = template

  # Determine if WaterCooled or AirCooled by
  # checking if the chiller is connected to a condenser
  # water loop or not.  Use name as fallback for exporting HVAC library.
  cooling_type = chiller_electric_eir.condenserType

  search_criteria['cooling_type'] = cooling_type

  # @todo Standards replace this with a mechanism to store this
  # data in the chiller object itself.
  # For now, retrieve the condenser type from the name
  name = chiller_electric_eir.name.get
  condenser_type = nil
  compressor_type = nil
  absorption_type = nil
  if cooling_type == 'AirCooled'
    if name.include?('WithCondenser')
      condenser_type = 'WithCondenser'
    elsif name.include?('WithoutCondenser')
      condenser_type = 'WithoutCondenser'
    else
      # default to 'WithCondenser' if not an absorption chiller
      condenser_type = 'WithCondenser' if absorption_type.nil?
    end
  elsif cooling_type == 'WaterCooled'
    # use the chiller additional properties compressor type if defined
    if chiller_electric_eir.additionalProperties.hasFeature('compressor_type')
      compressor_type = chiller_electric_eir.additionalProperties.getFeatureAsString('compressor_type').get
    else
      # try to lookup by chiller name
      if name.include?('Reciprocating')
        compressor_type = 'Reciprocating'
      elsif name.include?('Rotary Screw')
        compressor_type = 'Rotary Screw'
      elsif name.include?('Scroll')
        compressor_type = 'Scroll'
      elsif name.include?('Centrifugal')
        compressor_type = 'Centrifugal'
      end
    end
  end
  unless condenser_type.nil?
    search_criteria['condenser_type'] = condenser_type
  end
  unless compressor_type.nil?
    search_criteria['compressor_type'] = compressor_type
  end

  # @todo Find out what compliance path is desired
  # perhaps this could be set using additional
  # properties when the chiller is created
  # Assume path a by default for now
  search_criteria['compliance_path'] = 'Path A'

  return search_criteria
end

#chiller_electric_eir_get_cap_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path) ⇒ String

TODO:

the current assingment is meant to replicate what was in the data, it probably needs to be reviewed

Get applicable performance curve for capacity as a function of temperature

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

  • compressor_type (String)

    compressor type

  • cooling_type (String)

    cooling type ('AirCooled' or 'WaterCooled')

  • chiller_tonnage (Double)

    chiller capacity in ton

Returns:

  • (String)

    name of applicable cuvre, nil if not found



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 114

def chiller_electric_eir_get_cap_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path)
  curve_name = nil
  case cooling_type
  when 'AirCooled'
    curve_name = 'AirCooled_Chiller_2010_PathA_CAPFT'
  when 'WaterCooled'
    case compressor_type
    when 'Centrifugal'
      if chiller_tonnage >= 150
        curve_name = 'WaterCooled_Centrifugal_Chiller_GT150_2004_CAPFT'
      else
        curve_name = 'WaterCooled_Centrifugal_Chiller_LT150_2004_CAPFT'
      end
    when 'Reciprocating', 'Rotary Screw', 'Scroll'
      curve_name = 'ChlrWtrPosDispPathAAllQRatio_fTchwsTcwsSI'
    end
  end
  return curve_name
end

#chiller_electric_eir_get_eir_f_plr_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path) ⇒ String

TODO:

the current assingment is meant to replicate what was in the data, it probably needs to be reviewed

Get applicable performance curve for EIR as a function of part load ratio

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

  • compressor_type (String)

    compressor type

  • cooling_type (String)

    cooling type ('AirCooled' or 'WaterCooled')

  • chiller_tonnage (Double)

    chiller capacity in ton

Returns:

  • (String)

    name of applicable cuvre, nil if not found



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 170

def chiller_electric_eir_get_eir_f_plr_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path)
  case cooling_type
  when 'AirCooled'
    return 'AirCooled_Chiller_AllCapacities_2004_2010_EIRFPLR'
  when 'WaterCooled'
    case compressor_type
    when 'Centrifugal', 'Reciprocating', 'Rotary Screw', 'Scroll'
      return 'ChlrWtrCentPathAAllEIRRatio_fQRatio'
    else
      return nil
    end
  else
    return nil
  end
end

#chiller_electric_eir_get_eir_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path) ⇒ String

TODO:

the current assingment is meant to replicate what was in the data, it probably needs to be reviewed

Get applicable performance curve for EIR as a function of temperature

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

  • compressor_type (String)

    compressor type

  • cooling_type (String)

    cooling type ('AirCooled' or 'WaterCooled')

  • chiller_tonnage (Double)

    chiller capacity in ton

Returns:

  • (String)

    name of applicable cuvre, nil if not found



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 142

def chiller_electric_eir_get_eir_f_t_curve_name(chiller_electric_eir, compressor_type, cooling_type, chiller_tonnage, compliance_path)
  case cooling_type
  when 'AirCooled'
    return 'AirCooled_Chiller_2010_PathA_EIRFT'
  when 'WaterCooled'
    case compressor_type
    when 'Centrifugal'
      return 'WaterCooled_Centrifugal_Chiller_GT150_2004_EIRFT' if chiller_tonnage >= 150

      return 'WaterCooled_Centrifugal_Chiller_LT150_2004_EIRFT'
    when 'Reciprocating', 'Rotary Screw', 'Scroll'
      return 'ChlrWtrPosDispPathAAllEIRRatio_fTchwsTcwsSI'
    else
      return nil
    end
  else
    return nil
  end
end

#chiller_electric_eir_standard_minimum_full_load_efficiency(chiller_electric_eir) ⇒ Double

Finds lookup object in standards and return full load efficiency

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

Returns:

  • (Double)

    full load efficiency (COP)



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 72

def chiller_electric_eir_standard_minimum_full_load_efficiency(chiller_electric_eir)
  # Get the chiller properties
  search_criteria = chiller_electric_eir_find_search_criteria(chiller_electric_eir)
  capacity_w = OpenstudioStandards::HVAC.chiller_electric_get_capacity(chiller_electric_eir)
  return nil unless capacity_w

  capacity_tons = OpenStudio.convert(capacity_w, 'W', 'ton').get
  chlr_props = model_find_object(standards_data['chillers'], search_criteria, capacity_tons, Date.today)

  if chlr_props.nil?
    search_criteria.delete('compliance_path')
    chlr_props = model_find_object(standards_data['chillers'], search_criteria, capacity_tons, Date.today)
  end
  if chlr_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find minimum full load efficiency.")
    return nil
  else
    cop = nil
    if !chlr_props['minimum_coefficient_of_performance'].nil?
      cop = chlr_props['minimum_coefficient_of_performance']
    elsif !chlr_props['minimum_energy_efficiency_ratio'].nil?
      cop = OpenstudioStandards::HVAC.eer_to_cop(chlr_props['minimum_energy_efficiency_ratio'])
    elsif !chlr_props['minimum_kilowatts_per_tons'].nil?
      cop = OpenstudioStandards::HVAC.kw_per_ton_to_cop(chlr_props['minimum_kilowatts_per_tons'])
    end
    if cop.nil?
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find minimum full load efficiency.")
      return nil
    end
  end

  return cop
end

#chw_sizing_control(model, chilled_water_loop, dsgn_sup_wtr_temp, dsgn_sup_wtr_temp_delt) ⇒ Boolean

Apply sizing and controls to chilled water loop

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • chilled_water_loop (OpenStudio::Model::PlantLoop)

    chilled water loop

  • dsgn_sup_wtr_temp (Double)

    design chilled water supply T

  • dsgn_sup_wtr_temp_delt (Double)

    design chilled water supply delta T

Returns:

  • (Boolean)

    returns true if successful, false if not



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/openstudio-standards/standards/Standards.PlantLoop.rb', line 21

def chw_sizing_control(model, chilled_water_loop, dsgn_sup_wtr_temp, dsgn_sup_wtr_temp_delt)
  # chilled water loop sizing and controls
  if dsgn_sup_wtr_temp.nil?
    dsgn_sup_wtr_temp = 44.0
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  else
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp_delt.nil?
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(10.1, 'R', 'K').get
  else
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(dsgn_sup_wtr_temp_delt, 'R', 'K').get
  end
  chilled_water_loop.setMinimumLoopTemperature(1.0)
  chilled_water_loop.setMaximumLoopTemperature(40.0)
  sizing_plant = chilled_water_loop.sizingPlant
  sizing_plant.setLoopType('Cooling')
  sizing_plant.setDesignLoopExitTemperature(dsgn_sup_wtr_temp_c)
  sizing_plant.setLoopDesignTemperatureDifference(dsgn_sup_wtr_temp_delt_k)
  chw_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                 dsgn_sup_wtr_temp_c,
                                                                                 name: "#{chilled_water_loop.name} Temp - #{dsgn_sup_wtr_temp.round(0)}F",
                                                                                 schedule_type_limit: 'Temperature')
  chw_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, chw_temp_sch)
  chw_stpt_manager.setName("#{chilled_water_loop.name} Setpoint Manager")
  chw_stpt_manager.addToNode(chilled_water_loop.supplyOutletNode)
  # @todo Yixing check the CHW Setpoint from standards
  # @todo Should be a OutdoorAirReset, see the changes I've made in Standards.PlantLoop.apply_prm_baseline_temperatures

  return true
end

#coil_cooling_dx_multi_speed_apply_efficiency_and_curves(coil_cooling_dx_multi_speed, sql_db_vars_map) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_cooling_dx_multi_speed (OpenStudio::Model::CoilCoolingDXMultiSpeed)

    coil cooling dx multi speed object

  • sql_db_vars_map (Hash)

    hash map

Returns:

  • (Hash)

    hash of coil objects



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb', line 9

def coil_cooling_dx_multi_speed_apply_efficiency_and_curves(coil_cooling_dx_multi_speed, sql_db_vars_map)
  # Define the criteria to find the cooling coil properties in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template
  cooling_type = coil_cooling_dx_multi_speed.condenserType
  search_criteria['cooling_type'] = cooling_type

  # @todo Standards - add split system vs single package to model
  # For now, assume single package as default
  sub_category = 'Single Package'

  # Determine the heating type if unitary or zone hvac
  heat_pump = false
  heating_type = nil
  containing_comp = nil
  if coil_cooling_dx_multi_speed.airLoopHVAC.empty?
    if coil_cooling_dx_multi_speed.containingHVACComponent.is_initialized
      containing_comp = coil_cooling_dx_multi_speed.containingHVACComponent.get
      if containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.is_initialized
        htg_coil = containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get.heatingCoil
        if htg_coil.to_CoilHeatingDXMultiSpeed.is_initialized
          heat_pump = true
          heating_type = 'Electric Resistance or None'
        elsif htg_coil.to_CoilHeatingGasMultiStage.is_initialized
          heating_type = 'All Other'
        end
        # @todo Add other unitary systems
      end
    elsif coil_cooling_dx_multi_speed.containingZoneHVACComponent.is_initialized
      containing_comp = coil_cooling_dx_multi_speed.containingZoneHVACComponent.get
      if containing_comp.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized
        sub_category = 'PTAC'
        htg_coil = containing_comp.to_ZoneHVACPackagedTerminalAirConditioner.get.heatingCoil
        if htg_coil.to_CoilHeatingElectric.is_initialized
          heating_type = 'Electric Resistance or None'
        elsif htg_coil.to_CoilHeatingWater.is_initialized || htg_coil.to_CoilHeatingGas.is_initialized || htg_col.to_CoilHeatingGasMultiStage
          heating_type = 'All Other'
        end
        # @todo Add other zone hvac systems
      end
    end
  end

  # Add the heating type to the search criteria
  unless heating_type.nil?
    search_criteria['heating_type'] = heating_type
  end

  search_criteria['subcategory'] = sub_category

  # Get the coil capacity
  capacity_w = nil
  clg_stages = stages
  if clg_stages.last.grossRatedTotalCoolingCapacity.is_initialized
    capacity_w = clg_stages.last.grossRatedTotalCoolingCapacity.get
  elsif coil_cooling_dx_multi_speed.autosizedSpeed4GrossRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_multi_speed.autosizedSpeed4GrossRatedTotalCoolingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name} capacity is not available, cannot apply efficiency standard.")
    return false
  end

  # Volume flow rate
  flow_rate4 = nil
  if clg_stages.last.ratedAirFlowRate.is_initialized
    flow_rate4 = clg_stages.last.ratedAirFlowRate.get
  elsif coil_cooling_dx_multi_speed.autosizedSpeed4RatedAirFlowRate.is_initialized
    flow_rate4 = coil_cooling_dx_multi_speed.autosizedSpeed4RatedAirFlowRate.get
  end

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get efficiencies data depending on whether it is a unitary AC or a heat pump
  coil_efficiency_data = if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_multi_speed)
                           standards_data['heat_pumps']
                         else
                           standards_data['unitary_acs']
                         end

  # Additional search criteria
  if (coil_efficiency_data[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))) && !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_multi_speed)
    search_criteria['equipment_type'] = 'Air Conditioners'
  end
  if coil_efficiency_data[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Lookup efficiency
  ac_props = model_find_object(coil_efficiency_data, search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return false
  end

  # Make the COOL-CAP-FT curve
  cool_cap_ft = nil
  if ac_props['cool_cap_ft']
    cool_cap_ft = model_add_curve(coil_cooling_dx_multi_speed.model, ac_props['cool_cap_ft'])
  else
    cool_cap_ft_curve_name = coil_dx_cap_ft(coil_cooling_dx_multi_speed)
    cool_cap_ft = model_add_curve(coil_cooling_dx_multi_speed.model, cool_cap_ft_curve_name)
  end
  if cool_cap_ft
    clg_stages.each do |stage|
      stage.setTotalCoolingCapacityFunctionofTemperatureCurve(cool_cap_ft)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find cool_cap_ft curve, will not be set.")
  end

  # Make the COOL-CAP-FFLOW curve
  cool_cap_fflow = nil
  if ac_props['cool_cap_fflow']
    cool_cap_fflow = model_add_curve(coil_coolingcoil_cooling_dx_multi_speed_dx_two_speed.model, ac_props['cool_cap_fflow'])
  else
    cool_cap_fflow_curve_name = coil_dx_cap_fflow(coil_cooling_dx_multi_speed)
    cool_cap_fflow = model_add_curve(coil_cooling_dx_multi_speed.model, cool_cap_fflow_curve_name)
  end
  if cool_cap_fflow
    clg_stages.each do |stage|
      stage.setTotalCoolingCapacityFunctionofFlowFractionCurve(cool_cap_fflow)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find cool_cap_fflow curve, will not be set.")
  end

  # Make the COOL-EIR-FT curve
  cool_eir_ft = nil
  if ac_props['cool_eir_ft']
    cool_eir_ft = model_add_curve(coil_cooling_dx_multi_speed.model, ac_props['cool_eir_ft'])
  else
    cool_eir_ft_curve_name = coil_dx_eir_ft(coil_cooling_dx_multi_speed)
    cool_eir_ft = model_add_curve(coil_cooling_dx_multi_speed.model, cool_eir_ft_curve_name)
  end
  if cool_eir_ft
    clg_stages.each do |stage|
      stage.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find cool_eir_ft curve, will not be set.")
  end

  # Make the COOL-EIR-FFLOW curve
  cool_eir_fflow = nil
  if ac_props['cool_eir_fflow']
    cool_eir_fflow = model_add_curve(coil_cooling_dx_multi_speed.model, ac_props['cool_eir_fflow'])
  else
    cool_eir_fflow_curve_name = coil_dx_eir_fflow(coil_cooling_dx_multi_speed)
    cool_eir_fflow = model_add_curve(coil_cooling_dx_multi_speed.model, cool_eir_fflow_curve_name)
  end
  if cool_eir_fflow
    clg_stages.each do |stage|
      stage.setEnergyInputRatioFunctionofFlowFractionCurve(cool_eir_fflow)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find cool_eir_fflow curve, will not be set.")
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = nil
  if ac_props['cool_plf_fplr']
    cool_plf_fplr = model_add_curve(coil_cooling_dx_multi_speed.model, ac_props['cool_plf_fplr'])
  else
    cool_plf_fplr_curve_name = coil_dx_plf_fplr(coil_cooling_dx_multi_speed)
    cool_plf_fplr = model_add_curve(coil_cooling_dx_multi_speed.model, cool_plf_fplr_curve_name)
  end
  if cool_plf_fplr
    clg_stages.each do |stage|
      stage.setPartLoadFractionCorrelationCurve(cool_plf_fplr)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{coil_cooling_dx_multi_speed.name}, cannot find cool_plf_fplr curve, will not be set.")
  end

  # Get the minimum efficiency standards
  cop = nil

  if coil_dx_subcategory(coil_cooling_dx_multi_speed) == 'PTAC'
    ptac_eer_coeff_1 = ac_props['ptac_eer_coefficient_1']
    ptac_eer_coeff_2 = ac_props['ptac_eer_coefficient_2']
    capacity_btu_per_hr = 7000 if capacity_btu_per_hr < 7000
    capacity_btu_per_hr = 15_000 if capacity_btu_per_hr > 15_000
    ptac_eer = ptac_eer_coeff_1 + (ptac_eer_coeff_2 * capacity_btu_per_hr)
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(ptac_eer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{ptac_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{subcategory} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{ptac_eer}")
  end

  # Preserve the original name
  orig_name = coil_cooling_dx_single_speed.name.to_s

  # Find the minimum COP and rename with efficiency rating
  new_comp_name, cop = coil_cooling_dx_multi_speed_standard_minimum_cop(coil_cooling_dx_multi_speed)

  sql_db_vars_map[new_comp_name] = orig_name

  # Set the new name
  coil_cooling_dx_multi_speed.setName(new_comp_name)

  # Set the efficiency values
  unless cop.nil?
    clg_stages.each do |istage|
      istage.setGrossRatedCoolingCOP(cop)
    end
  end

  return sql_db_vars_map
end

#coil_cooling_dx_multi_speed_standard_minimum_cop(coil_cooling_dx_multi_speed) ⇒ Array

TODO:

align the method arguments and return types

Finds lookup object in standards and return efficiency

Parameters:

  • coil_cooling_dx_multi_speed (OpenStudio::Model::CoilCoolingDXMultiSpeed)

    coil cooling dx multi speed object

Returns:

  • (Array)

    array of full load efficiency (COP), new object name



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb', line 228

def coil_cooling_dx_multi_speed_standard_minimum_cop(coil_cooling_dx_multi_speed)
  search_criteria = coil_dx_find_search_criteria(coil_cooling_dx_multi_speed)
  cooling_type = search_criteria['cooling_type']
  heating_type = search_criteria['heating_type']
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_multi_speed_get_capacity(coil_cooling_dx_multi_speed)

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Define database
  if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_multi_speed)
    database = standards_data['heat_pumps']
  else
    database = standards_data['unitary_acs']
  end

  # Additional search criteria
  if (database[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))) && !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_multi_speed)
    search_criteria['equipment_type'] = 'Air Conditioners'
  end
  if database[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Lookup efficiencies depending on whether it is a unitary AC or a heat pump
  ac_props = nil
  ac_props = model_find_object(database, search_criteria, capacity_btu_per_hr, Date.today)

  # Get the minimum efficiency standards
  cop = nil

  # If specified as SEER
  unless ac_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as SEER2
  # TODO: assumed to be the same as SEER for now
  unless ac_props['minimum_seasonal_energy_efficiency_ratio_2'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless ac_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as EER2
  # TODO: assumed to be the same as EER for now
  unless ac_props['minimum_energy_efficiency_ratio_2'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specific as IEER
  if !ac_props['minimum_integrated_energy_efficiency_ratio'].nil? && cop.nil?
    min_ieer = ac_props['minimum_integrated_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.ieer_to_cop_no_fan(min_ieer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_ieer}IEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; IEER = #{min_ieer}")
  end

  # if specified as SEER (heat pump)
  unless ac_props['minimum_seasonal_efficiency'].nil?
    min_seer = ac_props['minimum_seasonal_efficiency']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless ac_props['minimum_full_load_efficiency'].nil?
    min_eer = ac_props['minimum_full_load_efficiency']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{template}: #{coil_cooling_dx_multi_speed.name}: #{cooling_type} #{heating_type} #{OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_multi_speed)} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  return cop, new_comp_name
end

#coil_cooling_dx_single_speed_apply_efficiency_and_curves(coil_cooling_dx_single_speed, sql_db_vars_map, necb_ref_hp = false) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_cooling_dx_single_speed (OpenStudio::Model::CoilCoolingDXSingleSpeed)

    coil cooling dx single speed object

  • sql_db_vars_map (Hash)

    hash map

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

Returns:

  • (Hash)

    hash of coil objects



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb', line 196

def coil_cooling_dx_single_speed_apply_efficiency_and_curves(coil_cooling_dx_single_speed, sql_db_vars_map, necb_ref_hp = false)
  # Get efficiencies data depending on whether it is a unitary AC or a heat pump
  coil_efficiency_data = if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_single_speed)
                           standards_data['heat_pumps']
                         else
                           standards_data['unitary_acs']
                         end

  # Get the search criteria
  equipment_type = coil_efficiency_data[0].keys.include?('equipment_type') ? true : false
  search_criteria = coil_dx_find_search_criteria(coil_cooling_dx_single_speed, necb_ref_hp, equipment_type)

  # Additional search criteria
  if coil_efficiency_data[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))
    if search_criteria.keys.include?('equipment_type')
      equipment_type = search_criteria['equipment_type']
      if ['PTAC', 'PTHP'].include?(equipment_type) && template.include?('90.1')
        search_criteria['application'] = coil_dx_packaged_terminal_application(coil_cooling_dx_single_speed)
      end
    elsif !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_single_speed)
      search_criteria['equipment_type'] = 'Air Conditioners'
    end
  end
  if coil_efficiency_data[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Get the capacity
  if ['PTAC', 'PTHP'].include?(equipment_type) || ['PTAC', 'PTHP'].include?(OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_single_speed))
    thermal_zone = OpenstudioStandards::HVAC.hvac_component_get_thermal_zone(coil_cooling_dx_single_speed)
    multiplier = thermal_zone.multiplier if !thermal_zone.nil?
  end
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_single_speed_get_capacity(coil_cooling_dx_single_speed, multiplier: multiplier)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Lookup efficiency
  ac_props = model_find_object(coil_efficiency_data, search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return sql_db_vars_map
  end

  equipment_type_field = search_criteria['equipment_type']
  # Make the COOL-CAP-FT curve
  cool_cap_ft = nil
  if ac_props['cool_cap_ft']
    cool_cap_ft = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_cap_ft'])
  else
    cool_cap_ft_curve_name = coil_dx_cap_ft(coil_cooling_dx_single_speed, equipment_type_field)
    cool_cap_ft = model_add_curve(coil_cooling_dx_single_speed.model, cool_cap_ft_curve_name)
  end
  if cool_cap_ft
    coil_cooling_dx_single_speed.setTotalCoolingCapacityFunctionOfTemperatureCurve(cool_cap_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_cap_ft curve, will not be set.")
  end

  # Make the COOL-CAP-FFLOW curve
  cool_cap_fflow = nil
  if ac_props['cool_cap_fflow']
    cool_cap_fflow = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_cap_fflow'])
  else
    cool_cap_fflow_curve_name = coil_dx_cap_fflow(coil_cooling_dx_single_speed, equipment_type_field)
    cool_cap_fflow = model_add_curve(coil_cooling_dx_single_speed.model, cool_cap_fflow_curve_name)
  end
  if cool_cap_fflow
    coil_cooling_dx_single_speed.setTotalCoolingCapacityFunctionOfFlowFractionCurve(cool_cap_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_cap_fflow curve, will not be set.")
  end

  # Make the COOL-EIR-FT curve
  cool_eir_ft = nil
  if ac_props['cool_eir_ft']
    cool_eir_ft = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_eir_ft'])
  else
    cool_eir_ft_curve_name = coil_dx_eir_ft(coil_cooling_dx_single_speed, equipment_type_field)
    cool_eir_ft = model_add_curve(coil_cooling_dx_single_speed.model, cool_eir_ft_curve_name)
  end
  if cool_eir_ft
    coil_cooling_dx_single_speed.setEnergyInputRatioFunctionOfTemperatureCurve(cool_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_eir_ft curve, will not be set.")
  end

  # Make the COOL-EIR-FFLOW curve
  cool_eir_fflow = nil
  if ac_props['cool_eir_fflow']
    cool_eir_fflow = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_eir_fflow'])
  else
    cool_eir_fflow_curve_name = coil_dx_eir_fflow(coil_cooling_dx_single_speed, equipment_type_field)
    cool_eir_fflow = model_add_curve(coil_cooling_dx_single_speed.model, cool_eir_fflow_curve_name)
  end
  if cool_eir_fflow
    coil_cooling_dx_single_speed.setEnergyInputRatioFunctionOfFlowFractionCurve(cool_eir_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_eir_fflow curve, will not be set.")
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = nil
  if ac_props['cool_plf_fplr']
    cool_plf_fplr = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_plf_fplr'])
  else
    cool_plf_fplr_curve_name = coil_dx_plf_fplr(coil_cooling_dx_single_speed, equipment_type_field)
    cool_plf_fplr = model_add_curve(coil_cooling_dx_single_speed.model, cool_plf_fplr_curve_name)
  end
  if cool_plf_fplr
    coil_cooling_dx_single_speed.setPartLoadFractionCorrelationCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_plf_fplr curve, will not be set.")
  end

  # Preserve the original name
  orig_name = coil_cooling_dx_single_speed.name.to_s

  # Find the minimum COP and rename with efficiency rating
  cop = coil_cooling_dx_single_speed_standard_minimum_cop(coil_cooling_dx_single_speed, true, necb_ref_hp, equipment_type)

  # Map the original name to the new name
  sql_db_vars_map[coil_cooling_dx_single_speed.name.to_s] = orig_name

  # Set the efficiency values
  unless cop.nil?
    coil_cooling_dx_single_speed.setRatedCOP(OpenStudio::OptionalDouble.new(cop))
  end

  return sql_db_vars_map
end

#coil_cooling_dx_single_speed_standard_minimum_cop(coil_cooling_dx_single_speed, rename = false, necb_ref_hp = false, equipment_type = false) ⇒ Double

Finds lookup object in standards and return efficiency

Parameters:

  • coil_cooling_dx_single_speed (OpenStudio::Model::CoilCoolingDXSingleSpeed)

    coil cooling dx single speed object

  • rename (Boolean) (defaults to: false)

    if true, object will be renamed to include capacity and efficiency level

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

  • equipment_type (Boolean) (defaults to: false)

    indicate that equipment_type should be in the search criteria.

Returns:

  • (Double)

    full load efficiency (COP)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb', line 13

def coil_cooling_dx_single_speed_standard_minimum_cop(coil_cooling_dx_single_speed, rename = false, necb_ref_hp = false, equipment_type = false)
  search_criteria = coil_dx_find_search_criteria(coil_cooling_dx_single_speed, necb_ref_hp, equipment_type)
  cooling_type = search_criteria['cooling_type']
  heating_type = search_criteria['heating_type']
  sub_category = search_criteria['subcategory']
  equipment_type = nil

  # Define database
  if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_single_speed)
    database = standards_data['heat_pumps']
  else
    database = standards_data['unitary_acs']
  end


  # Additional search criteria
  if database[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))
    if search_criteria.keys.include?('equipment_type')
      equipment_type = search_criteria['equipment_type']
      if ['PTAC', 'PTHP'].include?(equipment_type) && template.include?('90.1')
        search_criteria['application'] = coil_dx_packaged_terminal_application(coil_cooling_dx_single_speed)
      end
    elsif !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_single_speed)
      search_criteria['equipment_type'] = 'Air Conditioners'
    end
  end
  if database[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  if ['PTAC', 'PTHP'].include?(equipment_type) || ['PTAC', 'PTHP'].include?(OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_single_speed))
    thermal_zone = OpenstudioStandards::HVAC.hvac_component_get_thermal_zone(coil_cooling_dx_single_speed)
    multiplier = thermal_zone.multiplier if !thermal_zone.nil?
  end
  # Get the capacity
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_single_speed_get_capacity(coil_cooling_dx_single_speed, multiplier: multiplier)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  # Lookup efficiencies depending on whether it is a unitary AC or a heat pump
  ac_props = nil
  ac_props = model_find_object(database, search_criteria, capacity_btu_per_hr, Date.today)
  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return false
  end

  # Get the minimum efficiency standards
  cop = nil

  # If PTHP, use equations if coefficients are specified
  # Check both new format (equipment_type == 'PTHP') and old format (e.g. DOE Ref Pre-1980 / 1980-2004)
  # where there is no 'equipment_type' key and PTHP is identified via subcategory instead.
  pthp_eer_coeff_1 = ac_props['pthp_eer_coefficient_1']
  pthp_eer_coeff_2 = ac_props['pthp_eer_coefficient_2']
  if (equipment_type == 'PTHP' || sub_category == 'PTHP') && !pthp_eer_coeff_1.nil? && !pthp_eer_coeff_2.nil?
    # TABLE 6.8.1D
    # EER = pthp_eer_coeff_1 - (pthp_eer_coeff_2 * Cap / 1000)
    # Note c: Cap means the rated cooling capacity of the product in Btu/h.
    # If the unit's capacity is less than 7000 Btu/h, use 7000 Btu/h in the calculation.
    # If the unit's capacity is greater than 15,000 Btu/h, use 15,000 Btu/h in the calculation.
    eer_calc_cap_btu_per_hr = capacity_btu_per_hr
    eer_calc_cap_btu_per_hr = 7000 if capacity_btu_per_hr < 7000
    eer_calc_cap_btu_per_hr = 15_000 if capacity_btu_per_hr > 15_000
    pthp_eer = pthp_eer_coeff_1 - (pthp_eer_coeff_2 * eer_calc_cap_btu_per_hr / 1000.0)
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(pthp_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{pthp_eer.round(1)}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{pthp_eer.round(1)}")
  end

  # If PTAC, use equations if coefficients are specified
  ptac_eer_coeff_1 = ac_props['ptac_eer_coefficient_1']
  ptac_eer_coeff_2 = ac_props['ptac_eer_coefficient_2']
  if equipment_type == 'PTAC' && !ptac_eer_coeff_1.nil? && !ptac_eer_coeff_2.nil?
    # TABLE 6.8.1D
    # EER = ptac_eer_coeff_1 - (ptac_eer_coeff_2 * Cap / 1000)
    # Note c: Cap means the rated cooling capacity of the product in Btu/h.
    # If the unit's capacity is less than 7000 Btu/h, use 7000 Btu/h in the calculation.
    # If the unit's capacity is greater than 15,000 Btu/h, use 15,000 Btu/h in the calculation.
    eer_calc_cap_btu_per_hr = capacity_btu_per_hr
    eer_calc_cap_btu_per_hr = 7000 if capacity_btu_per_hr < 7000
    eer_calc_cap_btu_per_hr = 15_000 if capacity_btu_per_hr > 15_000
    ptac_eer = ptac_eer_coeff_1 - (ptac_eer_coeff_2 * eer_calc_cap_btu_per_hr / 1000.0)
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(ptac_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{ptac_eer.round(1)}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{ptac_eer.round(1)}")
  end

  # If CRAC, use equations if coefficients are specified
  crac_minimum_scop = ac_props['minimum_scop']
  if sub_category == 'CRAC' && !crac_minimum_scop.nil?
    # TABLE 6.8.1K in 90.1-2010, TABLE 6.8.1-10 in 90.1-2019
    # cop = scop/sensible heat ratio
    if coil_cooling_dx_single_speed.ratedSensibleHeatRatio.is_initialized
      crac_sensible_heat_ratio = coil_cooling_dx_single_speed.ratedSensibleHeatRatio.get
    elsif coil_cooling_dx_single_speed.autosizedRatedSensibleHeatRatio.is_initialized
      # Though actual inlet temperature is very high (thus basically no dehumidification),
      # sensible heat ratio can't be pre-assigned as 1 because it should be the value at conditions defined in ASHRAE Standard 127 => 26.7 degC drybulb/19.4 degC wetbulb.
      crac_sensible_heat_ratio = coil_cooling_dx_single_speed.autosizedRatedSensibleHeatRatio.get
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.CoilCoolingDXSingleSpeed', 'Failed to get autosized sensible heat ratio')
    end
    cop = crac_minimum_scop / crac_sensible_heat_ratio
    cop = cop.round(2)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{crac_minimum_scop}SCOP #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SCOP = #{crac_minimum_scop}")
  end

  # If specified as SEER
  unless ac_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as SEER2
  # TODO: assumed to be the same as SEER for now
  unless ac_props['minimum_seasonal_energy_efficiency_ratio_2'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless ac_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as EER2
  # TODO: assumed to be the same as EER for now
  unless ac_props['minimum_energy_efficiency_ratio_2'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specific as IEER
  if !ac_props['minimum_integrated_energy_efficiency_ratio'].nil? && cop.nil?
    min_ieer = ac_props['minimum_integrated_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.ieer_to_cop_no_fan(min_ieer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_ieer}IEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as SEER
  unless ac_props['minimum_seasonal_efficiency'].nil?
    min_seer = ac_props['minimum_seasonal_efficiency']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless ac_props['minimum_full_load_efficiency'].nil?
    min_eer = ac_props['minimum_full_load_efficiency']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    coil_cooling_dx_single_speed.setName(new_comp_name)
  end

  return cop
end

#coil_cooling_dx_two_speed_apply_efficiency_and_curves(coil_cooling_dx_two_speed, sql_db_vars_map) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_cooling_dx_two_speed (OpenStudio::Model::CoilCoolingDXTwoSpeed)

    coil cooling dx two speed object

  • sql_db_vars_map (Hash)

    hash map

Returns:

  • (Hash)

    hash of coil objects



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb', line 132

def coil_cooling_dx_two_speed_apply_efficiency_and_curves(coil_cooling_dx_two_speed, sql_db_vars_map)
  # Get the search criteria
  search_criteria = coil_dx_find_search_criteria(coil_cooling_dx_two_speed)

  # Get the capacity
  if ['PTAC', 'PTHP'].include?(OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_two_speed))
    thermal_zone = OpenstudioStandards::HVAC.hvac_component_get_thermal_zone(coil_cooling_dx_two_speed)
    multiplier = thermal_zone.multiplier if !thermal_zone.nil?
  end
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_two_speed_get_capacity(coil_cooling_dx_two_speed, multiplier: multiplier)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get efficiencies data depending on whether it is a unitary AC or a heat pump
  coil_efficiency_data = if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_two_speed)
                           standards_data['heat_pumps']
                         else
                           standards_data['unitary_acs']
                         end

  # Additional search criteria
  if (coil_efficiency_data[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))) && !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_two_speed)
    search_criteria['equipment_type'] = 'Air Conditioners'
  end
  if coil_efficiency_data[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Look up the efficiency characteristics
  # Lookup efficiencies depending on whether it is a unitary AC or a heat pump
  ac_props = nil
  ac_props = model_find_object(coil_efficiency_data, search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return sql_db_vars_map
  end

  # Make the total COOL-CAP-FT curve
  cool_cap_ft = nil
  if ac_props['cool_cap_ft']
    cool_cap_ft = model_add_curve(coil_cooling_dx_two_speed.model, ac_props['cool_cap_ft'])
  else
    cool_cap_ft_curve_name = coil_dx_cap_ft(coil_cooling_dx_two_speed)
    cool_cap_ft = model_add_curve(coil_cooling_dx_two_speed.model, cool_cap_ft_curve_name)
  end
  if cool_cap_ft
    coil_cooling_dx_two_speed.setTotalCoolingCapacityFunctionOfTemperatureCurve(cool_cap_ft)
    coil_cooling_dx_two_speed.setLowSpeedTotalCoolingCapacityFunctionOfTemperatureCurve(cool_cap_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find cool_cap_ft curve, will not be set.")
  end

  # Make the total COOL-CAP-FFLOW curve
  cool_cap_fflow = nil
  if ac_props['cool_cap_fflow']
    cool_cap_fflow = model_add_curve(coil_cooling_dx_two_speed.model, ac_props['cool_cap_fflow'])
  else
    cool_cap_fflow_curve_name = coil_dx_cap_fflow(coil_cooling_dx_two_speed)
    cool_cap_fflow = model_add_curve(coil_cooling_dx_two_speed.model, cool_cap_fflow_curve_name)
  end
  if cool_cap_fflow
    coil_cooling_dx_two_speed.setTotalCoolingCapacityFunctionOfFlowFractionCurve(cool_cap_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find cool_cap_fflow curve, will not be set.")
  end

  # Make the COOL-EIR-FT curve
  cool_eir_ft = nil
  if ac_props['cool_eir_ft']
    cool_eir_ft = model_add_curve(coil_cooling_dx_two_speed.model, ac_props['cool_eir_ft'])
  else
    cool_eir_ft_curve_name = coil_dx_eir_ft(coil_cooling_dx_two_speed)
    cool_eir_ft = model_add_curve(coil_cooling_dx_two_speed.model, cool_eir_ft_curve_name)
  end
  if cool_eir_ft
    coil_cooling_dx_two_speed.setEnergyInputRatioFunctionOfTemperatureCurve(cool_eir_ft)
    coil_cooling_dx_two_speed.setLowSpeedEnergyInputRatioFunctionOfTemperatureCurve(cool_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find cool_eir_ft curve, will not be set.")
  end

  # Make the COOL-EIR-FFLOW curve
  cool_eir_fflow = nil
  if ac_props['cool_eir_fflow']
    cool_eir_fflow = model_add_curve(coil_cooling_dx_two_speed.model, ac_props['cool_eir_fflow'])
  else
    cool_eir_fflow_curve_name = coil_dx_eir_fflow(coil_cooling_dx_two_speed)
    cool_eir_fflow = model_add_curve(coil_cooling_dx_two_speed.model, cool_eir_fflow_curve_name)
  end
  if cool_eir_fflow
    coil_cooling_dx_two_speed.setEnergyInputRatioFunctionOfFlowFractionCurve(cool_eir_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find cool_eir_fflow curve, will not be set.")
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = nil
  if ac_props['cool_plf_fplr']
    cool_plf_fplr = model_add_curve(coil_cooling_dx_two_speed.model, ac_props['cool_plf_fplr'])
  else
    cool_plf_fplr_curve_name = coil_dx_plf_fplr(coil_cooling_dx_two_speed)
    cool_plf_fplr = model_add_curve(coil_cooling_dx_two_speed.model, cool_plf_fplr_curve_name)
  end
  if cool_plf_fplr
    coil_cooling_dx_two_speed.setPartLoadFractionCorrelationCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find cool_plf_fplr curve, will not be set.")
  end

  # Preserve the original name
  orig_name = coil_cooling_dx_two_speed.name.to_s

  # Find the minimum COP and rename with efficiency rating
  cop = coil_cooling_dx_two_speed_standard_minimum_cop(coil_cooling_dx_two_speed, true)

  # Map the original name to the new name
  sql_db_vars_map[coil_cooling_dx_two_speed.name.to_s] = orig_name

  # Set the efficiency values
  unless cop.nil?
    coil_cooling_dx_two_speed.setRatedHighSpeedCOP(cop)
    coil_cooling_dx_two_speed.setRatedLowSpeedCOP(cop)
  end

  return sql_db_vars_map
end

#coil_cooling_dx_two_speed_standard_minimum_cop(coil_cooling_dx_two_speed, rename = false) ⇒ Double

Finds lookup object in standards and return efficiency

Parameters:

  • coil_cooling_dx_two_speed (OpenStudio::Model::CoilCoolingDXTwoSpeed)

    coil cooling dx two speed object

  • rename (Boolean) (defaults to: false)

    if true, object will be renamed to include capacity and efficiency level

Returns:

  • (Double)

    full load efficiency (COP)



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb', line 11

def coil_cooling_dx_two_speed_standard_minimum_cop(coil_cooling_dx_two_speed, rename = false)
  search_criteria = coil_dx_find_search_criteria(coil_cooling_dx_two_speed)
  cooling_type = search_criteria['cooling_type']
  heating_type = search_criteria['heating_type']
  sub_category = search_criteria['subcategory']

  # Define database
  if OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_two_speed)
    database = standards_data['heat_pumps']
  else
    database = standards_data['unitary_acs']
  end

  # Additional search criteria
  if (database[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))) && !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_cooling_dx_two_speed)
    search_criteria['equipment_type'] = 'Air Conditioners'
  end
  if database[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Get the capacity
  if ['PTAC', 'PTHP'].include?(OpenstudioStandards::HVAC.coil_dx_subcategory(coil_cooling_dx_two_speed))
    thermal_zone = OpenstudioStandards::HVAC.hvac_component_get_thermal_zone(coil_cooling_dx_two_speed)
    multiplier = thermal_zone.multiplier if !thermal_zone.nil?
  end
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_dx_two_speed_get_capacity(coil_cooling_dx_two_speed, multiplier: multiplier)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Lookup efficiencies depending on whether it is a unitary AC or a heat pump
  ac_props = nil
  ac_props = model_find_object(database, search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return false
  end

  # Get the minimum efficiency standards
  cop = nil

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return cop # value of nil
  end

  # If specified as SEER
  unless ac_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as SEER2
  # TODO: assumed to be the same as SEER for now
  unless ac_props['minimum_seasonal_energy_efficiency_ratio_2'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless ac_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as EER2
  # TODO: assumed to be the same as EER for now
  unless ac_props['minimum_energy_efficiency_ratio_2'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio_2']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specific as IEER
  if !ac_props['minimum_integrated_energy_efficiency_ratio'].nil? && cop.nil?
    min_ieer = ac_props['minimum_integrated_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.ieer_to_cop_no_fan(min_ieer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_ieer}IEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; IEER = #{min_ieer}")
  end

  # If specified as SEER (heat pump)
  unless ac_props['minimum_seasonal_efficiency'].nil?
    min_seer = ac_props['minimum_seasonal_efficiency']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless ac_props['minimum_full_load_efficiency'].nil?
    min_eer = ac_props['minimum_full_load_efficiency']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_two_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{template}: #{coil_cooling_dx_two_speed.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    coil_cooling_dx_two_speed.setName(new_comp_name)
  end

  return cop
end

#coil_cooling_water_to_air_heat_pump_apply_efficiency_and_curves(coil_cooling_water_to_air_heat_pump, sql_db_vars_map) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_cooling_water_to_air_heat_pump (OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit)

    coil cooling object

  • sql_db_vars_map (Hash)

    hash map

Returns:

  • (Hash)

    hash of coil objects



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb', line 102

def coil_cooling_water_to_air_heat_pump_apply_efficiency_and_curves(coil_cooling_water_to_air_heat_pump, sql_db_vars_map)
  # Get the search criteria
  search_criteria = {}
  search_criteria['template'] = template
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_water_to_air_heat_pump_get_capacity(coil_cooling_water_to_air_heat_pump)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Look up the efficiency characteristics
  coil_props = model_find_object(standards_data['water_source_heat_pumps'], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if coil_props.nil?
    # search again without capacity
    matching_objects = model_find_objects(standards_data['water_source_heat_pumps'], search_criteria, nil, Date.today)
    if matching_objects.empty?
      # This proves that the search_criteria has issue finding the correct coil prop
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{coil_cooling_water_to_air_heat_pump.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
      return sql_db_vars_map
    end
  end

  # Preserve the original name
  orig_name = coil_cooling_water_to_air_heat_pump.name.to_s

  # Find the minimum COP and rename with efficiency rating
  cop = coil_cooling_water_to_air_heat_pump_standard_minimum_cop(coil_cooling_water_to_air_heat_pump, true)

  # Map the original name to the new name
  sql_db_vars_map[coil_cooling_water_to_air_heat_pump.name.to_s] = orig_name

  # Set the efficiency values
  unless cop.nil?
    coil_cooling_water_to_air_heat_pump.setRatedCoolingCoefficientofPerformance(cop)
  end

  return sql_db_vars_map
end

#coil_cooling_water_to_air_heat_pump_standard_minimum_cop(coil_cooling_water_to_air_heat_pump, rename = false, computer_room_air_conditioner = false) ⇒ Double

Finds lookup object in standards and return efficiency

Parameters:

  • coil_cooling_water_to_air_heat_pump (OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit)

    coil cooling object

  • rename (Boolean) (defaults to: false)

    if true, object will be renamed to include capacity and efficiency level

Returns:

  • (Double)

    full load efficiency (COP)



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb', line 9

def coil_cooling_water_to_air_heat_pump_standard_minimum_cop(coil_cooling_water_to_air_heat_pump, rename = false, computer_room_air_conditioner = false)
  search_criteria = {}
  search_criteria['template'] = template
  if computer_room_air_conditioner
    search_criteria['cooling_type'] = 'WaterCooled'
    search_criteria['standard_model'] = 'Downflow units'
    cooling_type = search_criteria['cooling_type']
    heating_type = 'All Other'
    sub_category = 'CRAC'
  end
  capacity_w = OpenstudioStandards::HVAC.coil_cooling_water_to_air_heat_pump_get_capacity(coil_cooling_water_to_air_heat_pump)

  # Check to make sure properties were found
  if capacity_w.nil? || capacity_w < 1
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{coil_cooling_water_to_air_heat_pump.name}, cannot determine capacity.")
    return nil
  end
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  if computer_room_air_conditioner
    equipment_type = 'computer_room_acs'
  else
    equipment_type = 'water_source_heat_pumps'
  end
  coil_props = model_find_object(standards_data[equipment_type], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if coil_props.nil?
    # search again without capacity
    matching_objects = model_find_objects(standards_data[equipment_type], search_criteria, nil, Date.today)
    if !matching_objects.empty? && (equipment_type == 'water_source_heat_pumps') && (capacity_btu_per_hr > 135000)
      # Issue warning indicate the coil size is may be too large
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "The capacity of coil '#{coil_cooling_water_to_air_heat_pump.name}' is #{capacity_btu_per_hr.round} Btu/hr, which is larger than the 135,000 Btu/hr maximum capacity listed in the efficiency standard. This may be because of zone loads, zone size, or because zone equipment sizing in EnergyPlus includes zone multipliers. Will assume a capacity of 134,999 Btu/hr for the efficiency lookup.")
      coil_props = model_find_object(standards_data[equipment_type], search_criteria, 134999, Date.today)
    end
  end

  # Check to make sure properties were found
  if coil_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{coil_cooling_water_to_air_heat_pump.name}, cannot find efficiency info using #{search_criteria}  and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency standards
  cop = nil

  # If specified as EER (heat pump)
  unless coil_props['minimum_full_load_efficiency'].nil?
    min_eer = coil_props['minimum_full_load_efficiency']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer, capacity_w = nil)
    new_comp_name = "#{coil_cooling_water_to_air_heat_pump.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{template}: #{coil_cooling_water_to_air_heat_pump.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as SCOP (water-cooled Computer Room Air Conditioned (CRAC))
  if computer_room_air_conditioner
    crac_minimum_scop = coil_props['minimum_scop']
    unless crac_minimum_scop.nil?
      # cop = scop / sensible heat ratio
      # sensible heat ratio = sensible cool capacity / total cool capacity
      if coil_cooling_water_to_air_heat_pump.ratedSensibleCoolingCapacity.is_initialized
        crac_sensible_cool = coil_cooling_water_to_air_heat_pump.ratedSensibleCoolingCapacity.get
        crac_total_cool = coil_cooling_water_to_air_heat_pump.ratedTotalCoolingCapacity.get
        crac_sensible_cool_ratio = crac_sensible_cool / crac_total_cool
      elsif coil_cooling_water_to_air_heat_pump.autosizedRatedSensibleCoolingCapacity.is_initialized
        crac_sensible_cool = coil_cooling_water_to_air_heat_pump.autosizedRatedSensibleCoolingCapacity.get
        crac_total_cool = coil_cooling_water_to_air_heat_pump.autosizedRatedTotalCoolingCapacity.get
        crac_sensible_heat_ratio = crac_sensible_cool / crac_total_cool
      else
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', 'Failed to get autosized sensible cool capacity')
      end
      cop = crac_minimum_scop / crac_sensible_heat_ratio
      cop = cop.round(2)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{coil_cooling_water_to_air_heat_pump.name}: #{cooling_type} #{heating_type} #{sub_category} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SCOP = #{crac_minimum_scop}")
    end
  end

  # Rename
  if rename
    coil_cooling_water_to_air_heat_pump.setName(new_comp_name)
  end

  return cop
end

#coil_heating_dx_multi_speed_apply_efficiency_and_curves(coil_heating_dx_multi_speed, sql_db_vars_map) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_heating_dx_multi_speed (OpenStudio::Model::CoilHeatingDXMultiSpeed)

    coil heating dx multi speed object

Returns:

  • (Boolean)

    returns true if successful, false if not



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXMultiSpeed.rb', line 8

def coil_heating_dx_multi_speed_apply_efficiency_and_curves(coil_heating_dx_multi_speed, sql_db_vars_map)
  successfully_set_all_properties = true

  # Define the criteria to find the unitary properties
  # in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template

  # Determine supplemental heating type if unitary
  heat_pump = false
  suppl_heating_type = nil
  if coil_heating_dx_multi_speed.airLoopHVAC.empty? && coil_heating_dx_multi_speed.containingHVACComponent.is_initialized
    containing_comp = coil_heating_dx_multi_speed.containingHVACComponent.get
    if containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.is_initialized
      heat_pump = true
      htg_coil = containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get.supplementalHeatingCoil
      suppl_heating_type = if htg_coil.to_CoilHeatingElectric.is_initialized
                             'Electric Resistance or None'
                           else
                             'All Other'
                           end
    end
    # @todo Add other unitary systems
  end

  # @todo Standards - add split system vs single package to model
  # For now, assume single package
  subcategory = 'Single Package'
  search_criteria['subcategory'] = subcategory

  # Get the coil capacity
  clg_capacity = nil
  if heat_pump == true
    containing_comp = coil_heating_dx_multi_speed.containingHVACComponent.get
    heat_pump_comp = containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get
    ccoil = heat_pump_comp.coolingCoil
    dxcoil = ccoil.to_CoilCoolingDXMultiSpeed.get
    dxcoil_name = dxcoil.name.to_s
    if sql_db_vars_map && sql_db_vars_map[dxcoil_name]
      dxcoil.setName(sql_db_vars_map[dxcoil_name])
    end
    clg_stages = dxcoil.stages
    if clg_stages.last.grossRatedTotalCoolingCapacity.is_initialized
      clg_capacity = clg_stages.last.grossRatedTotalCoolingCapacity.get
    elsif dxcoil.autosizedSpeed4GrossRatedTotalCoolingCapacity.is_initialized
      clg_capacity = dxcoil.autosizedSpeed4GrossRatedTotalCoolingCapacity.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name} capacity is not available, cannot apply efficiency standard.")
      successfully_set_all_properties = false
      return successfully_set_all_properties
    end
    dxcoil.setName(dxcoil_name)
  end

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(clg_capacity, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(clg_capacity, 'W', 'kBtu/hr').get

  # Lookup efficiencies depending on whether it is a unitary AC or a heat pump
  hp_props = model_find_object(standards_data['heat_pumps'], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if hp_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultipeed', "For #{coil_heating_dx_multi_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Make the HEAT-CAP-FT curve
  htg_stages = stages
  heat_cap_ft = model_add_curve(model, hp_props['heat_cap_ft'], standards)
  if heat_cap_ft
    htg_stages.each do |istage|
      istage.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name}, cannot find heat_cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FFLOW curve
  heat_cap_fflow = model_add_curve(model, hp_props['heat_cap_fflow'], standards)
  if heat_cap_fflow
    htg_stages.each do |istage|
      istage.setHeatingCapacityFunctionofFlowFractionCurve(heat_cap_fflow)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name}, cannot find heat_cap_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT curve
  heat_eir_ft = model_add_curve(model, hp_props['heat_eir_ft'], standards)
  if heat_eir_ft
    htg_stages.each do |istage|
      istage.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name}, cannot find heat_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FFLOW curve
  heat_eir_fflow = model_add_curve(model, hp_props['heat_eir_fflow'], standards)
  if heat_eir_fflow
    htg_stages.each do |istage|
      istage.setEnergyInputRatioFunctionofFlowFractionCurve(heat_eir_fflow)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name}, cannot find heat_eir_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-PLF-FPLR curve
  heat_plf_fplr = model_add_curve(model, hp_props['heat_plf_fplr'], standards)
  if heat_plf_fplr
    htg_stages.each do |istage|
      istage.setPartLoadFractionCorrelationCurve(heat_plf_fplr)
    end
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name}, cannot find heat_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  htg_capacity = nil
  flow_rate4 = nil
  htg_stages = coil_heating_dx_multi_speed.stages
  if htg_stages.last.grossRatedHeatingCapacity.is_initialized
    htg_capacity = htg_stages.last.grossRatedHeatingCapacity.get
  elsif coil_heating_dx_multi_speed.autosizedSpeed4GrossRatedHeatingCapacity.is_initialized
    htg_capacity = coil_heating_dx_multi_speed.autosizedSpeed4GrossRatedHeatingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name} capacity is not available, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end
  if htg_stages.last.ratedAirFlowRate.is_initialized
    flow_rate4 = htg_stages.last.ratedAirFlowRate.get
  elsif coil_heating_dx_multi_speed.autosizedSpeed4RatedAirFlowRate.is_initialized
    flow_rate4 = coil_heating_dx_multi_speed.autosizedSpeed4RatedAirFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{coil_heating_dx_multi_speed.name} capacity is not available, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(htg_capacity, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(htg_capacity, 'W', 'kBtu/hr').get

  # Get the minimum efficiency standards
  cop = nil

  # If specified as SEER
  unless hp_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = hp_props['minimum_seasonal_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    coil_heating_dx_multi_speed.setName("#{coil_heating_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER")
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{template}: #{coil_heating_dx_multi_speed.name}: #{suppl_heating_type} #{subcategory} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless hp_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = hp_props['minimum_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    coil_heating_dx_multi_speed.setName("#{coil_heating_dx_multi_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER")
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXMultiSpeed', "For #{template}: #{coil_heating_dx_multi_speed.name}:  #{suppl_heating_type} #{subcategory} Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Set the efficiency values
  return false if cop.nil?

  htg_stages.each do |istage|
    istage.setGrossRatedHeatingCOP(cop)
  end
  return true
end

#coil_heating_dx_single_speed_apply_efficiency_and_curves(coil_heating_dx_single_speed, sql_db_vars_map, necb_ref_hp = false) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_heating_dx_single_speed (OpenStudio::Model::CoilHeatingDXSingleSpeed)

    coil heating dx single speed object

  • sql_db_vars_map (Hash)

    hash map

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

Returns:

  • (Hash)

    hash of coil objects



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb', line 152

def coil_heating_dx_single_speed_apply_efficiency_and_curves(coil_heating_dx_single_speed, sql_db_vars_map, necb_ref_hp = false)
  # Get the search criteria
  search_criteria = coil_dx_find_search_criteria(coil_heating_dx_single_speed, necb_ref_hp)
  sub_category = search_criteria['subcategory']
  suppl_heating_type = search_criteria['heating_type']
  coil_efficiency_data = standards_data['heat_pumps_heating']
  equipment_type = coil_efficiency_data[0].keys.include?('equipment_type') ? true : false

  # Get the capacity
  capacity_w = OpenstudioStandards::HVAC.coil_heating_get_paired_coil_cooling_capacity(coil_heating_dx_single_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Additional search criteria
  if coil_efficiency_data[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))
    if search_criteria.keys.include?('equipment_type')
      equipment_type = search_criteria['equipment_type']
      if ['PTHP'].include?(equipment_type) && template.include?('90.1')
        search_criteria['application'] = coil_dx_packaged_terminal_application(coil_heating_dx_single_speed)
      end
    elsif !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_heating_dx_single_speed) # `coil_dx_heat_pump?` returns false when a DX heating coil is wrapped into a AirloopHVAC:UnitarySystem
      search_criteria['equipment_type'] = 'Heat Pumps'
    end
    unless (template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
           (template == 'BTAP1980TO2010')
      # Single Package/Split System is only used for units less than 65 kBtu/h
      if capacity_btu_per_hr >= 65000
        search_criteria['rating_condition'] = '47F db/43F wb outdoor air'
        search_criteria['subcategory'] = nil
      else
        electric_power_phase = coil_dx_electric_power_phase(coil_heating_dx_single_speed)
        if !electric_power_phase.nil?
          search_criteria['electric_power_phase'] = electric_power_phase
        end
      end
    end
  end
  if coil_efficiency_data[0].keys.include?('region')
    search_criteria['region'] = nil # non-nil values are currently used for residential products
  end

  # Lookup efficiencies
  hp_props = model_find_object(standards_data['heat_pumps_heating'], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if hp_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return sql_db_vars_map
  end

  equipment_type_field = search_criteria['equipment_type']
  # Make the HEAT-CAP-FT curve
  heat_cap_ft = nil
  if hp_props['heat_cap_ft']
    heat_cap_ft = model_add_curve(coil_heating_dx_single_speed.model, hp_props['heat_cap_ft'])
  else
    heat_cap_ft_curve_name = coil_dx_cap_ft(coil_heating_dx_single_speed, equipment_type_field, heating = true)
    heat_cap_ft = model_add_curve(coil_heating_dx_single_speed.model, heat_cap_ft_curve_name)
  end
  if heat_cap_ft
    coil_heating_dx_single_speed.setTotalHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_cap_ft curve, will not be set.")
  end

  # Make the HEAT-CAP-FFLOW curve
  heat_cap_fflow = nil
  if hp_props['heat_cap_fflow']
    heat_cap_fflow = model_add_curve(coil_heating_dx_single_speed.model, hp_props['heat_cap_fflow'])
  else
    heat_cap_fflow_curve_name = coil_dx_cap_fflow(coil_heating_dx_single_speed, equipment_type_field, heating = true)
    heat_cap_fflow = model_add_curve(coil_heating_dx_single_speed.model, heat_cap_fflow_curve_name)
  end
  if heat_cap_fflow
    coil_heating_dx_single_speed.setTotalHeatingCapacityFunctionofFlowFractionCurve(heat_cap_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_cap_fflow curve, will not be set.")
  end

  # Make the HEAT-EIR-FT curve
  heat_eir_ft = nil
  if hp_props['heat_eir_ft']
    heat_eir_ft = model_add_curve(coil_heating_dx_single_speed.model, hp_props['heat_eir_ft'])
  else
    heat_eir_ft_curve_name = coil_dx_eir_ft(coil_heating_dx_single_speed, equipment_type_field, heating = true)
    heat_eir_ft = model_add_curve(coil_heating_dx_single_speed.model, heat_eir_ft_curve_name)
  end
  if heat_eir_ft
    coil_heating_dx_single_speed.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_eir_ft curve, will not be set.")
  end

  # Make the HEAT-EIR-FFLOW curve
  heat_eir_fflow = nil
  if hp_props['heat_eir_fflow']
    heat_eir_fflow = model_add_curve(coil_heating_dx_single_speed.model, hp_props['heat_eir_fflow'])
  else
    heat_eir_fflow_curve_name = coil_dx_eir_fflow(coil_heating_dx_single_speed, equipment_type_field, heating = true)
    heat_eir_fflow = model_add_curve(coil_heating_dx_single_speed.model, heat_eir_fflow_curve_name)
  end
  if heat_eir_fflow
    coil_heating_dx_single_speed.setEnergyInputRatioFunctionofFlowFractionCurve(heat_eir_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_eir_fflow curve, will not be set.")
  end

  # Make the HEAT-PLF-FPLR curve
  heat_plf_fplr = nil
  if hp_props['heat_plf_fplr']
    heat_plf_fplr = model_add_curve(coil_heating_dx_single_speed.model, hp_props['heat_plf_fplr'])
  else
    heat_plf_fplr_curve_name = coil_dx_plf_fplr(coil_heating_dx_single_speed, equipment_type_field, heating = true)
    heat_plf_fplr = model_add_curve(coil_heating_dx_single_speed.model, heat_plf_fplr_curve_name)
  end
  if heat_plf_fplr
    coil_heating_dx_single_speed.setPartLoadFractionCorrelationCurve(heat_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_plf_fplr curve, will not be set.")
  end

  # Preserve the original name
  orig_name = coil_heating_dx_single_speed.name.to_s

  # Find the minimum COP and rename with efficiency rating
  cop = coil_heating_dx_single_speed_standard_minimum_cop(coil_heating_dx_single_speed, true, necb_ref_hp, equipment_type)

  # Map the original name to the new name
  sql_db_vars_map[coil_heating_dx_single_speed.name.to_s] = orig_name

  # Set the efficiency values
  unless cop.nil?
    coil_heating_dx_single_speed.setRatedCOP(cop)
  end

  return sql_db_vars_map
end

#coil_heating_dx_single_speed_standard_minimum_cop(coil_heating_dx_single_speed, rename = false, necb_ref_hp = false, equipment_type = false) ⇒ Double

Finds lookup object in standards and return efficiency

Parameters:

  • coil_heating_dx_single_speed (OpenStudio::Model::CoilHeatingDXSingleSpeed)

    coil heating dx single speed object

  • rename (Boolean) (defaults to: false)

    if true, object will be renamed to include capacity and efficiency level

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

  • equipment_type (Boolean) (defaults to: false)

    indicate that equipment_type should be in the search criteria.

Returns:

  • (Double)

    full load efficiency (COP)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb', line 13

def coil_heating_dx_single_speed_standard_minimum_cop(coil_heating_dx_single_speed, rename = false, necb_ref_hp = false, equipment_type = false)
  coil_efficiency_data = standards_data['heat_pumps_heating']

  # Get the capacity
  capacity_w = OpenstudioStandards::HVAC.coil_heating_get_paired_coil_cooling_capacity(coil_heating_dx_single_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Get the search criteria
  search_criteria = coil_dx_find_search_criteria(coil_heating_dx_single_speed, necb_ref_hp, equipment_type)
  equipment_type = coil_efficiency_data[0].keys.include?('equipment_type') ? true : false

  # Additional search criteria for new data format (from BESD)
  # NECB/BTAP use the old format
  # DEER CBES use the old format
  # 'equipment_type' is only included in data coming from the BESD
  if coil_efficiency_data[0].keys.include?('equipment_type') || ((template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
    (template == 'BTAP1980TO2010'))
    if search_criteria.keys.include?('equipment_type')
      equipment_type = search_criteria['equipment_type']
      if equipment_type == 'PTHP'
        search_criteria['application'] = coil_dx_packaged_terminal_application(coil_heating_dx_single_speed)
      end
    elsif !OpenstudioStandards::HVAC.coil_dx_heat_pump?(coil_heating_dx_single_speed) # `coil_dx_heat_pump?` returns false when a DX heating coil is wrapped into a AirloopHVAC:UnitarySystem
      search_criteria['equipment_type'] = 'Heat Pumps'
    end
    unless (template == 'NECB2011') || (template == 'NECB2015') || (template == 'NECB2017') || (template == 'NECB2020') || (template == 'BTAPPRE1980') ||
           (template == 'BTAP1980TO2010')
      # Single Package/Split System is only used for units less than 65 kBtu/h
      if capacity_btu_per_hr >= 65000 && equipment_type != 'PTHP'
        search_criteria['rating_condition'] = '47F db/43F wb outdoor air'
        search_criteria['subcategory'] = nil
      else
        electric_power_phase = coil_dx_electric_power_phase(coil_heating_dx_single_speed)
        if !electric_power_phase.nil?
          search_criteria['electric_power_phase'] = electric_power_phase
        end
      end
    end
  end

  sub_category = search_criteria['subcategory']
  suppl_heating_type = search_criteria['heating_type']

  # find object
  hp_props = model_find_object(coil_efficiency_data, search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if hp_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    return false
  end

  cop = nil
  # If PTHP, use equations
  # Check both new format (equipment_type == 'PTHP') and old format (e.g. DOE Ref Pre-1980 / 1980-2004)
  # where there is no 'equipment_type' key and PTHP is identified via subcategory instead.
  if (equipment_type == 'PTHP' || sub_category == 'PTHP') && !hp_props['pthp_cop_coefficient_1'].nil? && !hp_props['pthp_cop_coefficient_2'].nil?
    pthp_cop_coeff_1 = hp_props['pthp_cop_coefficient_1']
    pthp_cop_coeff_2 = hp_props['pthp_cop_coefficient_2']
    # TABLE 6.8.1D
    # COP = pthp_cop_coeff_1 - (pthp_cop_coeff_2 * Cap / 1000)
    # Note c: Cap means the rated cooling capacity of the product in Btu/h.

    # If the unit's capacity is nil or less than 7000 Btu/h, use 7000 Btu/h in the calculation
    # If the unit's capacity is greater than 15,000 Btu/h, use 15,000 Btu/h in the calculation
    if capacity_btu_per_hr.nil?
      capacity_btu_per_hr = 7000.0
      capacity_kbtu_per_hr = capacity_btu_per_hr / 1000.0
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For PTHP units, 90.1 heating efficiency depends on paired cooling capacity. Cooling Capacity for #{coil_heating_dx_single_speed.name}: #{sub_category} is nil. This zone may not have heating. Using default equipment efficiency for a 7 kBtu/hr unit.")
    elsif capacity_btu_per_hr < 7000
      capacity_btu_per_hr = 7000.0
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For PTHP units, 90.1 heating efficiency depends on paired cooling capacity. Cooling Capacity for #{coil_heating_dx_single_speed.name}: #{sub_category} is #{capacity_btu_per_hr.round} Btu/hr, which is less than the typical minimum equipment size of 7 kBtu/hr. Using default equipment efficiency for a 7 kBtu/hr unit.")
    elsif capacity_btu_per_hr > 15_000
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For PTHP units, 90.1 heating efficiency depends on paired cooling capacity. Cooling Capacity for #{coil_heating_dx_single_speed.name}: #{sub_category} is #{capacity_btu_per_hr.round} Btu/hr, which is more than the typical maximum equipment size of 15 kBtu/hr. Using default equipment efficiency for a 15 kBtu/hr unit.")
      capacity_btu_per_hr = 15_000.0
    end

    min_coph = pthp_cop_coeff_1 - (pthp_cop_coeff_2 * capacity_btu_per_hr / 1000.0)
    cop = OpenstudioStandards::HVAC.cop_heating_to_cop_heating_no_fan(min_coph, OpenStudio.convert(capacity_btu_per_hr, 'Btu/hr', 'W').get)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_coph.round(1)}COPH"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}: #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COPH = #{min_coph.round(2)}")
  end

  # If specified as HSPF
  unless hp_props['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = hp_props['minimum_heating_seasonal_performance_factor']
    cop = OpenstudioStandards::HVAC.hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_hspf.round(1)}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: #{suppl_heating_type} #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; HSPF = #{min_hspf}")
  end

  # If specified as HSPF2
  # TODO: assumed to be the same as HSPF for now
  unless hp_props['minimum_heating_seasonal_performance_factor_2'].nil?
    min_hspf = hp_props['minimum_heating_seasonal_performance_factor_2']
    cop = OpenstudioStandards::HVAC.hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_hspf.round(1)}HSPF2"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: #{suppl_heating_type} #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; HSPF = #{min_hspf}")
  end

  # If specified as COPH
  unless hp_props['minimum_coefficient_of_performance_heating'].nil?
    min_coph = hp_props['minimum_coefficient_of_performance_heating']
    cop = OpenstudioStandards::HVAC.cop_heating_to_cop_heating_no_fan(min_coph, OpenStudio.convert(capacity_kbtu_per_hr, 'kBtu/hr', 'W').get)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_coph.round(1)}COPH"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: #{suppl_heating_type} #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COPH = #{min_coph}")
  end

  # If specified as EER
  unless hp_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = hp_props['minimum_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_eer.round(1)}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}:  #{suppl_heating_type} #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as SEER
  unless hp_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = hp_props['minimum_seasonal_energy_efficiency_ratio']
    cop = OpenstudioStandards::HVAC.seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{min_seer.round(1)}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}:  #{suppl_heating_type} #{sub_category} Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # Rename
  if rename
    coil_heating_dx_single_speed.setName(new_comp_name)
  end

  return cop
end

#coil_heating_gas_additional_search_criteria(coil_heating_gas, search_criteria) ⇒ Hash

Applies the standard efficiency ratings to CoilHeatingGas.

Parameters:

  • coil_heating_gas (OpenStudio::Model::CoilHeatingGas)

    coil heating gas object

  • search_criteria (Hash)

    search criteria for looking up furnace data

Returns:

  • (Hash)

    updated search criteria



9
10
11
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingGas.rb', line 9

def coil_heating_gas_additional_search_criteria(coil_heating_gas, search_criteria)
  return search_criteria
end

#coil_heating_gas_apply_efficiency_and_curves(coil_heating_gas) ⇒ Boolean

Applies the standard efficiency ratings to CoilHeatingGas.

Parameters:

  • coil_heating_gas (OpenStudio::Model::CoilHeatingGas)

    coil heating gas object

Returns:

  • (Boolean)

    returns true if successful, false if not



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingGas.rb', line 17

def coil_heating_gas_apply_efficiency_and_curves(coil_heating_gas)
  successfully_set_all_properties = false
  # Initialize search criteria
  search_criteria = {}
  search_criteria['template'] = template
  search_criteria['equipment_type'] = 'Warm Air Furnace'
  search_criteria['fuel_type'] = 'NaturalGas'
  search_criteria = coil_heating_gas_additional_search_criteria(coil_heating_gas, search_criteria)

  # Get the capacity, but return false if not available
  capacity_w = OpenstudioStandards::HVAC.coil_heating_gas_get_capacity(coil_heating_gas)

  # Return false if the coil does not have a heating capacity associated with it. Cannot apply the standard if without
  # it.
  return successfully_set_all_properties if capacity_w == false

  # Convert capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  return false unless capacity_btu_per_hr > 0

  # Get the boiler properties, if it exists for this template
  return false unless standards_data.include?('furnaces')

  furnace_props = model_find_object(standards_data['furnaces'], search_criteria, capacity_btu_per_hr)
  unless furnace_props
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGas', "For #{coil_heating_gas.name}, cannot find furnace properties with search criteria #{search_criteria}, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency standards
  thermal_eff = nil

  # If specified as thermal efficiency, this takes precedent
  if furnace_props['minimum_thermal_efficiency'].nil?
    # If not thermal efficiency, check other parameters

    # If specified as AFUE
    unless furnace_props['minimum_annual_fuel_utilization_efficiency'].nil?
      min_afue = furnace_props['minimum_annual_fuel_utilization_efficiency']
      thermal_eff = OpenstudioStandards::HVAC.afue_to_thermal_eff(min_afue)
      new_comp_name = "#{coil_heating_gas.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_afue} AFUE"
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingGas', "For #{template}: #{coil_heating_gas.name}: = #{capacity_kbtu_per_hr.round}kBtu/hr; AFUE = #{min_afue}")
    end

    # If specified as combustion efficiency
    unless furnace_props['minimum_combustion_efficiency'].nil?
      min_comb_eff = furnace_props['minimum_combustion_efficiency']
      thermal_eff = OpenstudioStandards::HVAC.combustion_eff_to_thermal_eff(min_comb_eff)
      new_comp_name = "#{coil_heating_gas.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_comb_eff} Combustion Eff"
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingGas', "For #{template}: #{coil_heating_gas.name}: = #{capacity_kbtu_per_hr.round}kBtu/hr; Combustion Efficiency = #{min_comb_eff}")
    end
  else
    thermal_eff = furnace_props['minimum_thermal_efficiency']
    new_comp_name = "#{coil_heating_gas.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{thermal_eff} Thermal Eff"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingGas', "For #{template}: #{coil_heating_gas.name}: = #{capacity_kbtu_per_hr.round}kBtu/hr; Thermal Efficiency = #{thermal_eff}")
  end

  # Set the efficiency values
  unless thermal_eff.nil?

    # Set the name
    coil_heating_gas.setName(new_comp_name)
    coil_heating_gas.setGasBurnerEfficiency(thermal_eff)
    successfully_set_all_properties = true
  end

  return successfully_set_all_properties
end

#coil_heating_gas_multi_stage_apply_efficiency_and_curves(coil_heating_gas_multi_stage) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_heating_gas_multi_stage (OpenStudio::Model::CoilHeatingGasMultiStage)

    coil heating gas multi stage object

Returns:

  • (Boolean)

    returns true if successful, false if not



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb', line 23

def coil_heating_gas_multi_stage_apply_efficiency_and_curves(coil_heating_gas_multi_stage)
  successfully_set_all_properties = true

  # Get the coil capacity
  capacity_w = nil
  htg_stages = stages
  if htg_stages.last.nominalCapacity.is_initialized
    capacity_w = htg_stages.last.nominalCapacity.get
  elsif coil_heating_gas_multi_stage.autosizedStage4NominalCapacity.is_initialized
    capacity_w = coil_heating_gas_multi_stage.autosizedStage4NominalCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGasMultiStage', "For #{coil_heating_gas_multi_stage.name} capacity is not available, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # plf vs plr curve for furnace
  furnace_plffplr_curve = model_add_curve(model, furnace_plffplr_curve_name, standards)
  if furnace_plffplr_curve
    coil_heating_gas_multi_stage.setPartLoadFractionCorrelationCurve(furnace_plffplr_curve)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGasMultiStage', "For #{coil_heating_gas_multi_stage.name}, cannot find plffplr curve, will not be set.")
    successfully_set_all_properties = false
  end
end

#coil_heating_gas_multi_stage_find_search_criteria(coil_heating_gas_multi_stage) ⇒ Hash

find search criteria

Parameters:

  • coil_heating_gas_multi_stage (OpenStudio::Model::CoilHeatingGasMultiStage)

    coil heating gas multi stage object

Returns:

  • (Hash)

    used for model_find_object(model)



8
9
10
11
12
13
14
15
16
17
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb', line 8

def coil_heating_gas_multi_stage_find_search_criteria(coil_heating_gas_multi_stage)
  # Define the criteria to find the coil heating gas multi-stage properties
  # in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template
  search_criteria['fuel_type'] = 'Gas'
  search_criteria['fluid_type'] = 'Air'

  return search_criteria
end

#coil_heating_water_to_air_heat_pump_apply_efficiency_and_curves(coil_heating_water_to_air_heat_pump, sql_db_vars_map) ⇒ Hash

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • coil_heating_water_to_air_heat_pump (OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit)

    coil heating object

  • sql_db_vars_map (Hash)

    hash map

Returns:

  • (Hash)

    hash of coil objects



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 49

def coil_heating_water_to_air_heat_pump_apply_efficiency_and_curves(coil_heating_water_to_air_heat_pump, sql_db_vars_map)
  successfully_set_all_properties = true

  # Get the search criteria
  search_criteria = {}
  search_criteria['template'] = template
  capacity_w = OpenstudioStandards::HVAC.coil_heating_get_paired_coil_cooling_capacity(coil_heating_water_to_air_heat_pump)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Look up the efficiency characteristics
  coil_props = model_find_object(standards_data['water_source_heat_pumps_heating'], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if coil_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{coil_heating_water_to_air_heat_pump.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return sql_db_vars_map
  end

  # @todo Add methods to set coefficients, and add coefficients to data spreadsheet
  # using OS defaults for now
  # heat_cap_coeff1 = coil_props['heat_cap_coeff1']
  # if heat_cap_coeff1
  #   coil_heating_water_to_air_heat_pump.setHeatingCapacityCoefficient1(heat_cap_coeff1)
  # else
  #   OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{coil_heating_water_to_air_heat_pump.name}, cannot find heat_cap_coeff1, will not be set.")
  #   successfully_set_all_properties = false
  # end

  # Preserve the original name
  orig_name = coil_heating_water_to_air_heat_pump.name.to_s

  # Find the minimum COP and rename with efficiency rating
  cop = coil_heating_water_to_air_heat_pump_standard_minimum_cop(coil_heating_water_to_air_heat_pump, true)

  # Map the original name to the new name
  sql_db_vars_map[coil_heating_water_to_air_heat_pump.name.to_s] = orig_name

  # Set the efficiency values
  unless cop.nil?
    coil_heating_water_to_air_heat_pump.setRatedHeatingCoefficientofPerformance(cop)
  end

  return sql_db_vars_map
end

#coil_heating_water_to_air_heat_pump_standard_minimum_cop(coil_heating_water_to_air_heat_pump, rename = false) ⇒ Double

Finds lookup object in standards and return efficiency

Parameters:

  • coil_heating_water_to_air_heat_pump (OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit)

    coil heating object

  • rename (Boolean) (defaults to: false)

    if true, object will be renamed to include capacity and efficiency level

Returns:

  • (Double)

    full load efficiency (COP)



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 9

def coil_heating_water_to_air_heat_pump_standard_minimum_cop(coil_heating_water_to_air_heat_pump, rename = false)
  search_criteria = {}
  search_criteria['template'] = template
  capacity_w = OpenstudioStandards::HVAC.coil_heating_get_paired_coil_cooling_capacity(coil_heating_water_to_air_heat_pump)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  coil_props = model_find_object(standards_data['water_source_heat_pumps_heating'], search_criteria, capacity_btu_per_hr, Date.today)

  # Check to make sure properties were found
  if coil_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{coil_heating_water_to_air_heat_pump.name}, cannot find efficiency info using #{search_criteria} and capacity #{capacity_btu_per_hr} btu/hr, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency standards
  cop = nil

  # If specified as EER
  unless coil_props['minimum_coefficient_of_performance_heating'].nil?
    cop = coil_props['minimum_coefficient_of_performance_heating']
    new_comp_name = "#{coil_heating_water_to_air_heat_pump.name} #{capacity_kbtu_per_hr.round} Clg kBtu/hr #{cop.round(1)}COPH"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{template}: #{coil_heating_water_to_air_heat_pump.name}: Cooling Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COPH = #{cop}")
  end

  # Rename
  if rename
    coil_heating_water_to_air_heat_pump.setName(new_comp_name)
  end

  return cop
end

#cooling_tower_single_speed_apply_efficiency_and_curves(cooling_tower_single_speed) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • cooling_tower_single_speed (OpenStudio::Model::CoolingTowerSingleSpeed)

    single speed cooling tower

Returns:

  • (Boolean)

    returns true if successful, false if not



10
11
12
13
# File 'lib/openstudio-standards/standards/Standards.CoolingTowerSingleSpeed.rb', line 10

def cooling_tower_single_speed_apply_efficiency_and_curves(cooling_tower_single_speed)
  cooling_tower_apply_minimum_power_per_flow(cooling_tower_single_speed)
  return true
end

#cooling_tower_two_speed_apply_efficiency_and_curves(cooling_tower_two_speed) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • cooling_tower_two_speed (OpenStudio::Model::CoolingTowerTwoSpeed)

    two speed cooling tower

Returns:

  • (Boolean)

    returns true if successful, false if not



10
11
12
13
14
# File 'lib/openstudio-standards/standards/Standards.CoolingTowerTwoSpeed.rb', line 10

def cooling_tower_two_speed_apply_efficiency_and_curves(cooling_tower_two_speed)
  cooling_tower_apply_minimum_power_per_flow(cooling_tower_two_speed)

  return true
end

#cooling_tower_variable_speed_apply_efficiency_and_curves(cooling_tower_variable_speed) ⇒ Boolean

Applies the standard efficiency ratings and typical performance curves to this object.

Parameters:

  • cooling_tower_variable_speed (OpenStudio::Model::CoolingTowerVariableSpeed)

    variable speed cooling tower

Returns:

  • (Boolean)

    returns true if successful, false if not



10
11
12
13
# File 'lib/openstudio-standards/standards/Standards.CoolingTowerVariableSpeed.rb', line 10

def cooling_tower_variable_speed_apply_efficiency_and_curves(cooling_tower_variable_speed)
  cooling_tower_apply_minimum_power_per_flow(cooling_tower_variable_speed)
  return true
end

#default_air_barrierObject

Buildings by default are assumed to not have an air barrier



2344
2345
2346
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2344

def default_air_barrier
  return false
end

#default_airtightnessObject

Default 5-sided (exterior walls and roof) airtightness design value (m^3/h-m^2) from a building pressurization test at 75 Pascals.



2338
2339
2340
2341
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2338

def default_airtightness
  airtightness_value = 13.8
  return airtightness_value
end

#define_space_multiplierHash

Returns space multiplier map.

Returns:

  • (Hash)

    space multiplier map



11
12
13
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 11

def define_space_multiplier
  return @space_multiplier_map
end

#enthalpy_recovery_ratio_design_to_typical_adjustment(enthalpy_recovery_ratio, climate_zone) ⇒ Double

Adjust ERR from design conditions to ERR for typical conditions. This is only applies to the 2B and 3B climate zones. In these climate zones a 50% ERR at typical condition leads a ERR > 50%, the ERR is thus scaled down.

Parameters:

  • enthalpy_recovery_ratio (Double)

    Enthalpy Recovery Ratio (ERR)

  • climate_zone (String)

    climate zone

Returns:

  • (Double)

    adjusted ERR



64
65
66
67
68
69
70
71
72
# File 'lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb', line 64

def enthalpy_recovery_ratio_design_to_typical_adjustment(enthalpy_recovery_ratio, climate_zone)
  if climate_zone.include? '2B'
    enthalpy_recovery_ratio /= 0.65 / 0.55
  elsif climate_zone.include? '3B'
    enthalpy_recovery_ratio /= 0.62 / 0.55
  end

  return enthalpy_recovery_ratio
end

#fan_constant_volume_airloop_fan_pressure_rise(fan_constant_volume) ⇒ Double

Determine the prototype fan pressure rise for a constant volume fan on an AirLoopHVAC based on system airflow. Defaults to the logic from ASHRAE 90.1-2004 prototypes.

Parameters:

  • fan_constant_volume (OpenStudio::Model::FanConstantVolume)

    constant volume fan object

Returns:

  • (Double)

    pressure rise in inches H20



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 58

def fan_constant_volume_airloop_fan_pressure_rise(fan_constant_volume)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_constant_volume.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_constant_volume.maximumFlowRate.get
  elsif fan_constant_volume.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_constant_volume.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanConstantVolume', "For #{fan_constant_volume.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Determine the pressure rise
  pressure_rise_in_h2o = if maximum_flow_rate_cfm < 7437
                           2.5
                         elsif maximum_flow_rate_cfm >= 7437 && maximum_flow_rate_cfm < 20_000
                           4.46
                         else # Over 20,000 cfm
                           4.09
                         end

  return pressure_rise_in_h2o
end

#fan_constant_volume_apply_prototype_fan_pressure_rise(fan_constant_volume) ⇒ Boolean

Sets the fan pressure rise based on the Prototype buildings inputs which are governed by the flow rate coming through the fan and whether the fan lives inside a unit heater, PTAC, etc.

Parameters:

  • fan_constant_volume (OpenStudio::Model::FanConstantVolume)

    constant volume fan object

Returns:

  • (Boolean)

    returns true if successful, false if not



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 11

def fan_constant_volume_apply_prototype_fan_pressure_rise(fan_constant_volume)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_constant_volume.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_constant_volume.maximumFlowRate.get
  elsif fan_constant_volume.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_constant_volume.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanConstantVolume', "For #{fan_constant_volume.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Pressure rise will be determined based on the following logic.
  pressure_rise_in_h2o = 0.0

  # If the fan lives inside of a zone hvac equipment
  if fan_constant_volume.containingZoneHVACComponent.is_initialized
    zone_hvac = fan_constant_volume.containingZoneHVACComponent.get
    if zone_hvac.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized || zone_hvac.to_ZoneHVACFourPipeFanCoil.is_initialized
      pressure_rise_in_h2o = 1.33
    elsif zone_hvac.to_ZoneHVACUnitHeater.is_initialized
      pressure_rise_in_h2o = 0.2
    else # This type of fan should not exist in the prototype models
      return false
    end
  # If the fan lives on an airloop
  elsif fan_constant_volume.airLoopHVAC.is_initialized
    pressure_rise_in_h2o = fan_constant_volume_airloop_fan_pressure_rise(fan_constant_volume)
  end

  # Set the fan pressure rise
  pressure_rise_pa = OpenStudio.convert(pressure_rise_in_h2o, 'inH_{2}O', 'Pa').get
  fan_constant_volume.setPressureRise(pressure_rise_pa)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.FanConstantVolume', "For Prototype: #{fan_constant_volume.name}: #{maximum_flow_rate_cfm.round}cfm; Pressure Rise = #{pressure_rise_in_h2o}in w.c.")

  return true
end

#fan_on_off_airloop_or_unitary_fan_pressure_rise(fan_on_off) ⇒ Double

Determine the prototype fan pressure rise for an on off fan on an AirLoopHVAC or inside a unitary system based on system airflow. Defaults to the logic from ASHRAE 90.1-2004 prototypes.

Parameters:

  • fan_on_off (OpenStudio::Model::FanOnOff)

    on off fan object

Returns:

  • (Double)

    pressure rise in inches H20



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb', line 68

def fan_on_off_airloop_or_unitary_fan_pressure_rise(fan_on_off)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_on_off.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_on_off.maximumFlowRate.get
  elsif fan_on_off.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_on_off.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanOnOff', "For #{fan_on_off.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Determine the pressure rise
  pressure_rise_in_h2o = if maximum_flow_rate_cfm < 7437
                           2.5
                         elsif maximum_flow_rate_cfm >= 7437 && maximum_flow_rate_cfm < 20_000
                           4.46
                         else # Over 20,000 cfm
                           4.09
                         end

  return pressure_rise_in_h2o
end

#fan_on_off_apply_prototype_fan_pressure_rise(fan_on_off) ⇒ Boolean

Sets the fan pressure rise based on the Prototype buildings inputs which are governed by the flow rate coming through the fan and whether the fan lives inside a unit heater, PTAC, etc.

Parameters:

  • fan_on_off (OpenStudio::Model::FanOnOff)

    on off fan object

Returns:

  • (Boolean)

    returns true if successful, false if not



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb', line 12

def fan_on_off_apply_prototype_fan_pressure_rise(fan_on_off)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_on_off.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_on_off.maximumFlowRate.get
  elsif fan_on_off.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_on_off.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanOnOff', "For #{fan_on_off.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Pressure rise will be determined based on the following logic.
  pressure_rise_in_h2o = 0.0

  # If the fan lives inside of a zone hvac equipment
  if fan_on_off.containingZoneHVACComponent.is_initialized
    zone_hvac = fan_on_off.containingZoneHVACComponent.get
    if zone_hvac.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized
      pressure_rise_in_h2o = 1.33
    elsif zone_hvac.to_ZoneHVACFourPipeFanCoil.is_initialized
      pressure_rise_in_h2o = 1.087563267
    elsif zone_hvac.to_ZoneHVACUnitHeater.is_initialized
      pressure_rise_in_h2o = 0.2
    else # This type of fan should not exist in the prototype models
      return false
    end
  end

  # If the fan lives on an airloop
  if fan_on_off.airLoopHVAC.is_initialized
    pressure_rise_in_h2o = fan_on_off_airloop_or_unitary_fan_pressure_rise(fan_on_off)
  end

  # If the fan lives inside a unitary system
  if fan_on_off.airLoopHVAC.empty? && fan_on_off.containingZoneHVACComponent.empty?
    pressure_rise_in_h2o = fan_on_off_airloop_or_unitary_fan_pressure_rise(fan_on_off)
  end

  # Set the fan pressure rise
  pressure_rise_pa = OpenStudio.convert(pressure_rise_in_h2o, 'inH_{2}O', 'Pa').get
  fan_on_off.setPressureRise(pressure_rise_pa)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.FanOnOff', "For Prototype: #{fan_on_off.name}: #{maximum_flow_rate_cfm.round}cfm; Pressure Rise = #{pressure_rise_in_h2o}in w.c.")

  return true
end

#fan_variable_volume_airloop_fan_pressure_rise(fan_variable_volume) ⇒ Double

Determine the prototype fan pressure rise for a variable volume fan on an AirLoopHVAC based on system airflow. Defaults to the logic from ASHRAE 90.1-2004 prototypes.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (Double)

    pressure rise in inches H20



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb', line 60

def fan_variable_volume_airloop_fan_pressure_rise(fan_variable_volume)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_variable_volume.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_variable_volume.maximumFlowRate.get
  elsif fan_variable_volume.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_variable_volume.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanVariableVolume', "For #{fan_variable_volume.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Determine the pressure rise
  pressure_rise_in_h2o = if maximum_flow_rate_cfm < 4648
                           4.0
                         elsif maximum_flow_rate_cfm >= 4648 && maximum_flow_rate_cfm < 20_000
                           6.32
                         else # Over 20,000 cfm
                           5.58
                         end

  return pressure_rise_in_h2o
end

#fan_variable_volume_apply_prototype_fan_pressure_rise(fan_variable_volume) ⇒ Boolean

Sets the fan pressure rise based on the Prototype buildings inputs which are governed by the flow rate coming through the fan and whether the fan lives inside a unit heater, PTAC, etc.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (Boolean)

    returns true if successful, false if not



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb', line 12

def fan_variable_volume_apply_prototype_fan_pressure_rise(fan_variable_volume)
  # Get the max flow rate from the fan.
  maximum_flow_rate_m3_per_s = nil
  if fan_variable_volume.maximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_variable_volume.maximumFlowRate.get
  elsif fan_variable_volume.autosizedMaximumFlowRate.is_initialized
    maximum_flow_rate_m3_per_s = fan_variable_volume.autosizedMaximumFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.FanVariableVolume', "For #{fan_variable_volume.name} max flow rate is not available, cannot apply prototype assumptions.")
    return false
  end

  # Convert max flow rate to cfm
  maximum_flow_rate_cfm = OpenStudio.convert(maximum_flow_rate_m3_per_s, 'm^3/s', 'cfm').get

  # Pressure rise will be determined based on the
  # following logic.
  pressure_rise_in_h2o = 0.0

  # If the fan lives inside of a zone hvac equipment
  if fan_variable_volume.containingZoneHVACComponent.is_initialized
    zone_hvac = fan_variable_volume.ZoneHVACComponent.get
    if zone_hvac.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized || zone_hvac.to_ZoneHVACFourPipeFanCoil.is_initialized
      pressure_rise_in_h2o = 1.33
    elsif zone_hvac.to_ZoneHVACUnitHeater.is_initialized
      pressure_rise_in_h2o = 0.2
    else # This type of fan should not exist in the prototype models
      return false
    end
  # If the fan lives on an airloop
  elsif fan_variable_volume.airLoopHVAC.is_initialized
    pressure_rise_in_h2o = fan_variable_volume_airloop_fan_pressure_rise(fan_variable_volume)
  end

  # Set the fan pressure rise
  pressure_rise_pa = OpenStudio.convert(pressure_rise_in_h2o, 'inH_{2}O', 'Pa').get
  fan_variable_volume.setPressureRise(pressure_rise_pa)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.FanVariableVolume', "For Prototype: #{fan_variable_volume.name}: #{maximum_flow_rate_cfm.round}cfm; Pressure Rise = #{pressure_rise_in_h2o}in w.c.")

  return true
end

#fan_variable_volume_cooling_system_type(fan_variable_volume) ⇒ String

Determine if the cooling system is DX, CHW, evaporative, or a mixture.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (String)

    the cooling system type. Possible options are: dx, chw, evaporative, mixed, unknown.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 80

def fan_variable_volume_cooling_system_type(fan_variable_volume)
  clg_sys_type = 'unknown'

  # Get the air loop this fan is connected to
  air_loop = fan_variable_volume.airLoopHVAC
  return clg_sys_type unless air_loop.is_initialized

  air_loop = air_loop.get

  # Check the types of coils on the AirLoopHVAC
  has_dx = false
  has_chw = false
  has_evap = false
  air_loop.supplyComponents.each do |sc|
    # CoilCoolingDXSingleSpeed
    if sc.to_CoilCoolingDXSingleSpeed.is_initialized || sc.to_CoilCoolingDXTwoSpeed.is_initialized || sc.to_CoilCoolingDXMultiSpeed.is_initialized || sc.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
      has_dx = true
    # CoilCoolingWater
    elsif sc.to_CoilCoolingWater.is_initialized
      has_chw = true
    # UnitarySystem
    elsif sc.to_AirLoopHVACUnitarySystem.is_initialized
      unitary = sc.to_AirLoopHVACUnitarySystem.get
      if unitary.coolingCoil.is_initialized
        clg_coil = unitary.coolingCoil.get
        # CoilCoolingDXSingleSpeed
        if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized || clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized || clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
          has_dx = true
        # CoilCoolingWater
        elsif clg_coil.to_CoilCoolingWater.is_initialized
          has_chw = true
        end
      end
    # UnitaryHeatPumpAirToAir
    elsif sc.to_AirLoopHVACUnitaryHeatPumpAirToAir.is_initialized
      unitary = sc.to_AirLoopHVACUnitaryHeatPumpAirToAir.get
      clg_coil = unitary.coolingCoil
      # CoilCoolingDXSingleSpeed
      if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized || clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized
        has_dx = true
      # CoilCoolingWater
      elsif clg_coil.to_CoilCoolingWater.is_initialized
        has_chw = true
      end
    # EvaporativeCoolerDirectResearchSpecial
    elsif sc.to_EvaporativeCoolerDirectResearchSpecial.is_initialized || sc.to_EvaporativeCoolerIndirectResearchSpecial.is_initialized
      has_evap = true
    elsif sc.to_CoilCoolingCooledBeam.is_initialized ||
          sc.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized ||
          sc.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.is_initialized ||
          sc.to_AirLoopHVACUnitarySystem.is_initialized
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FanVariableVolume', "#{air_loop.name} has a cooling coil named #{sc.name}, whose type is not yet covered by cooling system type checks.")
    end
  end

  # Determine the type
  if (has_chw && has_dx && has_evap) ||
     (has_chw && has_dx) ||
     (has_chw && has_evap) ||
     (has_dx && has_evap)
    clg_sys_type = 'mixed'
  elsif has_chw
    clg_sys_type = 'chw'
  elsif has_dx
    clg_sys_type = 'dx'
  elsif has_evap
    clg_sys_type = 'evap'
  end

  return clg_sys_type
end

#fan_variable_volume_part_load_fan_power_limitation?(fan_variable_volume) ⇒ Boolean

Determines whether there is a requirement to have a VSD or some other method to reduce fan power at low part load ratios.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (Boolean)

    returns true if required, false if not



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 10

def fan_variable_volume_part_load_fan_power_limitation?(fan_variable_volume)
  part_load_control_required = false

  # Check if the fan is on a multizone or single zone system.
  # If not on an AirLoop (for example, in unitary system or zone equipment), assumed to be a single zone fan
  mz_fan = false
  if fan_variable_volume.airLoopHVAC.is_initialized
    air_loop = fan_variable_volume.airLoopHVAC.get
    mz_fan = air_loop_hvac_multizone_vav_system?(air_loop)
  end

  # No part load fan power control is required for single zone VAV systems
  unless mz_fan
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FanVariableVolume', "For #{fan_variable_volume.name}: No part load fan power control is required for single zone VAV systems.")
    return part_load_control_required
  end

  # Determine the motor and capacity size limits
  hp_limit = fan_variable_volume_part_load_fan_power_limitation_hp_limit(fan_variable_volume)
  cap_limit_btu_per_hr = fan_variable_volume_part_load_fan_power_limitation_capacity_limit(fan_variable_volume)

  # Check against limits
  if hp_limit && cap_limit_btu_per_hr
    air_loop = fan_variable_volume.airLoopHVAC
    unless air_loop.is_initialized
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FanVariableVolume', "For #{fan_variable_volume.name}: Could not find the air loop to get cooling capacity for determining part load fan power control requirement.")
      return part_load_control_required
    end
    air_loop = air_loop.get
    clg_cap_w = air_loop_hvac_total_cooling_capacity(air_loop)
    clg_cap_btu_per_hr = OpenStudio.convert(clg_cap_w, 'W', 'Btu/hr').get
    fan_hp = fan_motor_horsepower(fan_variable_volume)
    if fan_hp >= hp_limit && clg_cap_btu_per_hr >= cap_limit_btu_per_hr
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FanVariableVolume', "For #{fan_variable_volume.name}: part load fan power control is required for #{fan_hp.round(1)} HP fan, #{clg_cap_btu_per_hr.round} Btu/hr cooling capacity.")
      part_load_control_required = true
    end
  elsif hp_limit
    fan_hp = fan_motor_horsepower(fan_variable_volume)
    if fan_hp >= hp_limit
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FanVariableVolume', "For #{fan_variable_volume.name}: Part load fan power control is required for #{fan_hp.round(1)} HP fan.")
      part_load_control_required = true
    end
  end

  return part_load_control_required
end

#fan_variable_volume_part_load_fan_power_limitation_capacity_limit(fan_variable_volume) ⇒ Double

The threhold capacity below which part load control is not required.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (Double)

    the limit, in Btu/hr. Return nil for no limit by default.



70
71
72
73
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 70

def fan_variable_volume_part_load_fan_power_limitation_capacity_limit(fan_variable_volume)
  cap_limit_btu_per_hr = nil # No minimum limit
  return cap_limit_btu_per_hr
end

#fan_variable_volume_part_load_fan_power_limitation_hp_limit(fan_variable_volume) ⇒ Double

The threhold horsepower below which part load control is not required.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

Returns:

  • (Double)

    the limit, in horsepower. Return nil for no limit by default.



61
62
63
64
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 61

def fan_variable_volume_part_load_fan_power_limitation_hp_limit(fan_variable_volume)
  hp_limit = nil # No minimum limit
  return hp_limit
end

#fan_zone_exhaust_apply_prototype_fan_pressure_rise(fan_zone_exhaust) ⇒ Boolean

Sets the fan pressure rise based on the Prototype buildings inputs

Parameters:

  • fan_zone_exhaust (OpenStudio::Model::FanZoneExhaust)

    the exhaust fan

Returns:

  • (Boolean)

    returns true if successful, false if not



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanZoneExhaust.rb', line 10

def fan_zone_exhaust_apply_prototype_fan_pressure_rise(fan_zone_exhaust)
  # Do not modify dummy exhaust fans
  return true if fan_zone_exhaust.name.to_s.downcase.include? 'dummy'

  # All exhaust fans are assumed to have a pressure rise of
  # 0.5 in w.c. in the prototype building models.
  pressure_rise_in_h2o = 0.5

  # Set the pressure rise
  pressure_rise_pa = OpenStudio.convert(pressure_rise_in_h2o, 'inH_{2}O', 'Pa').get
  fan_zone_exhaust.setPressureRise(pressure_rise_pa)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.FanZoneExhaust', "For Prototype: #{fan_zone_exhaust.name}: Pressure Rise = #{pressure_rise_in_h2o}in w.c.")

  return true
end

#find_exposed_conditioned_roof_surfaces(model) ⇒ Hash

This method is similar to the 'find_exposed_conditioned_vertical_surfaces' above only it is for roofs. Again, it distinguishes between plenum and non plenum roof area but collects and returns both.

Parameters:

Returns:

  • (Hash)

    hash of exposed roof information



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/openstudio-standards/standards/Standards.Surface.rb', line 99

def find_exposed_conditioned_roof_surfaces(model)
  exposed_surfaces = []
  plenum_surfaces = []
  exp_plenum_area = 0
  total_exp_area = 0
  exp_nonplenum_area = 0
  sub_surfaces_info = []
  sub_surface_area = 0
  # Sort through each space and determine if it conditioned.  Conditioned meaning it is either heated, cooled, or both.
  model.getSpaces.sort.each do |space|
    cooled = OpenstudioStandards::Space.space_cooled?(space)
    heated = OpenstudioStandards::Space.space_heated?(space)
    # If the space is conditioned sort through the surfaces looking for outdoor roofs.
    if heated || cooled
      space.surfaces.sort.each do |surface|
        # Assume a roof is of type 'RoofCeiling' and has an 'Outdoors' boundary condition.
        next unless surface.surfaceType == 'RoofCeiling'
        next unless surface.outsideBoundaryCondition == 'Outdoors'

        # Determine if the roof is adjacent to a plenum.
        sub_surface_info = []
        if OpenstudioStandards::Space.space_plenum?(space)
          # If the roof is adjacent to a plenum add it to the plenum roof array and the plenum roof area counter
          # (accounting for space multipliers).
          plenum_surfaces << surface
          exp_plenum_area += surface.grossArea * space.multiplier
        else
          # If the roof is not adjacent to a plenum add it to the non-plenum roof array and the non-plenum roof area
          # counter (accounting for space multipliers).
          exposed_surfaces << surface
          exp_nonplenum_area += surface.grossArea * space.multiplier
          surface.subSurfaces.sort.each do |sub_surface|
            sub_surface_area += sub_surface.grossArea.to_f * space.multiplier
            sub_surface_info << {
              'subsurface_name' => sub_surface.nameString,
              'subsurface_type' => sub_surface.subSurfaceType,
              'gross_area_m2' => sub_surface.grossArea.to_f,
              'construction_name' => sub_surface.construction.get.nameString
            }
          end
          unless sub_surface_info.empty?
            sub_surfaces_info << {
              'surface_name' => surface.nameString,
              'subsurfaces' => sub_surface_info
            }
          end
        end
        # Regardless of if the roof is adjacent to a plenum or not add it to the total roof area counter (accounting
        # for space multipliers).
        total_exp_area += surface.grossArea * space.multiplier
      end
    end
  end
  srr = 999
  unless exp_nonplenum_area < 0.1
    srr = sub_surface_area / exp_nonplenum_area
  end
  # Put the information into a hash and return it to whomever called this method.
  exp_surf_info = {
    'total_exp_roof_area_m2' => total_exp_area,
    'exp_plenum_roof_area_m2' => exp_plenum_area,
    'exp_nonplenum_roof_area_m2' => exp_nonplenum_area,
    'exp_plenum_roofs' => plenum_surfaces,
    'exp_nonplenum_roofs' => exposed_surfaces,
    'srr' => srr,
    'sub_surfaces' => sub_surfaces_info
  }
  return exp_surf_info
end

#find_exposed_conditioned_vertical_surfaces(model, max_angle: 91, min_angle: 89) ⇒ Hash

Note:

2018-09-12

This method searches through a model a returns vertical exterior surfaces which help enclose a conditioned space. It distinguishes between walls adjacent to plenums and wall adjacent to other conditioned spaces (as attics in OpenStudio are considered plenums and conditioned spaces though many would not agree). It returns a hash of the total exposed wall area adjacent to conditioned spaces (including plenums), the total exposed plenum wall area, the total exposed non-plenum area (adjacent to conditioned spaces), the exposed plenum walls and the exposed non-plenum walls (adjacent to conditioned spaces).

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • max_angle (Double) (defaults to: 91)

    maximum angle to consider surface

  • min_angle (Double) (defaults to: 89)

    minimum angle to consider surface

Returns:

  • (Hash)

    hash of exposed surface information

Author:

  • Chris Kirney



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/openstudio-standards/standards/Standards.Surface.rb', line 17

def find_exposed_conditioned_vertical_surfaces(model, max_angle: 91, min_angle: 89)
  exposed_surfaces = []
  plenum_surfaces = []
  exp_plenum_area = 0
  total_exp_area = 0
  exp_nonplenum_area = 0
  sub_surfaces_info = []
  sub_surface_area = 0
  # Sort through each space
  model.getSpaces.sort.each do |space|
    # Is the space heated or cooled?
    cooled = OpenstudioStandards::Space.space_cooled?(space)
    heated = OpenstudioStandards::Space.space_heated?(space)
    # Assume conditioned means the space is heated, cooled, or both.
    if heated || cooled
      # If the space is conditioned then go through each surface and determine if it a vertial exterior wall.
      space.surfaces.sort.each do |surface|
        # I define an exterior wall as one that is called a wall and that has a boundary contion of Outdoors.
        # Note that this will not include foundation walls.
        next unless surface.surfaceType == 'Wall'
        next unless surface.outsideBoundaryCondition == 'Outdoors'

        # Determine if the wall is vertical which I define as being between 89 and 91 degrees from horizontal.
        tilt_radian = surface.tilt
        tilt_degrees = OpenStudio.convert(tilt_radian, 'rad', 'deg').get
        sub_surface_info = []
        if tilt_degrees <= max_angle && tilt_degrees >= min_angle
          # If the wall is vertical determine if it is adjacent to a plenum.  If yes include it in the array of
          # plenum walls and add it to the plenum wall area counter (accounting for space multipliers).
          if OpenstudioStandards::Space.space_plenum?(space)
            plenum_surfaces << surface
            exp_plenum_area += surface.grossArea * space.multiplier
          else
            # If not a plenum then include it in the array of non-plenum walls and add it to the non-plenum area
            # counter (accounting for space multipliers).
            exposed_surfaces << surface
            exp_nonplenum_area += surface.grossArea * space.multiplier
            surface.subSurfaces.sort.each do |sub_surface|
              sub_surface_area += sub_surface.grossArea.to_f * space.multiplier
              sub_surface_info << {
                'subsurface_name' => sub_surface.nameString,
                'subsurface_type' => sub_surface.subSurfaceType,
                'gross_area_m2' => sub_surface.grossArea.to_f,
                'construction_name' => sub_surface.construction.get.nameString
              }
            end
            unless sub_surface_info.empty?
              sub_surfaces_info << {
                'surface_name' => surface.nameString,
                'subsurfaces' => sub_surface_info
              }
            end
          end
          # Regardless of if the wall is adjacent to a plenum or not add it to the exposed wall area adjacent to
          # conditioned spaces (accounting for space multipliers).
          total_exp_area += surface.grossArea * space.multiplier
        end
      end
    end
  end
  fdwr = 999
  unless exp_nonplenum_area < 0.1
    fdwr = sub_surface_area / exp_nonplenum_area
  end
  # Add everything into a hash and return that hash to whomever called the method.
  exp_surf_info = {
    'total_exp_wall_area_m2' => total_exp_area,
    'exp_plenum_wall_area_m2' => exp_plenum_area,
    'exp_nonplenum_wall_area_m2' => exp_nonplenum_area,
    'exp_plenum_walls' => plenum_surfaces,
    'exp_nonplenum_walls' => exposed_surfaces,
    'fdwr' => fdwr,
    'sub_surfaces' => sub_surfaces_info
  }
  return exp_surf_info
end

#find_highest_roof_centre(model) ⇒ Hash

This method finds the centroid of the highest roof(s). It cycles through each space and finds which surfaces are described as roofceiling whose outside boundary condition is outdoors. Of those surfaces that do it looks for the highest one(s) and finds the centroid of those.

Parameters:

Returns:

  • (Hash)

    It returns the following hash: roof_cent = { top_spaces: array of spaces which contain the highest roofs, roof_centroid: global x, y, and z coords of the centroid of the highest roof surfaces, roof_area: area of the highst roof surfaces} Each element of the top_spaces is a hash containing the following:

    top_space = {
    space:  OpenStudio space containing the surface,
    x:  global x coord of the centroid of roof surface(s),
    y:  global y coord of the centroid of roof surface(s),
    z:  global z coord of the centroid of roof surface(s),
    area_m2:  area of the roof surface(s)}


186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/openstudio-standards/standards/Standards.Surface.rb', line 186

def find_highest_roof_centre(model)
  # Initialize some variables
  tol = 6
  max_height = -1000000000000000
  top_spaces = []
  spaces_info = []
  roof_centroid = [0, 0, 0]
  # Go through each space looking for outdoor roofs
  model.getSpaces.sort.each do |space|
    outdoor_roof = false
    space_max = -1000000000000000
    max_surf = nil
    space_surfaces = space.surfaces
    # Go through each surface in the space.  If it is an outdoor roofceiling then continue.  Otherwise go to the next
    # space.
    space_surfaces.each do |surface|
      outdoor_roof = true if surface.surfaceType.to_s.upcase == 'ROOFCEILING' && surface.outsideBoundaryCondition.to_s.upcase == 'OUTDOORS'
      # Is this surface the highest roof on this space?
      if surface.centroid.z.to_f.round(tol) > space_max
        space_max = surface.centroid.z.to_f.round(tol)
        max_surf = surface
      end
    end
    # If no outdoor roofceiling go to the next space.
    next if outdoor_roof == false

    z_origin = space.zOrigin.to_f
    ceiling_centroid = [0, 0, 0]

    # Go through the surfaces and look for ones that are the highest.  Any that are the highest get added to the
    # centroid calculation.
    space_surfaces.each do |sp_surface|
      if max_surf.centroid.z.to_f.round(tol) == sp_surface.centroid.z.to_f.round(tol)
        ceiling_centroid[0] += sp_surface.centroid.x.to_f * sp_surface.grossArea.to_f
        ceiling_centroid[1] += sp_surface.centroid.y.to_f * sp_surface.grossArea.to_f
        ceiling_centroid[2] += sp_surface.grossArea.to_f
      end
    end

    # Calculate the centroid of the highest surface/surfaces for this space.
    ceiling_centroid[0] /= ceiling_centroid[2]
    ceiling_centroid[1] /= ceiling_centroid[2]

    # Put the info into an array containing hashes of spaces with outdoor roofceilings
    spaces_info << {
      space: space,
      x: ceiling_centroid[0] + space.xOrigin.to_f,
      y: ceiling_centroid[1] + space.yOrigin.to_f,
      z: max_surf.centroid.z.to_f + z_origin,
      area_m2: ceiling_centroid[2]
    }
    # This is to determine which are the global highest outdoor roofceilings
    if max_height.round(tol) < (max_surf.centroid.z.to_f + z_origin).round(tol)
      max_height = (max_surf.centroid.z.to_f + z_origin).round(tol)
    end
  end
  # Go through the roofceilings and find the highest one(s) and calculate the centroid.
  spaces_info.each do |space_info|
    # If the outdoor roofceiling is one of the highest ones add it to an array of hashes and get the info needed to
    # calculate the centroid
    if space_info[:z].to_f.round(tol) == max_height.round(tol)
      top_spaces << space_info
      roof_centroid[0] += space_info[:x] * space_info[:area_m2]
      roof_centroid[1] += space_info[:y] * space_info[:area_m2]
      roof_centroid[2] += space_info[:area_m2]
    end
  end
  # calculate the centroid of the highest outdoor roofceiling(s) and add the info to a hash to return to whomever
  # called this method.
  roof_centroid[0] /= roof_centroid[2]
  roof_centroid[1] /= roof_centroid[2]
  roof_cent = {
    top_spaces: top_spaces,
    roof_centroid: [roof_centroid[0], roof_centroid[1], max_height],
    roof_area: roof_centroid[2]
  }
  return roof_cent
end

#fluid_cooler_apply_minimum_power_per_flow(fluid_cooler, equipment_type: 'Closed Cooling Tower') ⇒ Boolean

Set the fluid cooler fan power such that the tower hits the minimum performance (gpm/hp) specified by the standard. Note that in this case hp is motor nameplate hp, per 90.1. This method assumes that the fan brake horsepower is 90% of the motor nameplate hp. This method determines the minimum motor efficiency for the nameplate motor hp and sets the actual fan power by multiplying the brake horsepower by the efficiency. Thus the fan power used as an input to the simulation divided by the design flow rate will not (and should not) exactly equal the minimum tower performance.

Parameters:

  • fluid_cooler (OpenStudio::Model::FluidCoolerSingleSpeed, OpenStudio::Model::FluidCoolerTwoSpeed, OpenStudio::Model::EvaporativeFluidCoolerSingleSpeed, OpenStudio::Model::EvaporativeFluidCoolerTwoSpeed)

    the fluid cooler

  • equipment_type (String) (defaults to: 'Closed Cooling Tower')

    heat rejection equipment type enumeration used for lookup query, options are 'Closed Cooling Tower', modeled as an EvaporativeFluidCooler, or 'Dry Cooler', modeled as a FluidCooler

Returns:

  • (Boolean)

    returns true if successful, false if not



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/openstudio-standards/standards/Standards.FluidCooler.rb', line 25

def fluid_cooler_apply_minimum_power_per_flow(fluid_cooler, equipment_type: 'Closed Cooling Tower')
  # Get the design water flow rate
  if fluid_cooler.designWaterFlowRate.is_initialized
    design_water_flow_m3_per_s = fluid_cooler.designWaterFlowRate.get
  elsif fluid_cooler.autosizedDesignWaterFlowRate.is_initialized
    design_water_flow_m3_per_s = fluid_cooler.autosizedDesignWaterFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FluidCooler', "For #{fluid_cooler.name} design water flow rate is not available, cannot apply efficiency standard.")
    return false
  end
  design_water_flow_gpm = OpenStudio.convert(design_water_flow_m3_per_s, 'm^3/s', 'gal/min').get

  # Get the table of fluid cooler efficiencies
  heat_rejection = standards_data['heat_rejection']

  # Define the criteria to find the fluid cooler properties
  # in the hvac standards data set.
  search_criteria = {}
  search_criteria['template'] = template

  # Closed cooling towers are fluidcooler objects.
  search_criteria['equipment_type'] = equipment_type

  # @todo Standards replace this with a mechanism to store this
  # data in the fluid cooler object itself.
  # For now, retrieve the fan type from the name
  name = fluid_cooler.name.get
  if name.include?('Centrifugal')
    fan_type = 'Centrifugal'
  elsif name.include?('Propeller or Axial')
    fan_type = 'Propeller or Axial'
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FluidCooler', "Cannot find fan type for #{fluid_cooler.name}. Assuming propeller or axial.")
    fan_type = 'Propeller or Axial'
  end
  unless fan_type.nil?
    search_criteria['fan_type'] = fan_type
  end

  # Get the fluid cooler properties
  ct_props = model_find_object(heat_rejection, search_criteria)
  unless ct_props
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FluidCooler', "For #{fluid_cooler.name}, cannot find heat rejection properties, cannot apply standard efficiencies or curves.")
    return false
  end

  # Get fluid cooler efficiency
  min_gpm_per_hp = ct_props['minimum_performance_gpm_per_hp']
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FluidCooler', "For #{fluid_cooler.name}, design water flow = #{design_water_flow_gpm.round} gpm, minimum performance = #{min_gpm_per_hp} gpm/hp (nameplate).")

  # Calculate the allowed fan brake horsepower
  # per method used in PNNL prototype buildings.
  # Assumes that the fan brake horsepower is 90%
  # of the fan nameplate rated motor power.
  # Source: Thornton et al. (2011), Achieving the 30% Goal: Energy and Cost Savings Analysis of ASHRAE Standard 90.1-2010, Section 4.5.4
  nominal_hp = design_water_flow_gpm / min_gpm_per_hp
  fan_bhp = 0.9 * nominal_hp
  fan_motor_eff = 0.85

  if nominal_hp <= 0.75
    motor_type = motor_type(nominal_hp)
    motor_properties = motor_fractional_hp_efficiencies(nominal_hp, motor_type = motor_type)
  else
    # Lookup the minimum motor efficiency
    motors = standards_data['motors']

    # Assuming all fan motors are 4-pole Enclosed
    search_criteria = {
      'template' => template,
      'number_of_poles' => 4.0,
      'type' => 'Enclosed'
    }

    # Use the efficiency largest motor efficiency when BHP is greater than the largest size for which a requirement is provided
    data = model_find_objects(motors, search_criteria)
    if data.empty?
      search_criteria = {
        'template' => template,
        'type' => nil
      }
      data = model_find_objects(motors, search_criteria)
    end
    maximum_capacity = model_find_maximum_value(data, 'maximum_capacity')
    if fan_bhp > maximum_capacity
      fan_bhp = maximum_capacity
    end

    motor_properties = model_find_object(motors, search_criteria, capacity = nil, date = Date.today, area = nil, num_floors = nil, fan_motor_bhp = fan_bhp)
    if motor_properties.nil?
      # Retry without the date
      motor_properties = model_find_object(motors, search_criteria, capacity = nil, date = nil, area = nil, num_floors = nil, fan_motor_bhp = fan_bhp)
    end
  end

  if motor_properties.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.FluidCooler', "For #{fluid_cooler.name}, could not find motor properties using search criteria: #{search_criteria}, motor_hp = #{norminal_hp} hp. Using a default value of #{fan_motor_eff}.")
  end

  unless motor_properties.nil?
    fan_motor_eff = motor_properties['nominal_full_load_efficiency']
    nominal_hp = motor_properties['maximum_capacity'].to_f.round(1)
  end
  # Round to nearest whole HP for niceness
  if nominal_hp >= 2
    nominal_hp = nominal_hp.round
  end

  # Calculate the fan motor power
  fan_motor_actual_power_hp = fan_bhp / fan_motor_eff
  # Convert to W
  fan_motor_actual_power_w = fan_motor_actual_power_hp * 745.7 # 745.7 W/HP

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FluidCooler', "For #{fluid_cooler.name}, allowed fan motor nameplate hp = #{nominal_hp.round(1)} hp, fan brake horsepower = #{fan_bhp.round(1)}, and fan motor actual power = #{fan_motor_actual_power_hp.round(1)} hp (#{fan_motor_actual_power_w.round} W) at #{fan_motor_eff} motor efficiency.")

  # Append the efficiency to the name
  fluid_cooler.setName("#{fluid_cooler.name} #{min_gpm_per_hp.to_f.round(1)} gpm/hp")

  # Hard size the design fan power.
  # Leave the water flow and air flow autosized.
  if fluid_cooler.to_FluidCoolerSingleSpeed.is_initialized
    fluid_cooler.setDesignAirFlowRateFanPower(fan_motor_actual_power_w)
  elsif fluid_cooler.to_FluidCoolerTwoSpeed.is_initialized || fluid_cooler.to_EvaporativeFluidCoolerTwoSpeed.is_initialized
    fluid_cooler.setHighFanSpeedFanPower(fan_motor_actual_power_w)
    fluid_cooler.setLowFanSpeedFanPower(0.3 * fan_motor_actual_power_w)
  elsif fluid_cooler.to_EvaporativeFluidCoolerSingleSpeed.is_initialized
    fluid_cooler.setFanPoweratDesignAirFlowRate(fan_motor_actual_power_w)
  end

  return true
end

#get_avg_of_other_zones(value_hash, ref_zone) ⇒ Object

For a multizone system, get straight average of hash values excluding the reference zone

Parameters:

  • value_hash (Hash<String>)

    of zoneName:Value

  • ref_zone (String)

    name of reference zone

Author:

  • Doug Maddox, PNNL



2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2170

def get_avg_of_other_zones(value_hash, ref_zone)
  num_others = value_hash.size - 1
  value_sum = 0
  value_hash.each do |key, val|
    value_sum += val unless key == ref_zone
  end
  if num_others == 0
    value_avg = value_hash[ref_zone]
  else
    value_avg = value_sum / num_others
  end
  return value_avg
end

#get_default_surface_cons_from_surface_type(surface_category, surface_type, cons_set) ⇒ Object

Get appropriate construction object based on type of surface or subsurface @author: Doug Maddox, PNNL @param: surface_category [String type of surface: this is not an OpenStudio string @param: surface_type [String SubSurfaceType: this is an OpenStudio string @param: cons_set [object] DefaultSubSurfaceConstructions object @return: [object] Construction object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/openstudio-standards/standards/Standards.PlanarSurface.rb', line 218

def get_default_surface_cons_from_surface_type(surface_category, surface_type, cons_set)
  # Get DefaultSurfaceContstructions or DefaultSubSurfaceConstructions object
  case surface_category
  when 'ExteriorSurface'
    cons_list = cons_set.defaultExteriorSurfaceConstructions.get
  when 'GroundSurface'
    cons_list = cons_set.defaultGroundContactSurfaceConstructions.get
  when 'ExteriorSubSurface'
    cons_list = cons_set.defaultExteriorSubSurfaceConstructions.get
  else
    cons_list = nil
  end

  cons = nil
  case surface_type
  when 'FixedWindow'
    if cons_list.fixedWindowConstruction.is_initialized
      cons = cons_list.fixedWindowConstruction.get
    end
  when 'OperableWindow'
    if cons_list.operableWindowConstruction.is_initialized
      cons = cons_list.operableWindowConstruction.get
    end
  when 'Door'
    if cons_list.doorConstruction.is_initialized
      cons = cons_list.doorConstruction.get
    end
  when 'GlassDoor'
    if cons_list.glassDoorConstruction.is_initialized
      cons = cons_list.glassDoorConstruction.get
    end
  when 'OverheadDoor'
    if cons_list.overheadDoorConstruction.is_initialized
      cons = cons_list.overheadDoorConstruction.get
    end
  when 'Skylight'
    if cons_list.skylightConstruction.is_initialized
      cons = cons_list.skylightConstruction.get
    end
  when 'TubularDaylightDome'
    if cons_list.tubularDaylightDomeConstruction.is_initialized
      cons = cons_list.tubularDaylightDomeConstruction.get
    end
  when 'TubularDaylightDiffuser'
    if cons_list.tubularDaylightDiffuserConstruction.is_initialized
      cons = cons_list.tubularDaylightDiffuserConstruction.get
    end
  when 'Floor'
    if cons_list.floorConstruction.is_initialized
      cons = cons_list.floorConstruction.get
    end
  when 'Wall'
    if cons_list.wallConstruction.is_initialized
      cons = cons_list.wallConstruction.get
    end
  when 'Roof'
    if cons_list.roofConstruction.is_initialized
      cons = cons_list.roofConstruction.get
    end
  end

  return cons
end

#get_fan_object_for_airloop(model, air_loop) ⇒ object

Get the supply fan object for an air loop

Parameters:

  • model (object)
  • air_loop (object)

Returns:

  • (object)

    supply fan of zone equipment component

Author:

  • Doug Maddox, PNNL



1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1217

def get_fan_object_for_airloop(model, air_loop)
  if air_loop.supplyFan.empty?
    # Check if system has unitary wrapper
    air_loop.supplyComponents.each do |component|
      # Get the object type, getting the internal coil
      # type if inside a unitary system.
      obj_type = component.iddObjectType.valueName.to_s
      fan_component = nil
      case obj_type
      when 'OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass'
        component = component.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get
        fan_component = component.supplyFan.get
      when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir'
        component = component.to_AirLoopHVACUnitaryHeatPumpAirToAir.get
        fan_component = component.supplyFan.get
      when 'OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeed'
        component = component.to_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.get
        fan_component = component.supplyFan.get
      when 'OS_AirLoopHVAC_UnitarySystem'
        component = component.to_AirLoopHVACUnitarySystem.get
        fan_component = component.supplyFan.get
      end

      if !fan_component.nil?
        break
      end
    end
  else
    fan_component = air_loop.supplyFan.get
  end

  # Get the fan object for this fan
  fan_obj_type = fan_component.iddObjectType.valueName.to_s
  case fan_obj_type
  when 'OS_Fan_OnOff'
    fan_obj = fan_component.to_FanOnOff.get
  when 'OS_Fan_ConstantVolume'
    fan_obj = fan_component.to_FanConstantVolume.get
  when 'OS_Fan_SystemModel'
    fan_obj = fan_component.to_FanSystemModel.get
  when 'OS_Fan_VariableVolume'
    fan_obj = fan_component.to_FanVariableVolume.get
  end
  return fan_obj
end

#get_fan_schedule_for_each_zone(model) ⇒ Hash

Store fan operation schedule for each zone before deleting HVAC objects

Parameters:

  • model (object)

Returns:

  • (Hash)

    of zoneName:fan_schedule_8760

Author:

  • Doug Maddox, PNNL



1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1142

def get_fan_schedule_for_each_zone(model)
  fan_sch_names = {}

  # Start with air loops
  model.getAirLoopHVACs.sort.each do |air_loop_hvac|
    fan_schedule_8760 = []
    # Check for availability managers
    # Assume only AvailabilityManagerScheduled will control fan schedule
    # @todo also check AvailabilityManagerScheduledOn
    avail_mgrs = air_loop_hvac.availabilityManagers
    # if avail_mgrs.is_initialized
    if !avail_mgrs.nil?
      avail_mgrs.each do |avail_mgr|
        # avail_mgr = avail_mgr.get
        # Check each type of AvailabilityManager
        # If the current one matches, get the fan schedule
        if avail_mgr.to_AvailabilityManagerScheduled.is_initialized
          avail_mgr = avail_mgr.to_AvailabilityManagerScheduled.get
          fan_schedule = avail_mgr.schedule
          # fan_sch_translator = ScheduleTranslator.new(model, fan_schedule)
          # fan_sch_ruleset = fan_sch_translator.translate
          fan_schedule_8760 = OpenstudioStandards::Schedules.schedule_get_hourly_values(fan_schedule)
        end
      end
    end
    if fan_schedule_8760.empty?
      # If there are no availability managers, then use the schedule in the supply fan object
      # Note: testing showed that the fan object schedule is not used by OpenStudio
      # Instead, get the fan schedule from the air_loop_hvac object
      # fan_object = nil
      # fan_object = get_fan_object_for_airloop(model, air_loop_hvac)
      fan_object = 'nothing'
      if fan_object.nil?
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Failed to retreive fan object for AirLoop #{air_loop_hvac.name}")
      else
        # fan_schedule = fan_object.availabilitySchedule
        fan_schedule = air_loop_hvac.availabilitySchedule
      end
      fan_schedule_8760 = OpenstudioStandards::Schedules.schedule_get_hourly_values(fan_schedule)
    end

    # Assign this schedule to each zone on this air loop
    air_loop_hvac.thermalZones.each do |zone|
      fan_sch_names[zone.name.get] = fan_schedule_8760
    end
  end

  # Handle Zone equipment
  model.getThermalZones.sort.each do |zone|
    if !fan_sch_names.key?(zone.name.get)
      # This zone was not assigned a schedule via air loop
      # Check for zone equipment fans
      zone.equipment.each do |zone_equipment|
        next if zone_equipment.to_FanZoneExhaust.is_initialized

        # get fan schedule
        fan_object = zone_hvac_get_fan_object(zone_equipment)
        if !fan_object.nil?
          fan_schedule = fan_object.availabilitySchedule
          fan_schedule_8760 = OpenstudioStandards::Schedules.schedule_get_hourly_values(fan_schedule)
          fan_sch_names[zone.name.get] = fan_schedule_8760
          break
        end
      end
    end
  end

  return fan_sch_names
end

#get_group_heat_types(model, zones) ⇒ String concatenated string showing different fuel types in a group of zones

Get list of heat types across a list of zones

Parameters:

  • zones (array of objects)

    array of zone objects

Returns:

  • (String concatenated string showing different fuel types in a group of zones)

    String concatenated string showing different fuel types in a group of zones



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1109

def get_group_heat_types(model, zones)
  heat_list = ''
  has_district_heat = false
  has_fuel_heat = false
  has_electric_heat = false
  zones.each do |zone|
    if OpenstudioStandards::ThermalZone.thermal_zone_district_heat?(zone)
      has_district_heat = true
    end
    if OpenstudioStandards::ThermalZone.thermal_zone_fossil_heat?(zone)
      has_fuel_heat = true
    end
    if OpenstudioStandards::ThermalZone.thermal_zone_electric_heat?(zone)
      has_electric_heat = true
    end
  end

  if has_district_heat
    heat_list = 'districtheating'
  end
  if has_fuel_heat
    heat_list += '_fuel'
  end
  if has_electric_heat
    heat_list += '_electric'
  end
  return heat_list
end

#get_outdoor_subsurface_ratio(model, surface_type = 'Wall') ⇒ Double

This method return the building ratio of subsurface_area / surface_type_area where surface_type can be "Wall" or "RoofCeiling"

Parameters:

Returns:

  • (Double)

    surface ratio



5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5611

def get_outdoor_subsurface_ratio(model, surface_type = 'Wall')
  surface_area = 0.0
  sub_surface_area = 0
  all_surfaces = []
  all_sub_surfaces = []
  model.getSpaces.sort.each do |space|
    zone = space.thermalZone
    zone_multiplier = nil
    next if zone.empty?

    zone_multiplier = zone.get.multiplier
    space.surfaces.sort.each do |surface|
      if (surface.outsideBoundaryCondition == 'Outdoors') && (surface.surfaceType == surface_type)
        surface_area += surface.grossArea * zone_multiplier
        surface.subSurfaces.sort.each do |sub_surface|
          sub_surface_area += sub_surface.grossArea * sub_surface.multiplier * zone_multiplier
        end
      end
    end
  end
  return fdwr = (sub_surface_area / surface_area)
end

#get_weekday_values_from_8760(model, values, value_includes_holiday = true) ⇒ Array

Return Array of weekday values from Array of all day values

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • values (Array)

    hourly time-series values of all days

  • value_includes_holiday (Boolean) (defaults to: true)

    whether the input values include a day of holiday at the end of the array

Returns:

  • (Array)

    hourly time-series values in weekdays

Author:

  • Xuechen (Jerry) Lei, PNNL



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb', line 12

def get_weekday_values_from_8760(model, values, value_includes_holiday = true)
  start_day = model.getYearDescription.dayofWeekforStartDay
  start_day_map = {
    'Sunday' => 0,
    'Monday' => 1,
    'Tuesday' => 2,
    'Wednesday' => 3,
    'Thursday' => 4,
    'Friday' => 5,
    'Saturday' => 6
  }
  start_day_num = start_day_map[start_day]
  weekday_values = []
  day_of_week = start_day_num
  num_of_days = values.size / 24
  if value_includes_holiday
    num_of_days -= 1
  end

  for day_i in 1..num_of_days do
    if day_of_week >= 1 && day_of_week <= 5
      weekday_values += values.slice!(0, 24)
    end
    day_of_week += 1
    # reset day of week
    if day_of_week == 7
      day_of_week = 0
    end
  end

  return weekday_values
end

#get_wtd_avg_of_other_zones(value_hash, area_hash, ref_zone) ⇒ Object

For a multizone system, get area weighted average of hash values excluding the reference zone

Parameters:

  • value_hash (Hash<String>)

    of zoneName:Value

  • area_hash (Hash<String>)

    of zoneName:Area

  • ref_zone (String)

    name of reference zone

Author:

  • Doug Maddox, PNNL



2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2189

def get_wtd_avg_of_other_zones(value_hash, area_hash, ref_zone)
  num_others = value_hash.size - 1
  value_sum = 0
  area_sum = 0
  value_hash.each do |key, val|
    value_sum += val * area_hash[key] unless key == ref_zone
    area_sum += area_hash[key] unless key == ref_zone
  end
  if num_others == 0
    value_avg = value_hash[ref_zone]
  else
    value_avg = value_sum / area_sum
  end
  return value_avg
end

#heat_exchanger_air_to_air_sensible_and_latent_apply_effectiveness(heat_exchanger_air_to_air_sensible_and_latent) ⇒ Boolean

Sets the minimum effectiveness of the heat exchanger per the standard.

Parameters:

  • heat_exchanger_air_to_air_sensible_and_latent (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    the heat exchanger

Returns:

  • (Boolean)

    returns true if successful, false if not



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb', line 8

def heat_exchanger_air_to_air_sensible_and_latent_apply_effectiveness(heat_exchanger_air_to_air_sensible_and_latent)
  # Assumed to be sensible and latent at all flow
  full_htg_sens_eff, full_htg_lat_eff, part_htg_sens_eff, part_htg_lat_eff, full_cool_sens_eff, full_cool_lat_eff, part_cool_sens_eff, part_cool_lat_eff = heat_exchanger_air_to_air_sensible_and_latent_minimum_effectiveness(heat_exchanger_air_to_air_sensible_and_latent)
  if heat_exchanger_air_to_air_sensible_and_latent.model.version < OpenStudio::VersionString.new('3.8.0')
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100HeatingAirFlow(full_htg_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100HeatingAirFlow(full_htg_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100CoolingAirFlow(full_cool_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100CoolingAirFlow(full_cool_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75HeatingAirFlow(part_htg_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75HeatingAirFlow(part_htg_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75CoolingAirFlow(part_cool_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75CoolingAirFlow(part_cool_lat_eff)
  else
    values = Hash.new{|hash, key| hash[key] = Hash.new}
    values['Sensible Heating'][0.75] = part_htg_sens_eff
    values['Sensible Heating'][1.0] = full_htg_sens_eff
    values['Latent Heating'][0.75] = part_htg_lat_eff
    values['Latent Heating'][1.0] = full_htg_lat_eff
    values['Sensible Cooling'][0.75] = part_cool_sens_eff
    values['Sensible Cooling'][1.0] = full_cool_sens_eff
    values['Latent Cooling'][0.75] = part_cool_lat_eff
    values['Latent Cooling'][1.0] = full_cool_lat_eff
    OpenstudioStandards::HVAC.heat_exchanger_air_to_air_set_effectiveness_values(heat_exchanger_air_to_air_sensible_and_latent, defaults: false, values: values)
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.HeatExchangerSensLat', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}: Set sensible and latent effectiveness.")

  return true
end

#heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency(heat_exchanger_air_to_air_sensible_and_latent) ⇒ Boolean

Sets the minimum effectiveness of the heat exchanger per the DOE prototype assumptions, which assume that an enthalpy wheel is used, which exceeds the 50% effectiveness minimum actually defined by 90.1.

Parameters:

  • heat_exchanger_air_to_air_sensible_and_latent (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    hx

Returns:

  • (Boolean)

    returns true if successful, false if not



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb', line 81

def heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency(heat_exchanger_air_to_air_sensible_and_latent)
  if heat_exchanger_air_to_air_sensible_and_latent.model.version < OpenStudio::VersionString.new('3.8.0')
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100HeatingAirFlow(0.7)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100HeatingAirFlow(0.6)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75HeatingAirFlow(0.7)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75HeatingAirFlow(0.6)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100CoolingAirFlow(0.75)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100CoolingAirFlow(0.6)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75CoolingAirFlow(0.75)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75CoolingAirFlow(0.6)
  else
    values = Hash.new{|hash, key| hash[key] = Hash.new}
    values['Sensible Heating'][0.75] = 0.7
    values['Sensible Heating'][1.0] = 0.7
    values['Latent Heating'][0.75] = 0.6
    values['Latent Heating'][1.0] = 0.6
    values['Sensible Cooling'][0.75] = 0.75
    values['Sensible Cooling'][1.0] = 0.75
    values['Latent Cooling'][0.75] = 0.6
    values['Latent Cooling'][1.0] = 0.6
    OpenstudioStandards::HVAC.heat_exchanger_air_to_air_set_effectiveness_values(heat_exchanger_air_to_air_sensible_and_latent, defaults: false, values: values)
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.HeatExchangerAirToAirSensibleAndLatent', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}: Changed sensible and latent effectiveness to ~70% per DOE Prototype assumptions for an enthalpy wheel.")

  return true
end

#heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency_enthalpy_recovery_ratio(heat_exchanger_air_to_air_sensible_and_latent, enthalpy_recovery_ratio, design_conditions, climate_zone) ⇒ Object

Set sensible and latent effectiveness at 100 and 75 heating and cooling airflow; The values are calculated by using ERR, which is introduced in 90.1-2016 Addendum CE

This function is only used for nontransient dwelling units (Mid-rise and High-rise Apartment)

Parameters:

  • heat_exchanger_air_to_air_sensible_and_latent (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    heat exchanger air to air sensible and latent

  • enthalpy_recovery_ratio (String)

    enthalpy recovery ratio

  • design_conditions (String)

    enthalpy recovery ratio design conditions: 'heating' or 'cooling'

  • climate_zone (String)

    climate zone



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb', line 117

def heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency_enthalpy_recovery_ratio(heat_exchanger_air_to_air_sensible_and_latent, enthalpy_recovery_ratio, design_conditions, climate_zone)
  # Assumed to be sensible and latent at all flow
  if enthalpy_recovery_ratio.nil?
    full_htg_sens_eff = 0.0
    full_htg_lat_eff = 0.0
    part_htg_sens_eff = 0.0
    part_htg_lat_eff = 0.0
    full_cool_sens_eff = 0.0
    full_cool_lat_eff = 0.0
    part_cool_sens_eff = 0.0
    part_cool_lat_eff = 0.0
  else
    enthalpy_recovery_ratio = enthalpy_recovery_ratio_design_to_typical_adjustment(enthalpy_recovery_ratio, climate_zone)
    full_htg_sens_eff, full_htg_lat_eff, part_htg_sens_eff, part_htg_lat_eff, full_cool_sens_eff, full_cool_lat_eff, part_cool_sens_eff, part_cool_lat_eff = heat_exchanger_air_to_air_sensible_and_latent_enthalpy_recovery_ratio_to_effectiveness(enthalpy_recovery_ratio, design_conditions)
  end
  if heat_exchanger_air_to_air_sensible_and_latent.model.version < OpenStudio::VersionString.new('3.8.0')
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100HeatingAirFlow(full_htg_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100HeatingAirFlow(full_htg_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat100CoolingAirFlow(full_cool_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat100CoolingAirFlow(full_cool_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75HeatingAirFlow(part_htg_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75HeatingAirFlow(part_htg_lat_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setSensibleEffectivenessat75CoolingAirFlow(part_cool_sens_eff)
    heat_exchanger_air_to_air_sensible_and_latent.setLatentEffectivenessat75CoolingAirFlow(part_cool_lat_eff)
  else
    values = Hash.new{|hash, key| hash[key] = Hash.new}
    values['Sensible Heating'][0.75] = part_htg_sens_eff
    values['Sensible Heating'][1.0] = full_htg_sens_eff
    values['Latent Heating'][0.75] = part_htg_lat_eff
    values['Latent Heating'][1.0] = full_htg_lat_eff
    values['Sensible Cooling'][0.75] = part_cool_sens_eff
    values['Sensible Cooling'][1.0] = full_cool_sens_eff
    values['Latent Cooling'][0.75] = part_cool_lat_eff
    values['Latent Cooling'][1.0] = full_cool_lat_eff
    OpenstudioStandards::HVAC.heat_exchanger_air_to_air_set_effectiveness_values(heat_exchanger_air_to_air_sensible_and_latent, defaults: false, values: values)
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.HeatExchangerSensLat', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}: Set sensible and latent effectiveness calculated by using Enthalpy Recovery Ratio.")
  return true
end

#heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_nominal_electric_power(heat_exchanger_air_to_air_sensible_and_latent) ⇒ Boolean

Sets the motor power to account for the extra fan energy from the increase in fan total static pressure

Returns:

  • (Boolean)

    returns true if successful, false if not



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb', line 15

def heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_nominal_electric_power(heat_exchanger_air_to_air_sensible_and_latent)
  # Get the nominal supply air flow rate
  supply_air_flow_m3_per_s = nil
  if heat_exchanger_air_to_air_sensible_and_latent.nominalSupplyAirFlowRate.is_initialized
    supply_air_flow_m3_per_s = heat_exchanger_air_to_air_sensible_and_latent.nominalSupplyAirFlowRate.get
  elsif heat_exchanger_air_to_air_sensible_and_latent.autosizedNominalSupplyAirFlowRate.is_initialized
    supply_air_flow_m3_per_s = heat_exchanger_air_to_air_sensible_and_latent.autosizedNominalSupplyAirFlowRate.get
  else
    # Get the min OA flow rate from the OA
    # system if the ERV was not on the system during sizing.
    # This prevents us from having to perform a second sizing run.
    controller_oa = nil
    oa_system = nil
    # Get the air loop
    air_loop = heat_exchanger_air_to_air_sensible_and_latent.airLoopHVAC
    if air_loop.empty?
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.HeatExchangerAirToAirSensibleAndLatent', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}, cannot get the air loop and therefore cannot get the min OA flow.")
      return false
    end
    air_loop = air_loop.get
    # Get the OA system
    if air_loop.airLoopHVACOutdoorAirSystem.is_initialized
      oa_system = air_loop.airLoopHVACOutdoorAirSystem.get
      controller_oa = oa_system.getControllerOutdoorAir
    else
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.HeatExchangerAirToAirSensibleAndLatent', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}, cannot find the min OA flow because it has no OA intake.")
      return false
    end
    # Get the min OA flow rate from the OA
    if controller_oa.minimumOutdoorAirFlowRate.is_initialized
      supply_air_flow_m3_per_s = controller_oa.minimumOutdoorAirFlowRate.get
    elsif controller_oa.autosizedMinimumOutdoorAirFlowRate.is_initialized
      supply_air_flow_m3_per_s = controller_oa.autosizedMinimumOutdoorAirFlowRate.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.HeatExchangerAirToAirSensibleAndLatent', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}, ERV minimum OA flow rate is not available, cannot apply prototype nominal power assumption.")
      return false
    end
  end

  # Convert the flow rate to cfm
  supply_air_flow_cfm = OpenStudio.convert(supply_air_flow_m3_per_s, 'm^3/s', 'cfm').get

  # Calculate the motor power for the rotary wheel per:
  # Power (W) = (Nominal Supply Air Flow Rate (CFM) * 0.3386) + 49.5
  # power = (supply_air_flow_cfm * 0.3386) + 49.5

  # Calculate the motor power for the rotary wheel per:
  # Power (W) = (Minimum Outdoor Air Flow Rate (m^3/s) * 212.5 / 0.5) + (Minimum Outdoor Air Flow Rate (m^3/s) * 162.5 / 0.5) + 50
  # This power is largely the added fan power from the extra static pressure drop from the enthalpy wheel.
  # It is included as motor power so it is only added when the enthalpy wheel is active, rather than a universal increase to the fan total static pressure.
  # From p.96 of https://www.pnnl.gov/main/publications/external/technical_reports/PNNL-20405.pdf
  default_fan_efficiency = heat_exchanger_air_to_air_sensible_and_latent_prototype_default_fan_efficiency
  power = (supply_air_flow_m3_per_s * 212.5 / default_fan_efficiency) + (supply_air_flow_m3_per_s * 0.9 * 162.5 / default_fan_efficiency) + 50
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.HeatExchangerAirToAirSensibleAndLatent', "For #{heat_exchanger_air_to_air_sensible_and_latent.name}, ERV power is calculated to be #{power.round} W, based on a min OA flow of #{supply_air_flow_cfm.round} cfm.  This power represents mostly the added fan energy from the extra static pressure, and is active only when the ERV is operating.")

  # Set the power for the HX
  heat_exchanger_air_to_air_sensible_and_latent.setNominalElectricPower(power)

  return true
end

#heat_exchanger_air_to_air_sensible_and_latent_enthalpy_recovery_ratio_to_effectiveness(enthalpy_recovery_ratio, design_conditions) ⇒ Array

Calculate a heat exchanger's effectiveness for a specific ERR and design conditions. Regressions were determined based available manufacturer data.

Parameters:

  • enthalpy_recovery_ratio (float)

    Enthalpy Recovery Ratio (ERR)

  • design_conditions (String)

    design_conditions for effectiveness calculation, either 'cooling' or 'heating'

Returns:

  • (Array)

    heating and cooling heat exchanger effectiveness at 100% and 75% nominal airflow



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb', line 80

def heat_exchanger_air_to_air_sensible_and_latent_enthalpy_recovery_ratio_to_effectiveness(enthalpy_recovery_ratio, design_conditions)
  case design_conditions
    when 'cooling'
      full_htg_sens_eff = ((20.707 * (enthalpy_recovery_ratio**2)) + (41.354 * enthalpy_recovery_ratio) + 40.755) / 100
      full_htg_lat_eff = ((127.45 * enthalpy_recovery_ratio) - 18.625) / 100
      part_htg_sens_eff = ((-0.1214 * enthalpy_recovery_ratio) + 1.111) * full_htg_sens_eff
      part_htg_lat_eff = ((-0.3405 * enthalpy_recovery_ratio) + 1.2732) * full_htg_lat_eff
      full_cool_sens_eff = ((70.689 * enthalpy_recovery_ratio) + 30.789) / 100
      full_cool_lat_eff = ((48.054 * (enthalpy_recovery_ratio**2)) + (83.082 * enthalpy_recovery_ratio) - 12.881) / 100
      part_cool_sens_eff = ((-0.1214 * enthalpy_recovery_ratio) + 1.111) * full_cool_sens_eff
      part_cool_lat_eff = ((-0.3982 * enthalpy_recovery_ratio)  + 1.3151) * full_cool_lat_eff
    when 'heating'
      full_htg_sens_eff = enthalpy_recovery_ratio
      full_htg_lat_eff = 0.0
      part_htg_sens_eff = ((-0.1214 * enthalpy_recovery_ratio) + 1.111) * full_htg_sens_eff
      part_htg_lat_eff = 0.0
      full_cool_sens_eff = enthalpy_recovery_ratio * ((70.689 * enthalpy_recovery_ratio) + 30.789) / ((20.707 * (enthalpy_recovery_ratio**2)) + (41.354 * enthalpy_recovery_ratio) + 40.755)
      full_cool_lat_eff = 0.0
      part_cool_sens_eff = ((-0.1214 * enthalpy_recovery_ratio) + 1.111) * full_cool_sens_eff
      part_cool_lat_eff = 0.0
  end

  return full_htg_sens_eff, full_htg_lat_eff, part_htg_sens_eff, part_htg_lat_eff, full_cool_sens_eff, full_cool_lat_eff, part_cool_sens_eff, part_cool_lat_eff
end

#heat_exchanger_air_to_air_sensible_and_latent_minimum_effectiveness(heat_exchanger_air_to_air_sensible_and_latent) ⇒ Array

Defines the minimum sensible and latent effectiveness of the heat exchanger. Assumed to apply to sensible and latent effectiveness at all flow rates.

Parameters:

  • heat_exchanger_air_to_air_sensible_and_latent (OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent)

    the heat exchanger

Returns:

  • (Array)

    List of full and part load heat echanger effectiveness



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb', line 43

def heat_exchanger_air_to_air_sensible_and_latent_minimum_effectiveness(heat_exchanger_air_to_air_sensible_and_latent)
  full_htg_sens_eff = 0.5
  full_htg_lat_eff = 0.5
  part_htg_sens_eff = 0.5
  part_htg_lat_eff = 0.5
  full_cool_sens_eff = 0.5
  full_cool_lat_eff = 0.5
  part_cool_sens_eff = 0.5
  part_cool_lat_eff = 0.5

  return full_htg_sens_eff, full_htg_lat_eff, part_htg_sens_eff, part_htg_lat_eff, full_cool_sens_eff, full_cool_lat_eff, part_cool_sens_eff, part_cool_lat_eff
end

#heat_exchanger_air_to_air_sensible_and_latent_prototype_default_fan_efficiencyDouble

Default fan efficiency assumption for the prm added fan power

Returns:

  • (Double)

    default fan efficiency



7
8
9
10
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb', line 7

def heat_exchanger_air_to_air_sensible_and_latent_prototype_default_fan_efficiency
  default_fan_efficiency = 0.5
  return default_fan_efficiency
end

#interior_lighting_get_prm_data(space_type) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/openstudio-standards/standards/Standards.SpaceType.rb', line 34

def interior_lighting_get_prm_data(space_type)
  standards_space_type = if space_type.is_a? String
                           space_type
                         elsif space_type.standardsSpaceType.is_initialized
                           space_type.standardsSpaceType.get
                         end

  # populate search hash
  search_criteria = {
    'template' => template,
    'lpd_space_type' => standards_space_type
  }

  # lookup space type properties
  interior_lighting_properties = model_find_object(standards_data['prm_interior_lighting'], search_criteria)

  if interior_lighting_properties.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.SpaceType', "Interior lighting PRM properties lookup failed: #{search_criteria}. Trying to search with primary_space_type. It is highly recommended to update the standard space type to one of the lighting types listed in: https://pnnl.github.io/BEM-for-PRM/user_guide/model_requirements/standards_space_type/")
    search_criteria = {
      'template' => template,
      'primary_space_type' => standards_space_type
    }
    interior_lighting_properties = model_find_object(standards_data['prm_interior_lighting'], search_criteria)
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.SpaceType', "Interior Lighting PRM properties lookup failed: #{search_criteria}")
    interior_lighting_properties = {}
  end

  return interior_lighting_properties
end

#load_initial_osm(osm_file) ⇒ Boolean

Loads a osm as a starting point.

Parameters:

  • osm_file (String)

    path to the .osm file, relative to the /data folder

Returns:

  • (Boolean)

    returns true if successful, false if not



5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5638

def load_initial_osm(osm_file)
  # Load the geometry .osm
  unless File.exist?(osm_file)
    raise("The initial osm path: #{osm_file} does not exist.")
  end

  osm_model_path = OpenStudio::Path.new(osm_file.to_s)
  # Upgrade version if required.
  version_translator = OpenStudio::OSVersion::VersionTranslator.new
  model = version_translator.loadModel(osm_model_path).get
  validate_initial_model(model)
  return model
end

#load_standards_database(data_directories = []) ⇒ Hash

Loads the openstudio standards dataset for this standard. For standards subclassed from other standards, the lowest-level data will override data supplied at a higher level. For example, data from ASHRAE 90.1-2004 will be overridden by data from ComStock ASHRAE 90.1-2004.

Parameters:

  • data_directories (Array<String>) (defaults to: [])

    array of file paths that contain standards data

Returns:

  • (Hash)

    a hash of standards data



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/openstudio-standards/standards/standard.rb', line 74

def load_standards_database(data_directories = [])
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.standard', "Loading OpenStudio Standards data for #{template}")
  @standards_data = {}

  # Load the JSON files from each directory
  data_directories.each do |data_dir|
    if __dir__[0] == ':' # Running from OpenStudio CLI
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Loading JSON files from OpenStudio CLI embedded directory #{data_dir}")
      EmbeddedScripting.allFileNamesAsString.split(';').each do |file|
        # Skip files outside of the specified directory
        next unless file.start_with?("#{data_dir}/data")

        # Skip files that are not JSON
        next unless File.basename(file).match(/.*\.json/)

        # Read the JSON file
        data = JSON.parse(EmbeddedScripting.getFileAsString(file))
        data.each_pair do |key, objs|
          # Override the template in inherited files to match the instantiated template
          objs.each do |obj|
            if obj.key?('template')
              obj['template'] = template
            end
          end
          if @standards_data[key].nil?
            OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Adding #{key} from #{File.basename(file)}")
          else
            OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Overriding #{key} with #{File.basename(file)}")
          end
          @standards_data[key] = objs
        end
      end
    else
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Loading JSON files from #{data_dir}")
      files = Dir.glob("#{data_dir}/data/*.json").select { |e| File.file? e }
      files.each do |file|
        data = JSON.parse(File.read(file))
        data.each_pair do |key, objs|
          # Override the template in inherited files to match the instantiated template
          objs.each do |obj|
            if obj.key?('template')
              obj['template'] = template
            end
          end
          if @standards_data[key].nil?
            OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Adding #{key} from #{File.basename(file)}")
          else
            OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.standard', "Overriding #{key} with #{File.basename(file)}")
          end
          @standards_data[key] = objs
        end
      end
    end
  end

  # Check that standards data was loaded
  if @standards_data.keys.empty?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.standard', "OpenStudio Standards JSON data was not loaded correctly for #{template}.")
  end
  return @standards_data
end

#make_ruleset_sched_from_8760(model, values, sch_name, sch_type_limits) ⇒ Object

Create a ScheduleRuleset object from an 8760 sequential array of values for a Values array will actually include 24 extra values if model year is a leap year Values array will also include 24 values at end of array representing the holiday day schedule

Parameters:

  • model (Object)
  • values (Array<Double>)

    array of annual values (8760 +/ 24) + holiday values (24)

  • sch_name (String)

    name of schedule to be created

  • sch_type_limits (Object)

    ScheduleTypeLimits object

Returns:

  • (Object)

    ScheduleRuleset

Author:

  • Doug Maddox, PNNL



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb', line 54

def make_ruleset_sched_from_8760(model, values, sch_name, sch_type_limits)
  # Build array of arrays: each top element is a week, each sub element is an hour of week
  all_week_values = []
  hr_of_yr = -1
  (0..51).each do |iweek|
    week_values = []
    (0..167).each do |hr_of_wk|
      hr_of_yr += 1
      week_values[hr_of_wk] = values[hr_of_yr]
    end
    all_week_values << week_values
  end

  # Extra week for days 365 and 366 (if applicable) of year
  # since 52 weeks is 364 days
  hr_of_yr += 1
  last_hr = values.size - 1
  iweek = 52
  week_values = []
  hr_of_wk = -1
  (hr_of_yr..last_hr).each do |ihr_of_yr|
    hr_of_wk += 1
    week_values[hr_of_wk] = values[ihr_of_yr]
  end
  all_week_values << week_values

  # Build ruleset schedules for first week
  yd = model.getYearDescription
  start_date = yd.makeDate(1, 1)
  one_day = OpenStudio::Time.new(1.0)
  seven_days = OpenStudio::Time.new(7.0)
  end_date = start_date + seven_days - one_day

  # Create new ruleset schedule
  sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
  sch_ruleset.setName(sch_name)
  sch_ruleset.setScheduleTypeLimits(sch_type_limits)

  # Make week schedule for first week
  num_week_scheds = 1
  week_sch_name = "#{sch_name}_ws#{num_week_scheds}"
  week_1_rules = make_week_ruleset_sched_from_168(model, sch_ruleset, all_week_values[1], start_date, end_date, week_sch_name)
  week_n_rules = week_1_rules
  all_week_rules = []
  all_week_rules << week_1_rules
  iweek_previous_week_rule = 0

  # temporary loop for debugging
  week_n_rules.each do |sch_rule|
    day_rule = sch_rule.daySchedule
    xtest = 1
  end

  # For each subsequent week, check if it is same as previous
  # If same, then append to Schedule:Rule of previous week
  # If different, then create new Schedule:Rule
  (1..51).each do |iweek|
    is_a_match = true
    start_date = end_date + one_day
    end_date += seven_days
    (0..167).each do |ihr|
      if all_week_values[iweek][ihr] != all_week_values[iweek_previous_week_rule][ihr]
        is_a_match = false
        break
      end
    end
    if is_a_match
      # Update the end date for the Rules of the previous week to include this week
      all_week_rules[iweek_previous_week_rule].each do |sch_rule|
        sch_rule.setEndDate(end_date)
      end
    else
      # Create a new week schedule for this week
      num_week_scheds += 1
      week_sch_name = sch_name + '_ws' + num_week_scheds.to_s
      week_n_rules = make_week_ruleset_sched_from_168(model, sch_ruleset, all_week_values[iweek], start_date, end_date, week_sch_name)
      all_week_rules << week_n_rules
      # Set this week as the reference for subsequent weeks
      iweek_previous_week_rule = iweek
    end
  end

  # temporary loop for debugging
  week_n_rules.each do |sch_rule|
    day_rule = sch_rule.daySchedule
    xtest = 1
  end

  # Need to handle week 52 with days 365 and 366
  # For each of these days, check if it matches a day from the previous week
  iweek = 52
  # First handle day 365
  end_date += one_day
  start_date = end_date
  match_was_found = false
  # week_n is the previous week
  week_n_rules.each do |sch_rule|
    day_rule = sch_rule.daySchedule
    is_match = true
    # Need a 24 hour array of values for the day rule
    ihr_start = 0
    day_values = []
    day_rule.times.each do |time|
      now_value = day_rule.getValue(time).to_f
      until_ihr = time.totalHours.to_i - 1
      (ihr_start..until_ihr).each do |ihr|
        day_values << now_value
      end
    end
    (0..23).each do |ihr|
      if day_values[ihr] != all_week_values[iweek][ihr + ihr_start]
        # not matching for this day_rule
        is_match = false
        break
      end
    end
    if is_match
      match_was_found = true
      # Extend the schedule period to include this day
      sch_rule.setEndDate(end_date)
      break
    end
  end
  if match_was_found == false
    # Need to add a new rule
    day_of_week = start_date.dayOfWeek.valueName
    day_names = [day_of_week]
    day_sch_name = "#{sch_name}_Day_365"
    day_sch_values = []
    (0..23).each do |ihr|
      day_sch_values << all_week_values[iweek][ihr]
    end
    # sch_rule is a sub-component of the ScheduleRuleset
    sch_rule = OpenstudioStandards::Schedules.schedule_ruleset_add_rule(sch_ruleset, day_sch_values,
                                                                        start_date: start_date,
                                                                        end_date: end_date,
                                                                        day_names: day_names,
                                                                        rule_name: day_sch_name)
    week_n_rules = sch_rule
  end

  # Handle day 366, if leap year
  # Last day in this week is the holiday schedule
  # If there are three days in this week, then the second is day 366
  if all_week_values[iweek].size == 24 * 3
    ihr_start = 23
    end_date += one_day
    start_date = end_date
    match_was_found = false
    # week_n is the previous week
    # which would be the week based on day 356, if that was its own week
    week_n_rules.each do |sch_rule|
      day_rule = sch_rule.daySchedule
      is_match = true
      day_rule.times.each do |ihr|
        if day_rule.getValue(ihr).to_f != all_week_values[iweek][ihr + ihr_start]
          # not matching for this day_rule
          is_match = false
          break
        end
      end
      if is_match
        match_was_found = true
        # Extend the schedule period to include this day
        sch_rule.setEndDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_date.month.to_i), end_date.day.to_i))
        break
      end
    end
    if match_was_found == false
      # Need to add a new rule
      # sch_rule is a sub-component of the ScheduleRuleset

      day_of_week = start_date.dayOfWeek.valueName
      day_names = [day_of_week]
      day_sch_name = "#{sch_name}_Day_366"
      day_sch_values = []
      (0..23).each do |ihr|
        day_sch_values << all_week_values[iweek][ihr]
      end
      sch_rule = OpenstudioStandards::Schedules.schedule_ruleset_add_rule(sch_ruleset, day_sch_values,
                                                                          start_date: start_date,
                                                                          end_date: end_date,
                                                                          day_names: day_names,
                                                                          rule_name: day_sch_name)
      week_n_rules = sch_rule
    end

    # Last day in values array is the holiday schedule
    # @todo add holiday schedule when implemented in OpenStudio SDK
  end

  # Need to handle design days
  # Find schedule with the most operating hours in a day,
  # and apply that to both cooling and heating design days
  hr_of_yr = -1
  max_eflh = 0
  ihr_max = -1
  (0..364).each do |iday|
    eflh = 0
    ihr_start = hr_of_yr + 1
    (0..23).each do |ihr|
      hr_of_yr += 1
      eflh += 1 if values[hr_of_yr] > 0
    end
    if eflh > max_eflh
      max_eflh = eflh
      # store index to first hour of day with max on hours
      ihr_max = ihr_start
    end
  end
  # Create the schedules for the design days
  day_sch = OpenStudio::Model::ScheduleDay.new(model)
  day_sch.setName("#{sch_name} Winter Design Day")
  (0..23).each do |ihr|
    hr_of_yr = ihr_max + ihr
    next if values[hr_of_yr] == values[hr_of_yr + 1]

    day_sch.addValue(OpenStudio::Time.new(0, ihr + 1, 0, 0), values[hr_of_yr])
  end
  sch_ruleset.setWinterDesignDaySchedule(day_sch)

  day_sch = OpenStudio::Model::ScheduleDay.new(model)
  day_sch.setName("#{sch_name} Summer Design Day")
  (0..23).each do |ihr|
    hr_of_yr = ihr_max + ihr
    next if values[hr_of_yr] == values[hr_of_yr + 1]

    day_sch.addValue(OpenStudio::Time.new(0, ihr + 1, 0, 0), values[hr_of_yr])
  end
  sch_ruleset.setSummerDesignDaySchedule(day_sch)

  return sch_ruleset
end

#make_week_ruleset_sched_from_168(model, sch_ruleset, values, start_date, end_date, sch_name) ⇒ Array<Object>

Create a ScheduleRules object from an hourly array of values for a week

Parameters:

  • model (Object)
  • sch_ruleset (Object)

    ScheduleRuleset object

  • values (Array<Double>)

    array of hourly values for week (168)

  • start_date (Date)

    start date of week period

  • end_date (Date)

    end date of week period

  • sch_name (String)

    name of parent ScheduleRuleset object

Returns:

  • (Array<Object>)

    array of ScheduleRules objects

Author:

  • Doug Maddox, PNNL



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb', line 297

def make_week_ruleset_sched_from_168(model, sch_ruleset, values, start_date, end_date, sch_name)
  one_day = OpenStudio::Time.new(1.0)
  now_date = start_date - one_day
  days_of_week = []
  values_by_day = []
  # Organize data into days
  # create a 2-D array values_by_day[iday][ihr]
  hr_of_wk = -1
  (0..6).each do |iday|
    hr_values = []
    (0..23).each do |hr_of_day|
      hr_of_wk += 1
      hr_values << values[hr_of_wk]
    end
    values_by_day << hr_values
    now_date += one_day
    days_of_week << now_date.dayOfWeek.valueName
  end

  # Make list of unique day schedules
  # First one is automatically unique
  # Store indexes to days with the same sched in array of arrays
  # day_sched_idays[0] << 0
  day_sched = {}
  day_sched['day_idx_list'] = [0]
  day_sched['hr_values'] = values_by_day[0]
  day_scheds = []
  day_scheds << day_sched

  # Check each day with the cumulative list of day_scheds and add new, if unique
  (1..6).each do |iday|
    match_was_found = false
    day_scheds.each do |day_sched|
      # Compare each jday to the current iday and check for a match
      is_a_match = true
      (0..23).each do |ihr|
        if day_sched['hr_values'][ihr] != values_by_day[iday][ihr]
          # this hour is not a match
          is_a_match = false
          break
        end
      end
      if is_a_match
        # Add the day index to the list for this day_sched
        day_sched['day_idx_list'] << iday
        match_was_found = true
        break
      end
    end
    if match_was_found == false
      # Add a new day type
      day_sched = {}
      day_sched['day_idx_list'] = [iday]
      day_sched['hr_values'] = values_by_day[iday]
      day_scheds << day_sched
    end
  end

  # Add the Rule and Day objects
  sch_rules = []
  iday_sch = 0
  day_scheds.each do |day_sched|
    iday_sch += 1

    day_names = []
    day_sched['day_idx_list'].each do |idx|
      day_names << days_of_week[idx]
    end
    day_sch_name = "#{sch_name} Day #{iday_sch}"
    day_sch_values = day_sched['hr_values']
    sch_rule = OpenstudioStandards::Schedules.schedule_ruleset_add_rule(sch_ruleset, day_sch_values,
                                                                        start_date: start_date,
                                                                        end_date: end_date,
                                                                        day_names: day_names,
                                                                        rule_name: day_sch_name)
    sch_rules << sch_rule
  end

  return sch_rules
end

#model_add_baseboard(model, thermal_zones, hot_water_loop: nil) ⇒ Array<OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric, OpenStudio::Model::ZoneHVACBaseboardConvectiveWater>

Adds hydronic or electric baseboard heating to each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to add baseboards to.

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    The hot water loop that serves the baseboards. If nil, baseboards are electric.

Returns:

  • (Array<OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric, OpenStudio::Model::ZoneHVACBaseboardConvectiveWater>)

    array of baseboard heaters.



4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4585

def model_add_baseboard(model,
                        thermal_zones,
                        hot_water_loop: nil)

  # Make a baseboard heater for each zone
  baseboards = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding baseboard heat for #{zone.name}.")

    if hot_water_loop.nil?
      baseboard = OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric.new(model)
      baseboard.setName("#{zone.name} Electric Baseboard")
      baseboard.addToThermalZone(zone)
      baseboards << baseboard
    else
      htg_coil = OpenStudio::Model::CoilHeatingWaterBaseboard.new(model)
      htg_coil.setName("#{zone.name} Hydronic Baseboard Coil")
      hot_water_loop.addDemandBranchForComponent(htg_coil)
      baseboard = OpenStudio::Model::ZoneHVACBaseboardConvectiveWater.new(model, model.alwaysOnDiscreteSchedule, htg_coil)
      baseboard.setName("#{zone.name} Hydronic Baseboard")
      baseboard.addToThermalZone(zone)
      baseboards << baseboard
    end
  end

  return baseboards
end

#model_add_cav(model, thermal_zones, system_name: nil, hot_water_loop: nil, chilled_water_loop: nil, hvac_op_sch: nil, oa_damper_sch: nil, fan_efficiency: 0.62, fan_motor_efficiency: 0.9, fan_pressure_rise: 4.0) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a CAV system and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect to heating and reheat coils.

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect to the cooling coil.

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

  • fan_efficiency (Double) (defaults to: 0.62)

    fan total efficiency, including motor and impeller

  • fan_motor_efficiency (Double) (defaults to: 0.9)

    fan motor efficiency

  • fan_pressure_rise (Double) (defaults to: 4.0)

    fan pressure rise, inH2O

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting packaged VAV air loop



2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 2561

def model_add_cav(model,
                  thermal_zones,
                  system_name: nil,
                  hot_water_loop: nil,
                  chilled_water_loop: nil,
                  hvac_op_sch: nil,
                  oa_damper_sch: nil,
                  fan_efficiency: 0.62,
                  fan_motor_efficiency: 0.9,
                  fan_pressure_rise: 4.0)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding CAV for #{thermal_zones.size} zones.")

  # create air handler
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName("#{thermal_zones.size} Zone CAV")
  else
    air_loop.setName(system_name)
  end

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures
  unless hot_water_loop.nil?
    hw_temp_c = hot_water_loop.sizingPlant.designLoopExitTemperature
    hw_delta_t_k = hot_water_loop.sizingPlant.loopDesignTemperatureDifference
  end

  # adjusted design heating temperature for cav
  dsgn_temps['htg_dsgn_sup_air_temp_f'] = 62.0
  dsgn_temps['htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get

  # default design settings used across all air loops
  sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 1.0)

  # air handler controls
  sa_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                dsgn_temps['clg_dsgn_sup_air_temp_c'],
                                                                                name: "Supply Air Temp - #{dsgn_temps['clg_dsgn_sup_air_temp_f']}F",
                                                                                schedule_type_limit: 'Temperature')
  sa_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, sa_temp_sch)
  sa_stpt_manager.setName("#{air_loop.name} Supply Air Setpoint Manager")
  sa_stpt_manager.addToNode(air_loop.supplyOutletNode)

  # create fan
  fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                     'Packaged_RTU_SZ_AC_CAV_Fan',
                                                     fan_name: "#{air_loop.name} Fan",
                                                     fan_efficiency: fan_efficiency,
                                                     pressure_rise: fan_pressure_rise,
                                                     motor_efficiency: fan_motor_efficiency,
                                                     end_use_subcategory: 'CAV System Fans')
  fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  fan.addToNode(air_loop.supplyInletNode)

  # create heating coil
  OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                      hot_water_loop,
                                                      air_loop_node: air_loop.supplyInletNode,
                                                      name: "#{air_loop.name} Main Htg Coil",
                                                      rated_inlet_water_temperature: hw_temp_c,
                                                      rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                      rated_inlet_air_temperature: dsgn_temps['prehtg_dsgn_sup_air_temp_c'],
                                                      rated_outlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'])

  # create cooling coil
  if chilled_water_loop.nil?
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX Clg Coil",
                                                               type: 'OS default')
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Clg Coil")
  end

  # create outdoor air intake system
  oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_intake_controller.setName("#{air_loop.name} OA Controller")
  oa_intake_controller.setMinimumLimitType('FixedMinimum')
  oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
  oa_intake_controller.setMinimumFractionofOutdoorAirSchedule(oa_damper_sch)
  oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
  controller_mv = oa_intake_controller.controllerMechanicalVentilation
  controller_mv.setName("#{air_loop.name} Vent Controller")
  controller_mv.setSystemOutdoorAirMethod('ZoneSum')
  oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
  oa_intake.setName("#{air_loop.name} OA System")
  oa_intake.addToNode(air_loop.supplyInletNode)

  # set air loop availability controls and night cycle manager, after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)
  air_loop.setNightCycleControlType('CycleOnAny')

  # Connect the CAV system to each zone
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "Adding CAV for #{zone.name}")

    # Reheat coil
    rht_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                   hot_water_loop,
                                                                   name: "#{zone.name} Reheat Coil",
                                                                   rated_inlet_water_temperature: hw_temp_c,
                                                                   rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                                   rated_inlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'],
                                                                   rated_outlet_air_temperature: dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    # VAV terminal
    terminal = OpenStudio::Model::AirTerminalSingleDuctVAVReheat.new(model, model.alwaysOnDiscreteSchedule, rht_coil)
    terminal.setName("#{zone.name} VAV Terminal")
    if model.version < OpenStudio::VersionString.new('3.0.1')
      terminal.setZoneMinimumAirFlowMethod('Constant')
    else
      terminal.setZoneMinimumAirFlowInputMethod('Constant')
    end
    terminal.setMaximumFlowPerZoneFloorAreaDuringReheat(0.0)
    terminal.setMaximumFlowFractionDuringReheat(0.5)
    terminal.setMaximumReheatAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    air_loop.multiAddBranchForZone(zone, terminal.to_HVACComponent.get)
    oa_rate = OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate_per_area(zone)
    air_terminal_single_duct_vav_reheat_apply_initial_prototype_damper_position(terminal, oa_rate)

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setCoolingDesignAirFlowMethod('DesignDayWithLimit')
    sizing_zone.setHeatingDesignAirFlowMethod('DesignDay')
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
  end

  # Set the damper action based on the template.
  air_loop_hvac_apply_vav_damper_action(air_loop)

  return air_loop
end

#model_add_central_air_source_heat_pump(model, thermal_zones, heating: true, cooling: true, ventilation: false) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to add fan coil units to.

  • heating (Boolean) (defaults to: true)

    if true, the unit will include a NaturalGas heating coil

  • cooling (Boolean) (defaults to: true)

    if true, the unit will include a DX cooling coil

  • ventilation (Boolean) (defaults to: false)

    if true, the unit will include an OA intake

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    and array of air loops representing the heat pumps



5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5490

def model_add_central_air_source_heat_pump(model,
                                           thermal_zones,
                                           heating: true,
                                           cooling: true,
                                           ventilation: false)
  # defaults
  hspf = 7.7
  # seer = 13.0
  # eer = 11.4
  cop = 3.05
  shr = 0.73
  ac_w_per_cfm = 0.365
  min_hp_oat_f = 0.0
  crank_case_heat_w = 0.0
  crank_case_max_temp_f = 55

  # default design temperatures across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted temperatures for furnace_central_ac
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
  dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

  hps = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding Central Air Source HP for #{zone.name}.")

    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    air_loop.setName("#{zone.name} Central Air Source HP")

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, sizing_option: 'NonCoincident')
    sizing_system.setAllOutdoorAirinCooling(true)
    sizing_system.setAllOutdoorAirinHeating(true)

    # create heating coil
    htg_coil = nil
    supplemental_htg_coil = nil
    if heating
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                               name: "#{air_loop.name} heating coil",
                                                                               type: 'Residential Central Air Source HP',
                                                                               cop: OpenstudioStandards::HVAC.hspf_to_cop_no_fan(hspf))
      if model.version < OpenStudio::VersionString.new('3.5.0')
        htg_coil.setRatedSupplyFanPowerPerVolumeFlowRate(ac_w_per_cfm / OpenStudio.convert(1.0, 'cfm', 'm^3/s').get)
      else
        htg_coil.setRatedSupplyFanPowerPerVolumeFlowRate2017(ac_w_per_cfm / OpenStudio.convert(1.0, 'cfm', 'm^3/s').get)
      end
      htg_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(OpenStudio.convert(min_hp_oat_f, 'F', 'C').get)
      htg_coil.setMaximumOutdoorDryBulbTemperatureforDefrostOperation(OpenStudio.convert(40.0, 'F', 'C').get)
      htg_coil.setCrankcaseHeaterCapacity(crank_case_heat_w)
      htg_coil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(OpenStudio.convert(crank_case_max_temp_f, 'F', 'C').get)
      htg_coil.setDefrostStrategy('ReverseCycle')
      htg_coil.setDefrostControl('OnDemand')
      htg_coil.resetDefrostTimePeriodFraction

      # Supplemental Heating Coil

      # create supplemental heating coil
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                     name: "#{air_loop.name} Supplemental Htg Coil")
    end

    # create cooling coil
    clg_coil = nil
    if cooling
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} Cooling Coil",
                                                                               type: 'Residential Central ASHP',
                                                                               cop: cop)
      clg_coil.setRatedSensibleHeatRatio(shr)
      clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(OpenStudio::OptionalDouble.new(ac_w_per_cfm / OpenStudio.convert(1.0, 'cfm', 'm^3/s').get))
      clg_coil.setNominalTimeForCondensateRemovalToBegin(OpenStudio::OptionalDouble.new(1000.0))
      clg_coil.setRatioOfInitialMoistureEvaporationRateAndSteadyStateLatentCapacity(OpenStudio::OptionalDouble.new(1.5))
      clg_coil.setMaximumCyclingRate(OpenStudio::OptionalDouble.new(3.0))
      clg_coil.setLatentCapacityTimeConstant(OpenStudio::OptionalDouble.new(45.0))
      clg_coil.setCondenserType('AirCooled')
      clg_coil.setCrankcaseHeaterCapacity(OpenStudio::OptionalDouble.new(crank_case_heat_w))
      clg_coil.setMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation(OpenStudio::OptionalDouble.new(OpenStudio.convert(crank_case_max_temp_f, 'F', 'C').get))
    end

    # create fan
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Residential_HVAC_Fan',
                                                       fan_name: "#{air_loop.name} Supply Fan",
                                                       end_use_subcategory: 'Residential HVAC Fans')
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # create outdoor air intake
    if ventilation
      oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
      oa_intake_controller.setName("#{air_loop.name} OA Controller")
      oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
      oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
      oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
      oa_intake.setName("#{air_loop.name} OA System")
      oa_intake.addToNode(air_loop.supplyInletNode)
    end

    # create unitary system (holds the coils and fan)
    unitary = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary.setName("#{air_loop.name} Unitary System")
    unitary.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
    unitary.setMaximumSupplyAirTemperature(OpenStudio.convert(170.0, 'F', 'C').get) # higher temp for supplemental heat as to not severely limit its use, resulting in unmet hours.
    unitary.setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(OpenStudio.convert(40.0, 'F', 'C').get)
    unitary.setControllingZoneorThermostatLocation(zone)
    unitary.addToNode(air_loop.supplyInletNode)

    # set flow rates during different conditions
    unitary.setSupplyAirFlowRateWhenNoCoolingorHeatingisRequired(0.0) unless ventilation

    # attach the coils and fan
    unitary.setHeatingCoil(htg_coil) if htg_coil
    unitary.setCoolingCoil(clg_coil) if clg_coil
    unitary.setSupplementalHeatingCoil(supplemental_htg_coil) if supplemental_htg_coil
    unitary.setSupplyFan(fan)
    unitary.setFanPlacement('BlowThrough')
    unitary.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)

    # create a diffuser
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName(" #{zone.name} Direct Air")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    hps << air_loop
  end

  return hps
end

#model_add_chw_loop(model, system_name: 'Chilled Water Loop', cooling_fuel: 'Electricity', dsgn_sup_wtr_temp: 44.0, dsgn_sup_wtr_temp_delt: 10.1, chw_pumping_type: nil, chiller_cooling_type: nil, chiller_condenser_type: nil, chiller_compressor_type: nil, num_chillers: 1, condenser_water_loop: nil, waterside_economizer: 'none') ⇒ OpenStudio::Model::PlantLoop

Creates a chilled water loop and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: 'Chilled Water Loop')

    the name of the system, or nil in which case it will be defaulted

  • cooling_fuel (String) (defaults to: 'Electricity')

    cooling fuel. Valid choices are: Electricity, DistrictCooling

  • dsgn_sup_wtr_temp (Double) (defaults to: 44.0)

    design supply water temperature in degrees Fahrenheit, default 44F

  • dsgn_sup_wtr_temp_delt (Double) (defaults to: 10.1)

    design supply-return water temperature difference in degrees Rankine, default 10R

  • chw_pumping_type (String) (defaults to: nil)

    valid choices are const_pri, const_pri_var_sec

  • chiller_cooling_type (String) (defaults to: nil)

    valid choices are AirCooled, WaterCooled

  • chiller_condenser_type (String) (defaults to: nil)

    valid choices are WithCondenser, WithoutCondenser, nil

  • chiller_compressor_type (String) (defaults to: nil)

    valid choices are Centrifugal, Reciprocating, Rotary Screw, Scroll, nil

  • num_chillers (Integer) (defaults to: 1)

    the number of chillers

  • condenser_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    optional condenser water loop for water-cooled chillers. If this is not passed in, the chillers will be air cooled.

  • waterside_economizer (String) (defaults to: 'none')

    Options are 'none', 'integrated', 'non-integrated'. If 'integrated' will add a heat exchanger to the supply inlet of the chilled water loop to provide waterside economizing whenever wet bulb temperatures allow If 'non-integrated' will add a heat exchanger in parallel with the chiller that will operate only when it can meet cooling demand exclusively with the waterside economizing.

Returns:

  • (OpenStudio::Model::PlantLoop)

    the resulting chilled water loop



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 228

def model_add_chw_loop(model,
                       system_name: 'Chilled Water Loop',
                       cooling_fuel: 'Electricity',
                       dsgn_sup_wtr_temp: 44.0,
                       dsgn_sup_wtr_temp_delt: 10.1,
                       chw_pumping_type: nil,
                       chiller_cooling_type: nil,
                       chiller_condenser_type: nil,
                       chiller_compressor_type: nil,
                       num_chillers: 1,
                       condenser_water_loop: nil,
                       waterside_economizer: 'none')
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding chilled water loop.')

  # create chilled water loop
  chilled_water_loop = OpenStudio::Model::PlantLoop.new(model)
  if system_name.nil?
    chilled_water_loop.setName('Chilled Water Loop')
  else
    chilled_water_loop.setName(system_name)
  end

  if dsgn_sup_wtr_temp.nil?
    dsgn_sup_wtr_temp = 44
  end

  # chilled water loop sizing and controls
  chw_sizing_control(model, chilled_water_loop, dsgn_sup_wtr_temp, dsgn_sup_wtr_temp_delt)

  # create chilled water pumps
  if chw_pumping_type == 'const_pri'
    # primary chilled water pump
    pri_chw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
    pri_chw_pump.setName("#{chilled_water_loop.name} Pump")
    pri_chw_pump.setRatedPumpHead(OpenStudio.convert(60.0, 'ftH_{2}O', 'Pa').get)
    pri_chw_pump.setMotorEfficiency(0.9)
    # flat pump curve makes it behave as a constant speed pump
    pri_chw_pump.setFractionofMotorInefficienciestoFluidStream(0)
    pri_chw_pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
    pri_chw_pump.setCoefficient2ofthePartLoadPerformanceCurve(1)
    pri_chw_pump.setCoefficient3ofthePartLoadPerformanceCurve(0)
    pri_chw_pump.setCoefficient4ofthePartLoadPerformanceCurve(0)
    pri_chw_pump.setPumpControlType('Intermittent')
    pri_chw_pump.addToNode(chilled_water_loop.supplyInletNode)
  elsif chw_pumping_type == 'const_pri_var_sec'
    pri_sec_config = plant_loop_set_chw_pri_sec_configuration(model)

    if pri_sec_config == 'common_pipe'
      # primary chilled water pump
      pri_chw_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
      pri_chw_pump.setName("#{chilled_water_loop.name} Primary Pump")
      pri_chw_pump.setRatedPumpHead(OpenStudio.convert(15.0, 'ftH_{2}O', 'Pa').get)
      pri_chw_pump.setMotorEfficiency(0.9)
      pri_chw_pump.setPumpControlType('Intermittent')
      pri_chw_pump.addToNode(chilled_water_loop.supplyInletNode)
      # secondary chilled water pump
      sec_chw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
      sec_chw_pump.setName("#{chilled_water_loop.name} Secondary Pump")
      sec_chw_pump.setRatedPumpHead(OpenStudio.convert(45.0, 'ftH_{2}O', 'Pa').get)
      sec_chw_pump.setMotorEfficiency(0.9)
      # curve makes it perform like variable speed pump
      sec_chw_pump.setFractionofMotorInefficienciestoFluidStream(0)
      sec_chw_pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
      sec_chw_pump.setCoefficient2ofthePartLoadPerformanceCurve(0.0205)
      sec_chw_pump.setCoefficient3ofthePartLoadPerformanceCurve(0.4101)
      sec_chw_pump.setCoefficient4ofthePartLoadPerformanceCurve(0.5753)
      sec_chw_pump.setPumpControlType('Intermittent')
      sec_chw_pump.addToNode(chilled_water_loop.demandInletNode)
      # Change the chilled water loop to have a two-way common pipes
      chilled_water_loop.setCommonPipeSimulation('CommonPipe')
    elsif pri_sec_config == 'heat_exchanger'
      # Check number of chillers
      if num_chillers > 3
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.PlantLoop', "EMS Code for multiple chiller pump has not been written for greater than 3 chillers. This has #{num_chillers} chillers")
      end
      # NOTE: PRECONDITIONING for `const_pri_var_sec` pump type is only applicable for PRM routine and only applies to System Type 7 and System Type 8
      # See: model_add_prm_baseline_system under Model object.
      # In this scenario, we will need to create a primary and secondary configuration:
      # chilled_water_loop is the primary loop
      # Primary: demand: heat exchanger, supply: chillers, name: Chilled Water Loop_Primary, additionalProperty: secondary_loop_name
      # Secondary: demand: Coils, supply: heat exchanger, name: Chilled Water Loop, additionalProperty: is_secondary_loop
      secondary_chilled_water_loop = OpenStudio::Model::PlantLoop.new(model)
      secondary_loop_name = system_name.nil? ? 'Chilled Water Loop' : system_name
      # Reset primary loop name
      chilled_water_loop.setName("#{secondary_loop_name}_Primary")
      secondary_chilled_water_loop.setName(secondary_loop_name)
      chw_sizing_control(model, secondary_chilled_water_loop, dsgn_sup_wtr_temp, dsgn_sup_wtr_temp_delt)
      chilled_water_loop.additionalProperties.setFeature('is_primary_loop', true)
      chilled_water_loop.additionalProperties.setFeature('secondary_loop_name', secondary_chilled_water_loop.name.to_s)
      secondary_chilled_water_loop.additionalProperties.setFeature('is_secondary_loop', true)
      # primary chilled water pumps are added when adding chillers
      # Add Constant pump, in plant loop, the number of chiller adjustment will assign pump to each chiller
      # pri_chw_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
      pri_chw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
      OpenstudioStandards::HVAC.pump_variable_speed_set_control_type(pri_chw_pump, control_type: 'Riding Curve')
      # This pump name is important for function add_ems_for_multiple_chiller_pumps_w_secondary_plant. If you update
      # it here, you must update the logic there to account for this
      pri_chw_pump.setName("#{chilled_water_loop.name} Primary Pump")
      # Will need to adjust the pump power after a sizing run
      pri_chw_pump.setRatedPumpHead(OpenStudio.convert(15.0, 'ftH_{2}O', 'Pa').get / num_chillers)
      pri_chw_pump.setMotorEfficiency(0.9)
      pri_chw_pump.setPumpControlType('Intermittent')
      # chiller_inlet_node = chiller.connectedObject(chiller.supplyInletPort).get.to_Node.get
      pri_chw_pump.addToNode(chilled_water_loop.supplyInletNode)

      # secondary chilled water pump
      sec_chw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
      sec_chw_pump.setName("#{secondary_chilled_water_loop.name} Pump")
      sec_chw_pump.setRatedPumpHead(OpenStudio.convert(45.0, 'ftH_{2}O', 'Pa').get)
      sec_chw_pump.setMotorEfficiency(0.9)
      # curve makes it perform like variable speed pump
      sec_chw_pump.setFractionofMotorInefficienciestoFluidStream(0)
      sec_chw_pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
      sec_chw_pump.setCoefficient2ofthePartLoadPerformanceCurve(0.0205)
      sec_chw_pump.setCoefficient3ofthePartLoadPerformanceCurve(0.4101)
      sec_chw_pump.setCoefficient4ofthePartLoadPerformanceCurve(0.5753)
      sec_chw_pump.setPumpControlType('Intermittent')
      sec_chw_pump.addToNode(secondary_chilled_water_loop.demandInletNode)

      # Add HX to connect secondary and primary loop
      heat_exchanger = OpenStudio::Model::HeatExchangerFluidToFluid.new(model)
      secondary_chilled_water_loop.addSupplyBranchForComponent(heat_exchanger)
      chilled_water_loop.addDemandBranchForComponent(heat_exchanger)

      # Clean up connections
      hx_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
      hx_bypass_pipe.setName("#{secondary_chilled_water_loop.name} HX Bypass")
      secondary_chilled_water_loop.addSupplyBranchForComponent(hx_bypass_pipe)
      outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
      outlet_pipe.setName("#{secondary_chilled_water_loop.name} Supply Outlet")
      outlet_pipe.addToNode(secondary_chilled_water_loop.supplyOutletNode)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'No primary/secondary configuration specified for the chilled water loop.')
    end
  else
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'No pumping type specified for the chilled water loop.')
  end

  # check for existence of condenser_water_loop if WaterCooled
  if chiller_cooling_type == 'WaterCooled' && condenser_water_loop.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Requested chiller is WaterCooled but no condenser loop specified.')
  end

  # check for non-existence of condenser_water_loop if AirCooled
  if chiller_cooling_type == 'AirCooled' && !condenser_water_loop.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Requested chiller is AirCooled but condenser loop specified.')
  end

  if cooling_fuel == 'DistrictCooling'
    # DistrictCooling
    dist_clg = OpenStudio::Model::DistrictCooling.new(model)
    dist_clg.setName('Purchased Cooling')
    dist_clg.autosizeNominalCapacity
    chilled_water_loop.addSupplyBranchForComponent(dist_clg)
  else

    # use default efficiency from 90.1-2019
    # 1.188 kw/ton for a 150 ton AirCooled chiller
    # 0.66 kw/ton for a 150 ton Water Cooled positive displacement chiller
    case chiller_cooling_type
    when 'AirCooled'
      default_cop = OpenstudioStandards::HVAC.kw_per_ton_to_cop(1.188)
    when 'WaterCooled'
      default_cop = OpenstudioStandards::HVAC.kw_per_ton_to_cop(0.66)
    else
      default_cop = OpenstudioStandards::HVAC.kw_per_ton_to_cop(0.66)
    end

    # make the correct type of chiller based these properties
    chiller_sizing_factor = (1.0 / num_chillers).round(2)

    # Create chillers and set plant operation scheme
    num_chillers.times do |i|
      chiller = OpenStudio::Model::ChillerElectricEIR.new(model)
      chiller.setName("#{template} #{chiller_cooling_type} #{chiller_condenser_type} #{chiller_compressor_type} Chiller #{i}")
      chilled_water_loop.addSupplyBranchForComponent(chiller)
      dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
      chiller.setReferenceLeavingChilledWaterTemperature(dsgn_sup_wtr_temp_c)
      chiller.setLeavingChilledWaterLowerTemperatureLimit(OpenStudio.convert(36.0, 'F', 'C').get)
      chiller.setReferenceEnteringCondenserFluidTemperature(OpenStudio.convert(95.0, 'F', 'C').get)
      chiller.setMinimumPartLoadRatio(0.15)
      chiller.setMaximumPartLoadRatio(1.0)
      chiller.setOptimumPartLoadRatio(1.0)
      chiller.setMinimumUnloadingRatio(0.25)
      chiller.setChillerFlowMode('ConstantFlow')
      chiller.setSizingFactor(chiller_sizing_factor)
      chiller.setReferenceCOP(default_cop)

      # connect the chiller to the condenser loop if one was supplied
      if condenser_water_loop.nil?
        chiller.setCondenserType('AirCooled')
      else
        condenser_water_loop.addDemandBranchForComponent(chiller)
        chiller.setCondenserType('WaterCooled')
      end
    end
  end

  # enable waterside economizer if requested
  unless condenser_water_loop.nil?
    case waterside_economizer
    when 'integrated'
      model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                     integrated: true)
    when 'non-integrated'
      model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                     integrated: false)
    end
  end

  # chilled water loop pipes
  chiller_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  chiller_bypass_pipe.setName("#{chilled_water_loop.name} Chiller Bypass")
  chilled_water_loop.addSupplyBranchForComponent(chiller_bypass_pipe)

  coil_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  coil_bypass_pipe.setName("#{chilled_water_loop.name} Coil Bypass")
  chilled_water_loop.addDemandBranchForComponent(coil_bypass_pipe)

  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe.setName("#{chilled_water_loop.name} Supply Outlet")
  supply_outlet_pipe.addToNode(chilled_water_loop.supplyOutletNode)

  demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_inlet_pipe.setName("#{chilled_water_loop.name} Demand Inlet")
  demand_inlet_pipe.addToNode(chilled_water_loop.demandInletNode)

  demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_outlet_pipe.setName("#{chilled_water_loop.name} Demand Outlet")
  demand_outlet_pipe.addToNode(chilled_water_loop.demandOutletNode)

  return chilled_water_loop
end

#model_add_construction(model, construction_name, construction_props = nil, surface = nil) ⇒ OpenStudio::Model::Construction

TODO:

make return an OptionalConstruction

Create a construction from the openstudio standards dataset. If construction_props are specified, modifies the insulation layer accordingly.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • construction_name (String)

    name of the construction

  • construction_props (Hash) (defaults to: nil)

    hash of construction properties

Returns:

  • (OpenStudio::Model::Construction)

    construction object



3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3051

def model_add_construction(model, construction_name, construction_props = nil, surface = nil)
  intended_surface_type = construction_props&.[]('intended_surface_type') || ''

  # First check model and return construction if it already exists
  model.getConstructions.sort.each do |construction|
    if construction.name.get.to_s == construction_name
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Already added construction: #{construction_name}")
      valid = true
      if !surface.nil?
        if intended_surface_type == 'GroundContactFloor' && construction.iddObjectType.valueName != 'OS_Construction_FfactorGroundFloor'
          valid = false
        elsif intended_surface_type == 'GroundContactWall' && construction.iddObjectType.valueName != 'OS_Construction_CfactorUndergroundWall'
          valid = false
        end
      end
      if valid
        return construction
      end
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Already added construction: '#{construction_name}' but its type '#{construction.iddObjectType.valueName}' is not valid for the intended surface type '#{intended_surface_type}'. A new construction will be created.")
    end
  end

  OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Adding construction: #{construction_name}")

  # Get the object data
  if standards_data.keys.include?('prm_constructions')
    data = model_find_object(standards_data['prm_constructions'], 'name' => construction_name)
  else
    data = model_find_object(standards_data['constructions'], 'name' => construction_name)
  end

  unless data
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for construction: #{construction_name}, will not be created.")
    return OpenStudio::Model::OptionalConstruction.new
  end

  intended_surface_type = data["intended_surface_type"]
  intended_surface_type ||= ''

  # Make a new construction and set the standards details
  is_layered_construction = true

  if intended_surface_type == 'GroundContactFloor' && !surface.nil?
    if construction_props
      construction = OpenStudio::Model::FFactorGroundFloorConstruction.new(model)
      is_layered_construction = false
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Construction properties not specified for '#{construction_name}', cannot create F-Factor Ground Floor Construction.  A regular construction will be created instead, and Surface '#{surface.name}' will be set to use the 'Ground' outside boundary condition (previously '#{surface.outsideBoundaryCondition}').")
      surface.setOutsideBoundaryCondition('Ground')
    end
  elsif intended_surface_type == 'GroundContactWall' && !surface.nil?
    if construction_props
      construction = OpenStudio::Model::CFactorUndergroundWallConstruction.new(model)
      is_layered_construction = false
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Construction properties not specified for '#{construction_name}', cannot create C-Factor Underground Wall Construction.  A regular construction will be created instead, and Surface '#{surface.name}' will be set to use the 'Ground' outside boundary condition (previously '#{surface.outsideBoundaryCondition}').")
      surface.setOutsideBoundaryCondition('Ground')
    end
  end

  if is_layered_construction
    construction = OpenStudio::Model::Construction.new(model)
    # Add the material layers to the construction
    layers = OpenStudio::Model::MaterialVector.new
    data['materials'].each do |material_name|
      material = model_add_material(model, material_name)
      if material
        layers << material
      end
    end
    construction.setLayers(layers)
  end
  construction.setName(construction_name)
  standards_info = construction.standardsInformation

  standards_info.setIntendedSurfaceType(intended_surface_type)

  standards_construction_type = data['standards_construction_type']
  standards_construction_type ||= ''
  standards_info.setStandardsConstructionType(standards_construction_type)

  # @todo could put construction rendering color in the spreadsheet

  # Modify the R value of the insulation to hit the specified U-value, C-Factor, or F-Factor.
  # Doesn't currently operate on glazing constructions
  if construction_props
    # Determine the target U-value, C-factor, and F-factor
    target_u_value_ip = construction_props['assembly_maximum_u_value']
    target_f_factor_ip = construction_props['assembly_maximum_f_factor']
    target_c_factor_ip = construction_props['assembly_maximum_c_factor']
    target_shgc = construction_props['assembly_maximum_solar_heat_gain_coefficient']
    u_includes_int_film = construction_props['u_value_includes_interior_film_coefficient']
    u_includes_ext_film = construction_props['u_value_includes_exterior_film_coefficient']

    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "#{data['intended_surface_type']} u_val #{target_u_value_ip} f_fac #{target_f_factor_ip} c_fac #{target_c_factor_ip}")

    if target_u_value_ip

      # Handle Opaque and Fenestration Constructions differently
      # if construction.isFenestration && OpenstudioStandards::Constructions.construction_simple_glazing?(construction)
      if construction.isFenestration
        if OpenstudioStandards::Constructions.construction_simple_glazing?(construction)
          # Set the U-Value and SHGC
          OpenstudioStandards::Constructions.construction_set_glazing_u_value(construction, target_u_value_ip.to_f,
                                                                              target_includes_interior_film_coefficients: u_includes_int_film,
                                                                              target_includes_exterior_film_coefficients: u_includes_ext_film)
          simple_glazing = construction.layers.first.to_SimpleGlazing
          unless simple_glazing.is_initialized && !target_shgc.nil?
            simple_glazing.get.setSolarHeatGainCoefficient(target_shgc.to_f)
          end
        else # if !data['intended_surface_type'] == 'ExteriorWindow' && !data['intended_surface_type'] == 'Skylight'
          # Set the U-Value
          OpenstudioStandards::Constructions.construction_set_u_value(construction, target_u_value_ip.to_f,
                                                                      insulation_layer_name: data['insulation_layer'],
                                                                      intended_surface_type: data['intended_surface_type'],
                                                                      target_includes_interior_film_coefficients: u_includes_int_film,
                                                                      target_includes_exterior_film_coefficients: u_includes_ext_film)
          # else
          # OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Not modifying U-value for #{data['intended_surface_type']} u_val #{target_u_value_ip} f_fac #{target_f_factor_ip} c_fac #{target_c_factor_ip}")
        end
      else
        # Set the U-Value
        OpenstudioStandards::Constructions.construction_set_u_value(construction, target_u_value_ip.to_f,
                                                                    insulation_layer_name: data['insulation_layer'],
                                                                    intended_surface_type: data['intended_surface_type'],
                                                                    target_includes_interior_film_coefficients: u_includes_int_film,
                                                                    target_includes_exterior_film_coefficients: u_includes_ext_film)
        # else
        # OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Not modifying U-value for #{data['intended_surface_type']} u_val #{target_u_value_ip} f_fac #{target_f_factor_ip} c_fac #{target_c_factor_ip}")
      end

    elsif target_f_factor_ip && data['intended_surface_type'] == 'GroundContactFloor'
      # F-factor objects are unique to each surface, so a surface needs to be passed
      # If not surface is passed, use the older approach to model ground contact floors
      if surface.nil?
        # Set the F-Factor (only applies to slabs on grade)
        # @todo figure out what the prototype buildings did about ground heat transfer
        # OpenstudioStandards::Constructions.construction_set_slab_f_factor(construction, target_f_factor_ip.to_f, insulation_layer_name: data['insulation_layer'])
        OpenstudioStandards::Constructions.construction_set_u_value(construction, 0.0,
                                                                    insulation_layer_name: data['insulation_layer'],
                                                                    intended_surface_type: data['intended_surface_type'],
                                                                    target_includes_interior_film_coefficients: u_includes_int_film,
                                                                    target_includes_exterior_film_coefficients: u_includes_ext_film)
      else
        OpenstudioStandards::Constructions.construction_set_surface_slab_f_factor(construction, target_f_factor_ip, surface)
      end
    elsif target_c_factor_ip && (data['intended_surface_type'] == 'GroundContactWall' || data['intended_surface_type'] == 'GroundContactRoof')
      # C-factor objects are unique to each surface, so a surface needs to be passed
      # If not surface is passed, use the older approach to model ground contact walls
      if surface.nil?
        # Set the C-Factor (only applies to underground walls)
        # @todo figure out what the prototype buildings did about ground heat transfer
        # OpenstudioStandards::Constructions.construction_set_underground_wall_c_factor(construction, target_c_factor_ip.to_f, insulation_layer_name: data['insulation_layer'])
        OpenstudioStandards::Constructions.construction_set_u_value(construction, 0.0,
                                                                    insulation_layer_name: data['insulation_layer'],
                                                                    intended_surface_type: data['intended_surface_type'],
                                                                    target_includes_interior_film_coefficients: u_includes_int_film,
                                                                    target_includes_exterior_film_coefficients: u_includes_ext_film)
      else
        OpenstudioStandards::Constructions.construction_set_surface_underground_wall_c_factor(construction, target_c_factor_ip, surface)
      end
    end

    # If the construction is fenestration,
    # also set the frame type for use in future lookups
    if construction.isFenestration
      case standards_construction_type
      when 'Metal framing (all other)'
        standards_info.setFenestrationFrameType('Metal Framing')
      when 'Nonmetal framing (all)'
        standards_info.setFenestrationFrameType('Non-Metal Framing')
      end
    end

    # If the construction has a skylight framing material specified,
    # get the skylight frame material properties and add frame to
    # all skylights in the model.
    if data['skylight_framing']
      # Get the skylight framing material
      framing_name = data['skylight_framing']
      frame_data = model_find_object(standards_data['materials'], 'name' => framing_name)
      if frame_data
        frame_width_in = frame_data['frame_width'].to_f
        frame_with_m = OpenStudio.convert(frame_width_in, 'in', 'm').get
        frame_resistance_ip = frame_data['resistance'].to_f
        frame_resistance_si = OpenStudio.convert(frame_resistance_ip, 'hr*ft^2*R/Btu', 'm^2*K/W').get
        frame_conductance_si = 1.0 / frame_resistance_si
        frame = OpenStudio::Model::WindowPropertyFrameAndDivider.new(model)
        frame.setName("Skylight frame R-#{frame_resistance_ip.round(2)} #{frame_width_in.round(1)} in. wide")
        frame.setFrameWidth(frame_with_m)
        frame.setFrameConductance(frame_conductance_si)
        skylights_frame_added = 0
        model.getSubSurfaces.each do |sub_surface|
          next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && sub_surface.subSurfaceType == 'Skylight'

          if model.version < OpenStudio::VersionString.new('3.1.0')
            # window frame setting before https://github.com/NREL/OpenStudio/issues/2895 was fixed
            sub_surface.setString(8, frame.name.get.to_s)
            skylights_frame_added += 1
          else
            if sub_surface.allowWindowPropertyFrameAndDivider
              sub_surface.setWindowPropertyFrameAndDivider(frame)
              skylights_frame_added += 1
            else
              OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "For #{sub_surface.name}: cannot add a frame to this skylight.")
            end
          end
        end
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding #{frame.name} to #{skylights_frame_added} skylights.") if skylights_frame_added > 0
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find skylight framing data for: #{framing_name}, will not be created.")
        return false
        # @todo change to return empty optional material
      end
    end

  end
  #     # Check if the construction with the modified name was already in the model.
  #     # If it was, delete this new construction and return the copy already in the model.
  #     m = construction.name.get.to_s.match(/\s(\d+)/)
  #     if m
  #       revised_cons_name = construction.name.get.to_s.gsub(/\s\d+/,'')
  #       model.getConstructions.sort.each do |exist_construction|
  #         if exist_construction.name.get.to_s == revised_cons_name
  #           OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Already added construction: #{construction_name}")
  #           # Remove the recently added construction
  #           lyrs = construction.layers
  #           # Erase the layers in the construction
  #           construction.setLayers([])
  #           # Delete unused materials
  #           lyrs.uniq.each do |lyr|
  #             if lyr.directUseCount.zero?
  #               OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Removing Material: #{lyr.name}")
  #               lyr.remove
  #             end
  #           end
  #           construction.remove # Remove the construction
  #           return exist_construction
  #         end
  #       end
  #     end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding construction #{construction.name}.")

  return construction
end

#model_add_construction_set(model, climate_zone, building_type, spc_type, is_residential) ⇒ OpenStudio::Model::OptionalDefaultConstructionSet

Create a construction set from the openstudio standards dataset.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

  • building_type (String)

    the building type

  • spc_type (String)

    the space type

  • is_residential (Boolean)

    true if the building is residential

Returns:

  • (OpenStudio::Model::OptionalDefaultConstructionSet)

    an optional default construction set



3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3382

def model_add_construction_set(model, climate_zone, building_type, spc_type, is_residential)
  construction_set = OpenStudio::Model::OptionalDefaultConstructionSet.new

  # Find the climate zone set that this climate zone falls into
  climate_zone_set = model_find_climate_zone_set(model, climate_zone)
  unless climate_zone_set
    return construction_set
  end

  # Get the object data
  data = model_find_object(standards_data['construction_sets'], 'template' => template, 'climate_zone_set' => climate_zone_set, 'building_type' => building_type, 'space_type' => spc_type, 'is_residential' => is_residential)
  unless data
    # Search again without the is_residential criteria in the case that this field is not specified for a standard
    data = model_find_object(standards_data['construction_sets'], 'template' => template, 'climate_zone_set' => climate_zone_set, 'building_type' => building_type, 'space_type' => spc_type)
    unless data
      # if nothing matches say that we could not find it
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', "Construction set for template =#{template}, climate zone set =#{climate_zone_set}, building type = #{building_type}, space type = #{spc_type}, is residential = #{is_residential} was not found in standards_data['construction_sets']")
      return construction_set
    end
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding construction set: #{template}-#{climate_zone}-#{building_type}-#{spc_type}-is_residential#{is_residential}")

  name = model_make_name(model, climate_zone, building_type, spc_type)

  # Create a new construction set and name it
  construction_set = OpenStudio::Model::DefaultConstructionSet.new(model)
  construction_set.setName(name)

  # Exterior surfaces constructions
  exterior_surfaces = OpenStudio::Model::DefaultSurfaceConstructions.new(model)
  construction_set.setDefaultExteriorSurfaceConstructions(exterior_surfaces)
  # Special condition for attics, where the insulation is actually on the floor but the soffit is uninsulated
  if spc_type == 'Attic'
    exterior_surfaces.setFloorConstruction(model_add_construction(model, 'Typical Attic Soffit'))
  else
    if data['exterior_floor_standards_construction_type'] && data['exterior_floor_building_category']
      exterior_surfaces.setFloorConstruction(model_find_and_add_construction(model,
                                                                             climate_zone_set,
                                                                             'ExteriorFloor',
                                                                             data['exterior_floor_standards_construction_type'],
                                                                             data['exterior_floor_building_category']))
    end
  end
  if data['exterior_wall_standards_construction_type'] && data['exterior_wall_building_category']
    exterior_surfaces.setWallConstruction(model_find_and_add_construction(model,
                                                                          climate_zone_set,
                                                                          'ExteriorWall',
                                                                          data['exterior_wall_standards_construction_type'],
                                                                          data['exterior_wall_building_category']))
  end
  # Special condition for attics, where the insulation is actually on the floor and the roof itself is uninsulated
  if spc_type == 'Attic'
    if data['exterior_roof_standards_construction_type'] && data['exterior_roof_building_category']
      exterior_surfaces.setRoofCeilingConstruction(model_add_construction(model, 'Typical Uninsulated Wood Joist Attic Roof'))
    end
  else
    if data['exterior_roof_standards_construction_type'] && data['exterior_roof_building_category']
      exterior_surfaces.setRoofCeilingConstruction(model_find_and_add_construction(model,
                                                                                   climate_zone_set,
                                                                                   'ExteriorRoof',
                                                                                   data['exterior_roof_standards_construction_type'],
                                                                                   data['exterior_roof_building_category']))
    end
  end
  # Interior surfaces constructions
  interior_surfaces = OpenStudio::Model::DefaultSurfaceConstructions.new(model)
  construction_set.setDefaultInteriorSurfaceConstructions(interior_surfaces)
  construction_name = data['interior_floors']
  # Special condition for attics, where the insulation is actually on the floor and the roof itself is uninsulated
  if spc_type == 'Attic'
    if data['exterior_roof_standards_construction_type'] && data['exterior_roof_building_category']
      interior_surfaces.setFloorConstruction(model_find_and_add_construction(model,
                                                                             climate_zone_set,
                                                                             'ExteriorRoof',
                                                                             data['exterior_roof_standards_construction_type'],
                                                                             data['exterior_roof_building_category']))

    end
  else
    unless construction_name.nil?
      interior_surfaces.setFloorConstruction(model_add_construction(model, construction_name))
    end
  end
  construction_name = data['interior_walls']
  unless construction_name.nil?
    interior_surfaces.setWallConstruction(model_add_construction(model, construction_name))
  end
  construction_name = data['interior_ceilings']
  unless construction_name.nil?
    interior_surfaces.setRoofCeilingConstruction(model_add_construction(model, construction_name))
  end

  # Ground contact surfaces constructions
  ground_surfaces = OpenStudio::Model::DefaultSurfaceConstructions.new(model)
  construction_set.setDefaultGroundContactSurfaceConstructions(ground_surfaces)
  if data['ground_contact_floor_standards_construction_type'] && data['ground_contact_floor_building_category']
    ground_surfaces.setFloorConstruction(model_find_and_add_construction(model,
                                                                         climate_zone_set,
                                                                         'GroundContactFloor',
                                                                         data['ground_contact_floor_standards_construction_type'],
                                                                         data['ground_contact_floor_building_category']))
  end
  if data['ground_contact_wall_standards_construction_type'] && data['ground_contact_wall_building_category']
    ground_surfaces.setWallConstruction(model_find_and_add_construction(model,
                                                                        climate_zone_set,
                                                                        'GroundContactWall',
                                                                        data['ground_contact_wall_standards_construction_type'],
                                                                        data['ground_contact_wall_building_category']))
  end
  if data['ground_contact_ceiling_standards_construction_type'] && data['ground_contact_ceiling_building_category']
    ground_surfaces.setRoofCeilingConstruction(model_find_and_add_construction(model,
                                                                               climate_zone_set,
                                                                               'GroundContactRoof',
                                                                               data['ground_contact_ceiling_standards_construction_type'],
                                                                               data['ground_contact_ceiling_building_category']))

  end

  # Exterior sub surfaces constructions
  exterior_subsurfaces = OpenStudio::Model::DefaultSubSurfaceConstructions.new(model)
  construction_set.setDefaultExteriorSubSurfaceConstructions(exterior_subsurfaces)
  if data['exterior_fixed_window_standards_construction_type'] && data['exterior_fixed_window_building_category']
    exterior_subsurfaces.setFixedWindowConstruction(model_find_and_add_construction(model,
                                                                                    climate_zone_set,
                                                                                    'ExteriorWindow',
                                                                                    data['exterior_fixed_window_standards_construction_type'],
                                                                                    data['exterior_fixed_window_building_category']))
  end
  if data['exterior_operable_window_standards_construction_type'] && data['exterior_operable_window_building_category']
    exterior_subsurfaces.setOperableWindowConstruction(model_find_and_add_construction(model,
                                                                                       climate_zone_set,
                                                                                       'ExteriorWindow',
                                                                                       data['exterior_operable_window_standards_construction_type'],
                                                                                       data['exterior_operable_window_building_category']))
  end
  if data['exterior_door_standards_construction_type'] && data['exterior_door_building_category']
    exterior_subsurfaces.setDoorConstruction(model_find_and_add_construction(model,
                                                                             climate_zone_set,
                                                                             'ExteriorDoor',
                                                                             data['exterior_door_standards_construction_type'],
                                                                             data['exterior_door_building_category']))
  end
  if data['exterior_glass_door_standards_construction_type'] && data['exterior_glass_door_building_category']
    exterior_subsurfaces.setGlassDoorConstruction(model_find_and_add_construction(model,
                                                                                  climate_zone_set,
                                                                                  'GlassDoor',
                                                                                  data['exterior_glass_door_standards_construction_type'],
                                                                                  data['exterior_glass_door_building_category']))
  end
  if data['exterior_overhead_door_standards_construction_type'] && data['exterior_overhead_door_building_category']
    exterior_subsurfaces.setOverheadDoorConstruction(model_find_and_add_construction(model,
                                                                                     climate_zone_set,
                                                                                     'ExteriorDoor',
                                                                                     data['exterior_overhead_door_standards_construction_type'],
                                                                                     data['exterior_overhead_door_building_category']))
  end
  if data['exterior_skylight_standards_construction_type'] && data['exterior_skylight_building_category']
    exterior_subsurfaces.setSkylightConstruction(model_find_and_add_construction(model,
                                                                                 climate_zone_set,
                                                                                 'Skylight',
                                                                                 data['exterior_skylight_standards_construction_type'],
                                                                                 data['exterior_skylight_building_category']))
  end
  if (construction_name = data['tubular_daylight_domes'])
    exterior_subsurfaces.setTubularDaylightDomeConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['tubular_daylight_diffusers'])
    exterior_subsurfaces.setTubularDaylightDiffuserConstruction(model_add_construction(model, construction_name))
  end

  # Interior sub surfaces constructions
  interior_subsurfaces = OpenStudio::Model::DefaultSubSurfaceConstructions.new(model)
  construction_set.setDefaultInteriorSubSurfaceConstructions(interior_subsurfaces)
  if (construction_name = data['interior_fixed_windows'])
    interior_subsurfaces.setFixedWindowConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['interior_operable_windows'])
    interior_subsurfaces.setOperableWindowConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['interior_doors'])
    interior_subsurfaces.setDoorConstruction(model_add_construction(model, construction_name))
  end

  # Other constructions
  if (construction_name = data['interior_partitions'])
    construction_set.setInteriorPartitionConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['space_shading'])
    construction_set.setSpaceShadingConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['building_shading'])
    construction_set.setBuildingShadingConstruction(model_add_construction(model, construction_name))
  end
  if (construction_name = data['site_shading'])
    construction_set.setSiteShadingConstruction(model_add_construction(model, construction_name))
  end

  # componentize the construction set
  # construction_set_component = construction_set.createComponent

  # Return the construction set
  return OpenStudio::Model::OptionalDefaultConstructionSet.new(construction_set)
end

#model_add_crac(model, thermal_zones, climate_zone, system_name: nil, hvac_op_sch: nil, oa_damper_sch: nil, fan_location: 'DrawThrough', fan_type: 'ConstantVolume', cooling_type: 'Single Speed DX AC', supply_temp_sch: nil) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates a CRAC system for data center and adds it to the model.

or nil in which case will be defaulted to always on or nil in which case will be defaulted to always open no heating

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • thermal_zones (String)

    zones to connect to this system

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule

  • oa_damper_sch (Double) (defaults to: nil)

    name of the oa damper schedule,

  • fan_location (Double) (defaults to: 'DrawThrough')

    valid choices are BlowThrough, DrawThrough

  • fan_type (Double) (defaults to: 'ConstantVolume')

    valid choices are ConstantVolume, Cycling, VariableVolume

  • cooling_type (String) (defaults to: 'Single Speed DX AC')

    valid choices are Two Speed DX AC, Single Speed DX AC

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    an array of the resulting CRAC air loops



3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3391

def model_add_crac(model,
                   thermal_zones,
                   climate_zone,
                   system_name: nil,
                   hvac_op_sch: nil,
                   oa_damper_sch: nil,
                   fan_location: 'DrawThrough',
                   fan_type: 'ConstantVolume',
                   cooling_type: 'Single Speed DX AC',
                   supply_temp_sch: nil)

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # Make a CRAC for each data center zone
  air_loops = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding CRAC for #{zone.name}.")

    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    if system_name.nil?
      air_loop.setName("#{zone.name} CRAC")
    else
      air_loop.setName("#{zone.name} #{system_name}")
    end

    # default design temperatures across all air loops
    dsgn_temps = standard_design_sizing_temperatures

    # adjusted zone design heating temperature for data center psz_ac
    dsgn_temps['prehtg_dsgn_sup_air_temp_f'] = 64.4
    dsgn_temps['preclg_dsgn_sup_air_temp_f'] = 80.6
    dsgn_temps['htg_dsgn_sup_air_temp_f'] = 55
    dsgn_temps['clg_dsgn_sup_air_temp_f'] = 55
    dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = dsgn_temps['htg_dsgn_sup_air_temp_f']
    dsgn_temps['zn_clg_dsgn_sup_air_temp_f'] = dsgn_temps['clg_dsgn_sup_air_temp_f']
    dsgn_temps['prehtg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['prehtg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['preclg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['preclg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['htg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['clg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['zn_clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_clg_dsgn_sup_air_temp_f'], 'F', 'C').get

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 0.05)

    # Zone sizing
    sizing_zone = zone.sizingZone
    # per ASHRAE 90.4, recommended range of data center supply air temperature is 18-27C, pick the mean value 22.5C as prototype
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    # create fan
    # ConstantVolume: Packaged Rooftop Single Zone Air conditioner
    # Cycling: Unitary System
    # CyclingHeatPump: Unitary Heat Pump system
    if fan_type == 'VariableVolume'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'CRAC_VAV_fan',
                                                         fan_name: "#{air_loop.name} Fan")
      fan.setAvailabilitySchedule(hvac_op_sch)
    elsif fan_type == 'ConstantVolume'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'CRAC_CAV_fan',
                                                         fan_name: "#{air_loop.name} Fan")
      fan.setAvailabilitySchedule(hvac_op_sch)
    elsif fan_type == 'Cycling'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'CRAC_Cycling_fan',
                                                         fan_name: "#{air_loop.name} Fan")
      fan.setAvailabilitySchedule(hvac_op_sch)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Fan type '#{fan_type}' not recognized, cannot add CRAC.")
      return false
    end

    # create cooling coil
    case cooling_type
    when 'Two Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                                            name: "#{air_loop.name} 2spd DX AC Clg Coil")
    when 'Single Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} 1spd DX AC Clg Coil",
                                                                               type: 'PSZ-AC')
    else
      clg_coil = nil
    end

    oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
    oa_controller.setName("#{air_loop.name} OA System Controller")
    oa_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
    oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
    oa_system.setName("#{air_loop.name} OA System")

    # CRAC can't operate properly at very low ambient temperature (E+ limit: -25C)
    # As a result, the room temperature will rise to HUGE
    # Adding economizer can solve the issue, but economizer is not added until first sizing done, which causes severe error during sizing
    # To solve the issue, add economizer here for cold climates
    # select the climate zones with winter design temperature lower than -20C (for safer)
    cold_climates = ['ASHRAE 169-2006-6A', 'ASHRAE 169-2006-6B', 'ASHRAE 169-2006-7A',
                     'ASHRAE 169-2006-7B', 'ASHRAE 169-2006-8A', 'ASHRAE 169-2006-8B',
                     'ASHRAE 169-2013-6A', 'ASHRAE 169-2013-6B', 'ASHRAE 169-2013-7A',
                     'ASHRAE 169-2013-7B', 'ASHRAE 169-2013-8A', 'ASHRAE 169-2013-8B']
    if cold_climates.include? climate_zone
      # Determine the economizer type in the prototype buildings, which depends on climate zone.
      economizer_type = model_economizer_type(model, climate_zone)
      oa_controller.setEconomizerControlType(economizer_type)

      # Check that the economizer type set by the prototypes
      # is not prohibited by code.  If it is, change to no economizer.
      unless air_loop_hvac_economizer_type_allowable?(air_loop, climate_zone)
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.prototype.Model', "#{air_loop.name} is required to have an economizer, but the type chosen, #{economizer_type} is prohibited by code for , climate zone #{climate_zone}.  Economizer type will be switched to No Economizer.")
        oa_controller.setEconomizerControlType('NoEconomizer')
      end
    end

    # add humidifier to control minimum RH
    humidifier = OpenStudio::Model::HumidifierSteamElectric.new(model)
    humidifier.autosizeRatedCapacity
    humidifier.autosizeRatedPower
    humidifier.setName("#{air_loop.name} Electric Steam Humidifier")

    # Add the components to the air loop
    # in order from closest to zone to furthest from zone
    supply_inlet_node = air_loop.supplyInletNode

    if fan_location == 'DrawThrough'
      # Add the fan
      fan.addToNode(supply_inlet_node) unless fan.nil?
      # Add the humidifier
      humidifier.addToNode(supply_inlet_node) unless humidifier.nil?
      # Add the cooling coil
      clg_coil.addToNode(supply_inlet_node) unless clg_coil.nil?

    elsif fan_location == 'BlowThrough'
      # Add the humidifier
      humidifier.addToNode(supply_inlet_node) unless humidifier.nil?
      # Add the cooling coil
      clg_coil.addToNode(supply_inlet_node) unless clg_coil.nil?
      # Add the fan
      fan.addToNode(supply_inlet_node) unless fan.nil?

    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'Invalid fan location')
      return false
    end

    # add humidifying setpoint
    humidity_spm = OpenStudio::Model::SetpointManagerSingleZoneHumidityMinimum.new(model)
    humidity_spm.setControlZone(zone)
    humidity_spm.addToNode(humidifier.outletModelObject.get.to_Node.get)

    humidistat = OpenStudio::Model::ZoneControlHumidistat.new(model)
    humidistat.setHumidifyingRelativeHumiditySetpointSchedule(model_add_schedule(model, 'DataCenter Humidity Setpoint Schedule'))
    zone.setZoneControlHumidistat(humidistat)

    # Add a setpoint manager for cooling to control the supply air temperature based on the needs of this zone
    if supply_temp_sch.nil?
      supply_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                        dsgn_temps['clg_dsgn_sup_air_temp_c'],
                                                                                        name: 'AHU Supply Temp Sch',
                                                                                        schedule_type_limit: 'Temperature')
    end
    setpoint_mgr_cooling = OpenStudio::Model::SetpointManagerScheduled.new(model, supply_temp_sch)
    setpoint_mgr_cooling.setName('CRAC supply air setpoint manager')
    setpoint_mgr_cooling.addToNode(air_loop.supplyOutletNode)

    # Add the OA system
    oa_system.addToNode(supply_inlet_node)

    # set air loop availability controls
    air_loop.setAvailabilitySchedule(hvac_op_sch)

    # Create a diffuser and attach the zone/diffuser pair to the air loop
    diffuser = OpenStudio::Model::AirTerminalSingleDuctVAVNoReheat.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{air_loop.name} Diffuser")
    if model.version < OpenStudio::VersionString.new('3.0.1')
      diffuser.setZoneMinimumAirFlowMethod('Constant')
    else
      diffuser.setZoneMinimumAirFlowInputMethod('Constant')
    end
    diffuser.setConstantMinimumAirFlowFraction(0.1)
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    air_loops << air_loop
  end

  return air_loops
end

#model_add_crah(model, thermal_zones, system_name: nil, chilled_water_loop: nil, hvac_op_sch: nil, oa_damper_sch: nil, return_plenum: nil, supply_temp_sch: nil) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates a CRAH system for larger size data center and adds it to the model.

or nil in which case will be defaulted to always on or nil in which case will be defaulted to always open no heating

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • chilled_water_loop (String) (defaults to: nil)

    hilled_water_loop [String

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • thermal_zones (String)

    zones to connect to this system

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule

  • oa_damper_sch (Double) (defaults to: nil)

    name of the oa damper schedule,

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    an array of the resulting CRAH air loops



3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3605

def model_add_crah(model,
                   thermal_zones,
                   system_name: nil,
                   chilled_water_loop: nil,
                   hvac_op_sch: nil,
                   oa_damper_sch: nil,
                   return_plenum: nil,
                   supply_temp_sch: nil)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding CRAH system for #{thermal_zones.size} zones data center.")
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "---#{zone.name}")
  end

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # air handler
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName('Data Center CRAH')
  else
    air_loop.setName(system_name)
  end

  # default design temperatures across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted zone design heating temperature for data center psz_ac
  dsgn_temps['prehtg_dsgn_sup_air_temp_f'] = 64.4
  dsgn_temps['preclg_dsgn_sup_air_temp_f'] = 80.6
  dsgn_temps['htg_dsgn_sup_air_temp_f'] = 55
  dsgn_temps['clg_dsgn_sup_air_temp_f'] = 55
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = dsgn_temps['htg_dsgn_sup_air_temp_f']
  dsgn_temps['zn_clg_dsgn_sup_air_temp_f'] = dsgn_temps['clg_dsgn_sup_air_temp_f']
  dsgn_temps['prehtg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['prehtg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['preclg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['preclg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['clg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = dsgn_temps['htg_dsgn_sup_air_temp_c']
  dsgn_temps['zn_clg_dsgn_sup_air_temp_c'] = dsgn_temps['clg_dsgn_sup_air_temp_c']

  # default design settings used across all air loops
  sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 0.3)

  # Add a setpoint manager for cooling to control the supply air temperature based on the needs of this zone
  if supply_temp_sch.nil?
    supply_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                      dsgn_temps['clg_dsgn_sup_air_temp_c'],
                                                                                      name: 'AHU Supply Temp Sch',
                                                                                      schedule_type_limit: 'Temperature')
  end
  setpoint_mgr_cooling = OpenStudio::Model::SetpointManagerScheduled.new(model, supply_temp_sch)
  setpoint_mgr_cooling.setName('CRAH supply air setpoint manager')
  setpoint_mgr_cooling.addToNode(air_loop.supplyOutletNode)

  # create fan
  fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                     'VAV_System_Fan',
                                                     fan_name: "#{air_loop.name} Fan")
  fan.setAvailabilitySchedule(hvac_op_sch)
  fan.addToNode(air_loop.supplyInletNode)

  # add humidifier to control minimum RH
  humidifier = OpenStudio::Model::HumidifierSteamElectric.new(model)
  humidifier.autosizeRatedCapacity
  humidifier.autosizeRatedPower
  humidifier.setName("#{air_loop.name} Electric Steam Humidifier")
  humidifier.addToNode(air_loop.supplyInletNode)

  # cooling coil
  if chilled_water_loop.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No chilled water plant loop supplied for CRAH system')
    return false
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Water Clg Coil",
                                                        schedule: hvac_op_sch)
  end

  # outdoor air intake system
  oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_intake_controller.setName("#{air_loop.name} OA Controller")
  oa_intake_controller.setMinimumLimitType('FixedMinimum')
  oa_intake_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
  oa_intake_controller.autosizeMinimumOutdoorAirFlowRate

  controller_mv = oa_intake_controller.controllerMechanicalVentilation
  controller_mv.setName("#{air_loop.name} Vent Controller")
  controller_mv.setSystemOutdoorAirMethod('ZoneSum')

  oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
  oa_intake.setName("#{air_loop.name} OA System")
  oa_intake.addToNode(air_loop.supplyInletNode)

  # set air loop availability controls
  air_loop.setAvailabilitySchedule(hvac_op_sch)

  # hook the CRAH system to each zone
  thermal_zones.each do |zone|
    # Create a diffuser and attach the zone/diffuser pair to the air loop
    diffuser = OpenStudio::Model::AirTerminalSingleDuctVAVNoReheat.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{zone.name} VAV terminal")
    if model.version < OpenStudio::VersionString.new('3.0.1')
      diffuser.setZoneMinimumAirFlowMethod('Constant')
    else
      diffuser.setZoneMinimumAirFlowInputMethod('Constant')
    end
    diffuser.setConstantMinimumAirFlowFraction(0.1)
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    # Zone sizing
    sizing_zone = zone.sizingZone
    # per ASHRAE 90.4, recommended range of data center supply air temperature is 18-27C, pick the mean value 22.5C as prototype
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    humidity_spm = OpenStudio::Model::SetpointManagerSingleZoneHumidityMinimum.new(model)
    humidity_spm.setControlZone(zone)
    humidity_spm.addToNode(humidifier.outletModelObject.get.to_Node.get)

    humidistat = OpenStudio::Model::ZoneControlHumidistat.new(model)
    humidistat.setHumidifyingRelativeHumiditySetpointSchedule(model_add_schedule(model, 'DataCenter Humidity Setpoint Schedule'))
    zone.setZoneControlHumidistat(humidistat)

    unless return_plenum.nil?
      zone.setReturnPlenum(return_plenum)
    end
  end

  return air_loop
end

#model_add_curve(model, curve_name) ⇒ OpenStudio::Model::Curve

Adds a curve from the OpenStudio-Standards dataset to the model based on the curve name.

Parameters:

Returns:

  • (OpenStudio::Model::Curve)

    curve object, nil if not found



3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3592

def model_add_curve(model, curve_name)
  # First check model and return curve if it already exists
  existing_curves = []
  existing_curves += model.getCurveLinears
  existing_curves += model.getCurveCubics
  existing_curves += model.getCurveQuadratics
  existing_curves += model.getCurveBicubics
  existing_curves += model.getCurveBiquadratics
  existing_curves += model.getCurveQuadLinears
  existing_curves += model.getTableMultiVariableLookups
  existing_curves += model.getTableLookups
  existing_curves.sort.each do |curve|
    if curve.name.get.to_s == curve_name
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Already added curve: #{curve_name}")
      return curve
    end
  end

  # Find curve data
  data = model_find_object(standards_data['curves'], 'name' => curve_name)
  if data.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Could not find a curve called '#{curve_name}' in the standards.")
    return nil
  end

  # Make the correct type of curve
  case data['form']
    when 'Linear'
      curve = OpenStudio::Model::CurveLinear.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'Cubic'
      curve = OpenStudio::Model::CurveCubic.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setCoefficient3xPOW2(data['coeff_3'])
      curve.setCoefficient4xPOW3(data['coeff_4'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'Quadratic'
      curve = OpenStudio::Model::CurveQuadratic.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setCoefficient3xPOW2(data['coeff_3'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'BiCubic'
      curve = OpenStudio::Model::CurveBicubic.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setCoefficient3xPOW2(data['coeff_3'])
      curve.setCoefficient4y(data['coeff_4'])
      curve.setCoefficient5yPOW2(data['coeff_5'])
      curve.setCoefficient6xTIMESY(data['coeff_6'])
      curve.setCoefficient7xPOW3(data['coeff_7'])
      curve.setCoefficient8yPOW3(data['coeff_8'])
      curve.setCoefficient9xPOW2TIMESY(data['coeff_9'])
      curve.setCoefficient10xTIMESYPOW2(data['coeff_10'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumValueofy(data['minimum_independent_variable_2']) if data['minimum_independent_variable_2']
      curve.setMaximumValueofy(data['maximum_independent_variable_2']) if data['maximum_independent_variable_2']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'BiQuadratic'
      curve = OpenStudio::Model::CurveBiquadratic.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setCoefficient3xPOW2(data['coeff_3'])
      curve.setCoefficient4y(data['coeff_4'])
      curve.setCoefficient5yPOW2(data['coeff_5'])
      curve.setCoefficient6xTIMESY(data['coeff_6'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumValueofy(data['minimum_independent_variable_2']) if data['minimum_independent_variable_2']
      curve.setMaximumValueofy(data['maximum_independent_variable_2']) if data['maximum_independent_variable_2']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'BiLinear'
      curve = OpenStudio::Model::CurveBiquadratic.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2x(data['coeff_2'])
      curve.setCoefficient4y(data['coeff_3'])
      curve.setMinimumValueofx(data['minimum_independent_variable_1']) if data['minimum_independent_variable_1']
      curve.setMaximumValueofx(data['maximum_independent_variable_1']) if data['maximum_independent_variable_1']
      curve.setMinimumValueofy(data['minimum_independent_variable_2']) if data['minimum_independent_variable_2']
      curve.setMaximumValueofy(data['maximum_independent_variable_2']) if data['maximum_independent_variable_2']
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output']) if data['minimum_dependent_variable_output']
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output']) if data['maximum_dependent_variable_output']
      return curve
    when 'QuadLinear'
      curve = OpenStudio::Model::CurveQuadLinear.new(model)
      curve.setName(data['name'])
      curve.setCoefficient1Constant(data['coeff_1'])
      curve.setCoefficient2w(data['coeff_2'])
      curve.setCoefficient3x(data['coeff_3'])
      curve.setCoefficient4y(data['coeff_4'])
      curve.setCoefficient5z(data['coeff_5'])
      curve.setMinimumValueofw(data['minimum_independent_variable_w'])
      curve.setMaximumValueofw(data['maximum_independent_variable_w'])
      curve.setMinimumValueofx(data['minimum_independent_variable_x'])
      curve.setMaximumValueofx(data['maximum_independent_variable_x'])
      curve.setMinimumValueofy(data['minimum_independent_variable_y'])
      curve.setMaximumValueofy(data['maximum_independent_variable_y'])
      curve.setMinimumValueofz(data['minimum_independent_variable_z'])
      curve.setMaximumValueofz(data['maximum_independent_variable_z'])
      curve.setMinimumCurveOutput(data['minimum_dependent_variable_output'])
      curve.setMaximumCurveOutput(data['maximum_dependent_variable_output'])
      return curve
    when 'TableLookup', 'LookupTable', 'TableMultiVariableLookup', 'MultiVariableLookupTable'
      num_ind_var = data['number_independent_variables'].to_i
      if model.version < OpenStudio::VersionString.new('3.7.0')
        # Use TableMultiVariableLookup object
        table = OpenStudio::Model::TableMultiVariableLookup.new(model, num_ind_var)
        table.setInterpolationMethod(data['interpolation_method'])
        table.setNumberofInterpolationPoints(data['number_of_interpolation_points'])
        table.setCurveType(data['curve_type'])
        table.setTableDataFormat('SingleLineIndependentVariableWithMatrix')
        table.setNormalizationReference(data['normalization_reference'].to_f)

        # set table limits
        table.setMinimumValueofX1(data['minimum_independent_variable_1'].to_f)
        table.setMaximumValueofX1(data['maximum_independent_variable_1'].to_f)
        table.setInputUnitTypeforX1(data['input_unit_type_x1'])
        if num_ind_var == 2
          table.setMinimumValueofX2(data['minimum_independent_variable_2'].to_f)
          table.setMaximumValueofX2(data['maximum_independent_variable_2'].to_f)
          table.setInputUnitTypeforX2(data['input_unit_type_x2'])
        end

        # add data points
        data_points = data.each.select { |key, value| key.include? 'data_point' }
        data_points.each do |key, value|
          if num_ind_var == 1
            table.addPoint(value.split(',')[0].to_f, value.split(',')[1].to_f)
          elsif num_ind_var == 2
            table.addPoint(value.split(',')[0].to_f, value.split(',')[1].to_f, value.split(',')[2].to_f)
          end
        end
      else
        # Use TableLookup Object
        table = OpenStudio::Model::TableLookup.new(model)
        table.setNormalizationDivisor(data['normalization_reference'].to_f)

        # sorting data in ascending order
        data_points = data.each.select { |key, value| key.include? 'data_point' }
        data_points = data_points.sort_by { |item| item[1].split(',').map(&:to_f) }
        data_points.each do |key, value|
          var_dep = value.split(',')[2].to_f
          table.addOutputValue(var_dep)
        end
        num_ind_var.times do |i|
          table_indvar = OpenStudio::Model::TableIndependentVariable.new(model)
          table_indvar.setName(data['name'] + "_ind_#{i + 1}")
          table_indvar.setInterpolationMethod(data['interpolation_method'])

          # set table limits
          table_indvar.setMinimumValue(data["minimum_independent_variable_#{i + 1}"].to_f)
          table_indvar.setMaximumValue(data["maximum_independent_variable_#{i + 1}"].to_f)
          table_indvar.setUnitType(data["input_unit_type_x#{i + 1}"].to_s)

          # add data points
          var_ind_unique = data_points.map { |key, value| value.split(',')[i].to_f }.uniq
          var_ind_unique.each { |var_ind| table_indvar.addValue(var_ind) }
          table.addIndependentVariable(table_indvar)
        end
      end
      table.setName(data['name'])
      table.setOutputUnitType(data['output_unit_type'])
      return table
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "#{curve_name}' has an invalid form: #{data['form']}', cannot create this curve.")
      return nil
  end
end

#model_add_cw_loop(model, system_name: 'Condenser Water Loop', cooling_tower_type: 'Open Cooling Tower', cooling_tower_fan_type: 'Propeller or Axial', cooling_tower_capacity_control: 'TwoSpeed Fan', number_of_cells_per_tower: 1, number_cooling_towers: 1, use_90_1_design_sizing: true, sup_wtr_temp: 70.0, dsgn_sup_wtr_temp: 85.0, dsgn_sup_wtr_temp_delt: 10.0, wet_bulb_approach: 7.0, pump_spd_ctrl: 'Constant', pump_tot_hd: 49.7) ⇒ OpenStudio::Model::PlantLoop

Creates a condenser water loop and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: 'Condenser Water Loop')

    the name of the system, or nil in which case it will be defaulted

  • cooling_tower_type (String) (defaults to: 'Open Cooling Tower')

    valid choices are Open Cooling Tower, Closed Cooling Tower

  • cooling_tower_fan_type (String) (defaults to: 'Propeller or Axial')

    valid choices are Centrifugal, "Propeller or Axial"

  • cooling_tower_capacity_control (String) (defaults to: 'TwoSpeed Fan')

    valid choices are Fluid Bypass, Fan Cycling, TwoSpeed Fan, Variable Speed Fan

  • number_of_cells_per_tower (Integer) (defaults to: 1)

    the number of discrete cells per tower

  • number_cooling_towers (Integer) (defaults to: 1)

    the number of cooling towers to be added (in parallel)

  • use_90_1_design_sizing (Boolean) (defaults to: true)

    will determine the design sizing temperatures based on the 90.1 Appendix G approach. Overrides sup_wtr_temp, dsgn_sup_wtr_temp, dsgn_sup_wtr_temp_delt, and wet_bulb_approach if true.

  • sup_wtr_temp (Double) (defaults to: 70.0)

    supply water temperature in degrees Fahrenheit, default 70F

  • dsgn_sup_wtr_temp (Double) (defaults to: 85.0)

    design supply water temperature in degrees Fahrenheit, default 85F

  • dsgn_sup_wtr_temp_delt (Double) (defaults to: 10.0)

    design water range temperature in degrees Rankine, default 10R

  • wet_bulb_approach (Double) (defaults to: 7.0)

    design wet bulb approach temperature, default 7R

  • pump_spd_ctrl (String) (defaults to: 'Constant')

    pump speed control type, Constant or Variable (default)

  • pump_tot_hd (Double) (defaults to: 49.7)

    pump head in ft H2O

Returns:

  • (OpenStudio::Model::PlantLoop)

    the resulting condenser water plant loop



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 480

def model_add_cw_loop(model,
                      system_name: 'Condenser Water Loop',
                      cooling_tower_type: 'Open Cooling Tower',
                      cooling_tower_fan_type: 'Propeller or Axial',
                      cooling_tower_capacity_control: 'TwoSpeed Fan',
                      number_of_cells_per_tower: 1,
                      number_cooling_towers: 1,
                      use_90_1_design_sizing: true,
                      sup_wtr_temp: 70.0,
                      dsgn_sup_wtr_temp: 85.0,
                      dsgn_sup_wtr_temp_delt: 10.0,
                      wet_bulb_approach: 7.0,
                      pump_spd_ctrl: 'Constant',
                      pump_tot_hd: 49.7)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding condenser water loop.')

  # create condenser water loop
  condenser_water_loop = OpenStudio::Model::PlantLoop.new(model)
  if system_name.nil?
    condenser_water_loop.setName('Condenser Water Loop')
  else
    condenser_water_loop.setName(system_name)
  end

  # condenser water loop sizing and controls
  if sup_wtr_temp.nil?
    sup_wtr_temp = 70.0
    sup_wtr_temp_c = OpenStudio.convert(sup_wtr_temp, 'F', 'C').get
  else
    sup_wtr_temp_c = OpenStudio.convert(sup_wtr_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp.nil?
    dsgn_sup_wtr_temp = 85.0
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  else
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp_delt.nil?
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(10.0, 'R', 'K').get
  else
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(dsgn_sup_wtr_temp_delt, 'R', 'K').get
  end
  if wet_bulb_approach.nil?
    wet_bulb_approach_k = OpenStudio.convert(7.0, 'R', 'K').get
  else
    wet_bulb_approach_k = OpenStudio.convert(wet_bulb_approach, 'R', 'K').get
  end
  condenser_water_loop.setMinimumLoopTemperature(5.0)
  condenser_water_loop.setMaximumLoopTemperature(80.0)
  sizing_plant = condenser_water_loop.sizingPlant
  sizing_plant.setLoopType('Condenser')
  sizing_plant.setDesignLoopExitTemperature(dsgn_sup_wtr_temp_c)
  sizing_plant.setLoopDesignTemperatureDifference(dsgn_sup_wtr_temp_delt_k)
  sizing_plant.setSizingOption('Coincident')
  sizing_plant.setZoneTimestepsinAveragingWindow(6)
  sizing_plant.setCoincidentSizingFactorMode('GlobalCoolingSizingFactor')

  # follow outdoor air wetbulb with given approach temperature
  cw_stpt_manager = OpenStudio::Model::SetpointManagerFollowOutdoorAirTemperature.new(model)
  cw_stpt_manager.setName("#{condenser_water_loop.name} Setpoint Manager Follow OATwb with #{wet_bulb_approach}F Approach")
  cw_stpt_manager.setReferenceTemperatureType('OutdoorAirWetBulb')
  cw_stpt_manager.setMaximumSetpointTemperature(dsgn_sup_wtr_temp_c)
  cw_stpt_manager.setMinimumSetpointTemperature(sup_wtr_temp_c)
  cw_stpt_manager.setOffsetTemperatureDifference(wet_bulb_approach_k)
  cw_stpt_manager.addToNode(condenser_water_loop.supplyOutletNode)

  # create condenser water pump
  case pump_spd_ctrl
  when 'Constant'
    cw_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
  when 'Variable'
    cw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
  when 'HeaderedVariable'
    cw_pump = OpenStudio::Model::HeaderedPumpsVariableSpeed.new(model)
    cw_pump.setNumberofPumpsinBank(2)
  when 'HeaderedConstant'
    cw_pump = OpenStudio::Model::HeaderedPumpsConstantSpeed.new(model)
    cw_pump.setNumberofPumpsinBank(2)
  else
    cw_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
  end
  cw_pump.setName("#{condenser_water_loop.name} #{pump_spd_ctrl} Pump")
  cw_pump.setPumpControlType('Intermittent')

  if pump_tot_hd.nil?
    pump_tot_hd_pa =  OpenStudio.convert(49.7, 'ftH_{2}O', 'Pa').get
  else
    pump_tot_hd_pa =  OpenStudio.convert(pump_tot_hd, 'ftH_{2}O', 'Pa').get
  end
  cw_pump.setRatedPumpHead(pump_tot_hd_pa)
  cw_pump.addToNode(condenser_water_loop.supplyInletNode)

  # Cooling towers
  # Per PNNL PRM Reference Manual
  number_cooling_towers.times do |_i|
    # Tower object depends on the control type
    cooling_tower = nil
    case cooling_tower_capacity_control
    when 'Fluid Bypass', 'Fan Cycling'
      cooling_tower = OpenStudio::Model::CoolingTowerSingleSpeed.new(model)
      if cooling_tower_capacity_control == 'Fluid Bypass'
        cooling_tower.setCellControl('FluidBypass')
      else
        cooling_tower.setCellControl('FanCycling')
      end
    when 'TwoSpeed Fan'
      cooling_tower = OpenStudio::Model::CoolingTowerTwoSpeed.new(model)
      # @todo expose newer cooling tower sizing fields in API
      # cooling_tower.setLowFanSpeedAirFlowRateSizingFactor(0.5)
      # cooling_tower.setLowFanSpeedFanPowerSizingFactor(0.3)
      # cooling_tower.setLowFanSpeedUFactorTimesAreaSizingFactor
      # cooling_tower.setLowSpeedNominalCapacitySizingFactor
    when 'Variable Speed Fan'
      cooling_tower = OpenStudio::Model::CoolingTowerVariableSpeed.new(model)
      cooling_tower.setDesignRangeTemperature(dsgn_sup_wtr_temp_delt_k)
      cooling_tower.setDesignApproachTemperature(wet_bulb_approach_k)
      cooling_tower.setFractionofTowerCapacityinFreeConvectionRegime(0.125)
      twr_fan_curve = model_add_curve(model, 'VSD-TWR-FAN-FPLR')
      cooling_tower.setFanPowerRatioFunctionofAirFlowRateRatioCurve(twr_fan_curve)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Prototype.hvac_systems', "#{cooling_tower_capacity_control} is not a valid choice of cooling tower capacity control.  Valid choices are Fluid Bypass, Fan Cycling, TwoSpeed Fan, Variable Speed Fan.")
    end

    # Set the properties that apply to all tower types and attach to the condenser loop.
    unless cooling_tower.nil?
      cooling_tower.setName("#{cooling_tower_fan_type} #{cooling_tower_capacity_control} #{cooling_tower_type}")
      cooling_tower.setSizingFactor(1 / number_cooling_towers)
      cooling_tower.setNumberofCells(number_of_cells_per_tower)
      condenser_water_loop.addSupplyBranchForComponent(cooling_tower)
    end
  end

  # apply 90.1 sizing temperatures
  if use_90_1_design_sizing
    # use the formulation in 90.1-2010 G3.1.3.11 to set the approach temperature
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Prototype.hvac_systems', "Using the 90.1-2010 G3.1.3.11 approach temperature sizing methodology for condenser loop #{condenser_water_loop.name}.")

    # first, look in the model design day objects for sizing information
    summer_oat_wbs_f = []
    condenser_water_loop.model.getDesignDays.sort.each do |dd|
      next unless dd.dayType == 'SummerDesignDay'
      next unless dd.name.get.to_s.include?('WB=>MDB')

      if condenser_water_loop.model.version < OpenStudio::VersionString.new('3.3.0')
        if dd.humidityIndicatingType == 'Wetbulb'
          summer_oat_wb_c = dd.humidityIndicatingConditionsAtMaximumDryBulb
          summer_oat_wbs_f << OpenStudio.convert(summer_oat_wb_c, 'C', 'F').get
        else
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', "For #{dd.name}, humidity is specified as #{dd.humidityIndicatingType}; cannot determine Twb.")
        end
      else
        if dd.humidityConditionType == 'Wetbulb' && dd.wetBulbOrDewPointAtMaximumDryBulb.is_initialized
          summer_oat_wbs_f << OpenStudio.convert(dd.wetBulbOrDewPointAtMaximumDryBulb.get, 'C', 'F').get
        else
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', "For #{dd.name}, humidity is specified as #{dd.humidityConditionType}; cannot determine Twb.")
        end
      end
    end

    # if no design day objects are present in the model, attempt to load the .ddy file directly
    if summer_oat_wbs_f.empty?
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', 'No valid WB=>MDB Summer Design Days were found in the model.  Attempting to load wet bulb sizing from the .ddy file directly.')
      if model.weatherFile.is_initialized && model.weatherFile.get.path.is_initialized
        weather_file_path = model.weatherFile.get.path.get.to_s
        # Run differently depending on whether running from embedded filesystem in OpenStudio CLI or not
        if weather_file_path[0] == ':' # Running from OpenStudio CLI
          # Attempt to load in the ddy file based on convention that it is in the same directory and has the same basename as the epw file.
          ddy_file = weather_file_path.gsub('.epw', '.ddy')
          if EmbeddedScripting.hasFile(ddy_file)
            ddy_string = EmbeddedScripting.getFileAsString(ddy_file)
            temp_ddy_path = "#{Dir.pwd}/in.ddy"
            File.open(temp_ddy_path, 'wb') do |f|
              f << ddy_string
              f.flush
            end
            ddy_model = OpenStudio::EnergyPlus.loadAndTranslateIdf(temp_ddy_path).get
            FileUtils.rm_rf(temp_ddy_path)
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', "Could not locate a .ddy file for weather file path #{weather_file_path}")
          end
        else
          # Attempt to load in the ddy file based on convention that it is in the same directory and has the same basename as the epw file.
          ddy_file = "#{File.join(File.dirname(weather_file_path), File.basename(weather_file_path, '.*'))}.ddy"
          if File.exist? ddy_file
            ddy_model = OpenStudio::EnergyPlus.loadAndTranslateIdf(ddy_file).get
          else
            OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', "Could not locate a .ddy file for weather file path #{weather_file_path}")
          end
        end

        unless ddy_model.nil?
          ddy_model.getDesignDays.sort.each do |dd|
            # Save the model wetbulb design conditions Condns WB=>MDB
            if dd.name.get.include? '4% Condns WB=>MDB'
              if model.version < OpenStudio::VersionString.new('3.3.0')
                summer_oat_wb_c = dd.humidityIndicatingConditionsAtMaximumDryBulb
                summer_oat_wbs_f << OpenStudio.convert(summer_oat_wb_c, 'C', 'F').get
              else
                if dd.wetBulbOrDewPointAtMaximumDryBulb.is_initialized
                  summer_oat_wb_c = dd.wetBulbOrDewPointAtMaximumDryBulb.get
                  summer_oat_wbs_f << OpenStudio.convert(summer_oat_wb_c, 'C', 'F').get
                end
              end
            end
          end
        end
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', 'The model does not have a weather file object or path specified in the object. Cannot get .ddy file directory.')
      end
    end

    # if values are still absent, use the CTI rating condition 78F
    design_oat_wb_f = nil
    if summer_oat_wbs_f.empty?
      design_oat_wb_f = 78.0
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Prototype.hvac_systems', "For condenser loop #{condenser_water_loop.name}, no design day OATwb conditions found.  CTI rating condition of 78F OATwb will be used for sizing cooling towers.")
    else
      # Take worst case condition
      design_oat_wb_f = summer_oat_wbs_f.max
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.Prototype.hvac_systems', "The maximum design wet bulb temperature from the Summer Design Day WB=>MDB is #{design_oat_wb_f} F")
    end
    design_oat_wb_c = OpenStudio.convert(design_oat_wb_f, 'F', 'C').get

    # call method to apply design sizing to the condenser water loop
    prototype_apply_condenser_water_temperatures(condenser_water_loop, design_wet_bulb_c: design_oat_wb_c)
  end

  # Condenser water loop pipes
  cooling_tower_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  cooling_tower_bypass_pipe.setName("#{condenser_water_loop.name} Cooling Tower Bypass")
  condenser_water_loop.addSupplyBranchForComponent(cooling_tower_bypass_pipe)

  chiller_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  chiller_bypass_pipe.setName("#{condenser_water_loop.name} Chiller Bypass")
  condenser_water_loop.addDemandBranchForComponent(chiller_bypass_pipe)

  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe.setName("#{condenser_water_loop.name} Supply Outlet")
  supply_outlet_pipe.addToNode(condenser_water_loop.supplyOutletNode)

  demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_inlet_pipe.setName("#{condenser_water_loop.name} Demand Inlet")
  demand_inlet_pipe.addToNode(condenser_water_loop.demandInletNode)

  demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_outlet_pipe.setName("#{condenser_water_loop.name} Demand Outlet")
  demand_outlet_pipe.addToNode(condenser_water_loop.demandOutletNode)

  return condenser_water_loop
end

#model_add_data_center_hvac(model, thermal_zones, hot_water_loop, heat_pump_loop, system_name: nil, hvac_op_sch: nil, oa_damper_sch: nil, main_data_center: false) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates a data center PSZ-AC system for each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • hot_water_loop (OpenStudio::Model::PlantLoop)

    hot water loop to connect to the heating coil

  • heat_pump_loop (OpenStudio::Model::PlantLoop)

    heat pump water loop to connect to heat pump

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

  • main_data_center (Boolean) (defaults to: false)

    whether or not this is the main data center in the building.

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    an array of the resulting air loops



3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3227

def model_add_data_center_hvac(model,
                               thermal_zones,
                               hot_water_loop,
                               heat_pump_loop,
                               system_name: nil,
                               hvac_op_sch: nil,
                               oa_damper_sch: nil,
                               main_data_center: false)

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # create a PSZ-AC for each zone
  air_loops = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding data center HVAC for #{zone.name}.")

    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    if system_name.nil?
      air_loop.setName("#{zone.name} PSZ-AC Data Center")
    else
      air_loop.setName("#{zone.name} #{system_name}")
    end

    # default design temperatures across all air loops
    dsgn_temps = standard_design_sizing_temperatures
    unless hot_water_loop.nil?
      hw_temp_c = hot_water_loop.sizingPlant.designLoopExitTemperature
      hw_delta_t_k = hot_water_loop.sizingPlant.loopDesignTemperatureDifference
    end

    # adjusted zone design heating temperature for data center psz_ac
    dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
    dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 1.0)

    # air handler controls
    # add a setpoint manager single zone reheat to control the supply air temperature
    setpoint_mgr_single_zone_reheat = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
    setpoint_mgr_single_zone_reheat.setName("#{zone.name} Setpoint Manager SZ Reheat")
    setpoint_mgr_single_zone_reheat.setControlZone(zone)
    setpoint_mgr_single_zone_reheat.setMinimumSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.addToNode(air_loop.supplyOutletNode)

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    # add the components to the air loop in order from closest to zone to furthest from zone
    if main_data_center
      # extra water heating coil
      OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                          hot_water_loop,
                                                          air_loop_node: air_loop.supplyInletNode,
                                                          name: "#{air_loop.name} Water Htg Coil",
                                                          rated_inlet_water_temperature: hw_temp_c,
                                                          rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                          rated_inlet_air_temperature: dsgn_temps['prehtg_dsgn_sup_air_temp_c'],
                                                          rated_outlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'])

      # extra electric heating coil
      OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                             air_loop_node: air_loop.supplyInletNode,
                                                             name: "#{air_loop.name} Electric Htg Coil")

      # humidity controllers
      humidifier = OpenStudio::Model::HumidifierSteamElectric.new(model)
      humidifier.setRatedCapacity(3.72E-5)
      humidifier.setRatedPower(100_000)
      humidifier.setName("#{air_loop.name} Electric Steam Humidifier")
      humidifier.addToNode(air_loop.supplyInletNode)
      humidity_spm = OpenStudio::Model::SetpointManagerSingleZoneHumidityMinimum.new(model)
      humidity_spm.setControlZone(zone)
      humidity_spm.addToNode(humidifier.outletModelObject.get.to_Node.get)
      humidistat = OpenStudio::Model::ZoneControlHumidistat.new(model)
      humidistat.setHumidifyingRelativeHumiditySetpointSchedule(model_add_schedule(model, 'OfficeLarge DC_MinRelHumSetSch'))
      zone.setZoneControlHumidistat(humidistat)
    end

    # create fan
    # @type [OpenStudio::Model::FanConstantVolume]
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Packaged_RTU_SZ_AC_Cycling_Fan',
                                                       fan_name: "#{air_loop.name} Fan")
    fan.setAvailabilitySchedule(hvac_op_sch)

    # create heating and cooling coils
    htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water_to_air_heat_pump_equation_fit(model,
                                                                                                 heat_pump_loop,
                                                                                                 name: "#{air_loop.name} Water-to-Air HP Htg Coil")
    clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_water_to_air_heat_pump_equation_fit(model,
                                                                                                 heat_pump_loop,
                                                                                                 name: "#{air_loop.name} Water-to-Air HP Clg Coil")
    supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                   name: "#{air_loop.name} Electric Backup Htg Coil")

    # wrap fan and coils in a unitary system object
    unitary_system = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary_system.setName("#{zone.name} Unitary HP")
    unitary_system.setSupplyFan(fan)
    unitary_system.setHeatingCoil(htg_coil)
    unitary_system.setCoolingCoil(clg_coil)
    unitary_system.setSupplementalHeatingCoil(supplemental_htg_coil)
    unitary_system.setControllingZoneorThermostatLocation(zone)
    unitary_system.setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(OpenStudio.convert(40.0, 'F', 'C').get)
    unitary_system.setFanPlacement('BlowThrough')
    unitary_system.setSupplyAirFanOperatingModeSchedule(hvac_op_sch)
    unitary_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOnDiscreteSchedule)
    unitary_system.addToNode(air_loop.supplyInletNode)

    # create outdoor air system
    oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
    oa_controller.setName("#{air_loop.name} OA System Controller")
    oa_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
    oa_controller.autosizeMinimumOutdoorAirFlowRate
    oa_controller.resetEconomizerMinimumLimitDryBulbTemperature
    oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
    oa_system.setName("#{air_loop.name} OA System")
    oa_system.addToNode(air_loop.supplyInletNode)

    # set air loop availability controls and night cycle manager, after oa system added
    air_loop.setAvailabilitySchedule(hvac_op_sch)
    air_loop.setNightCycleControlType('CycleOnAny')

    # create a diffuser and attach the zone/diffuser pair to the air loop
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{air_loop.name} Diffuser")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    air_loops << air_loop
  end

  return air_loops
end

#model_add_data_center_load(model, space, dc_watts_per_area) ⇒ Boolean

Adds a data center load to a given space.

Parameters:

Returns:

  • (Boolean)

    returns true if successful, false if not



3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3202

def model_add_data_center_load(model, space, dc_watts_per_area)
  # create data center load
  data_center_definition = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
  data_center_definition.setName('Data Center Load')
  data_center_definition.setWattsperSpaceFloorArea(dc_watts_per_area)
  data_center_equipment = OpenStudio::Model::ElectricEquipment.new(data_center_definition)
  data_center_equipment.setName('Data Center Load')
  data_center_sch = model.alwaysOnDiscreteSchedule
  data_center_equipment.setSchedule(data_center_sch)
  data_center_equipment.setSpace(space)

  return true
end

#model_add_daylighting_controls(model) ⇒ Boolean

Applies daylighting controls to each space in the model per the standard.

Parameters:

Returns:

  • (Boolean)

    returns true if successful, false if not



2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2325

def model_add_daylighting_controls(model)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started adding daylighting controls.')

  # Add daylighting controls to each space
  model.getSpaces.sort.each do |space|
    added = space_add_daylighting_controls(space, true, false)
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished adding daylighting controls.')
  return true
end

#model_add_district_ambient_loop(model, system_name: 'Ambient Loop') ⇒ OpenStudio::Model::PlantLoop

TODO:

add inputs for design temperatures like heat pump loop object

TODO:

handle ground and heat pump with this; make heating/cooling source options (boiler, fluid cooler, district)

Adds an ambient condenser water loop that will be used in a district to connect buildings as a shared sink/source for heat pumps.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: 'Ambient Loop')

    the name of the system, or nil in which case it will be defaulted

Returns:

  • (OpenStudio::Model::PlantLoop)

    the ambient loop



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 1072

def model_add_district_ambient_loop(model,
                                    system_name: 'Ambient Loop')
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding district ambient loop.')

  # create ambient loop
  ambient_loop = OpenStudio::Model::PlantLoop.new(model)
  if system_name.nil?
    ambient_loop.setName('Ambient Loop')
  else
    ambient_loop.setName(system_name)
  end

  # ambient loop sizing and controls
  ambient_loop.setMinimumLoopTemperature(5.0)
  ambient_loop.setMaximumLoopTemperature(80.0)

  amb_high_temp_f = 90 # Supplemental cooling below 65F
  amb_low_temp_f = 41 # Supplemental heat below 41F
  amb_temp_sizing_f = 102.2 # CW sized to deliver 102.2F
  amb_delta_t_r = 19.8 # 19.8F delta-T
  amb_high_temp_c = OpenStudio.convert(amb_high_temp_f, 'F', 'C').get
  amb_low_temp_c = OpenStudio.convert(amb_low_temp_f, 'F', 'C').get
  amb_temp_sizing_c = OpenStudio.convert(amb_temp_sizing_f, 'F', 'C').get
  amb_delta_t_k = OpenStudio.convert(amb_delta_t_r, 'R', 'K').get

  amb_high_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                      amb_high_temp_c,
                                                                                      name: "Ambient Loop High Temp - #{amb_high_temp_f}F",
                                                                                      schedule_type_limit: 'Temperature')

  amb_low_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                     amb_low_temp_c,
                                                                                     name: "Ambient Loop Low Temp - #{amb_low_temp_f}F",
                                                                                     schedule_type_limit: 'Temperature')

  amb_stpt_manager = OpenStudio::Model::SetpointManagerScheduledDualSetpoint.new(model)
  amb_stpt_manager.setName("#{ambient_loop.name} Supply Water Setpoint Manager")
  amb_stpt_manager.setHighSetpointSchedule(amb_high_temp_sch)
  amb_stpt_manager.setLowSetpointSchedule(amb_low_temp_sch)
  amb_stpt_manager.addToNode(ambient_loop.supplyOutletNode)

  sizing_plant = ambient_loop.sizingPlant
  sizing_plant.setLoopType('Heating')
  sizing_plant.setDesignLoopExitTemperature(amb_temp_sizing_c)
  sizing_plant.setLoopDesignTemperatureDifference(amb_delta_t_k)

  # create pump
  pump = OpenStudio::Model::PumpVariableSpeed.new(model)
  pump.setName("#{ambient_loop.name} Pump")
  pump.setRatedPumpHead(OpenStudio.convert(60.0, 'ftH_{2}O', 'Pa').get)
  pump.setPumpControlType('Intermittent')
  pump.addToNode(ambient_loop.supplyInletNode)

  # cooling
  district_cooling = OpenStudio::Model::DistrictCooling.new(model)
  district_cooling.setNominalCapacity(1_000_000_000_000) # large number; no autosizing
  ambient_loop.addSupplyBranchForComponent(district_cooling)

  # heating
  if model.version < OpenStudio::VersionString.new('3.7.0')
    district_heating = OpenStudio::Model::DistrictHeating.new(model)
  else
    district_heating = OpenStudio::Model::DistrictHeatingWater.new(model)
  end
  district_heating.setNominalCapacity(1_000_000_000_000) # large number; no autosizing
  ambient_loop.addSupplyBranchForComponent(district_heating)

  # add ambient water loop pipes
  supply_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_bypass_pipe.setName("#{ambient_loop.name} Supply Bypass")
  ambient_loop.addSupplyBranchForComponent(supply_bypass_pipe)

  demand_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_bypass_pipe.setName("#{ambient_loop.name} Demand Bypass")
  ambient_loop.addDemandBranchForComponent(demand_bypass_pipe)

  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe.setName("#{ambient_loop.name} Supply Outlet")
  supply_outlet_pipe.addToNode(ambient_loop.supplyOutletNode)

  demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_inlet_pipe.setName("#{ambient_loop.name} Demand Inlet")
  demand_inlet_pipe.addToNode(ambient_loop.demandInletNode)

  demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_outlet_pipe.setName("#{ambient_loop.name} Demand Outlet")
  demand_outlet_pipe.addToNode(ambient_loop.demandOutletNode)

  return ambient_loop
end

#model_add_doas(model, thermal_zones, system_name: nil, doas_type: 'DOASCV', hot_water_loop: nil, chilled_water_loop: nil, hvac_op_sch: nil, min_oa_sch: nil, min_frac_oa_sch: nil, fan_maximum_flow_rate: nil, econo_ctrl_mthd: 'NoEconomizer', include_exhaust_fan: true, demand_control_ventilation: false, doas_control_strategy: 'NeutralSupplyAir', clg_dsgn_sup_air_temp: 60.0, htg_dsgn_sup_air_temp: 70.0) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a DOAS system with terminal units for each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • doas_type (String) (defaults to: 'DOASCV')

    DOASCV or DOASVAV, determines whether the DOAS is operated at scheduled, constant flow rate, or airflow is variable to allow for economizing or demand controlled ventilation

  • doas_control_strategy (String) (defaults to: 'NeutralSupplyAir')

    DOAS control strategy

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect to heating and zone fan coils

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect to cooling coil

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule, default is always on

  • min_oa_sch (String) (defaults to: nil)

    name of the minimum outdoor air schedule, default is always on

  • min_frac_oa_sch (String) (defaults to: nil)

    name of the minimum fraction of outdoor air schedule, default is always on

  • fan_maximum_flow_rate (Double) (defaults to: nil)

    fan maximum flow rate in cfm, default is autosize

  • econo_ctrl_mthd (String) (defaults to: 'NoEconomizer')

    economizer control type, default is Fixed Dry Bulb If enabled, the DOAS will be sized for twice the ventilation minimum to allow economizing

  • include_exhaust_fan (Boolean) (defaults to: true)

    if true, include an exhaust fan

  • clg_dsgn_sup_air_temp (Double) (defaults to: 60.0)

    design cooling supply air temperature in degrees Fahrenheit, default 65F

  • htg_dsgn_sup_air_temp (Double) (defaults to: 70.0)

    design heating supply air temperature in degrees Fahrenheit, default 75F

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting DOAS air loop



1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 1526

def model_add_doas(model,
                   thermal_zones,
                   system_name: nil,
                   doas_type: 'DOASCV',
                   hot_water_loop: nil,
                   chilled_water_loop: nil,
                   hvac_op_sch: nil,
                   min_oa_sch: nil,
                   min_frac_oa_sch: nil,
                   fan_maximum_flow_rate: nil,
                   econo_ctrl_mthd: 'NoEconomizer',
                   include_exhaust_fan: true,
                   demand_control_ventilation: false,
                   doas_control_strategy: 'NeutralSupplyAir',
                   clg_dsgn_sup_air_temp: 60.0,
                   htg_dsgn_sup_air_temp: 70.0)

  # Check the total OA requirement for all zones on the system
  tot_oa_req = 0
  thermal_zones.each do |zone|
    tot_oa_req += OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone)
  end

  # If the total OA requirement is zero do not add the DOAS system because the simulations will fail
  if tot_oa_req.zero?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Not adding DOAS system for #{thermal_zones.size} zones because combined OA requirement for all zones is zero.")
    return false
  end
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding DOAS system for #{thermal_zones.size} zones.")

  # create a DOAS air loop
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName("#{thermal_zones.size} Zone DOAS")
  else
    air_loop.setName(system_name)
  end

  # set availability schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # DOAS design temperatures
  if clg_dsgn_sup_air_temp.nil?
    clg_dsgn_sup_air_temp_c = OpenStudio.convert(60.0, 'F', 'C').get
  else
    clg_dsgn_sup_air_temp_c = OpenStudio.convert(clg_dsgn_sup_air_temp, 'F', 'C').get
  end

  if htg_dsgn_sup_air_temp.nil?
    htg_dsgn_sup_air_temp_c = OpenStudio.convert(70.0, 'F', 'C').get
  else
    htg_dsgn_sup_air_temp_c = OpenStudio.convert(htg_dsgn_sup_air_temp, 'F', 'C').get
  end

  # modify system sizing properties
  sizing_system = air_loop.sizingSystem
  sizing_system.setTypeofLoadtoSizeOn('VentilationRequirement')
  sizing_system.setAllOutdoorAirinCooling(true)
  sizing_system.setAllOutdoorAirinHeating(true)
  # set minimum airflow ratio to 1.0 to avoid under-sizing heating coil
  if model.version < OpenStudio::VersionString.new('2.7.0')
    sizing_system.setMinimumSystemAirFlowRatio(1.0)
  else
    sizing_system.setCentralHeatingMaximumSystemAirFlowRatio(1.0)
  end
  sizing_system.setSizingOption('Coincident')
  sizing_system.setCentralCoolingDesignSupplyAirTemperature(clg_dsgn_sup_air_temp_c)
  sizing_system.setCentralHeatingDesignSupplyAirTemperature(htg_dsgn_sup_air_temp_c)

  if doas_type == 'DOASCV'
    supply_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                              'Constant_DOAS_Fan',
                                                              fan_name: 'DOAS Supply Fan',
                                                              end_use_subcategory: 'DOAS Fans')
  else # 'DOASVAV'
    supply_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                              'Variable_DOAS_Fan',
                                                              fan_name: 'DOAS Supply Fan',
                                                              end_use_subcategory: 'DOAS Fans')
  end
  supply_fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  supply_fan.setMaximumFlowRate(OpenStudio.convert(fan_maximum_flow_rate, 'cfm', 'm^3/s').get) unless fan_maximum_flow_rate.nil?
  supply_fan.addToNode(air_loop.supplyInletNode)

  # create heating coil
  if hot_water_loop.nil?
    # electric backup heating coil
    OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                           air_loop_node: air_loop.supplyInletNode,
                                                           name: "#{air_loop.name} Backup Htg Coil")
    # heat pump coil
    OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                  air_loop_node: air_loop.supplyInletNode,
                                                                  name: "#{air_loop.name} Htg Coil")
  else
    OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                        hot_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Htg Coil",
                                                        controller_convergence_tolerance: 0.0001)
  end

  # could add a humidity controller here set to limit supply air to a 16.6C/62F dewpoint
  # the default outdoor air reset to 60F prevents exceeding this dewpoint in all ASHRAE climate zones
  # the humidity controller needs a DX coil that can control humidity, e.g. CoilCoolingDXTwoStageWithHumidityControlMode
  # max_humidity_ratio_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
  #                                                                                          0.012,
  #                                                                                          name: "0.012 Humidity Ratio Schedule",
  #                                                                                          schedule_type_limit: "Humidity Ratio")
  # sat_oa_reset = OpenStudio::Model::SetpointManagerScheduled.new(model, max_humidity_ratio_sch)
  # sat_oa_reset.setName("#{air_loop.name.to_s} Humidity Controller")
  # sat_oa_reset.setControlVariable('MaximumHumidityRatio')
  # sat_oa_reset.addToNode(air_loop.supplyInletNode)

  # create cooling coil
  if chilled_water_loop.nil?
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX Clg Coil",
                                                               type: 'OS default')
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Clg Coil")
  end

  # minimum outdoor air schedule
  unless min_oa_sch.nil?
    min_oa_sch = model_add_schedule(model, min_oa_sch)
  end

  # minimum outdoor air fraction schedule
  if min_frac_oa_sch.nil?
    min_frac_oa_sch = model.alwaysOnDiscreteSchedule
  else
    min_frac_oa_sch = model_add_schedule(model, min_frac_oa_sch)
  end

  # create controller outdoor air
  controller_oa = OpenStudio::Model::ControllerOutdoorAir.new(model)
  controller_oa.setName("#{air_loop.name} Outdoor Air Controller")
  controller_oa.setEconomizerControlType(econo_ctrl_mthd)
  controller_oa.setMinimumLimitType('FixedMinimum')
  controller_oa.autosizeMinimumOutdoorAirFlowRate
  controller_oa.setMinimumOutdoorAirSchedule(min_oa_sch) unless min_oa_sch.nil?
  controller_oa.setMinimumFractionofOutdoorAirSchedule(min_frac_oa_sch)
  controller_oa.resetEconomizerMinimumLimitDryBulbTemperature
  controller_oa.resetEconomizerMaximumLimitDryBulbTemperature
  controller_oa.resetEconomizerMaximumLimitEnthalpy
  controller_oa.resetMaximumFractionofOutdoorAirSchedule
  controller_oa.setHeatRecoveryBypassControlType('BypassWhenWithinEconomizerLimits')
  controller_mech_vent = controller_oa.controllerMechanicalVentilation
  controller_mech_vent.setName("#{air_loop.name} Mechanical Ventilation Controller")
  controller_mech_vent.setDemandControlledVentilation(true) if demand_control_ventilation
  controller_mech_vent.setSystemOutdoorAirMethod('ZoneSum')

  # create outdoor air system
  oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, controller_oa)
  oa_system.setName("#{air_loop.name} OA System")
  oa_system.addToNode(air_loop.supplyInletNode)

  # create an exhaust fan
  if include_exhaust_fan
    if doas_type == 'DOASCV'
      exhaust_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                                 'Constant_DOAS_Fan',
                                                                 fan_name: 'DOAS Exhaust Fan',
                                                                 end_use_subcategory: 'DOAS Fans')
    else # 'DOASVAV'
      exhaust_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                                 'Variable_DOAS_Fan',
                                                                 fan_name: 'DOAS Exhaust Fan',
                                                                 end_use_subcategory: 'DOAS Fans')
    end
    # set pressure rise 1.0 inH2O lower than supply fan, 1.0 inH2O minimum
    exhaust_fan_pressure_rise = supply_fan.pressureRise - OpenStudio.convert(1.0, 'inH_{2}O', 'Pa').get
    exhaust_fan_pressure_rise = OpenStudio.convert(1.0, 'inH_{2}O', 'Pa').get if exhaust_fan_pressure_rise < OpenStudio.convert(1.0, 'inH_{2}O', 'Pa').get
    exhaust_fan.setPressureRise(exhaust_fan_pressure_rise)
    exhaust_fan.addToNode(air_loop.supplyInletNode)
  end

  # create a setpoint manager
  sat_oa_reset = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
  sat_oa_reset.setName("#{air_loop.name} SAT Reset")
  sat_oa_reset.setControlVariable('Temperature')
  sat_oa_reset.setSetpointatOutdoorLowTemperature(htg_dsgn_sup_air_temp_c)
  sat_oa_reset.setOutdoorLowTemperature(OpenStudio.convert(55.0, 'F', 'C').get)
  sat_oa_reset.setSetpointatOutdoorHighTemperature(clg_dsgn_sup_air_temp_c)
  sat_oa_reset.setOutdoorHighTemperature(OpenStudio.convert(70.0, 'F', 'C').get)
  sat_oa_reset.addToNode(air_loop.supplyOutletNode)

  # set air loop availability controls and night cycle manager, after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)
  air_loop.setNightCycleControlType('CycleOnAnyZoneFansOnly')

  # add thermal zones to airloop
  thermal_zones.each do |zone|
    # skip zones with no outdoor air flow rate
    unless OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone) > 0
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "---#{zone.name} has no outdoor air flow rate and will not be added to #{air_loop.name}")
      next
    end

    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "---adding #{zone.name} to #{air_loop.name}")

    # make an air terminal for the zone
    if doas_type == 'DOASCV'
      air_terminal = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    elsif doas_type == 'DOASVAVReheat'
      # Reheat coil
      if hot_water_loop.nil?
        rht_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model, name: "#{zone.name} Electric Reheat Coil")
      else
        rht_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model, hot_water_loop, name: "#{zone.name} Reheat Coil")
      end
      # VAV reheat terminal
      air_terminal = OpenStudio::Model::AirTerminalSingleDuctVAVReheat.new(model, model.alwaysOnDiscreteSchedule, rht_coil)
      if model.version < OpenStudio::VersionString.new('3.0.1')
        air_terminal.setZoneMinimumAirFlowMethod('Constant')
      else
        air_terminal.setZoneMinimumAirFlowInputMethod('Constant')
      end
      air_terminal.setControlForOutdoorAir(true) if demand_control_ventilation
    else # 'DOASVAV'
      air_terminal = OpenStudio::Model::AirTerminalSingleDuctVAVNoReheat.new(model, model.alwaysOnDiscreteSchedule)
      if model.version < OpenStudio::VersionString.new('3.0.1')
        air_terminal.setZoneMinimumAirFlowMethod('Constant')
      else
        air_terminal.setZoneMinimumAirFlowInputMethod('Constant')
      end
      air_terminal.setConstantMinimumAirFlowFraction(0.1)
      air_terminal.setControlForOutdoorAir(true) if demand_control_ventilation
    end
    air_terminal.setName("#{zone.name} Air Terminal")

    # attach new terminal to the zone and to the airloop
    air_loop.multiAddBranchForZone(zone, air_terminal.to_HVACComponent.get)

    # ensure the DOAS takes priority, so ventilation load is included when treated by other zonal systems
    # From EnergyPlus I/O reference:
    # "For situations where one or more equipment types has limited capacity or limited control capability, order the
    #  sequence so that the most controllable piece of equipment runs last. For example, with a dedicated outdoor air
    #  system (DOAS), the air terminal for the DOAS should be assigned Heating Sequence = 1 and Cooling Sequence = 1.
    #  Any other equipment should be assigned sequence 2 or higher so that it will see the net load after the DOAS air
    #  is added to the zone."
    zone.setCoolingPriority(air_terminal.to_ModelObject.get, 1)
    zone.setHeatingPriority(air_terminal.to_ModelObject.get, 1)

    # set the cooling and heating fraction to zero so that if DCV is enabled,
    # the system will lower the ventilation rate rather than trying to meet the heating or cooling load.
    if model.version < OpenStudio::VersionString.new('2.8.0')
      if demand_control_ventilation
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Unable to add DOAS with DCV to model because the setSequentialCoolingFraction method is not available in OpenStudio versions less than 2.8.0.')
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', 'OpenStudio version is less than 2.8.0.  The DOAS system will not be able to have DCV if changed at a later date.')
      end
    else
      zone.setSequentialCoolingFraction(air_terminal.to_ModelObject.get, 0.0)
      zone.setSequentialHeatingFraction(air_terminal.to_ModelObject.get, 0.0)

      # if economizing, override to meet cooling load first with doas supply
      unless econo_ctrl_mthd == 'NoEconomizer'
        zone.setSequentialCoolingFraction(air_terminal.to_ModelObject.get, 1.0)
      end
    end

    # DOAS sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setAccountforDedicatedOutdoorAirSystem(true)
    sizing_zone.setDedicatedOutdoorAirSystemControlStrategy(doas_control_strategy)
    sizing_zone.setDedicatedOutdoorAirLowSetpointTemperatureforDesign(clg_dsgn_sup_air_temp_c)
    sizing_zone.setDedicatedOutdoorAirHighSetpointTemperatureforDesign(htg_dsgn_sup_air_temp_c)
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
  end

  return air_loop
end

#model_add_doas_cold_supply(model, thermal_zones, system_name: nil, hot_water_loop: nil, chilled_water_loop: nil, hvac_op_sch: nil, min_oa_sch: nil, min_frac_oa_sch: nil, fan_maximum_flow_rate: nil, econo_ctrl_mthd: 'FixedDryBulb', energy_recovery: false, doas_control_strategy: 'NeutralSupplyAir', clg_dsgn_sup_air_temp: 55.0, htg_dsgn_sup_air_temp: 60.0) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a DOAS system with cold supply and terminal units for each zone. This is the default DOAS system for DOE prototype buildings. Use model_add_doas for other DOAS systems.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect to heating and zone fan coils

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect to cooling coil

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule, default is always on

  • min_oa_sch (String) (defaults to: nil)

    name of the minimum outdoor air schedule, default is always on

  • min_frac_oa_sch (String) (defaults to: nil)

    name of the minimum fraction of outdoor air schedule, default is always on

  • fan_maximum_flow_rate (Double) (defaults to: nil)

    fan maximum flow rate in cfm, default is autosize

  • econo_ctrl_mthd (String) (defaults to: 'FixedDryBulb')

    economizer control type, default is Fixed Dry Bulb

  • energy_recovery (Boolean) (defaults to: false)

    if true, an ERV will be added to the system

  • doas_control_strategy (String) (defaults to: 'NeutralSupplyAir')

    DOAS control strategy

  • clg_dsgn_sup_air_temp (Double) (defaults to: 55.0)

    design cooling supply air temperature in degrees Fahrenheit, default 65F

  • htg_dsgn_sup_air_temp (Double) (defaults to: 60.0)

    design heating supply air temperature in degrees Fahrenheit, default 75F

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting DOAS air loop



1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 1298

def model_add_doas_cold_supply(model,
                               thermal_zones,
                               system_name: nil,
                               hot_water_loop: nil,
                               chilled_water_loop: nil,
                               hvac_op_sch: nil,
                               min_oa_sch: nil,
                               min_frac_oa_sch: nil,
                               fan_maximum_flow_rate: nil,
                               econo_ctrl_mthd: 'FixedDryBulb',
                               energy_recovery: false,
                               doas_control_strategy: 'NeutralSupplyAir',
                               clg_dsgn_sup_air_temp: 55.0,
                               htg_dsgn_sup_air_temp: 60.0)

  # Check the total OA requirement for all zones on the system
  tot_oa_req = 0
  thermal_zones.each do |zone|
    tot_oa_req += OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate(zone)
    break if tot_oa_req > 0
  end

  # If the total OA requirement is zero do not add the DOAS system because the simulations will fail
  if tot_oa_req.zero?
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Not adding DOAS system for #{thermal_zones.size} zones because combined OA requirement for all zones is zero.")
    return false
  end
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding DOAS system for #{thermal_zones.size} zones.")

  # create a DOAS air loop
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName("#{thermal_zones.size} Zone DOAS")
  else
    air_loop.setName(system_name)
  end

  # set availability schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # DOAS design temperatures
  if clg_dsgn_sup_air_temp.nil?
    clg_dsgn_sup_air_temp_c = OpenStudio.convert(55.0, 'F', 'C').get
  else
    clg_dsgn_sup_air_temp_c = OpenStudio.convert(clg_dsgn_sup_air_temp, 'F', 'C').get
  end

  if htg_dsgn_sup_air_temp.nil?
    htg_dsgn_sup_air_temp_c = OpenStudio.convert(60.0, 'F', 'C').get
  else
    htg_dsgn_sup_air_temp_c = OpenStudio.convert(htg_dsgn_sup_air_temp, 'F', 'C').get
  end

  # modify system sizing properties
  sizing_system = air_loop.sizingSystem
  sizing_system.setTypeofLoadtoSizeOn('VentilationRequirement')
  sizing_system.setAllOutdoorAirinCooling(true)
  sizing_system.setAllOutdoorAirinHeating(true)
  # set minimum airflow ratio to 1.0 to avoid under-sizing heating coil
  if model.version < OpenStudio::VersionString.new('2.7.0')
    sizing_system.setMinimumSystemAirFlowRatio(1.0)
  else
    sizing_system.setCentralHeatingMaximumSystemAirFlowRatio(1.0)
  end
  sizing_system.setSizingOption('Coincident')
  sizing_system.setCentralCoolingDesignSupplyAirTemperature(clg_dsgn_sup_air_temp_c)
  sizing_system.setCentralHeatingDesignSupplyAirTemperature(htg_dsgn_sup_air_temp_c)

  # create supply fan
  supply_fan = OpenstudioStandards::HVAC.create_typical_fan(model, 'Constant_DOAS_Fan',
                                                            fan_name: 'DOAS Supply Fan',
                                                            end_use_subcategory: 'DOAS Fans')
  supply_fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  supply_fan.setMaximumFlowRate(OpenStudio.convert(fan_maximum_flow_rate, 'cfm', 'm^3/s').get) unless fan_maximum_flow_rate.nil?
  supply_fan.addToNode(air_loop.supplyInletNode)

  # create heating coil
  if hot_water_loop.nil?
    # electric backup heating coil
    OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                           air_loop_node: air_loop.supplyInletNode,
                                                           name: "#{air_loop.name} Backup Htg Coil")
    # heat pump coil
    OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                  air_loop_node: air_loop.supplyInletNode,
                                                                  name: "#{air_loop.name} Htg Coil")
  else
    OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                        hot_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Htg Coil",
                                                        controller_convergence_tolerance: 0.0001)
  end

  # create cooling coil
  if chilled_water_loop.nil?
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX Clg Coil",
                                                               type: 'OS default')
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Clg Coil")
  end

  # minimum outdoor air schedule
  if min_oa_sch.nil?
    min_oa_sch = model.alwaysOnDiscreteSchedule
  else
    min_oa_sch = model_add_schedule(model, min_oa_sch)
  end

  # minimum outdoor air fraction schedule
  if min_frac_oa_sch.nil?
    min_frac_oa_sch = model.alwaysOnDiscreteSchedule
  else
    min_frac_oa_sch = model_add_schedule(model, min_frac_oa_sch)
  end

  # create controller outdoor air
  controller_oa = OpenStudio::Model::ControllerOutdoorAir.new(model)
  controller_oa.setName("#{air_loop.name} OA Controller")
  controller_oa.setEconomizerControlType(econo_ctrl_mthd)
  controller_oa.setMinimumLimitType('FixedMinimum')
  controller_oa.autosizeMinimumOutdoorAirFlowRate
  controller_oa.setMinimumOutdoorAirSchedule(min_oa_sch)
  controller_oa.setMinimumFractionofOutdoorAirSchedule(min_frac_oa_sch)
  controller_oa.resetEconomizerMaximumLimitDryBulbTemperature
  controller_oa.resetEconomizerMaximumLimitEnthalpy
  controller_oa.resetMaximumFractionofOutdoorAirSchedule
  controller_oa.resetEconomizerMinimumLimitDryBulbTemperature
  controller_oa.setHeatRecoveryBypassControlType('BypassWhenWithinEconomizerLimits')

  # create outdoor air system
  oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, controller_oa)
  oa_system.setName("#{air_loop.name} OA System")
  oa_system.addToNode(air_loop.supplyInletNode)

  # create a setpoint manager
  sat_oa_reset = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
  sat_oa_reset.setName("#{air_loop.name} SAT Reset")
  sat_oa_reset.setControlVariable('Temperature')
  sat_oa_reset.setSetpointatOutdoorLowTemperature(htg_dsgn_sup_air_temp_c)
  sat_oa_reset.setOutdoorLowTemperature(OpenStudio.convert(60.0, 'F', 'C').get)
  sat_oa_reset.setSetpointatOutdoorHighTemperature(clg_dsgn_sup_air_temp_c)
  sat_oa_reset.setOutdoorHighTemperature(OpenStudio.convert(70.0, 'F', 'C').get)
  sat_oa_reset.addToNode(air_loop.supplyOutletNode)

  # set air loop availability controls and night cycle manager, after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)
  air_loop.setNightCycleControlType('CycleOnAny')

  # add energy recovery if requested
  if energy_recovery
    # Get the OA system and its outboard OA node
    oa_system = air_loop.airLoopHVACOutdoorAirSystem.get

    # create the ERV and set its properties
    # @todo come up with scheme for estimating power of ERV motor wheel which might require knowing airflow.
    # erv.setNominalElectricPower(value_new)
    erv = OpenstudioStandards::HVAC.create_heat_exchanger_air_to_air_sensible_and_latent(model,
                                                                                         name: "#{zone.name} ERV HX",
                                                                                         type: "Rotary",
                                                                                         economizer_lockout: true,
                                                                                         sensible_heating_100_eff: 0.76,
                                                                                         sensible_heating_75_eff: 0.81,
                                                                                         latent_heating_100_eff: 0.68,
                                                                                         latent_heating_75_eff: 0.73,
                                                                                         sensible_cooling_100_eff: 0.76,
                                                                                         sensible_cooling_75_eff: 0.81,
                                                                                         latent_cooling_100_eff: 0.68,
                                                                                         latent_cooling_75_eff: 0.73)
    erv.addToNode(oa_system.outboardOANode.get)

    # increase fan static pressure to account for ERV
    erv_pressure_rise = OpenStudio.convert(1.0, 'inH_{2}O', 'Pa').get
    new_pressure_rise = supply_fan.pressureRise + erv_pressure_rise
    supply_fan.setPressureRise(new_pressure_rise)
  end

  # add thermal zones to airloop
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "---adding #{zone.name} to #{air_loop.name}")

    # make an air terminal for the zone
    air_terminal = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    air_terminal.setName("#{zone.name} Air Terminal")

    # attach new terminal to the zone and to the airloop
    air_loop.multiAddBranchForZone(zone, air_terminal.to_HVACComponent.get)

    # DOAS sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setAccountforDedicatedOutdoorAirSystem(true)
    sizing_zone.setDedicatedOutdoorAirSystemControlStrategy('ColdSupplyAir')
    sizing_zone.setDedicatedOutdoorAirLowSetpointTemperatureforDesign(clg_dsgn_sup_air_temp_c)
    sizing_zone.setDedicatedOutdoorAirHighSetpointTemperatureforDesign(htg_dsgn_sup_air_temp_c)
  end

  return air_loop
end

#model_add_elevator(model, space, number_of_elevators, elevator_type, elevator_schedule, elevator_fan_schedule, elevator_lights_schedule, building_type = nil) ⇒ OpenStudio::Model::ElectricEquipment

Add an elevator the the specified space

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • space (OpenStudio::Model::Space)

    the space that contains the elevators

  • number_of_elevators (Integer)

    the number of elevators

  • elevator_type (String)

    valid choices are Traction, Hydraulic

  • elevator_schedule (String)

    the name of the elevator schedule

  • elevator_fan_schedule (String)

    the name of the elevator fan schedule

  • elevator_lights_schedule (String)

    the name of the elevator lights schedule

  • building_type (String) (defaults to: nil)

    the building type

Returns:

  • (OpenStudio::Model::ElectricEquipment)

    the resulting elevator



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.Model.elevators.rb', line 13

def model_add_elevator(model,
                       space,
                       number_of_elevators,
                       elevator_type,
                       elevator_schedule,
                       elevator_fan_schedule,
                       elevator_lights_schedule,
                       building_type = nil)

  # Lift motor assumptions
  lift_pwr_w = model_elevator_lift_power(model, elevator_type, building_type)

  # Size assumptions
  length_ft = 6.66
  width_ft = 4.25
  height_ft = 8.0
  area_ft2 = length_ft * width_ft
  volume_ft3 = area_ft2 * height_ft

  # Ventilation assumptions
  vent_rate_acm = 1 # air changes per minute
  vent_rate_cfm = volume_ft3 / vent_rate_acm
  vent_pwr_w = model_elevator_fan_pwr(model, vent_rate_cfm)

  # Heating fraction radiant assumptions
  elec_equip_frac_radiant = 0.5

  # Lighting assumptions
  design_ltg_lm_per_ft2 = 30
  light_loss_factor = 0.75
  pct_incandescent = model_elevator_lighting_pct_incandescent(model)
  pct_led = 1.0 - pct_incandescent

  incandescent_efficacy_lm_per_w = 10.0
  led_efficacy_lm_per_w = 35.0
  target_ltg_lm_per_ft2 = design_ltg_lm_per_ft2 / light_loss_factor # 40
  target_ltg_lm = target_ltg_lm_per_ft2 * area_ft2 # 1132.2
  lm_incandescent = target_ltg_lm * pct_incandescent # 792.54
  lm_led = target_ltg_lm * pct_led # 339.66
  w_incandescent = lm_incandescent / incandescent_efficacy_lm_per_w # 79.254
  w_led = lm_led / led_efficacy_lm_per_w # 9.7
  lighting_pwr_w = w_incandescent + w_led

  # Elevator lift motor
  elevator_definition = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
  elevator_definition.setName('Elevator Lift Motor')
  elevator_definition.setDesignLevel(lift_pwr_w)
  elevator_definition.setFractionRadiant(elec_equip_frac_radiant)

  elevator_equipment = OpenStudio::Model::ElectricEquipment.new(elevator_definition)
  elevator_equipment.setName("#{number_of_elevators.round} Elevator Lift Motors")
  elevator_equipment.setEndUseSubcategory('Elevators')
  elevator_sch = model_add_schedule(model, elevator_schedule)
  elevator_equipment.setSchedule(elevator_sch)
  elevator_equipment.setSpace(space)
  elevator_equipment.setMultiplier(number_of_elevators)

  # Elevator fan
  elevator_fan_definition = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
  elevator_fan_definition.setName('Elevator Fan')
  elevator_fan_definition.setDesignLevel(vent_pwr_w)
  elevator_fan_definition.setFractionRadiant(elec_equip_frac_radiant)

  elevator_fan_equipment = OpenStudio::Model::ElectricEquipment.new(elevator_fan_definition)
  elevator_fan_equipment.setName("#{number_of_elevators.round} Elevator Fans")
  elevator_fan_equipment.setEndUseSubcategory('Elevators')
  elevator_fan_sch = model_add_schedule(model, elevator_fan_schedule)
  elevator_fan_equipment.setSchedule(elevator_fan_sch)
  elevator_fan_equipment.setSpace(space)
  elevator_fan_equipment.setMultiplier(number_of_elevators)

  # Elevator lights
  elevator_lights_definition = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
  elevator_lights_definition.setName('Elevator Lights')
  elevator_lights_definition.setDesignLevel(lighting_pwr_w)
  elevator_lights_definition.setFractionRadiant(elec_equip_frac_radiant)

  elevator_lights_equipment = OpenStudio::Model::ElectricEquipment.new(elevator_lights_definition)
  elevator_lights_equipment.setName("#{number_of_elevators.round} Elevator Lights")
  elevator_lights_equipment.setEndUseSubcategory('Elevators')
  elevator_lights_sch = model_add_schedule(model, elevator_lights_schedule)
  elevator_lights_equipment.setSchedule(elevator_lights_sch)
  elevator_lights_equipment.setSpace(space)
  elevator_lights_equipment.setMultiplier(number_of_elevators)

  return elevator_equipment
end

#model_add_elevators(model) ⇒ OpenStudio::Model::ElectricEquipment

Add elevators to the model based on the building size, number of stories, and building type. Logic was derived from the DOE prototype buildings.

Parameters:

Returns:

  • (OpenStudio::Model::ElectricEquipment)

    the resulting elevator



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.Model.elevators.rb', line 151

def model_add_elevators(model)
  # determine effective number of stories
  effective_num_stories = model_effective_num_stories(model)

  # determine elevator type
  # todo add logic here or upstream to have some multi-story buildings without elevators (e.g. small multi-family and small hotels)
  if effective_num_stories[:below_grade] + effective_num_stories[:above_grade] < 2
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', 'The building only has 1 story, no elevators will be added.')
    return nil # don't add elevators
  elsif effective_num_stories[:below_grade] + effective_num_stories[:above_grade] < 6
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', 'The building has fewer than 6 effective stories; assuming Hydraulic elevators.')
    elevator_type = 'Hydraulic'
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', 'The building has 6 or more effective stories; assuming Traction elevators.')
    elevator_type = 'Traction'
  end

  # determine space to put elevator load in
  # largest bottom story (including basement) space that has multiplier of 1
  bottom_spaces = {}
  bottom_story = effective_num_stories[:story_hash].keys.first
  bottom_story.spaces.each do |space|
    next if space.multiplier > 1

    bottom_spaces[space] = space.floorArea
  end
  target_space = bottom_spaces.key(bottom_spaces.values.max)

  building_types = []

  # determine number of elevators
  number_of_pass_elevators = 0.0
  number_of_freight_elevators = 0.0
  building_type_hash = {}

  # apply building type specific log to add to number of elevators based on Beyer (2009) rules of thumb
  space_type_hash = model_create_space_type_hash(model)
  space_type_hash.each do |space_type, hash|
    # update building_type_hash
    if building_type_hash.key?(hash[:stds_bldg_type])
      building_type_hash[hash[:stds_bldg_type]] += hash[:floor_area]
    else
      building_type_hash[hash[:stds_bldg_type]] = hash[:floor_area]
    end

    building_type = hash[:stds_bldg_type]
    building_types << building_type

    # store floor area ip
    floor_area_ip = OpenStudio.convert(hash[:floor_area], 'm^2', 'ft^2').get

    # load elevator_data
    search_criteria = {
      'building_type' => building_type,
      'template' => template
    }
    elevator_data_lookup = model_find_object(standards_data['elevators'], search_criteria)
    if elevator_data_lookup.nil?
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.prototype.elevators', "Could not find elevator data for #{building_type}, elevator counts will not account for serving this portion of the building area.")
      next
    end

    # determine number of passenger elevators
    if !elevator_data_lookup['area_per_passenger_elevator'].nil?
      pass_elevs = floor_area_ip / elevator_data_lookup['area_per_passenger_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{pass_elevs.round(1)} passenger elevators at 1 per #{elevator_data_lookup['area_per_passenger_elevator']} ft^2.")
    elsif !elevator_data_lookup['units_per_passenger_elevator'].nil?
      pass_elevs = hash[:num_units] / elevator_data_lookup['units_per_passenger_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{pass_elevs.round(1)} passenger elevators at 1 per #{elevator_data_lookup['units_per_passenger_elevator']} units.")
    elsif !elevator_data_lookup['beds_per_passenger_elevator'].nil?
      pass_elevs = hash[:num_beds] / elevator_data_lookup['beds_per_passenger_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{pass_elevs.round(1)} passenger elevators at 1 per #{elevator_data_lookup['beds_per_passenger_elevator']} beds.")
    else
      pass_elevs = 0.0
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "Unexpected key, can't calculate number of passenger elevators from #{elevator_data_lookup.keys.first}.")
    end

    # determine number of freight elevators
    if !elevator_data_lookup['area_per_freight_elevator'].nil?
      freight_elevs = floor_area_ip / elevator_data_lookup['area_per_freight_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{freight_elevs.round(1)} freight/service elevators at 1 per #{elevator_data_lookup['area_per_freight_elevator']} ft^2.")
    elsif !elevator_data_lookup['units_per_freight_elevator'].nil?
      freight_elevs = hash[:num_units] / elevator_data_lookup['units_per_freight_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{freight_elevs.round(1)} freight/service elevators at 1 per #{elevator_data_lookup['units_per_freight_elevator']} units.")
    elsif !elevator_data_lookup['beds_per_freight_elevator'].nil?
      freight_elevs = hash[:num_beds] / elevator_data_lookup['beds_per_freight_elevator'].to_f
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "For #{space_type.name}, adding #{freight_elevs.round(1)} freight/service elevators at 1 per #{elevator_data_lookup['beds_per_freight_elevator']} beds.")
    else
      freight_elevs = 0.0
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "Unexpected key, can't calculate number of freight elevators from #{elevator_data_lookup.keys.first}.")
    end
    number_of_pass_elevators += pass_elevs
    number_of_freight_elevators += freight_elevs
  end

  # additional passenger elevators (applicable for DOE LargeHotel and DOE Hospital only)
  add_pass_elevs = 0.0
  building_types.uniq.each do |building_type|
    # load elevator_data
    search_criteria = { 'building_type' => building_type }
    elevator_data_lookup = model_find_object(standards_data['elevators'], search_criteria)
    if elevator_data_lookup.nil?
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.prototype.elevators', "Could not find elevator data for #{building_type}.")
      next
    end

    # determine number of additional passenger elevators
    if elevator_data_lookup['additional_passenger_elevators'].nil?
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', 'No additional passenger elevators added to model.')
    else
      add_pass_elevs += elevator_data_lookup['additional_passenger_elevators']
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "Adding #{elevator_data_lookup['additional_passenger_elevators']} additional passenger elevators.")
    end
  end

  # adjust number of elevators (can be double but if not 0 must be at least 1.0)
  if (number_of_pass_elevators > 0.0) && (number_of_pass_elevators < 1.0)
    number_of_pass_elevators = 1.0
  end
  if (number_of_freight_elevators > 0.0) && (number_of_freight_elevators < 1.0)
    number_of_freight_elevators = 1.0
  end

  # determine total number of elevators (rounding up to nearest whole number)
  number_of_pass_elevators = number_of_pass_elevators.ceil + add_pass_elevs
  number_of_freight_elevators = number_of_freight_elevators.ceil
  number_of_elevators = number_of_pass_elevators + number_of_freight_elevators

  building_type = building_type_hash.key(building_type_hash.values.max)

  # determine blended occupancy schedule
  occ_schedule = OpenstudioStandards::Space.spaces_get_occupancy_schedule(model.getSpaces)

  # get total number of people in building
  max_occ_in_spaces = 0
  model.getSpaces.each do |space|
    # From the space type
    if space.spaceType.is_initialized
      space.spaceType.get.people.each do |people|
        num_ppl = people.getNumberOfPeople(space.floorArea)
        max_occ_in_spaces += num_ppl
      end
    end
    # From the space
    space.people.each do |people|
      num_ppl = people.getNumberOfPeople(space.floorArea)
      max_occ_in_spaces += num_ppl
    end
  end

  # make elevator schedule based on change in occupancy for each timestep
  day_schedules = []
  default_day_schedule = occ_schedule.defaultDaySchedule
  day_schedules << default_day_schedule
  occ_schedule.scheduleRules.each do |rule|
    day_schedules << rule.daySchedule
  end
  day_schedules.each do |day_schedule|
    elevator_hourly_fractions = []
    (0..23).each do |hr|
      t = OpenStudio::Time.new(0, hr, 0, 0)
      value = day_schedule.getValue(t)
      t_plus = OpenStudio::Time.new(0, hr + 1, 0, 0)
      value_plus = day_schedule.getValue(t_plus)
      change_occupancy_fraction = (value_plus - value).abs
      change_num_people = change_occupancy_fraction * max_occ_in_spaces * 1.2
      # multiplication factor or 1.2 to account for interfloor traffic

      # determine time per ride based on number of floors and elevator type
      if elevator_type == 'Hydraulic'
        time_per_ride = 8.7 + (effective_num_stories[:above_grade] * 5.6)
      elsif elevator_type == 'Traction'
        time_per_ride = 5.6 + (effective_num_stories[:above_grade] * 2.1)
      else
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.prototype.elevators', "Elevator type #{elevator_type} not recognized.")
        return nil
      end

      # determine elevator operation fraction for each timestep
      people_per_ride = 5
      rides_per_elevator = (change_num_people / people_per_ride) / number_of_elevators
      operation_time = rides_per_elevator * time_per_ride
      elevator_operation_fraction = operation_time / 3600
      if elevator_operation_fraction > 1.00
        elevator_operation_fraction = 1.00
      end
      elevator_hourly_fractions << elevator_operation_fraction
    end

    # replace hourly occupancy values with operating fractions
    day_schedule.clearValues
    (0..23).each do |hr|
      t = OpenStudio::Time.new(0, hr, 0, 0)
      value = elevator_hourly_fractions[hr]
      value_plus = if hr <= 22
                     elevator_hourly_fractions[hr + 1]
                   else
                     elevator_hourly_fractions[0]
                   end
      next if value == value_plus

      day_schedule.addValue(t, elevator_hourly_fractions[hr])
    end
  end

  occ_schedule.setName('Elevator Schedule')

  # clone new elevator schedule and assign to elevator
  elev_sch = occ_schedule.clone(model)
  elevator_schedule = elev_sch.name.to_s

  # For elevator lights and fan, assume 100% operation during hours that elevator fraction > 0 (when elevator is in operation).
  # elevator lights
  lights_sch = occ_schedule.clone(model)
  lights_sch = lights_sch.to_ScheduleRuleset.get
  profiles = []
  profiles << lights_sch.defaultDaySchedule
  rules = lights_sch.scheduleRules
  rules.each do |rule|
    profiles << rule.daySchedule
  end
  profiles.each do |profile|
    times = profile.times
    values = profile.values
    values.each_with_index do |val, i|
      if val > 0
        profile.addValue(times[i], 1.0)
      end
    end
  end
  elevator_lights_schedule = lights_sch.name.to_s

  # elevator fan
  fan_sch = occ_schedule.clone(model)
  fan_sch = fan_sch.to_ScheduleRuleset.get
  profiles = []
  profiles << fan_sch.defaultDaySchedule
  rules = fan_sch.scheduleRules
  rules.each do |rule|
    profiles << rule.daySchedule
  end
  profiles.each do |profile|
    times = profile.times
    values = profile.values
    values.each_with_index do |val, i|
      if val > 0
        profile.addValue(times[i], 1.0)
      end
    end
  end
  elevator_fan_schedule = fan_sch.name.to_s

  # @todo currently add elevator doesn't allow me to choose the size of the elevator?
  # ref bldg pdf has formula for motor hp based on weight, speed, counterweight fraction and mech eff (in 5.1.4)

  # @todo should schedules change based on traction vs. hydraulic vs. just taking what is in prototype.

  # call add_elevator in Prototype.hvac_systems.rb to create elevator objects
  elevator = model_add_elevator(model,
                                target_space,
                                number_of_elevators,
                                elevator_type,
                                elevator_schedule,
                                elevator_fan_schedule,
                                elevator_lights_schedule,
                                building_type)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.prototype.elevators', "Adding #{elevator.multiplier.round(1)} #{elevator_type} elevators to the model in #{target_space.name}.")

  # check fraction lost on heat from elevator if traction, change to 100% lost if not setup that way.
  if elevator_type == 'Traction'
    elevator.definition.to_ElectricEquipmentDefinition.get.setFractionLatent(0.0)
    elevator.definition.to_ElectricEquipmentDefinition.get.setFractionRadiant(0.0)
    elevator.definition.to_ElectricEquipmentDefinition.get.setFractionLost(1.0)
  end

  return elevator
end

#model_add_evap_cooler(model, thermal_zones) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates an evaporative cooler for each zone and adds it to the model.

Parameters:

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    the resulting evaporative coolers



4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4415

def model_add_evap_cooler(model,
                          thermal_zones)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding evaporative coolers for #{thermal_zones.size} zones.")
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "---#{zone.name}")
  end

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted design temperatures for evap cooler
  dsgn_temps['clg_dsgn_sup_air_temp_f'] = 70.0
  dsgn_temps['clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['clg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['max_clg_dsgn_sup_air_temp_f'] = 78.0
  dsgn_temps['max_clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['max_clg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['approach_r'] = 3.0 # wetbulb approach temperature
  dsgn_temps['approach_k'] = OpenStudio.convert(dsgn_temps['approach_r'], 'R', 'K').get

  # EMS programs
  programs = []

  # Make an evap cooler for each zone
  evap_coolers = []
  thermal_zones.each do |zone|
    zone_name_clean = zone.name.get.delete(':')

    # Air loop
    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    air_loop.setName("#{zone_name_clean} Evaporative Cooler")

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps)

    # air handler controls
    # setpoint follows OAT WetBulb
    evap_stpt_manager = OpenStudio::Model::SetpointManagerFollowOutdoorAirTemperature.new(model)
    evap_stpt_manager.setName("#{dsgn_temps['approach_r']} F above OATwb")
    evap_stpt_manager.setReferenceTemperatureType('OutdoorAirWetBulb')
    evap_stpt_manager.setMaximumSetpointTemperature(dsgn_temps['max_clg_dsgn_sup_air_temp_c'])
    evap_stpt_manager.setMinimumSetpointTemperature(dsgn_temps['clg_dsgn_sup_air_temp_c'])
    evap_stpt_manager.setOffsetTemperatureDifference(dsgn_temps['approach_k'])
    evap_stpt_manager.addToNode(air_loop.supplyOutletNode)

    # Schedule to control the airloop availability
    air_loop_avail_sch = OpenStudio::Model::ScheduleConstant.new(model)
    air_loop_avail_sch.setName("#{air_loop.name} Availability Sch")
    air_loop_avail_sch.setValue(1)
    air_loop.setAvailabilitySchedule(air_loop_avail_sch)

    # EMS to turn on Evap Cooler if there is a cooling load in the target zone.
    # Without this EMS, the airloop runs 24/7-365 even when there is no load in the zone.

    # Create a sensor to read the zone load
    zn_load_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model,
                                                                         'Zone Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate')
    zn_load_sensor.setName("#{OpenstudioStandards::HVAC.ems_friendly_name(zone_name_clean)} Clg Load Sensor")
    zn_load_sensor.setKeyName(zone.handle.to_s)

    # Create an actuator to set the airloop availability
    air_loop_avail_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(air_loop_avail_sch,
                                                                                    'Schedule:Constant',
                                                                                    'Schedule Value')
    air_loop_avail_actuator.setName("#{OpenstudioStandards::HVAC.ems_friendly_name(air_loop.name)} Availability Actuator")

    # Create a program to turn on Evap Cooler if
    # there is a cooling load in the target zone.
    # Load < 0.0 is a cooling load.
    avail_program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    avail_program.setName("#{OpenstudioStandards::HVAC.ems_friendly_name(air_loop.name)} Availability Control")
    avail_program_body = <<-EMS
      IF #{zn_load_sensor.handle} < 0.0
        SET #{air_loop_avail_actuator.handle} = 1
      ELSE
        SET #{air_loop_avail_actuator.handle} = 0
      ENDIF
    EMS
    avail_program.setBody(avail_program_body)

    programs << avail_program

    # Direct Evap Cooler
    # @todo better assumptions for fan pressure rise
    evap = OpenStudio::Model::EvaporativeCoolerDirectResearchSpecial.new(model, model.alwaysOnDiscreteSchedule)
    evap.setName("#{zone.name} Evap Media")
    # assume 90% design effectiveness from https://basc.pnnl.gov/resource-guides/evaporative-cooling-systems#edit-group-description
    evap.setCoolerDesignEffectiveness(0.90)
    evap.autosizePrimaryAirDesignFlowRate
    evap.autosizeRecirculatingWaterPumpPowerConsumption
    # use suggested E+ default values of 90.0 W-s/m^3 for pump sizing factor and 3.0 for blowdown concentration
    evap.setWaterPumpPowerSizingFactor(90.0)
    evap.setBlowdownConcentrationRatio(3.0)
    evap.addToNode(air_loop.supplyInletNode)

    # Fan (cycling), must be inside unitary system to cycle on airloop
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Evap_Cooler_Supply_Fan',
                                                       fan_name: "#{zone.name} Evap Cooler Supply Fan")
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # Dummy zero-capacity cooling coil
    clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                             name: 'Dummy Always Off DX Coil',
                                                                             schedule: model.alwaysOffDiscreteSchedule)
    unitary_system = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary_system.setName("#{zone.name} Evap Cooler Cycling Fan")
    unitary_system.setSupplyFan(fan)
    unitary_system.setCoolingCoil(clg_coil)
    unitary_system.setControllingZoneorThermostatLocation(zone)
    unitary_system.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    unitary_system.setFanPlacement('BlowThrough')
    if model.version < OpenStudio::VersionString.new('3.7.0')
      unitary_system.setSupplyAirFlowRateMethodDuringCoolingOperation('SupplyAirFlowRate')
      unitary_system.setSupplyAirFlowRateMethodDuringHeatingOperation('SupplyAirFlowRate')
      unitary_system.setSupplyAirFlowRateMethodWhenNoCoolingorHeatingisRequired('SupplyAirFlowRate')
    else
      unitary_system.autosizeSupplyAirFlowRateDuringCoolingOperation
      unitary_system.autosizeSupplyAirFlowRateDuringHeatingOperation
      unitary_system.autosizeSupplyAirFlowRateWhenNoCoolingorHeatingisRequired
    end
    unitary_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)
    unitary_system.addToNode(air_loop.supplyInletNode)

    # Outdoor air intake system
    oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
    oa_intake_controller.setName("#{air_loop.name} OA Controller")
    oa_intake_controller.setMinimumLimitType('FixedMinimum')
    oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
    oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
    oa_intake_controller.setMinimumFractionofOutdoorAirSchedule(model.alwaysOnDiscreteSchedule)
    controller_mv = oa_intake_controller.controllerMechanicalVentilation
    controller_mv.setName("#{air_loop.name} Vent Controller")
    controller_mv.setSystemOutdoorAirMethod('ZoneSum')

    oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
    oa_intake.setName("#{air_loop.name} OA System")
    oa_intake.addToNode(air_loop.supplyInletNode)

    # make an air terminal for the zone
    air_terminal = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    air_terminal.setName("#{zone.name} Air Terminal")

    # attach new terminal to the zone and to the airloop
    air_loop.multiAddBranchForZone(zone, air_terminal.to_HVACComponent.get)

    sizing_zone = zone.sizingZone
    sizing_zone.setCoolingDesignAirFlowMethod('DesignDay')
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])

    evap_coolers << air_loop
  end

  # Create a programcallingmanager
  avail_pcm = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
  avail_pcm.setName('EvapCoolerAvailabilityProgramCallingManager')
  avail_pcm.setCallingPoint('AfterPredictorAfterHVACManagers')
  programs.each do |program|
    avail_pcm.addProgram(program)
  end

  return evap_coolers
end

#model_add_exhaust_fan(model, thermal_zones, flow_rate: nil, availability_sch_name: nil, flow_fraction_schedule_name: nil, balanced_exhaust_fraction_schedule_name: nil) ⇒ Array<OpenStudio::Model::FanZoneExhaust>

TODO:

use the create_fan_zone_exhaust method, default to 1.25 inH2O pressure rise and fan efficiency of 0.6

Adds an exhaust fan to each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    an array of thermal zones

  • flow_rate (Double) (defaults to: nil)

    the exhaust fan flow rate in m^3/s

  • availability_sch_name (String) (defaults to: nil)

    the name of the fan availability schedule

  • flow_fraction_schedule_name (String) (defaults to: nil)

    the name of the flow fraction schedule

  • balanced_exhaust_fraction_schedule_name (String) (defaults to: nil)

    the name of the balanced exhaust fraction schedule

Returns:

  • (Array<OpenStudio::Model::FanZoneExhaust>)

    an array of exhaust fans created



6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6142

def model_add_exhaust_fan(model,
                          thermal_zones,
                          flow_rate: nil,
                          availability_sch_name: nil,
                          flow_fraction_schedule_name: nil,
                          balanced_exhaust_fraction_schedule_name: nil)

  if availability_sch_name.nil?
    availability_schedule = model.alwaysOnDiscreteSchedule
  else
    availability_schedule = model_add_schedule(model, availability_sch_name)
  end

  # make an exhaust fan for each zone
  fans = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding zone exhaust fan for #{zone.name}.")
    fan = OpenStudio::Model::FanZoneExhaust.new(model)
    fan.setName("#{zone.name} Exhaust Fan")
    fan.setAvailabilitySchedule(availability_schedule)

    # input the flow rate as a number (assign directly) or from an array (assign each flow rate to each zone)
    if flow_rate.is_a? Numeric
      fan.setMaximumFlowRate(flow_rate)
    elsif flow_rate.instance_of?(::Array)
      index = thermal_zones.index(zone)
      flow_rate_zone = flow_rate[index]
      fan.setMaximumFlowRate(flow_rate_zone)
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', 'Wrong format of flow rate')
    end

    unless flow_fraction_schedule_name.nil?
      fan.setFlowFractionSchedule(model_add_schedule(model, flow_fraction_schedule_name))
    end

    fan.setSystemAvailabilityManagerCouplingMode('Decoupled')
    unless balanced_exhaust_fraction_schedule_name.nil?
      fan.setBalancedExhaustFractionSchedule(model_add_schedule(model, balanced_exhaust_fraction_schedule_name))
    end

    fan.addToThermalZone(zone)
    fans << fan
  end

  return fans
end

#model_add_four_pipe_fan_coil(model, thermal_zones, chilled_water_loop, hot_water_loop: nil, ventilation: false, capacity_control_method: 'CyclingFan') ⇒ Array<OpenStudio::Model::ZoneHVACFourPipeFanCoil>

Adds four pipe fan coil units to each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to add fan coil units

  • chilled_water_loop (OpenStudio::Model::PlantLoop)

    the chilled water loop that serves the fan coils.

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    the hot water loop that serves the fan coils. If nil, a zero-capacity, electric heating coil set to Always-Off will be included in the unit.

  • ventilation (Boolean) (defaults to: false)

    If true, ventilation will be supplied through the unit. If false, no ventilation will be supplied through the unit, with the expectation that it will be provided by a DOAS or separate system.

  • capacity_control_method (String) (defaults to: 'CyclingFan')

    Capacity control method for the fan coil. Options are ConstantFanVariableFlow, CyclingFan, VariableFanVariableFlow, and VariableFanConstantFlow. If VariableFan, the fan will be VariableVolume.

Returns:

  • (Array<OpenStudio::Model::ZoneHVACFourPipeFanCoil>)

    array of fan coil units.



4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4682

def model_add_four_pipe_fan_coil(model,
                                 thermal_zones,
                                 chilled_water_loop,
                                 hot_water_loop: nil,
                                 ventilation: false,
                                 capacity_control_method: 'CyclingFan')

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # make a fan coil unit for each zone
  fcus = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding fan coil for #{zone.name}.")
    sizing_zone = zone.sizingZone
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    if chilled_water_loop
      fcu_clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                                         chilled_water_loop,
                                                                         name: "#{zone.name} FCU Cooling Coil")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Fan coil units require a chilled water loop, but none was provided.')
      return false
    end

    if hot_water_loop
      fcu_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                         hot_water_loop,
                                                                         name: "#{zone.name} FCU Heating Coil",
                                                                         rated_outlet_air_temperature: dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    else
      # Zero-capacity, always-off electric heating coil
      fcu_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                            name: "#{zone.name} No Heat",
                                                                            schedule: model.alwaysOffDiscreteSchedule,
                                                                            nominal_capacity: 0.0)
    end

    case capacity_control_method
    when 'VariableFanVariableFlow', 'VariableFanConstantFlow'
      fcu_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                             'Fan_Coil_VarSpeed_Fan',
                                                             fan_name: "#{zone.name} Fan Coil Variable Fan",
                                                             end_use_subcategory: 'FCU Fans')
    else
      fcu_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                             'Fan_Coil_Fan',
                                                             fan_name: "#{zone.name} Fan Coil fan",
                                                             end_use_subcategory: 'FCU Fans')
    end
    fcu_fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
    fcu_fan.autosizeMaximumFlowRate

    fcu = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new(model,
                                                         model.alwaysOnDiscreteSchedule,
                                                         fcu_fan,
                                                         fcu_clg_coil,
                                                         fcu_htg_coil)
    fcu.setName("#{zone.name} FCU")
    fcu.setCapacityControlMethod(capacity_control_method)
    fcu.autosizeMaximumSupplyAirFlowRate
    unless ventilation
      fcu.setMaximumOutdoorAirFlowRate(0.0)
    end
    fcu.addToThermalZone(zone)
    fcus << fcu
  end

  return fcus
end

#model_add_furnace_central_ac(model, thermal_zones, heating: true, cooling: false, ventilation: false) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Adds a forced air furnace or central AC to each zone. Default is a forced air furnace without outdoor air Code adapted from: https://github.com/NREL/OpenStudio-BEopt/blob/master/measures/ResidentialHVACFurnaceFuel/measure.rb

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to add fan coil units to.

  • heating (Boolean) (defaults to: true)

    if true, the unit will include a NaturalGas heating coil

  • cooling (Boolean) (defaults to: false)

    if true, the unit will include a DX cooling coil

  • ventilation (Boolean) (defaults to: false)

    if true, the unit will include an OA intake

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    and array of air loops representing the furnaces



5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5359

def model_add_furnace_central_ac(model,
                                 thermal_zones,
                                 heating: true,
                                 cooling: false,
                                 ventilation: false)

  if heating && cooling
    equip_name = 'Central Heating and AC'
  elsif heating && !cooling
    equip_name = 'Furnace'
  elsif cooling && !heating
    equip_name = 'Central AC'
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', 'Heating and cooling both disabled, not a valid Furnace or Central AC selection, no equipment was added.')
    return false
  end

  # defaults
  afue = 0.78
  # seer = 13.0
  eer = 11.1
  shr = 0.73
  ac_w_per_cfm = 0.365
  crank_case_heat_w = 0.0
  crank_case_max_temp_f = 55.0

  furnaces = []
  thermal_zones.each do |zone|
    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    air_loop.setName("#{zone.name} #{equip_name}")
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding furnace AC for #{zone.name}.")

    # default design temperatures across all air loops
    dsgn_temps = standard_design_sizing_temperatures

    # adjusted temperatures for furnace_central_ac
    dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
    dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
    dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, sizing_option: 'NonCoincident')
    sizing_system.setAllOutdoorAirinCooling(true)
    sizing_system.setAllOutdoorAirinHeating(true)

    # create heating coil
    htg_coil = nil
    if heating
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                   name: "#{air_loop.name} Heating Coil",
                                                                   efficiency: OpenstudioStandards::HVAC.afue_to_thermal_eff(afue))
    end

    # create cooling coil
    clg_coil = nil
    if cooling
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} Cooling Coil",
                                                                               type: 'Residential Central AC')
      clg_coil.setRatedSensibleHeatRatio(shr)
      clg_coil.setRatedCOP(OpenStudio::OptionalDouble.new(OpenstudioStandards::HVAC.eer_to_cop_no_fan(eer)))
      clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(OpenStudio::OptionalDouble.new(ac_w_per_cfm / OpenStudio.convert(1.0, 'cfm', 'm^3/s').get))
      clg_coil.setNominalTimeForCondensateRemovalToBegin(OpenStudio::OptionalDouble.new(1000.0))
      clg_coil.setRatioOfInitialMoistureEvaporationRateAndSteadyStateLatentCapacity(OpenStudio::OptionalDouble.new(1.5))
      clg_coil.setMaximumCyclingRate(OpenStudio::OptionalDouble.new(3.0))
      clg_coil.setLatentCapacityTimeConstant(OpenStudio::OptionalDouble.new(45.0))
      clg_coil.setCondenserType('AirCooled')
      clg_coil.setCrankcaseHeaterCapacity(OpenStudio::OptionalDouble.new(crank_case_heat_w))
      clg_coil.setMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation(OpenStudio::OptionalDouble.new(OpenStudio.convert(crank_case_max_temp_f, 'F', 'C').get))
    end

    # create fan
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Residential_HVAC_Fan',
                                                       fan_name: "#{air_loop.name} Supply Fan",
                                                       end_use_subcategory: 'Residential HVAC Fans')
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    if ventilation
      # create outdoor air intake
      oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
      oa_intake_controller.setName("#{air_loop.name} OA Controller")
      oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
      oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
      oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
      oa_intake.setName("#{air_loop.name} OA System")
      oa_intake.addToNode(air_loop.supplyInletNode)
    end

    # create unitary system (holds the coils and fan)
    unitary = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary.setName("#{air_loop.name} Unitary System")
    unitary.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
    unitary.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    unitary.setControllingZoneorThermostatLocation(zone)
    unitary.addToNode(air_loop.supplyInletNode)

    # set flow rates during different conditions
    unitary.setSupplyAirFlowRateDuringHeatingOperation(0.0) unless heating
    unitary.setSupplyAirFlowRateDuringCoolingOperation(0.0) unless cooling
    unitary.setSupplyAirFlowRateWhenNoCoolingorHeatingisRequired(0.0) unless ventilation

    # attach the coils and fan
    unitary.setHeatingCoil(htg_coil) if htg_coil
    unitary.setCoolingCoil(clg_coil) if clg_coil
    unitary.setSupplyFan(fan)
    unitary.setFanPlacement('BlowThrough')
    unitary.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)

    # create a diffuser
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{zone.name} Direct Air")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    furnaces << air_loop
  end

  return furnaces
end

#model_add_ground_hx_loop(model, system_name: 'Ground HX Loop') ⇒ OpenStudio::Model::PlantLoop

TODO:

replace condenser loop w/ ground HX model that does not involve district objects

Creates loop that roughly mimics a properly sized ground heat exchanger for supplemental heating/cooling and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_name (String) (defaults to: 'Ground HX Loop')

    the name of the system, or nil in which case it will be defaulted

Returns:

  • (OpenStudio::Model::PlantLoop)

    the resulting plant loop



972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 972

def model_add_ground_hx_loop(model,
                             system_name: 'Ground HX Loop')
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding ground source loop.')

  # create ground hx loop
  ground_hx_loop = OpenStudio::Model::PlantLoop.new(model)
  if system_name.nil?
    ground_hx_loop.setName('Ground HX Loop')
  else
    ground_hx_loop.setName(system_name)
  end

  # ground hx loop sizing and controls
  ground_hx_loop.setMinimumLoopTemperature(5.0)
  ground_hx_loop.setMaximumLoopTemperature(80.0)
  delta_t_k = OpenStudio.convert(12.0, 'R', 'K').get # temp change at high and low entering condition
  min_inlet_c = OpenStudio.convert(30.0, 'F', 'C').get # low entering condition.
  max_inlet_c = OpenStudio.convert(90.0, 'F', 'C').get # high entering condition

  # calculate the linear formula that defines outlet temperature based on inlet temperature of the ground hx
  min_outlet_c = min_inlet_c + delta_t_k
  max_outlet_c = max_inlet_c - delta_t_k
  slope_c_per_c = (max_outlet_c - min_outlet_c) / (max_inlet_c - min_inlet_c)
  intercept_c = min_outlet_c - (slope_c_per_c * min_inlet_c)

  sizing_plant = ground_hx_loop.sizingPlant
  sizing_plant.setLoopType('Heating')
  sizing_plant.setDesignLoopExitTemperature(max_outlet_c)
  sizing_plant.setLoopDesignTemperatureDifference(delta_t_k)

  # create pump
  pump = OpenStudio::Model::PumpConstantSpeed.new(model)
  pump.setName("#{ground_hx_loop.name} Pump")
  pump.setRatedPumpHead(OpenStudio.convert(60.0, 'ftH_{2}O', 'Pa').get)
  pump.setPumpControlType('Intermittent')
  pump.addToNode(ground_hx_loop.supplyInletNode)

  # use EMS and a PlantComponentTemperatureSource to mimic the operation of the ground heat exchanger.

  # schedule to actuate ground HX outlet temperature
  hx_temp_sch = OpenStudio::Model::ScheduleConstant.new(model)
  hx_temp_sch.setName('Ground HX Temp Sch')
  hx_temp_sch.setValue(24.0)

  ground_hx = OpenStudio::Model::PlantComponentTemperatureSource.new(model)
  ground_hx.setName('Ground HX')
  ground_hx.setTemperatureSpecificationType('Scheduled')
  ground_hx.setSourceTemperatureSchedule(hx_temp_sch)
  ground_hx_loop.addSupplyBranchForComponent(ground_hx)

  hx_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, hx_temp_sch)
  hx_stpt_manager.setName("#{ground_hx.name} Supply Outlet Setpoint")
  hx_stpt_manager.addToNode(ground_hx.outletModelObject.get.to_Node.get)

  loop_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, hx_temp_sch)
  loop_stpt_manager.setName("#{ground_hx_loop.name} Supply Outlet Setpoint")
  loop_stpt_manager.addToNode(ground_hx_loop.supplyOutletNode)

  # edit name to be EMS friendly
  ground_hx_ems_name = OpenstudioStandards::HVAC.ems_friendly_name(ground_hx.name)

  # sensor to read supply inlet temperature
  inlet_temp_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model,
                                                                          'System Node Temperature')
  inlet_temp_sensor.setName("#{ground_hx_ems_name} Inlet Temp Sensor")
  inlet_temp_sensor.setKeyName(ground_hx_loop.supplyInletNode.handle.to_s)

  # actuator to set supply outlet temperature
  outlet_temp_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(hx_temp_sch,
                                                                               'Schedule:Constant',
                                                                               'Schedule Value')
  outlet_temp_actuator.setName("#{ground_hx_ems_name} Outlet Temp Actuator")

  # program to control outlet temperature
  # adjusts delta-t based on calculation of slope and intercept from control temperatures
  program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
  program.setName("#{ground_hx_ems_name} Temperature Control")
  program_body = <<-EMS
    SET Tin = #{inlet_temp_sensor.handle}
    SET Tout = #{slope_c_per_c.round(2)} * Tin + #{intercept_c.round(1)}
    SET #{outlet_temp_actuator.handle} = Tout
  EMS
  program.setBody(program_body)

  # program calling manager
  pcm = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
  pcm.setName("#{program.name} Calling Manager")
  pcm.setCallingPoint('InsideHVACSystemIterationLoop')
  pcm.addProgram(program)

  return ground_hx_loop
end

#model_add_high_temp_radiant(model, thermal_zones, heating_type: 'NaturalGas', combustion_efficiency: 0.8, control_type: 'MeanAirTemperature') ⇒ Array<OpenStudio::Model::ZoneHVACHighTemperatureRadiant>

Creates a high temp radiant heater for each zone and adds it to the model.

array of the resulting radiant heaters.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • heating_type (String) (defaults to: 'NaturalGas')

    valid choices are Gas, Electric

  • combustion_efficiency (Double) (defaults to: 0.8)

    combustion efficiency as decimal

  • control_type (String) (defaults to: 'MeanAirTemperature')

    control type

Returns:

  • (Array<OpenStudio::Model::ZoneHVACHighTemperatureRadiant>)

    an



4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4361

def model_add_high_temp_radiant(model,
                                thermal_zones,
                                heating_type: 'NaturalGas',
                                combustion_efficiency: 0.8,
                                control_type: 'MeanAirTemperature')

  # make a high temp radiant heater for each zone
  radiant_heaters = []
  thermal_zones.each do |zone|
    high_temp_radiant = OpenStudio::Model::ZoneHVACHighTemperatureRadiant.new(model)
    high_temp_radiant.setName("#{zone.name} High Temp Radiant")

    if heating_type.nil? || heating_type == 'NaturalGas' || heating_type == 'Gas'
      high_temp_radiant.setFuelType('NaturalGas')
    else
      high_temp_radiant.setFuelType(heating_type)
    end

    if combustion_efficiency.nil?
      if heating_type == 'NaturalGas' || heating_type == 'Gas'
        high_temp_radiant.setCombustionEfficiency(0.8)
      elsif heating_type == 'Electric'
        high_temp_radiant.setCombustionEfficiency(1.0)
      end
    else
      high_temp_radiant.setCombustionEfficiency(combustion_efficiency)
    end

    # set heating setpoint schedule
    tstat = zone.thermostatSetpointDualSetpoint.get
    if tstat.heatingSetpointTemperatureSchedule.is_initialized
      htg_sch = tstat.heatingSetpointTemperatureSchedule.get
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "For #{zone.name}: Cannot find a heating setpoint schedule for this zone, cannot apply high temp radiant system.")
      return false
    end

    # set defaults
    high_temp_radiant.setHeatingSetpointTemperatureSchedule(htg_sch)
    high_temp_radiant.setTemperatureControlType(control_type)
    high_temp_radiant.setFractionofInputConvertedtoRadiantEnergy(0.8)
    high_temp_radiant.setHeatingThrottlingRange(2)
    high_temp_radiant.addToThermalZone(zone)
    radiant_heaters << high_temp_radiant
  end

  return radiant_heaters
end

#model_add_hp_loop(model, heating_fuel: 'NaturalGas', cooling_fuel: 'Electricity', cooling_type: 'EvaporativeFluidCooler', system_name: 'Heat Pump Loop', sup_wtr_high_temp: 87.0, sup_wtr_low_temp: 67.0, dsgn_sup_wtr_temp: 102.2, dsgn_sup_wtr_temp_delt: 19.8) ⇒ OpenStudio::Model::PlantLoop

TODO:

replace cooling tower with fluid cooler after fixing sizing inputs

Creates a heat pump loop which has a boiler and fluid cooler for supplemental heating/cooling and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • heating_fuel (String) (defaults to: 'NaturalGas')
  • cooling_fuel (String) (defaults to: 'Electricity')

    cooling fuel. Valid options are: Electricity, DistrictCooling

  • cooling_type (String) (defaults to: 'EvaporativeFluidCooler')

    cooling type if not DistrictCooling. Valid options are: CoolingTower, CoolingTowerSingleSpeed, CoolingTowerTwoSpeed, CoolingTowerVariableSpeed, FluidCooler, FluidCoolerSingleSpeed, FluidCoolerTwoSpeed, EvaporativeFluidCooler, EvaporativeFluidCoolerSingleSpeed, EvaporativeFluidCoolerTwoSpeed

  • system_name (String) (defaults to: 'Heat Pump Loop')

    the name of the system, or nil in which case it will be defaulted

  • sup_wtr_high_temp (Double) (defaults to: 87.0)

    target supply water temperature to enable cooling in degrees Fahrenheit, default 65.0F

  • sup_wtr_low_temp (Double) (defaults to: 67.0)

    target supply water temperature to enable heating in degrees Fahrenheit, default 41.0F

  • dsgn_sup_wtr_temp (Double) (defaults to: 102.2)

    design supply water temperature in degrees Fahrenheit, default 102.2F

  • dsgn_sup_wtr_temp_delt (Double) (defaults to: 19.8)

    design supply-return water temperature difference in degrees Rankine, default 19.8R

Returns:

  • (OpenStudio::Model::PlantLoop)

    the resulting plant loop



748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 748

def model_add_hp_loop(model,
                      heating_fuel: 'NaturalGas',
                      cooling_fuel: 'Electricity',
                      cooling_type: 'EvaporativeFluidCooler',
                      system_name: 'Heat Pump Loop',
                      sup_wtr_high_temp: 87.0,
                      sup_wtr_low_temp: 67.0,
                      dsgn_sup_wtr_temp: 102.2,
                      dsgn_sup_wtr_temp_delt: 19.8)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding heat pump loop.')

  # create heat pump loop
  heat_pump_water_loop = OpenStudio::Model::PlantLoop.new(model)
  heat_pump_water_loop.setLoadDistributionScheme('SequentialLoad')
  if system_name.nil?
    heat_pump_water_loop.setName('Heat Pump Loop')
  else
    heat_pump_water_loop.setName(system_name)
  end

  # hot water loop sizing and controls
  if sup_wtr_high_temp.nil?
    sup_wtr_high_temp = 87.0
    sup_wtr_high_temp_c = OpenStudio.convert(sup_wtr_high_temp, 'F', 'C').get
  else
    sup_wtr_high_temp_c = OpenStudio.convert(sup_wtr_high_temp, 'F', 'C').get
  end
  if sup_wtr_low_temp.nil?
    sup_wtr_low_temp = 67.0
    sup_wtr_low_temp_c = OpenStudio.convert(sup_wtr_low_temp, 'F', 'C').get
  else
    sup_wtr_low_temp_c = OpenStudio.convert(sup_wtr_low_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp.nil?
    dsgn_sup_wtr_temp_c = OpenStudio.convert(102.2, 'F', 'C').get
  else
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp_delt.nil?
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(19.8, 'R', 'K').get
  else
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(dsgn_sup_wtr_temp_delt, 'R', 'K').get
  end
  sizing_plant = heat_pump_water_loop.sizingPlant
  sizing_plant.setLoopType('Heating')
  heat_pump_water_loop.setMinimumLoopTemperature(10.0)
  heat_pump_water_loop.setMaximumLoopTemperature(35.0)
  sizing_plant.setDesignLoopExitTemperature(dsgn_sup_wtr_temp_c)
  sizing_plant.setLoopDesignTemperatureDifference(dsgn_sup_wtr_temp_delt_k)
  hp_high_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                     sup_wtr_high_temp_c,
                                                                                     name: "#{heat_pump_water_loop.name} High Temp - #{sup_wtr_high_temp.round(0)}F",
                                                                                     schedule_type_limit: 'Temperature')
  hp_low_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                    sup_wtr_low_temp_c,
                                                                                    name: "#{heat_pump_water_loop.name} Low Temp - #{sup_wtr_low_temp.round(0)}F",
                                                                                    schedule_type_limit: 'Temperature')
  hp_stpt_manager = OpenStudio::Model::SetpointManagerScheduledDualSetpoint.new(model)
  hp_stpt_manager.setName("#{heat_pump_water_loop.name} Scheduled Dual Setpoint")
  hp_stpt_manager.setHighSetpointSchedule(hp_high_temp_sch)
  hp_stpt_manager.setLowSetpointSchedule(hp_low_temp_sch)
  hp_stpt_manager.addToNode(heat_pump_water_loop.supplyOutletNode)

  # create pump
  hp_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
  hp_pump.setName("#{heat_pump_water_loop.name} Pump")
  hp_pump.setRatedPumpHead(OpenStudio.convert(60.0, 'ftH_{2}O', 'Pa').get)
  hp_pump.setPumpControlType('Intermittent')
  hp_pump.addToNode(heat_pump_water_loop.supplyInletNode)

  # add setpoint manager schedule to cooling equipment outlet so correct plant operation scheme is generated
  cooling_equipment_stpt_manager = OpenStudio::Model::SetpointManagerScheduledDualSetpoint.new(model)
  cooling_equipment_stpt_manager.setHighSetpointSchedule(hp_high_temp_sch)
  cooling_equipment_stpt_manager.setLowSetpointSchedule(hp_low_temp_sch)

  # create cooling equipment and add to the loop
  case cooling_fuel
  when 'DistrictCooling'
    cooling_equipment = OpenStudio::Model::DistrictCooling.new(model)
    cooling_equipment.setName("#{heat_pump_water_loop.name} District Cooling")
    cooling_equipment.autosizeNominalCapacity
    heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
    cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} District Cooling Scheduled Dual Setpoint")
  else
    case cooling_type
    when 'CoolingTower', 'CoolingTowerTwoSpeed'
      cooling_equipment = OpenStudio::Model::CoolingTowerTwoSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} CoolingTowerTwoSpeed")
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Cooling Tower Scheduled Dual Setpoint")
    when 'CoolingTowerSingleSpeed'
      cooling_equipment = OpenStudio::Model::CoolingTowerSingleSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} CoolingTowerSingleSpeed")
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Cooling Tower Scheduled Dual Setpoint")
    when 'CoolingTowerVariableSpeed'
      cooling_equipment = OpenStudio::Model::CoolingTowerVariableSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} CoolingTowerVariableSpeed")
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Cooling Tower Scheduled Dual Setpoint")
    when 'FluidCooler', 'FluidCoolerSingleSpeed'
      cooling_equipment = OpenStudio::Model::FluidCoolerSingleSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} FluidCoolerSingleSpeed")
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Fluid Cooler Scheduled Dual Setpoint")
      # Remove hard coded default values
      cooling_equipment.setPerformanceInputMethod('UFactorTimesAreaAndDesignWaterFlowRate')
      cooling_equipment.autosizeDesignWaterFlowRate
      cooling_equipment.autosizeDesignAirFlowRate
    when 'FluidCoolerTwoSpeed'
      cooling_equipment = OpenStudio::Model::FluidCoolerTwoSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} FluidCoolerTwoSpeed")
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Fluid Cooler Scheduled Dual Setpoint")
      # Remove hard coded default values
      cooling_equipment.setPerformanceInputMethod('UFactorTimesAreaAndDesignWaterFlowRate')
      cooling_equipment.autosizeDesignWaterFlowRate
      cooling_equipment.autosizeHighFanSpeedAirFlowRate
      cooling_equipment.autosizeLowFanSpeedAirFlowRate
    when 'EvaporativeFluidCooler', 'EvaporativeFluidCoolerSingleSpeed'
      cooling_equipment = OpenStudio::Model::EvaporativeFluidCoolerSingleSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} EvaporativeFluidCoolerSingleSpeed")
      cooling_equipment.setDesignSprayWaterFlowRate(0.002208) # Based on HighRiseApartment
      cooling_equipment.setPerformanceInputMethod('UFactorTimesAreaAndDesignWaterFlowRate')
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Fluid Cooler Scheduled Dual Setpoint")
    when 'EvaporativeFluidCoolerTwoSpeed'
      cooling_equipment = OpenStudio::Model::EvaporativeFluidCoolerTwoSpeed.new(model)
      cooling_equipment.setName("#{heat_pump_water_loop.name} EvaporativeFluidCoolerTwoSpeed")
      cooling_equipment.setDesignSprayWaterFlowRate(0.002208) # Based on HighRiseApartment
      cooling_equipment.setPerformanceInputMethod('UFactorTimesAreaAndDesignWaterFlowRate')
      heat_pump_water_loop.addSupplyBranchForComponent(cooling_equipment)
      cooling_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Fluid Cooler Scheduled Dual Setpoint")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Cooling fuel type #{cooling_type} is not a valid option, no cooling equipment will be added.")
      return false
    end
  end
  cooling_equipment_stpt_manager.addToNode(cooling_equipment.outletModelObject.get.to_Node.get)

  # add setpoint manager schedule to heating equipment outlet so correct plant operation scheme is generated
  heating_equipment_stpt_manager = OpenStudio::Model::SetpointManagerScheduledDualSetpoint.new(model)
  heating_equipment_stpt_manager.setHighSetpointSchedule(hp_high_temp_sch)
  heating_equipment_stpt_manager.setLowSetpointSchedule(hp_low_temp_sch)

  # switch statement to handle district heating name change
  if model.version < OpenStudio::VersionString.new('3.7.0')
    if heating_fuel == 'DistrictHeatingWater' || heating_fuel == 'DistrictHeatingSteam'
      heating_fuel = 'DistrictHeating'
    end
  else
    heating_fuel = 'DistrictHeatingWater' if heating_fuel == 'DistrictHeating'
  end

  # create heating equipment and add to the loop
  case heating_fuel
  when 'DistrictHeating'
    heating_equipment = OpenStudio::Model::DistrictHeating.new(model)
    heating_equipment.setName("#{heat_pump_water_loop.name} District Heating")
    heating_equipment.autosizeNominalCapacity
    heat_pump_water_loop.addSupplyBranchForComponent(heating_equipment)
    heating_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} District Heating Scheduled Dual Setpoint")
  when 'DistrictHeatingWater'
    heating_equipment = OpenStudio::Model::DistrictHeatingWater.new(model)
    heating_equipment.setName("#{heat_pump_water_loop.name} District Heating")
    heating_equipment.autosizeNominalCapacity
    heat_pump_water_loop.addSupplyBranchForComponent(heating_equipment)
    heating_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} District Heating Scheduled Dual Setpoint")
  when 'DistrictHeatingSteam'
    heating_equipment = OpenStudio::Model::DistrictHeatingSteam.new(model)
    heating_equipment.setName("#{heat_pump_water_loop.name} District Heating")
    heating_equipment.autosizeNominalCapacity
    heat_pump_water_loop.addSupplyBranchForComponent(heating_equipment)
    heating_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} District Heating Scheduled Dual Setpoint")
  when 'AirSourceHeatPump', 'ASHP'
    heating_equipment = OpenstudioStandards::HVAC.create_central_air_source_heat_pump(model, heat_pump_water_loop)
    heating_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} ASHP Scheduled Dual Setpoint")
  when 'Electricity', 'Gas', 'NaturalGas', 'Propane', 'PropaneGas', 'FuelOilNo1', 'FuelOilNo2'
    heating_equipment = OpenstudioStandards::HVAC.create_boiler_hot_water(model,
                                                                          hot_water_loop: heat_pump_water_loop,
                                                                          name: "#{heat_pump_water_loop.name} Supplemental Boiler",
                                                                          fuel_type: heating_fuel,
                                                                          flow_mode: 'ConstantFlow',
                                                                          lvg_temp_dsgn_f: 86.0, # 30.0 degrees Celsius
                                                                          min_plr: 0.0,
                                                                          max_plr: 1.2,
                                                                          opt_plr: 1.0)
    heating_equipment_stpt_manager.setName("#{heat_pump_water_loop.name} Boiler Scheduled Dual Setpoint")
  else
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Boiler fuel type #{heating_fuel} is not valid, no heating equipment will be added.")
    return false
  end
  heating_equipment_stpt_manager.addToNode(heating_equipment.outletModelObject.get.to_Node.get)

  # add heat pump water loop pipes
  supply_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_bypass_pipe.setName("#{heat_pump_water_loop.name} Supply Bypass")
  heat_pump_water_loop.addSupplyBranchForComponent(supply_bypass_pipe)

  demand_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_bypass_pipe.setName("#{heat_pump_water_loop.name} Demand Bypass")
  heat_pump_water_loop.addDemandBranchForComponent(demand_bypass_pipe)

  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe.setName("#{heat_pump_water_loop.name} Supply Outlet")
  supply_outlet_pipe.addToNode(heat_pump_water_loop.supplyOutletNode)

  demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_inlet_pipe.setName("#{heat_pump_water_loop.name} Demand Inlet")
  demand_inlet_pipe.addToNode(heat_pump_water_loop.demandInletNode)

  demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_outlet_pipe.setName("#{heat_pump_water_loop.name} Demand Outlet")
  demand_outlet_pipe.addToNode(heat_pump_water_loop.demandOutletNode)

  return heat_pump_water_loop
end

#model_add_hvac(model, building_type, climate_zone, prototype_input) ⇒ Boolean

Adds the prototype HVAC system to the model

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • building_type (String)

    the building type

  • climate_zone (String)

    ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'

  • prototype_input (Hash)

    hash of prototype inputs

Returns:

  • (Boolean)

    returns true if successful, false if not



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.Model.hvac.rb', line 9

def model_add_hvac(model, building_type, climate_zone, prototype_input)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started Adding HVAC')

  # Get the list of HVAC systems, as defined for each building in the Prototype.building_name files

  # Add each HVAC system
  @system_to_space_map.each do |system|
    thermal_zones = model_get_zones_from_spaces_on_system(model, system)
    return_plenum = model_get_return_plenum_from_system(model, system)

    # Add the HVAC systems
    case system['type']
    when 'VAV'
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model,
                                           'NaturalGas',
                                           dsgn_sup_wtr_temp: system['hot_water_design_supply_water_temperature'],
                                           boiler_lvg_temp_dsgn: system['boiler_leaving_temperature_design'],
                                           boiler_out_temp_lmt: system['boiler_outlet_temperature_limit'],
                                           boiler_sizing_factor: system['boiler_sizing_factor'])
                       end

      # Retrieve the existing chilled water loop or add a new one if necessary.
      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      else
        # get num_chillers from prototype_input
        num_chillers = prototype_input['chw_number_chillers']
        if num_chillers.nil? || num_chillers.to_i < 1
          num_chillers = 1
        end
        # update num_chillers if specified in @system_to_space_map
        if !system['chw_number_chillers'].nil? && system['chw_number_chillers'].to_i > 0
          num_chillers = system['chw_number_chillers']
        end

        # get number_cooling_towers if specified in @system_to_space_map
        number_cooling_towers = 1
        if !system['number_cooling_towers'].nil? && system['number_cooling_towers'].to_i > 0
          number_cooling_towers = system['number_cooling_towers']
        end

        condenser_water_loop = nil
        if system['chiller_cooling_type'] == 'WaterCooled'
          condenser_water_loop = model_add_cw_loop(model,
                                                   cooling_tower_type: 'Open Cooling Tower',
                                                   cooling_tower_fan_type: 'Centrifugal',
                                                   cooling_tower_capacity_control: 'Variable Speed Fan',
                                                   number_of_cells_per_tower: 2,
                                                   number_cooling_towers: number_cooling_towers.to_i)
        end
        chilled_water_loop = model_add_chw_loop(model,
                                                cooling_fuel: 'Electricity',
                                                dsgn_sup_wtr_temp: system['chilled_water_design_supply_water_temperature'],
                                                dsgn_sup_wtr_temp_delt: system['chilled_water_design_supply_water_temperature_delta'],
                                                chw_pumping_type: system['chw_pumping_type'],
                                                chiller_cooling_type: system['chiller_cooling_type'],
                                                chiller_condenser_type: system['chiller_condenser_type'],
                                                chiller_compressor_type: system['chiller_compressor_type'],
                                                condenser_water_loop: condenser_water_loop,
                                                num_chillers: num_chillers.to_i)
      end

      # Add the VAV
      model_add_vav_reheat(model,
                           thermal_zones,
                           system_name: system['name'],
                           return_plenum: return_plenum,
                           reheat_type: 'Water',
                           hot_water_loop: hot_water_loop,
                           chilled_water_loop: chilled_water_loop,
                           hvac_op_sch: system['operation_schedule'],
                           oa_damper_sch: system['oa_damper_schedule'],
                           fan_efficiency: 0.62,
                           fan_motor_efficiency: 0.9,
                           fan_pressure_rise: 4.0,
                           min_sys_airflow_ratio: system['min_sys_airflow_ratio'],
                           vav_sizing_option: system['vav_sizing_option'])

    when 'CAV'
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model, 'NaturalGas')
                       end

      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      elsif building_type == 'Hospital'
        condenser_water_loop = nil
        condenser_water_loop = model_add_cw_loop(model, cooling_tower_capacity_control: 'Variable Speed Fan') if system['chiller_cooling_type'] == 'WaterCooled'
        chilled_water_loop = model_add_chw_loop(model,
                                                cooling_fuel: 'Electricity',
                                                dsgn_sup_wtr_temp: system['chilled_water_design_supply_water_temperature'],
                                                dsgn_sup_wtr_temp_delt: system['chilled_water_design_supply_water_temperature_delta'],
                                                chw_pumping_type: system['chw_pumping_type'],
                                                chiller_cooling_type: system['chiller_cooling_type'],
                                                chiller_condenser_type: system['chiller_condenser_type'],
                                                chiller_compressor_type: system['chiller_compressor_type'],
                                                condenser_water_loop: condenser_water_loop)
      end

      # Add the CAV
      model_add_cav(model,
                    thermal_zones,
                    system_name: system['name'],
                    hot_water_loop: hot_water_loop,
                    chilled_water_loop: chilled_water_loop,
                    hvac_op_sch: system['operation_schedule'],
                    oa_damper_sch: system['oa_damper_schedule'],
                    fan_efficiency: 0.62,
                    fan_motor_efficiency: 0.9,
                    fan_pressure_rise: 4.0)

    when 'PSZ-AC'
      # Special logic to make unitary heat pumps all blow-through
      fan_position = 'DrawThrough'
      if system['heating_type'] == 'Single Speed Heat Pump' ||
         system['heating_type'] == 'Water To Air Heat Pump'
        fan_position = 'BlowThrough'
      end

      # Special logic to make a heat pump loop if necessary
      heat_pump_loop = nil
      if system['heating_type'] == 'Water To Air Heat Pump'
        # @note code_sections [90.1-2016_6.5.5.2.1]
        # change highrise apartment heat rejection fan (< 5hp) from single speed to two speed evaporative fluid cooler
        # @todo this is temporary fix, it should be applied to all heat rejection devices smaller than 5hp.
        if system['heat_pump_loop_cooling_type'].nil?
          hp_loop_cooling_type = 'EvaporativeFluidCooler'
        else
          hp_loop_cooling_type = system['heat_pump_loop_cooling_type']
        end
        heat_pump_loop = model_get_or_add_heat_pump_loop(model, 'NaturalGas', 'Electricity', heat_pump_loop_cooling_type: hp_loop_cooling_type)
      end
      # if water to air heat pump is using existing chilled water loop and hot water loop as source
      # get existing loops, and assign heat_pump_cool_loop = chilled_water_loop, heat_pump_heat_loop = hot_water_loop
      # applicable to super tall building elevator machine room that is in the middle of the building

      model_add_psz_ac(model,
                       thermal_zones,
                       system_name: system['name'],
                       cooling_type: system['cooling_type'],
                       chilled_water_loop: heat_pump_loop,
                       heating_type: system['heating_type'],
                       supplemental_heating_type: system['supplemental_heating_type'],
                       hot_water_loop: heat_pump_loop,
                       fan_location: fan_position,
                       fan_type: system['fan_type'],
                       hvac_op_sch: system['operation_schedule'],
                       oa_damper_sch: system['oa_damper_schedule'])

    when 'PVAV'
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       elsif building_type == 'MediumOffice' || building_type == 'MediumOfficeDetailed'
                         nil
                       else
                         model_add_hw_loop(model,
                                           'NaturalGas',
                                           pump_spd_ctrl: system['hotwater_pump_speed_control'])
                       end
      case system['electric_reheat']
      when true
        electric_reheat = true
      else
        electric_reheat = false
      end
      model_add_pvav(model,
                     thermal_zones,
                     system_name: system['name'],
                     hvac_op_sch: system['operation_schedule'],
                     oa_damper_sch: system['oa_damper_schedule'],
                     electric_reheat: electric_reheat,
                     hot_water_loop: hot_water_loop,
                     return_plenum: return_plenum)

    when 'DOAS Cold Supply'
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model, 'NaturalGas')
                       end

      # Retrieve the existing chilled water loop or add a new one if necessary.
      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      else
        num_chillers = 1
        if !system['num_chillers'].nil? && system['num_chillers'].to_i > 0
          num_chillers = system['num_chillers'].to_i
        end
        condenser_water_loop = nil
        if system['chiller_cooling_type'] == 'WaterCooled'
          condenser_water_loop = model_add_cw_loop(model,
                                                   cooling_tower_type: 'Open Cooling Tower',
                                                   cooling_tower_fan_type: 'Centrifugal',
                                                   cooling_tower_capacity_control: 'Fan Cycling',
                                                   number_of_cells_per_tower: 2,
                                                   number_cooling_towers: num_chillers)
        end
        chilled_water_loop = model_add_chw_loop(model,
                                                cooling_fuel: 'Electricity',
                                                dsgn_sup_wtr_temp: system['chilled_water_design_supply_water_temperature'],
                                                dsgn_sup_wtr_temp_delt: system['chilled_water_design_supply_water_temperature_delta'],
                                                chw_pumping_type: system['chw_pumping_type'],
                                                chiller_cooling_type: system['chiller_cooling_type'],
                                                chiller_condenser_type: system['chiller_condenser_type'],
                                                chiller_compressor_type: system['chiller_compressor_type'],
                                                num_chillers: num_chillers,
                                                condenser_water_loop: condenser_water_loop)
      end
      model_add_doas_cold_supply(model,
                                 thermal_zones,
                                 system_name: system['name'],
                                 hot_water_loop: hot_water_loop,
                                 chilled_water_loop: chilled_water_loop,
                                 hvac_op_sch: system['operation_schedule'],
                                 min_oa_sch: system['oa_damper_schedule'],
                                 min_frac_oa_sch: system['minimum_fraction_of_outdoor_air_schedule'],
                                 fan_maximum_flow_rate: system['fan_maximum_flow_rate'],
                                 econo_ctrl_mthd: system['economizer_control_method'],
                                 doas_control_strategy: system['doas_control_strategy'],
                                 clg_dsgn_sup_air_temp: system['cooling_design_supply_air_temperature'],
                                 htg_dsgn_sup_air_temp: system['heating_design_supply_air_temperature'])

      model_add_four_pipe_fan_coil(model,
                                   thermal_zones,
                                   chilled_water_loop,
                                   hot_water_loop: hot_water_loop,
                                   ventilation: false)

    when 'Packaged DOAS'
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model, 'NaturalGas')
                       end
      # check inputs
      doas_type = system['doas_type'] || 'DOASCV'
      econo_ctrl_mthd = system['economizer_control_method'] || 'NoEconomizer'
      doas_control_strategy = system['doas_control_strategy'] || 'NeutralSupplyAir'
      clg_dsgn_sup_air_temp = system['cooling_design_supply_air_temperature'] || 60.0
      htg_dsgn_sup_air_temp = system['heating_design_supply_air_temperature'] || 70.0

      # for boolean input, this makes sure we get the correct input translation
      if system['include_exhaust_fan'].nil? || (system['include_exhaust_fan'].to_s.downcase == 'true')
        include_exhaust_fan = true
      else
        include_exhaust_fan = false
      end
      if (system['demand_control_ventilation'].to_s.downcase == 'true')
        demand_control_ventilation = true
      else
        demand_control_ventilation = false
      end

      model_add_doas(model,
                     thermal_zones,
                     system_name: system['name'],
                     doas_type: doas_type,
                     hot_water_loop: hot_water_loop,
                     chilled_water_loop: nil,
                     hvac_op_sch: system['operation_schedule'],
                     min_oa_sch: system['oa_damper_schedule'],
                     min_frac_oa_sch: system['minimum_fraction_of_outdoor_air_schedule'],
                     fan_maximum_flow_rate: system['fan_maximum_flow_rate'],
                     econo_ctrl_mthd: econo_ctrl_mthd,
                     include_exhaust_fan: include_exhaust_fan,
                     demand_control_ventilation: demand_control_ventilation,
                     doas_control_strategy: doas_control_strategy,
                     clg_dsgn_sup_air_temp: clg_dsgn_sup_air_temp,
                     htg_dsgn_sup_air_temp: htg_dsgn_sup_air_temp)

    when 'DC' # Data Center in Large Office building
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = model_get_or_add_hot_water_loop(model, 'NaturalGas')

      # Set heat pump loop cooling type to CoolingTowerTwoSpeed if not specified in system hash
      heat_pump_loop_cooling_type = system['heat_pump_loop_cooling_type'].nil? ? 'CoolingTowerTwoSpeed' : system['heat_pump_loop_cooling_type']

      heat_pump_loop = model_get_or_add_heat_pump_loop(model, 'NaturalGas', 'Electricity',
                                                       heat_pump_loop_cooling_type: heat_pump_loop_cooling_type)
      model_add_data_center_hvac(model,
                                 thermal_zones,
                                 hot_water_loop,
                                 heat_pump_loop,
                                 hvac_op_sch: system['flow_fraction_schedule'],
                                 oa_damper_sch: system['flow_fraction_schedule'],
                                 main_data_center: system['main_data_center'])

    when 'CRAC' # Small Data Center
      model_add_crac(model,
                     thermal_zones,
                     climate_zone,
                     system_name: system['name'],
                     hvac_op_sch: system['CRAC_operation_schedule'],
                     oa_damper_sch: system['CRAC_oa_damper_schedule'],
                     fan_location: 'DrawThrough',
                     fan_type: system['CRAC_fan_type'],
                     cooling_type: system['CRAC_cooling_type'],
                     supply_temp_sch: nil)

    when 'CRAH' # Large Data Center (standalone)
      # Retrieve the existing chilled water loop or add a new one if necessary.
      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      else
        condenser_water_loop = nil
        if system['chiller_cooling_type'] == 'WaterCooled'
          condenser_water_loop = model_add_cw_loop(model,
                                                   cooling_tower_type: 'Open Cooling Tower',
                                                   cooling_tower_fan_type: 'Centrifugal',
                                                   cooling_tower_capacity_control: 'Fan Cycling',
                                                   number_of_cells_per_tower: 2,
                                                   number_cooling_towers: 1)
        end
        chilled_water_loop = model_add_chw_loop(model,
                                                cooling_fuel: 'Electricity',
                                                dsgn_sup_wtr_temp: system['chilled_water_design_supply_water_temperature'],
                                                dsgn_sup_wtr_temp_delt: system['chilled_water_design_supply_water_temperature_delta'],
                                                chw_pumping_type: system['chw_pumping_type'],
                                                chiller_cooling_type: system['chiller_cooling_type'],
                                                chiller_condenser_type: system['chiller_condenser_type'],
                                                chiller_compressor_type: system['chiller_compressor_type'],
                                                condenser_water_loop: condenser_water_loop,
                                                waterside_economizer: system['waterside_economizer'])
      end
      model_add_crah(model,
                     thermal_zones,
                     system_name: system['name'],
                     chilled_water_loop: chilled_water_loop,
                     hvac_op_sch: system['operation_schedule'],
                     oa_damper_sch: system['oa_damper_schedule'],
                     return_plenum: nil,
                     supply_temp_sch: nil)

    when 'SAC'
      model_add_split_ac(model,
                         thermal_zones,
                         cooling_type: system['cooling_type'],
                         heating_type: system['heating_type'],
                         supplemental_heating_type: system['supplemental_heating_type'],
                         fan_type: system['fan_type'],
                         hvac_op_sch: system['operation_schedule'],
                         oa_damper_sch: system['oa_damper_schedule'],
                         econ_max_oa_frac_sch: system['econ_max_oa_frac_sch'])

    when 'UnitHeater'
      model_add_unitheater(model,
                           thermal_zones,
                           hvac_op_sch: system['operation_schedule'],
                           fan_control_type: system['fan_type'],
                           fan_pressure_rise: system['fan_static_pressure'],
                           heating_type: system['heating_type'])

    when 'PTAC'
      model_add_ptac(model,
                     thermal_zones,
                     cooling_type: system['cooling_type'],
                     heating_type: system['heating_type'],
                     fan_type: system['fan_type'])

    when 'PTHP'
      model_add_pthp(model,
                     thermal_zones,
                     fan_type: system['fan_type'])

    when 'Exhaust Fan'
      model_add_exhaust_fan(model,
                            thermal_zones,
                            flow_rate: system['flow_rate'],
                            availability_sch_name: system['operation_schedule'],
                            flow_fraction_schedule_name: system['flow_fraction_schedule'],
                            balanced_exhaust_fraction_schedule_name: system['balanced_exhaust_fraction_schedule'])

    when 'Zone Ventilation'
      model_add_zone_ventilation(model,
                                 thermal_zones,
                                 ventilation_type: system['ventilation_type'],
                                 flow_rate: system['flow_rate'],
                                 availability_sch_name: system['operation_schedule'])

    when 'Refrigeration'
      model_add_refrigeration(model,
                              system['case_type'],
                              system['cooling_capacity_per_length'],
                              system['length'],
                              system['evaporator_fan_pwr_per_length'],
                              system['lighting_per_length'],
                              system['lighting_schedule'],
                              system['defrost_pwr_per_length'],
                              system['restocking_schedule'],
                              system['cop'],
                              system['cop_f_of_t_curve_name'],
                              system['condenser_fan_pwr'],
                              system['condenser_fan_pwr_curve_name'],
                              thermal_zones[0])

    # When multiple cases and walk-ins assigned to a system
    when 'Refrigeration_system'
      model_add_refrigeration_system(model,
                                     system['compressor_type'],
                                     system['name'],
                                     system['cases'],
                                     system['walkins'],
                                     thermal_zones[0])

    when 'WSHP'
      condenser_loop = case system['heating_type']
                       when 'Gas'
                         model_get_or_add_heat_pump_loop(model,
                                                         system['heating_type'],
                                                         system['cooling_type'],
                                                         heat_pump_loop_cooling_type: 'CoolingTowerTwoSpeed')
                       else
                         model_get_or_add_ambient_water_loop(model)
                       end
      model_add_water_source_hp(model,
                                thermal_zones,
                                condenser_loop,
                                ventilation: true)

    when 'Fan Coil'
      case system['heating_type']
      when 'Gas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam', 'Electricity'
        hot_water_loop = model_get_or_add_hot_water_loop(model, system['heating_type'])
      when nil
        hot_water_loop = nil
      end
      case system['cooling_type']
      when 'Electricity', 'DistrictCooling'
        chilled_water_loop = model_get_or_add_chilled_water_loop(model, system['cooling_type'], chilled_water_loop_cooling_type: 'AirCooled')
      when nil
        chilled_water_loop = nil
      end
      model_add_four_pipe_fan_coil(model,
                                   thermal_zones,
                                   chilled_water_loop,
                                   hot_water_loop: hot_water_loop,
                                   ventilation: true)

    when 'Baseboards'
      case system['heating_type']
      when 'Gas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
        hot_water_loop = model_get_or_add_hot_water_loop(model, system['heating_type'])
      when 'Electricity'
        hot_water_loop = nil
      when nil
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'Baseboards must have heating_type specified.')
      end
      model_add_baseboard(model,
                          thermal_zones,
                          hot_water_loop: hot_water_loop)

    when 'Unconditioned'
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'System type is Unconditioned.  No system will be added.')

    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "System type '#{system['type']}' is not recognized for system named '#{system['name']}'.  This system will not be added.")

    end
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished adding HVAC')

  return true
end

#model_add_hvac_system(model, system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones, hot_water_loop_type: 'HighTemperature', chilled_water_loop_cooling_type: 'WaterCooled', heat_pump_loop_cooling_type: 'EvaporativeFluidCooler', air_loop_heating_type: 'Water', air_loop_cooling_type: 'Water', zone_equipment_ventilation: true, fan_coil_capacity_control_method: 'CyclingFan') ⇒ Boolean

Add the specified system type to the specified zones based on the specified template. For multi-zone system types, add one system per story.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_type (String)

    The system type

  • main_heat_fuel (String)

    Main heating fuel used for air loops and plant loops

  • zone_heat_fuel (String)

    Zone heating fuel for zone hvac equipment and terminal units

  • cool_fuel (String)

    Cooling fuel used for air loops, plant loops, and zone equipment

  • zones (Array<OpenStudio::Model::ThermalZone>)

    array of thermal zones served by the system

  • hot_water_loop_type (String) (defaults to: 'HighTemperature')

    Archetype for hot water loops HighTemperature (180F supply) (default) or LowTemperature (120F supply) only used if HVAC system has a hot water loop

  • chilled_water_loop_cooling_type (String) (defaults to: 'WaterCooled')

    Archetype for chilled water loops, AirCooled or WaterCooled only used if HVAC system has a chilled water loop and cool_fuel is Electricity

  • heat_pump_loop_cooling_type (String) (defaults to: 'EvaporativeFluidCooler')

    the type of cooling equipment for heat pump loops if not DistrictCooling. Valid options are: CoolingTower, CoolingTowerSingleSpeed, CoolingTowerTwoSpeed, CoolingTowerVariableSpeed, FluidCooler, FluidCoolerSingleSpeed, FluidCoolerTwoSpeed, EvaporativeFluidCooler, EvaporativeFluidCoolerSingleSpeed, EvaporativeFluidCoolerTwoSpeed

  • air_loop_heating_type (String) (defaults to: 'Water')

    type of heating coil serving main air loop, options are Gas, DX, or Water

  • air_loop_cooling_type (String) (defaults to: 'Water')

    type of cooling coil serving main air loop, options are DX or Water

  • zone_equipment_ventilation (Boolean) (defaults to: true)

    toggle whether to include outdoor air ventilation on zone equipment including as fan coil units, VRF terminals, or water source heat pumps.

  • fan_coil_capacity_control_method (String) (defaults to: 'CyclingFan')

    Only applicable to Fan Coil system type. Capacity control method for the fan coil. Options are ConstantFanVariableFlow, CyclingFan, VariableFanVariableFlow, and VariableFanConstantFlow. If VariableFan, the fan will be VariableVolume.

Returns:

  • (Boolean)

    returns true if successful, false if not



6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6903

def model_add_hvac_system(model,
                          system_type,
                          main_heat_fuel,
                          zone_heat_fuel,
                          cool_fuel,
                          zones,
                          hot_water_loop_type: 'HighTemperature',
                          chilled_water_loop_cooling_type: 'WaterCooled',
                          heat_pump_loop_cooling_type: 'EvaporativeFluidCooler',
                          air_loop_heating_type: 'Water',
                          air_loop_cooling_type: 'Water',
                          zone_equipment_ventilation: true,
                          fan_coil_capacity_control_method: 'CyclingFan')

  # enforce defaults if fields are nil
  hot_water_loop_type = 'HighTemperature' if hot_water_loop_type.nil?
  chilled_water_loop_cooling_type = 'WaterCooled' if chilled_water_loop_cooling_type.nil?
  heat_pump_loop_cooling_type = 'EvaporativeFluidCooler' if heat_pump_loop_cooling_type.nil?
  air_loop_heating_type = 'Water' if air_loop_heating_type.nil?
  air_loop_cooling_type = 'Water' if air_loop_cooling_type.nil?
  zone_equipment_ventilation = true if zone_equipment_ventilation.nil?
  fan_coil_capacity_control_method = 'CyclingFan' if fan_coil_capacity_control_method.nil?

  # don't do anything if there are no zones
  return true if zones.empty?

  case system_type
  when 'PTAC'
    case main_heat_fuel
    when 'NaturalGas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
      heating_type = 'Water'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      heating_type = 'Water'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    when 'Electricity'
      heating_type = main_heat_fuel
      hot_water_loop = nil
    else
      heating_type = zone_heat_fuel
      hot_water_loop = nil
    end

    model_add_ptac(model,
                   zones,
                   cooling_type: 'Single Speed DX AC',
                   heating_type: heating_type,
                   hot_water_loop: hot_water_loop,
                   fan_type: 'Cycling',
                   ventilation: zone_equipment_ventilation)

  when 'PTHP'
    model_add_pthp(model,
                   zones,
                   fan_type: 'Cycling',
                   ventilation: zone_equipment_ventilation)

  when 'PSZ-AC'
    case main_heat_fuel
    when 'NaturalGas', 'Gas'
      heating_type = main_heat_fuel
      supplemental_heating_type = 'Electricity'
      if air_loop_heating_type == 'Water'
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: hot_water_loop_type)
        heating_type = 'Water'
      else
        hot_water_loop = nil
      end
    when 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
      heating_type = 'Water'
      supplemental_heating_type = 'Electricity'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump', 'ASHP'
      heating_type = 'Water'
      supplemental_heating_type = 'Electricity'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    when 'Electricity'
      heating_type = main_heat_fuel
      supplemental_heating_type = 'Electricity'
    else
      heating_type = zone_heat_fuel
      supplemental_heating_type = nil
      hot_water_loop = nil
    end

    case cool_fuel
    when 'DistrictCooling'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel)
      cooling_type = 'Water'
    else
      chilled_water_loop = nil
      cooling_type = 'Single Speed DX AC'
    end

    model_add_psz_ac(model,
                     zones,
                     cooling_type: cooling_type,
                     chilled_water_loop: chilled_water_loop,
                     hot_water_loop: hot_water_loop,
                     heating_type: heating_type,
                     supplemental_heating_type: supplemental_heating_type,
                     fan_location: 'DrawThrough',
                     fan_type: 'ConstantVolume')

  when 'PSZ-HP'
    model_add_psz_ac(model,
                     zones,
                     system_name: 'PSZ-HP',
                     cooling_type: 'Single Speed Heat Pump',
                     heating_type: 'Single Speed Heat Pump',
                     supplemental_heating_type: 'Electricity',
                     fan_location: 'DrawThrough',
                     fan_type: 'ConstantVolume')

  when 'PSZ-VAV'
    if main_heat_fuel.nil?
      supplemental_heating_type = nil
    else
      supplemental_heating_type = 'Electricity'
    end
    model_add_psz_vav(model,
                      zones,
                      system_name: 'PSZ-VAV',
                      heating_type: main_heat_fuel,
                      supplemental_heating_type: supplemental_heating_type,
                      hvac_op_sch: nil,
                      oa_damper_sch: nil)

  when 'VRF'
    model_add_vrf(model,
                  zones,
                  ventilation: zone_equipment_ventilation)

  when 'Fan Coil'
    case main_heat_fuel
    when 'NaturalGas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam', 'Electricity'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    else
      hot_water_loop = nil
    end

    case cool_fuel
    when 'Electricity', 'DistrictCooling'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    model_add_four_pipe_fan_coil(model,
                                 zones,
                                 chilled_water_loop,
                                 hot_water_loop: hot_water_loop,
                                 ventilation: zone_equipment_ventilation,
                                 capacity_control_method: fan_coil_capacity_control_method)

  when 'Radiant Slab'
    case main_heat_fuel
    when 'NaturalGas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam', 'Electricity'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    else
      hot_water_loop = nil
    end

    case cool_fuel
    when 'Electricity', 'DistrictCooling'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    model_add_low_temp_radiant(model,
                               zones,
                               hot_water_loop,
                               chilled_water_loop)

  when 'Baseboards'
    case main_heat_fuel
    when 'NaturalGas', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    when 'Electricity'
      hot_water_loop = nil
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'Baseboards must have heating_type specified.')
      return false
    end
    model_add_baseboard(model,
                        zones,
                        hot_water_loop: hot_water_loop)

  when 'Unit Heaters'
    model_add_unitheater(model,
                         zones,
                         hvac_op_sch: nil,
                         fan_control_type: 'ConstantVolume',
                         fan_pressure_rise: 0.2,
                         heating_type: main_heat_fuel)

  when 'High Temp Radiant'
    model_add_high_temp_radiant(model,
                                zones,
                                heating_type: main_heat_fuel,
                                combustion_efficiency: 0.8)

  when 'Window AC'
    model_add_window_ac(model,
                        zones)

  when 'Residential AC'
    model_add_furnace_central_ac(model,
                                 zones,
                                 heating: false,
                                 cooling: true,
                                 ventilation: false)

  when 'Forced Air Furnace'
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', 'If a Forced Air Furnace with ventilation serves a core zone, make sure the outdoor air is included in design sizing for the systems (typically occupancy, and therefore ventilation is zero during winter sizing), otherwise it may not be sized large enough to meet the heating load in some situations.')
    model_add_furnace_central_ac(model,
                                 zones,
                                 heating: true,
                                 cooling: false,
                                 ventilation: true)

  when 'Residential Forced Air Furnace'
    model_add_furnace_central_ac(model,
                                 zones,
                                 heating: true,
                                 cooling: false,
                                 ventilation: false)

  when 'Residential Forced Air Furnace with AC'
    model_add_furnace_central_ac(model,
                                 zones,
                                 heating: true,
                                 cooling: true,
                                 ventilation: false)

  when 'Residential Air Source Heat Pump'
    heating = true unless main_heat_fuel.nil?
    cooling = true unless cool_fuel.nil?
    model_add_central_air_source_heat_pump(model,
                                           zones,
                                           heating: heating,
                                           cooling: cooling,
                                           ventilation: false)

  when 'Residential Minisplit Heat Pumps'
    model_add_minisplit_hp(model,
                           zones)

  when 'VAV Reheat'
    case main_heat_fuel
    when 'NaturalGas', 'Gas', 'HeatPump', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
      heating_type = main_heat_fuel
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      heating_type = main_heat_fuel
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    else
      heating_type = 'Electricity'
      hot_water_loop = nil
    end

    case air_loop_cooling_type
    when 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    if hot_water_loop.nil?
      case zone_heat_fuel
      when 'NaturalGas', 'Gas'
        reheat_type = 'NaturalGas'
      when 'Electricity'
        reheat_type = 'Electricity'
      else
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "zone_heat_fuel '#{zone_heat_fuel}' not supported with main_heat_fuel '#{main_heat_fuel}' for a 'VAV Reheat' system type.")
        return false
      end
    else
      reheat_type = 'Water'
    end

    model_add_vav_reheat(model,
                         zones,
                         heating_type: heating_type,
                         reheat_type: reheat_type,
                         hot_water_loop: hot_water_loop,
                         chilled_water_loop: chilled_water_loop,
                         fan_efficiency: 0.62,
                         fan_motor_efficiency: 0.9,
                         fan_pressure_rise: 4.0)

  when 'VAV No Reheat'
    case main_heat_fuel
    when 'NaturalGas', 'Gas', 'HeatPump', 'DistrictHeating', 'DistrictHeatingWater', 'DistrictHeatingSteam'
      heating_type = main_heat_fuel
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: hot_water_loop_type)
    when 'AirSourceHeatPump'
      heating_type = main_heat_fuel
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    else
      heating_type = 'Electricity'
      hot_water_loop = nil
    end

    if air_loop_cooling_type == 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end
    model_add_vav_reheat(model,
                         zones,
                         heating_type: heating_type,
                         reheat_type: nil,
                         hot_water_loop: hot_water_loop,
                         chilled_water_loop: chilled_water_loop,
                         fan_efficiency: 0.62,
                         fan_motor_efficiency: 0.9,
                         fan_pressure_rise: 4.0)

  when 'VAV Gas Reheat'
    if air_loop_cooling_type == 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end
    model_add_vav_reheat(model,
                         zones,
                         heating_type: 'NaturalGas',
                         reheat_type: 'NaturalGas',
                         chilled_water_loop: chilled_water_loop,
                         fan_efficiency: 0.62,
                         fan_motor_efficiency: 0.9,
                         fan_pressure_rise: 4.0)

  when 'PVAV Reheat'
    case main_heat_fuel
    when 'AirSourceHeatPump'
      hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                       hot_water_loop_type: 'LowTemperature')
    else
      if air_loop_heating_type == 'Water'
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: hot_water_loop_type)
      else
        heating_type = main_heat_fuel
      end
    end

    case cool_fuel
    when 'Electricity'
      chilled_water_loop = nil
    else
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    end

    if zone_heat_fuel == 'Electricity'
      electric_reheat = true
    else
      electric_reheat = false
    end

    model_add_pvav(model,
                   zones,
                   hot_water_loop: hot_water_loop,
                   chilled_water_loop: chilled_water_loop,
                   heating_type: heating_type,
                   electric_reheat: electric_reheat)

  when 'PVAV PFP Boxes'
    case cool_fuel
    when 'DistrictCooling'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel)
    else
      chilled_water_loop = nil
    end
    model_add_pvav_pfp_boxes(model,
                             zones,
                             chilled_water_loop: chilled_water_loop,
                             fan_efficiency: 0.62,
                             fan_motor_efficiency: 0.9,
                             fan_pressure_rise: 4.0)

  when 'VAV PFP Boxes'
    chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                             chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    model_add_pvav_pfp_boxes(model,
                             zones,
                             chilled_water_loop: chilled_water_loop,
                             fan_efficiency: 0.62,
                             fan_motor_efficiency: 0.9,
                             fan_pressure_rise: 4.0)

  when 'Water Source Heat Pumps'
    if (main_heat_fuel.include?('DistrictHeating') && cool_fuel == 'DistrictCooling') || (main_heat_fuel == 'AmbientLoop' && cool_fuel == 'AmbientLoop')
      condenser_loop = model_get_or_add_ambient_water_loop(model)
    else
      condenser_loop = model_get_or_add_heat_pump_loop(model, main_heat_fuel, cool_fuel,
                                                       heat_pump_loop_cooling_type: heat_pump_loop_cooling_type)
    end
    model_add_water_source_hp(model,
                              zones,
                              condenser_loop,
                              ventilation: zone_equipment_ventilation)

  when 'Ground Source Heat Pumps'
    condenser_loop = model_get_or_add_ground_hx_loop(model)
    model_add_water_source_hp(model,
                              zones,
                              condenser_loop,
                              ventilation: zone_equipment_ventilation)

  when 'DOAS Cold Supply'
    hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                     hot_water_loop_type: hot_water_loop_type)
    chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                             chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    model_add_doas_cold_supply(model,
                               zones,
                               hot_water_loop: hot_water_loop,
                               chilled_water_loop: chilled_water_loop)

  when 'DOAS'
    if air_loop_heating_type == 'Water'
      case main_heat_fuel
      when nil
        hot_water_loop = nil
      when 'AirSourceHeatPump'
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: 'LowTemperature')
      when 'Electricity'
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "air_loop_heating_type '#{air_loop_heating_type}' is not supported with main_heat_fuel '#{main_heat_fuel}' for a 'DOAS' system type.")
        return false
      else
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: hot_water_loop_type)
      end
    else
      hot_water_loop = nil
    end
    if air_loop_cooling_type == 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    model_add_doas(model,
                   zones,
                   hot_water_loop: hot_water_loop,
                   chilled_water_loop: chilled_water_loop)

  when 'DOAS with DCV'
    if air_loop_heating_type == 'Water'
      case main_heat_fuel
      when nil
        hot_water_loop = nil
      when 'AirSourceHeatPump'
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: 'LowTemperature')
      else
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: hot_water_loop_type)
      end
    else
      hot_water_loop = nil
    end
    if air_loop_cooling_type == 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    model_add_doas(model,
                   zones,
                   hot_water_loop: hot_water_loop,
                   chilled_water_loop: chilled_water_loop,
                   doas_type: 'DOASVAV',
                   demand_control_ventilation: true)

  when 'DOAS with Economizing'
    if air_loop_heating_type == 'Water'
      case main_heat_fuel
      when nil
        hot_water_loop = nil
      when 'AirSourceHeatPump'
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: 'LowTemperature')
      else
        hot_water_loop = model_get_or_add_hot_water_loop(model, main_heat_fuel,
                                                         hot_water_loop_type: hot_water_loop_type)
      end
    else
      hot_water_loop = nil
    end
    if air_loop_cooling_type == 'Water'
      chilled_water_loop = model_get_or_add_chilled_water_loop(model, cool_fuel,
                                                               chilled_water_loop_cooling_type: chilled_water_loop_cooling_type)
    else
      chilled_water_loop = nil
    end

    model_add_doas(model,
                   zones,
                   hot_water_loop: hot_water_loop,
                   chilled_water_loop: chilled_water_loop,
                   doas_type: 'DOASVAV',
                   econo_ctrl_mthd: 'FixedDryBulb')

  when 'ERVs'
    model_add_zone_erv(model, zones)

  when 'Residential ERVs'
    model_add_residential_erv(model, zones)

  when 'Residential Ventilators'
    model_add_residential_ventilator(model, zones)

  when 'Evaporative Cooler'
    model_add_evap_cooler(model, zones)

  when 'Ideal Air Loads'
    model_add_ideal_air_loads(model, zones)

  else
    # Combination Systems
    if system_type.include? 'with DOAS with DCV'
      # add DOAS DCV system
      model_add_hvac_system(model, 'DOAS with DCV', main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
      # add paired system type
      paired_system_type = system_type.gsub(' with DOAS with DCV', '')
      model_add_hvac_system(model, paired_system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
    elsif system_type.include? 'with DOAS'
      # add DOAS system
      model_add_hvac_system(model, 'DOAS', main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
      # add paired system type
      paired_system_type = system_type.gsub(' with DOAS', '')
      model_add_hvac_system(model, paired_system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
    elsif system_type.include? 'with ERVs'
      # add DOAS system
      model_add_hvac_system(model, 'ERVs', main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
      # add paired system type
      paired_system_type = system_type.gsub(' with ERVs', '')
      model_add_hvac_system(model, paired_system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones,
                            hot_water_loop_type: hot_water_loop_type,
                            chilled_water_loop_cooling_type: chilled_water_loop_cooling_type,
                            heat_pump_loop_cooling_type: heat_pump_loop_cooling_type,
                            air_loop_heating_type: air_loop_heating_type,
                            air_loop_cooling_type: air_loop_cooling_type,
                            zone_equipment_ventilation: false,
                            fan_coil_capacity_control_method: fan_coil_capacity_control_method)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "HVAC system type '#{system_type}' not recognized")
      return false
    end
  end

  # rename air loop and plant loop nodes for readability
  OpenstudioStandards::HVAC.rename_air_loop_nodes(model)
  OpenstudioStandards::HVAC.rename_plant_loop_nodes(model)
end

#model_add_hw_loop(model, boiler_fuel_type, ambient_loop: nil, system_name: 'Hot Water Loop', dsgn_sup_wtr_temp: 180.0, dsgn_sup_wtr_temp_delt: 20.0, pump_spd_ctrl: 'Variable', pump_tot_hd: nil, boiler_draft_type: nil, boiler_eff_curve_temp_eval_var: nil, boiler_lvg_temp_dsgn: nil, boiler_out_temp_lmt: nil, boiler_max_plr: nil, boiler_sizing_factor: nil) ⇒ OpenStudio::Model::PlantLoop

Creates a hot water loop with a boiler, district heating, or a water-to-water heat pump and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • boiler_fuel_type (String)

    valid choices are Electricity, NaturalGas, Propane, PropaneGas, FuelOilNo1, FuelOilNo2, DistrictHeating, DistrictHeatingWater, DistrictHeatingSteam, HeatPump

  • ambient_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    The condenser loop for the heat pump. Only used when boiler_fuel_type is HeatPump.

  • system_name (String) (defaults to: 'Hot Water Loop')

    the name of the system, or nil in which case it will be defaulted

  • dsgn_sup_wtr_temp (Double) (defaults to: 180.0)

    design supply water temperature in degrees Fahrenheit, default 180F

  • dsgn_sup_wtr_temp_delt (Double) (defaults to: 20.0)

    design supply-return water temperature difference in degrees Rankine, default 20R

  • pump_spd_ctrl (String) (defaults to: 'Variable')

    pump speed control type, Constant or Variable (default)

  • pump_tot_hd (Double) (defaults to: nil)

    pump head in ft H2O

  • boiler_draft_type (String) (defaults to: nil)

    Boiler type Condensing, MechanicalNoncondensing, Natural (default)

  • boiler_eff_curve_temp_eval_var (String) (defaults to: nil)

    LeavingBoiler or EnteringBoiler temperature for the boiler efficiency curve

  • boiler_lvg_temp_dsgn (Double) (defaults to: nil)

    boiler leaving design temperature in degrees Fahrenheit

  • boiler_out_temp_lmt (Double) (defaults to: nil)

    boiler outlet temperature limit in degrees Fahrenheit

  • boiler_max_plr (Double) (defaults to: nil)

    boiler maximum part load ratio

  • boiler_sizing_factor (Double) (defaults to: nil)

    boiler oversizing factor

Returns:

  • (OpenStudio::Model::PlantLoop)

    the resulting hot water loop



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 42

def model_add_hw_loop(model,
                      boiler_fuel_type,
                      ambient_loop: nil,
                      system_name: 'Hot Water Loop',
                      dsgn_sup_wtr_temp: 180.0,
                      dsgn_sup_wtr_temp_delt: 20.0,
                      pump_spd_ctrl: 'Variable',
                      pump_tot_hd: nil,
                      boiler_draft_type: nil,
                      boiler_eff_curve_temp_eval_var: nil,
                      boiler_lvg_temp_dsgn: nil,
                      boiler_out_temp_lmt: nil,
                      boiler_max_plr: nil,
                      boiler_sizing_factor: nil)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', 'Adding hot water loop.')

  # create hot water loop
  hot_water_loop = OpenStudio::Model::PlantLoop.new(model)
  if system_name.nil?
    hot_water_loop.setName('Hot Water Loop')
  else
    hot_water_loop.setName(system_name)
  end

  # hot water loop sizing and controls
  if dsgn_sup_wtr_temp.nil?
    dsgn_sup_wtr_temp = 180.0
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  else
    dsgn_sup_wtr_temp_c = OpenStudio.convert(dsgn_sup_wtr_temp, 'F', 'C').get
  end
  if dsgn_sup_wtr_temp_delt.nil?
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(20.0, 'R', 'K').get
  else
    dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(dsgn_sup_wtr_temp_delt, 'R', 'K').get
  end

  sizing_plant = hot_water_loop.sizingPlant
  sizing_plant.setLoopType('Heating')
  sizing_plant.setDesignLoopExitTemperature(dsgn_sup_wtr_temp_c)
  sizing_plant.setLoopDesignTemperatureDifference(dsgn_sup_wtr_temp_delt_k)
  hot_water_loop.setMinimumLoopTemperature(10.0)
  hw_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                dsgn_sup_wtr_temp_c,
                                                                                name: "#{hot_water_loop.name} Temp - #{dsgn_sup_wtr_temp.round(0)}F",
                                                                                schedule_type_limit: 'Temperature')
  hw_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, hw_temp_sch)
  hw_stpt_manager.setName("#{hot_water_loop.name} Setpoint Manager")
  hw_stpt_manager.addToNode(hot_water_loop.supplyOutletNode)

  # create hot water pump
  if pump_spd_ctrl == 'Constant'
    hw_pump = OpenStudio::Model::PumpConstantSpeed.new(model)
  elsif pump_spd_ctrl == 'Variable'
    hw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
  else
    hw_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
  end
  hw_pump.setName("#{hot_water_loop.name} Pump")
  if pump_tot_hd.nil?
    pump_tot_hd_pa = OpenStudio.convert(60, 'ftH_{2}O', 'Pa').get
  else
    pump_tot_hd_pa = OpenStudio.convert(pump_tot_hd, 'ftH_{2}O', 'Pa').get
  end
  hw_pump.setRatedPumpHead(pump_tot_hd_pa)
  hw_pump.setMotorEfficiency(0.9)
  hw_pump.setPumpControlType('Intermittent')
  hw_pump.addToNode(hot_water_loop.supplyInletNode)

  # switch statement to handle district heating name change
  if model.version < OpenStudio::VersionString.new('3.7.0')
    if boiler_fuel_type == 'DistrictHeatingWater' || boiler_fuel_type == 'DistrictHeatingSteam'
      boiler_fuel_type = 'DistrictHeating'
    end
  else
    boiler_fuel_type = 'DistrictHeatingWater' if boiler_fuel_type == 'DistrictHeating'
  end

  # create boiler and add to loop
  case boiler_fuel_type
    # District Heating
    when 'DistrictHeating'
      district_heat = OpenStudio::Model::DistrictHeating.new(model)
      district_heat.setName("#{hot_water_loop.name} District Heating")
      district_heat.autosizeNominalCapacity
      hot_water_loop.addSupplyBranchForComponent(district_heat)
    when 'DistrictHeatingWater'
      district_heat = OpenStudio::Model::DistrictHeatingWater.new(model)
      district_heat.setName("#{hot_water_loop.name} District Heating")
      district_heat.autosizeNominalCapacity
      hot_water_loop.addSupplyBranchForComponent(district_heat)
    when 'DistrictHeatingSteam'
      district_heat = OpenStudio::Model::DistrictHeatingSteam.new(model)
      district_heat.setName("#{hot_water_loop.name} District Heating")
      district_heat.autosizeNominalCapacity
      hot_water_loop.addSupplyBranchForComponent(district_heat)
    when 'HeatPump', 'AmbientLoop'
      # Ambient Loop
      water_to_water_hp = OpenStudio::Model::HeatPumpWaterToWaterEquationFitHeating.new(model)
      water_to_water_hp.setName("#{hot_water_loop.name} Water to Water Heat Pump")
      hot_water_loop.addSupplyBranchForComponent(water_to_water_hp)
      # Get or add an ambient loop
      if ambient_loop.nil?
        ambient_loop = model_get_or_add_ambient_water_loop(model)
      end
      ambient_loop.addDemandBranchForComponent(water_to_water_hp)
    # Central Air Source Heat Pump
    when 'AirSourceHeatPump', 'ASHP'
      OpenstudioStandards::HVAC.create_central_air_source_heat_pump(model, hot_water_loop)
    # Boiler
    when 'Electricity', 'Gas', 'NaturalGas', 'Propane', 'PropaneGas', 'FuelOilNo1', 'FuelOilNo2'
      if boiler_lvg_temp_dsgn.nil?
        lvg_temp_dsgn_f = dsgn_sup_wtr_temp
      else
        lvg_temp_dsgn_f = boiler_lvg_temp_dsgn
      end

      if boiler_out_temp_lmt.nil?
        out_temp_lmt_f = 203.0
      else
        out_temp_lmt_f = boiler_out_temp_lmt
      end

      boiler = OpenstudioStandards::HVAC.create_boiler_hot_water(model,
                                                                 hot_water_loop: hot_water_loop,
                                                                 fuel_type: boiler_fuel_type,
                                                                 draft_type: boiler_draft_type,
                                                                 nominal_thermal_efficiency: 0.78,
                                                                 eff_curve_temp_eval_var: boiler_eff_curve_temp_eval_var,
                                                                 lvg_temp_dsgn_f: lvg_temp_dsgn_f,
                                                                 out_temp_lmt_f: out_temp_lmt_f,
                                                                 max_plr: boiler_max_plr,
                                                                 sizing_factor: boiler_sizing_factor)

      # @todo Yixing. Adding temperature setpoint controller at boiler outlet causes simulation errors
      # boiler_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(self, hw_temp_sch)
      # boiler_stpt_manager.setName("Boiler outlet setpoint manager")
      # boiler_stpt_manager.addToNode(boiler.outletModelObject.get.to_Node.get)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Boiler fuel type #{boiler_fuel_type} is not valid, no boiler will be added.")
  end

  # add hot water loop pipes
  supply_equipment_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_equipment_bypass_pipe.setName("#{hot_water_loop.name} Supply Equipment Bypass")
  hot_water_loop.addSupplyBranchForComponent(supply_equipment_bypass_pipe)

  coil_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  coil_bypass_pipe.setName("#{hot_water_loop.name} Coil Bypass")
  hot_water_loop.addDemandBranchForComponent(coil_bypass_pipe)

  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe.setName("#{hot_water_loop.name} Supply Outlet")
  supply_outlet_pipe.addToNode(hot_water_loop.supplyOutletNode)

  demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_inlet_pipe.setName("#{hot_water_loop.name} Demand Inlet")
  demand_inlet_pipe.addToNode(hot_water_loop.demandInletNode)

  demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  demand_outlet_pipe.setName("#{hot_water_loop.name} Demand Outlet")
  demand_outlet_pipe.addToNode(hot_water_loop.demandOutletNode)

  return hot_water_loop
end

#model_add_ideal_air_loads(model, thermal_zones, hvac_op_sch: nil, heat_avail_sch: nil, cool_avail_sch: nil, heat_limit_type: 'NoLimit', cool_limit_type: 'NoLimit', dehumid_limit_type: 'ConstantSensibleHeatRatio', cool_sensible_heat_ratio: 0.7, humid_ctrl_type: 'None', include_outdoor_air: true, enable_dcv: false, econo_ctrl_mthd: 'NoEconomizer', heat_recovery_type: 'None', heat_recovery_sensible_eff: 0.7, heat_recovery_latent_eff: 0.65, add_output_meters: false) ⇒ Array<OpenStudio::Model::ZoneHVACIdealLoadsAirSystem>

Adds ideal air loads systems for each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to enable ideal air loads

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule, default is always on

  • heat_avail_sch (String) (defaults to: nil)

    name of the heating availability schedule, default is always on

  • cool_avail_sch (String) (defaults to: nil)

    name of the cooling availability schedule, default is always on

  • heat_limit_type (String) (defaults to: 'NoLimit')

    heating limit type options are 'NoLimit', 'LimitFlowRate', 'LimitCapacity', and 'LimitFlowRateAndCapacity'

  • cool_limit_type (String) (defaults to: 'NoLimit')

    cooling limit type options are 'NoLimit', 'LimitFlowRate', 'LimitCapacity', and 'LimitFlowRateAndCapacity'

  • dehumid_limit_type (String) (defaults to: 'ConstantSensibleHeatRatio')

    dehumidification limit type options are 'None', 'ConstantSensibleHeatRatio', 'Humidistat', 'ConstantSupplyHumidityRatio'

  • cool_sensible_heat_ratio (Double) (defaults to: 0.7)

    cooling sensible heat ratio if dehumidification limit type is 'ConstantSensibleHeatRatio'

  • humid_ctrl_type (String) (defaults to: 'None')

    humidification control type options are 'None', 'Humidistat', 'ConstantSupplyHumidityRatio'

  • include_outdoor_air (Boolean) (defaults to: true)

    include design specification outdoor air ventilation

  • enable_dcv (Boolean) (defaults to: false)

    include demand control ventilation, uses occupancy schedule if true

  • econo_ctrl_mthd (String) (defaults to: 'NoEconomizer')

    economizer control method (require a cool_limit_type and include_outdoor_air set to true) options are 'NoEconomizer', 'DifferentialDryBulb', 'DifferentialEnthalpy'

  • heat_recovery_type (String) (defaults to: 'None')

    heat recovery type options are 'None', 'Sensible', 'Enthalpy'

  • heat_recovery_sensible_eff (Double) (defaults to: 0.7)

    heat recovery sensible effectivness if heat recovery specified

  • heat_recovery_latent_eff (Double) (defaults to: 0.65)

    heat recovery latent effectivness if heat recovery specified

  • add_output_meters (Boolean) (defaults to: false)

    include and output custom meter objects to sum all ideal air loads values

Returns:

  • (Array<OpenStudio::Model::ZoneHVACIdealLoadsAirSystem>)

    an array of ideal air loads systems



5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5798

def model_add_ideal_air_loads(model,
                              thermal_zones,
                              hvac_op_sch: nil,
                              heat_avail_sch: nil,
                              cool_avail_sch: nil,
                              heat_limit_type: 'NoLimit',
                              cool_limit_type: 'NoLimit',
                              dehumid_limit_type: 'ConstantSensibleHeatRatio',
                              cool_sensible_heat_ratio: 0.7,
                              humid_ctrl_type: 'None',
                              include_outdoor_air: true,
                              enable_dcv: false,
                              econo_ctrl_mthd: 'NoEconomizer',
                              heat_recovery_type: 'None',
                              heat_recovery_sensible_eff: 0.7,
                              heat_recovery_latent_eff: 0.65,
                              add_output_meters: false)

  # set availability schedules
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # set heating availability schedules
  if heat_avail_sch.nil?
    heat_avail_sch = model.alwaysOnDiscreteSchedule
  else
    heat_avail_sch = model_add_schedule(model, heat_avail_sch)
  end

  # set cooling availability schedules
  if cool_avail_sch.nil?
    cool_avail_sch = model.alwaysOnDiscreteSchedule
  else
    cool_avail_sch = model_add_schedule(model, cool_avail_sch)
  end

  ideal_systems = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding ideal air loads for for #{zone.name}.")
    ideal_loads = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(model)
    ideal_loads.setName("#{zone.name} Ideal Loads Air System")
    ideal_loads.setAvailabilitySchedule(hvac_op_sch)
    ideal_loads.setHeatingAvailabilitySchedule(heat_avail_sch)
    ideal_loads.setCoolingAvailabilitySchedule(cool_avail_sch)
    ideal_loads.setHeatingLimit(heat_limit_type)
    ideal_loads.setCoolingLimit(cool_limit_type)
    ideal_loads.setDehumidificationControlType(dehumid_limit_type)
    ideal_loads.setCoolingSensibleHeatRatio(cool_sensible_heat_ratio)
    ideal_loads.setHumidificationControlType(humid_ctrl_type)
    if include_outdoor_air
      # get the design specification outdoor air of the largest space in the zone
      # @todo create a new design specification outdoor air object that sums ventilation rates and schedules if multiple design specification outdoor air objects
      space_areas = zone.spaces.map(&:floorArea)
      largest_space = zone.spaces.select { |s| s.floorArea == space_areas.max }
      largest_space = largest_space[0]
      design_spec_oa = largest_space.designSpecificationOutdoorAir
      if design_spec_oa.is_initialized
        design_spec_oa = design_spec_oa.get
        ideal_loads.setDesignSpecificationOutdoorAirObject(design_spec_oa)
      else
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Outdoor air requested for ideal loads object, but space #{largest_space.name} in thermal zone #{zone.name} does not have a design specification outdoor air object.")
      end
    end
    if enable_dcv
      ideal_loads.setDemandControlledVentilationType('OccupancySchedule')
    else
      ideal_loads.setDemandControlledVentilationType('None')
    end
    ideal_loads.setOutdoorAirEconomizerType(econo_ctrl_mthd)
    ideal_loads.setHeatRecoveryType(heat_recovery_type)
    ideal_loads.setSensibleHeatRecoveryEffectiveness(heat_recovery_sensible_eff)
    ideal_loads.setLatentHeatRecoveryEffectiveness(heat_recovery_latent_eff)
    ideal_loads.addToThermalZone(zone)
    ideal_systems << ideal_loads

    # set zone sizing parameters
    zone_sizing = zone.sizingZone
    zone_sizing.setHeatingMaximumAirFlowFraction(1.0)
  end

  if add_output_meters
    # ideal air loads system variables to include
    ideal_air_loads_system_variables = [
      'Zone Ideal Loads Supply Air Sensible Heating Energy',
      'Zone Ideal Loads Supply Air Latent Heating Energy',
      'Zone Ideal Loads Supply Air Total Heating Energy',
      'Zone Ideal Loads Supply Air Sensible Cooling Energy',
      'Zone Ideal Loads Supply Air Latent Cooling Energy',
      'Zone Ideal Loads Supply Air Total Cooling Energy',
      'Zone Ideal Loads Zone Sensible Heating Energy',
      'Zone Ideal Loads Zone Latent Heating Energy',
      'Zone Ideal Loads Zone Total Heating Energy',
      'Zone Ideal Loads Zone Sensible Cooling Energy',
      'Zone Ideal Loads Zone Latent Cooling Energy',
      'Zone Ideal Loads Zone Total Cooling Energy',
      'Zone Ideal Loads Outdoor Air Sensible Heating Energy',
      'Zone Ideal Loads Outdoor Air Latent Heating Energy',
      'Zone Ideal Loads Outdoor Air Total Heating Energy',
      'Zone Ideal Loads Outdoor Air Sensible Cooling Energy',
      'Zone Ideal Loads Outdoor Air Latent Cooling Energy',
      'Zone Ideal Loads Outdoor Air Total Cooling Energy',
      'Zone Ideal Loads Heat Recovery Sensible Heating Energy',
      'Zone Ideal Loads Heat Recovery Latent Heating Energy',
      'Zone Ideal Loads Heat Recovery Total Heating Energy',
      'Zone Ideal Loads Heat Recovery Sensible Cooling Energy',
      'Zone Ideal Loads Heat Recovery Latent Cooling Energy',
      'Zone Ideal Loads Heat Recovery Total Cooling Energy'
    ]

    meters_added = 0
    outputs_added = 0
    ideal_air_loads_system_variables.each do |variable|
      # create meter definition for variable
      meter_definition = OpenStudio::Model::MeterCustom.new(model)
      meter_definition.setName("Sum #{variable}")
      meter_definition.setFuelType('Generic')
      model.getZoneHVACIdealLoadsAirSystems.each { |sys| meter_definition.addKeyVarGroup(sys.name.to_s, variable) }
      meters_added += 1

      # add output meter
      output_meter_definition = OpenStudio::Model::OutputMeter.new(model)
      output_meter_definition.setName("Sum #{variable}")
      output_meter_definition.setReportingFrequency('Hourly')
      output_meter_definition.setMeterFileOnly(true)
      output_meter_definition.setCumulative(false)
      outputs_added += 1
    end
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Added #{meters_added} custom meter objects and #{outputs_added} meter outputs for ideal loads air systems.")
  end

  return ideal_systems
end

#model_add_low_temp_radiant(model, thermal_zones, hot_water_loop, chilled_water_loop, two_pipe_system: false, two_pipe_control_strategy: 'outdoor_air_lockout', two_pipe_lockout_temperature: 65.0, plant_supply_water_temperature_control: false, plant_supply_water_temperature_control_strategy: 'outdoor_air', hwsp_at_oat_low: 120.0, hw_oat_low: 55.0, hwsp_at_oat_high: 80.0, hw_oat_high: 70.0, chwsp_at_oat_low: 70.0, chw_oat_low: 65.0, chwsp_at_oat_high: 55.0, chw_oat_high: 75.0, radiant_type: 'floor', radiant_temperature_control_type: 'SurfaceFaceTemperature', radiant_setpoint_control_type: 'ZeroFlowPower', include_carpet: true, carpet_thickness_in: 0.25, control_strategy: 'proportional_control', use_zone_occupancy_for_control: true, occupied_percentage_threshold: 0.10, model_occ_hr_start: 6.0, model_occ_hr_end: 18.0, proportional_gain: 0.3, switch_over_time: 24.0, slab_sp_at_oat_low: 73, slab_oat_low: 65, slab_sp_at_oat_high: 68, slab_oat_high: 80, radiant_availability_type: 'precool', radiant_lockout: false, radiant_lockout_start_time: 12.0, radiant_lockout_end_time: 20.0) ⇒ Array<OpenStudio::Model::ZoneHVACLowTemperatureRadiantVariableFlow>

TODO:

Once the OpenStudio API supports it, make chilled water loops optional for heating only systems

TODO:

Lookup occupany start and end hours from zone occupancy schedule

Adds low temperature radiant loop systems to each zone.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to add radiant loops

  • hot_water_loop (OpenStudio::Model::PlantLoop)

    the hot water loop that serves the radiant loop.

  • chilled_water_loop (OpenStudio::Model::PlantLoop)

    the chilled water loop that serves the radiant loop.

  • two_pipe_system (Boolean) (defaults to: false)

    when set to true, it converts the default 4-pipe water plant HVAC system to a 2-pipe system.

  • two_pipe_control_strategy (String) (defaults to: 'outdoor_air_lockout')

    Method to determine whether the loop is in heating or cooling mode 'outdoor_air_lockout' - The system will be in heating below the two_pipe_lockout_temperature variable, and cooling above the two_pipe_lockout_temperature. Requires the two_pipe_lockout_temperature variable. 'zone_demand' - Create EMS code to determine heating or cooling mode based on zone heating or cooling load requests. Requires thermal_zones defined.

  • two_pipe_lockout_temperature (Double) (defaults to: 65.0)

    hot water plant lockout in degrees Fahrenheit, default 65F. Hot water plant is unavailable when outdoor drybulb is above the specified threshold.

  • plant_supply_water_temperature_control (Bool) (defaults to: false)

    Set to true if the plant supply water temperature is to be controlled else it is held constant, default to false.

  • plant_supply_water_temperature_control_strategy (String) (defaults to: 'outdoor_air')

    Method to determine how to control the plant's supply water temperature. 'outdoor_air' - Set the supply water temperature based on the outdoor air temperature. 'zone_demand' - Set the supply water temperature based on the preponderance of zone demand. Requires thermal_zone defined.

  • hwsp_at_oat_low (Double) (defaults to: 120.0)

    hot water plant supply water temperature setpoint, in F, at the outdoor low temperature. Requires

  • hw_oat_low (Double) (defaults to: 55.0)

    outdoor drybulb air temperature, in F, for low setpoint for hot water plant.

  • hwsp_at_oat_high (Double) (defaults to: 80.0)

    hot water plant supply water temperature setpoint, in F, at the outdoor high temperature.

  • hw_oat_high (Double) (defaults to: 70.0)

    outdoor drybulb air temperature, in F, for high setpoint for hot water plant.

  • chwsp_at_oat_low (Double) (defaults to: 70.0)

    chilled water plant supply water temperature setpoint, in F, at the outdoor low temperature.

  • chw_oat_low (Double) (defaults to: 65.0)

    outdoor drybulb air temperature, in F, for low setpoint for chilled water plant.

  • chwsp_at_oat_high (Double) (defaults to: 55.0)

    chilled water plant supply water temperature setpoint, in F, at the outdoor high temperature.

  • chw_oat_high (Double) (defaults to: 75.0)

    outdoor drybulb air temperature, in F, for high setpoint for chilled water plant.

  • radiant_type (String) (defaults to: 'floor')

    type of radiant system, floor or ceiling, to create in zone.

  • radiant_temperature_control_type (String) (defaults to: 'SurfaceFaceTemperature')

    determines the controlled temperature for the radiant system options are 'MeanAirTemperature', 'MeanRadiantTemperature', 'OperativeTemperature', 'OutdoorDryBulbTemperature', 'OutdoorWetBulbTemperature', 'SurfaceFaceTemperature', 'SurfaceInteriorTemperature'

  • radiant_setpoint_control_type (String) (defaults to: 'ZeroFlowPower')

    determines the response of the radiant system at setpoint temperature options are 'ZeroFlowPower', 'HalfFlowPower'

  • include_carpet (Boolean) (defaults to: true)

    boolean to include thin carpet tile over radiant slab, default to true

  • carpet_thickness_in (Double) (defaults to: 0.25)

    thickness of carpet in inches

  • control_strategy (String) (defaults to: 'proportional_control')

    name of control strategy. Options are 'proportional_control', 'oa_based_control', 'constant_control', and 'none'. If control strategy is 'proportional_control', the method will apply the CBE radiant control sequences detailed in Raftery et al. (2017), 'A new control strategy for high thermal mass radiant systems'. If control strategy is 'oa_based_control', the method will apply native EnergyPlus objects/parameters to vary slab setpoint based on outdoor weather. If control strategy is 'constant_control', the method will apply native EnergyPlus objects/parameters to maintain a constant slab setpoint. Otherwise no control strategy will be applied and the radiant system will assume the EnergyPlus default controls.

  • use_zone_occupancy_for_control (Boolean) (defaults to: true)

    Set to true if radiant system is to use specific zone occupancy objects for CBE control strategy. If false, then it will use values in model_occ_hr_start and model_occ_hr_end for all radiant zones. default to true.

  • occupied_percentage_threshold (Double) (defaults to: 0.10)

    the minimum fraction (0 to 1) that counts as occupied if this parameter is set, the returned ScheduleRuleset will be 0 = unoccupied, 1 = occupied otherwise the ScheduleRuleset will be the weighted fractional occupancy schedule. Only used if use_zone_occupancy_for_control is set to true.

  • model_occ_hr_start (Double) (defaults to: 6.0)

    (Optional) Only applies if control_strategy is 'proportional_control'. Starting hour of building occupancy.

  • model_occ_hr_end (Double) (defaults to: 18.0)

    (Optional) Only applies if control_strategy is 'proportional_control'. Ending hour of building occupancy.

  • proportional_gain (Double) (defaults to: 0.3)

    (Optional) Only applies if control_strategy is 'proportional_control'. Proportional gain constant (recommended 0.3 or less).

  • switch_over_time (Double) (defaults to: 24.0)

    Time limitation for when the system can switch between heating and cooling

  • slab_sp_at_oat_low (Double) (defaults to: 73)

    radiant slab temperature setpoint, in F, at the outdoor high temperature.

  • slab_oat_low (Double) (defaults to: 65)

    outdoor drybulb air temperature, in F, for low radiant slab setpoint.

  • slab_sp_at_oat_high (Double) (defaults to: 68)

    radiant slab temperature setpoint, in F, at the outdoor low temperature.

  • slab_oat_high (Double) (defaults to: 80)

    outdoor drybulb air temperature, in F, for high radiant slab setpoint.

  • radiant_availability_type (String) (defaults to: 'precool')

    a preset that determines the availability of the radiant system options are 'all_day', 'precool', 'afternoon_shutoff', 'occupancy' If preset is set to 'all_day' radiant system is available 24 hours a day, 'precool' primarily operates radiant system during night-time hours, 'afternoon_shutoff' avoids operation during peak grid demand, and 'occupancy' operates radiant system during building occupancy hours.

  • radiant_lockout (Boolean) (defaults to: false)

    True if system contains a radiant lockout. If true, it will overwrite radiant_availability_type.

  • radiant_lockout_start_time (double) (defaults to: 12.0)

    decimal hour of when radiant lockout starts Only used if radiant_lockout is true

  • radiant_lockout_end_time (double) (defaults to: 20.0)

    decimal hour of when radiant lockout ends Only used if radiant_lockout is true

Returns:

  • (Array<OpenStudio::Model::ZoneHVACLowTemperatureRadiantVariableFlow>)

    array of radiant objects.



4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4832

def model_add_low_temp_radiant(model,
                               thermal_zones,
                               hot_water_loop,
                               chilled_water_loop,
                               two_pipe_system: false,
                               two_pipe_control_strategy: 'outdoor_air_lockout',
                               two_pipe_lockout_temperature: 65.0,
                               plant_supply_water_temperature_control: false,
                               plant_supply_water_temperature_control_strategy: 'outdoor_air',
                               hwsp_at_oat_low: 120.0,
                               hw_oat_low: 55.0,
                               hwsp_at_oat_high: 80.0,
                               hw_oat_high: 70.0,
                               chwsp_at_oat_low: 70.0,
                               chw_oat_low: 65.0,
                               chwsp_at_oat_high: 55.0,
                               chw_oat_high: 75.0,
                               radiant_type: 'floor',
                               radiant_temperature_control_type: 'SurfaceFaceTemperature',
                               radiant_setpoint_control_type: 'ZeroFlowPower',
                               include_carpet: true,
                               carpet_thickness_in: 0.25,
                               control_strategy: 'proportional_control',
                               use_zone_occupancy_for_control: true,
                               occupied_percentage_threshold: 0.10,
                               model_occ_hr_start: 6.0,
                               model_occ_hr_end: 18.0,
                               proportional_gain: 0.3,
                               switch_over_time: 24.0,
                               slab_sp_at_oat_low: 73,
                               slab_oat_low: 65,
                               slab_sp_at_oat_high: 68,
                               slab_oat_high: 80,
                               radiant_availability_type: 'precool',
                               radiant_lockout: false,
                               radiant_lockout_start_time: 12.0,
                               radiant_lockout_end_time: 20.0)

  # create internal source constructions for surfaces
  OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Replacing #{radiant_type} constructions with new radiant slab constructions.")

  # determine construction insulation thickness by climate zone
  climate_zone = OpenstudioStandards::Weather.model_get_climate_zone(model)
  if climate_zone.empty?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', 'Unable to determine climate zone for radiant slab insulation determination.  Defaulting to climate zone 5, R-20 insulation, 110F heating design supply water temperature.')
    cz_mult = 4
    radiant_htg_dsgn_sup_wtr_temp_f = 110
  else
    climate_zone_set = model_find_climate_zone_set(model, climate_zone)
    case climate_zone_set.gsub('ClimateZone ', '').gsub('CEC T24 ', '')
    when '1'
      cz_mult = 2
      radiant_htg_dsgn_sup_wtr_temp_f = 90
    when '2', '2A', '2B', 'CEC15'
      cz_mult = 2
      radiant_htg_dsgn_sup_wtr_temp_f = 100
    when '3', '3A', '3B', '3C', 'CEC3', 'CEC4', 'CEC5', 'CEC6', 'CEC7', 'CEC8', 'CEC9', 'CEC10', 'CEC11', 'CEC12', 'CEC13', 'CEC14'
      cz_mult = 3
      radiant_htg_dsgn_sup_wtr_temp_f = 100
    when '4', '4A', '4B', '4C', 'CEC1', 'CEC2'
      cz_mult = 4
      radiant_htg_dsgn_sup_wtr_temp_f = 100
    when '5', '5A', '5B', '5C', 'CEC16'
      cz_mult = 4
      radiant_htg_dsgn_sup_wtr_temp_f = 110
    when '6', '6A', '6B'
      cz_mult = 4
      radiant_htg_dsgn_sup_wtr_temp_f = 120
    when '7', '8'
      cz_mult = 5
      radiant_htg_dsgn_sup_wtr_temp_f = 120
    else # default to 4
      cz_mult = 4
      radiant_htg_dsgn_sup_wtr_temp_f = 100
    end
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Based on model climate zone #{climate_zone} using R-#{(cz_mult * 5).to_i} slab insulation, R-#{((cz_mult + 1) * 5).to_i} exterior floor insulation, R-#{((cz_mult + 1) * 2 * 5).to_i} exterior roof insulation, and #{radiant_htg_dsgn_sup_wtr_temp_f}F heating design supply water temperature.")
  end

  # create materials
  mat_concrete_3_5in = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'MediumRough', 0.0889, 2.31, 2322, 832)
  mat_concrete_3_5in.setName('Radiant Slab Concrete - 3.5 in.')

  mat_concrete_1_5in = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'MediumRough', 0.0381, 2.31, 2322, 832)
  mat_concrete_1_5in.setName('Radiant Slab Concrete - 1.5 in')

  mat_refl_roof_membrane = model.getStandardOpaqueMaterialByName('Roof Membrane - Highly Reflective')
  if mat_refl_roof_membrane.is_initialized
    mat_refl_roof_membrane = model.getStandardOpaqueMaterialByName('Roof Membrane - Highly Reflective').get
  else
    mat_refl_roof_membrane = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'VeryRough', 0.0095, 0.16, 1121.29, 1460)
    mat_refl_roof_membrane.setThermalAbsorptance(0.75)
    mat_refl_roof_membrane.setSolarAbsorptance(0.45)
    mat_refl_roof_membrane.setVisibleAbsorptance(0.7)
    mat_refl_roof_membrane.setName('Roof Membrane - Highly Reflective')
  end

  if include_carpet
    carpet_thickness_m = OpenStudio.convert(carpet_thickness_in / 12.0, 'ft', 'm').get
    conductivity_si = 0.06
    conductivity_ip = OpenStudio.convert(conductivity_si, 'W/m*K', 'Btu*in/hr*ft^2*R').get
    r_value_ip = carpet_thickness_in * (1 / conductivity_ip)
    mat_thin_carpet_tile = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'MediumRough', carpet_thickness_m, conductivity_si, 288, 1380)
    mat_thin_carpet_tile.setThermalAbsorptance(0.9)
    mat_thin_carpet_tile.setSolarAbsorptance(0.7)
    mat_thin_carpet_tile.setVisibleAbsorptance(0.8)
    mat_thin_carpet_tile.setName("Radiant Slab Thin Carpet Tile R-#{r_value_ip.round(2)}")
  end

  # set exterior slab insulation thickness based on climate zone
  slab_insulation_thickness_m = 0.0254 * cz_mult
  mat_slab_insulation = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'Rough', slab_insulation_thickness_m, 0.02, 56.06, 1210)
  mat_slab_insulation.setName("Radiant Ground Slab Insulation - #{cz_mult} in.")

  ext_insulation_thickness_m = 0.0254 * (cz_mult + 1)
  mat_ext_insulation = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'Rough', ext_insulation_thickness_m, 0.02, 56.06, 1210)
  mat_ext_insulation.setName("Radiant Exterior Slab Insulation - #{cz_mult + 1} in.")

  roof_insulation_thickness_m = 0.0254 * (cz_mult + 1) * 2
  mat_roof_insulation = OpenStudio::Model::StandardOpaqueMaterial.new(model, 'Rough', roof_insulation_thickness_m, 0.02, 56.06, 1210)
  mat_roof_insulation.setName("Radiant Exterior Ceiling Insulation - #{(cz_mult + 1) * 2} in.")

  # create radiant internal source constructions
  OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', 'New constructions exclude the metal deck, as high thermal diffusivity materials cause errors in EnergyPlus internal source construction calculations.')

  layers = []
  layers << mat_slab_insulation
  layers << mat_concrete_3_5in
  layers << mat_concrete_1_5in
  layers << mat_thin_carpet_tile if include_carpet
  radiant_ground_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
  radiant_ground_slab_construction.setName('Radiant Ground Slab Construction')
  radiant_ground_slab_construction.setSourcePresentAfterLayerNumber(2)
  radiant_ground_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(3)
  radiant_ground_slab_construction.setTubeSpacing(0.2286) # 9 inches

  layers = []
  layers << mat_ext_insulation
  layers << mat_concrete_3_5in
  layers << mat_concrete_1_5in
  layers << mat_thin_carpet_tile if include_carpet
  radiant_exterior_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
  radiant_exterior_slab_construction.setName('Radiant Exterior Slab Construction')
  radiant_exterior_slab_construction.setSourcePresentAfterLayerNumber(2)
  radiant_exterior_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(3)
  radiant_exterior_slab_construction.setTubeSpacing(0.2286) # 9 inches

  layers = []
  layers << mat_concrete_3_5in
  layers << mat_concrete_1_5in
  layers << mat_thin_carpet_tile if include_carpet
  radiant_interior_floor_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
  radiant_interior_floor_slab_construction.setName('Radiant Interior Floor Slab Construction')
  radiant_interior_floor_slab_construction.setSourcePresentAfterLayerNumber(1)
  radiant_interior_floor_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(1)
  radiant_interior_floor_slab_construction.setTubeSpacing(0.2286) # 9 inches

  # create reversed interior floor construction
  rev_radiant_interior_floor_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers.reverse)
  rev_radiant_interior_floor_slab_construction.setName('Radiant Interior Floor Slab Construction - Reversed')
  rev_radiant_interior_floor_slab_construction.setSourcePresentAfterLayerNumber(layers.length - 1)
  rev_radiant_interior_floor_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(layers.length - 1)
  rev_radiant_interior_floor_slab_construction.setTubeSpacing(0.2286) # 9 inches

  layers = []
  layers << mat_thin_carpet_tile if include_carpet
  layers << mat_concrete_3_5in
  layers << mat_concrete_1_5in
  radiant_interior_ceiling_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
  radiant_interior_ceiling_slab_construction.setName('Radiant Interior Ceiling Slab Construction')
  slab_src_loc = include_carpet ? 2 : 1
  radiant_interior_ceiling_slab_construction.setSourcePresentAfterLayerNumber(slab_src_loc)
  radiant_interior_ceiling_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(slab_src_loc)
  radiant_interior_ceiling_slab_construction.setTubeSpacing(0.2286) # 9 inches

  # create reversed interior ceiling construction
  rev_radiant_interior_ceiling_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers.reverse)
  rev_radiant_interior_ceiling_slab_construction.setName('Radiant Interior Ceiling Slab Construction - Reversed')
  rev_radiant_interior_ceiling_slab_construction.setSourcePresentAfterLayerNumber(layers.length - slab_src_loc)
  rev_radiant_interior_ceiling_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(layers.length - slab_src_loc)
  rev_radiant_interior_ceiling_slab_construction.setTubeSpacing(0.2286) # 9 inches

  layers = []
  layers << mat_refl_roof_membrane
  layers << mat_roof_insulation
  layers << mat_concrete_3_5in
  layers << mat_concrete_1_5in
  radiant_ceiling_slab_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
  radiant_ceiling_slab_construction.setName('Radiant Exterior Ceiling Slab Construction')
  radiant_ceiling_slab_construction.setSourcePresentAfterLayerNumber(3)
  radiant_ceiling_slab_construction.setTemperatureCalculationRequestedAfterLayerNumber(4)
  radiant_ceiling_slab_construction.setTubeSpacing(0.2286) # 9 inches

  # adjust hot and chilled water loop temperatures and set new setpoint schedules
  radiant_htg_dsgn_sup_wtr_temp_delt_r = 10.0
  radiant_htg_dsgn_sup_wtr_temp_c = OpenStudio.convert(radiant_htg_dsgn_sup_wtr_temp_f, 'F', 'C').get
  radiant_htg_dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(radiant_htg_dsgn_sup_wtr_temp_delt_r, 'R', 'K').get
  hot_water_loop.sizingPlant.setDesignLoopExitTemperature(radiant_htg_dsgn_sup_wtr_temp_c)
  hot_water_loop.sizingPlant.setLoopDesignTemperatureDifference(radiant_htg_dsgn_sup_wtr_temp_delt_k)
  hw_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                radiant_htg_dsgn_sup_wtr_temp_c,
                                                                                name: "#{hot_water_loop.name} Temp - #{radiant_htg_dsgn_sup_wtr_temp_f.round(0)}F",
                                                                                schedule_type_limit: 'Temperature')
  hot_water_loop.supplyOutletNode.setpointManagers.each do |spm|
    if spm.to_SetpointManagerScheduled.is_initialized
      spm = spm.to_SetpointManagerScheduled.get
      spm.setSchedule(hw_temp_sch)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Changing hot water loop setpoint for '#{hot_water_loop.name}' to '#{hw_temp_sch.name}' to account for the radiant system.")
    end
  end

  radiant_clg_dsgn_sup_wtr_temp_f = 55.0
  radiant_clg_dsgn_sup_wtr_temp_delt_r = 5.0
  radiant_clg_dsgn_sup_wtr_temp_c = OpenStudio.convert(radiant_clg_dsgn_sup_wtr_temp_f, 'F', 'C').get
  radiant_clg_dsgn_sup_wtr_temp_delt_k = OpenStudio.convert(radiant_clg_dsgn_sup_wtr_temp_delt_r, 'R', 'K').get
  chilled_water_loop.sizingPlant.setDesignLoopExitTemperature(radiant_clg_dsgn_sup_wtr_temp_c)
  chilled_water_loop.sizingPlant.setLoopDesignTemperatureDifference(radiant_clg_dsgn_sup_wtr_temp_delt_k)
  chw_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                 radiant_clg_dsgn_sup_wtr_temp_c,
                                                                                 name: "#{chilled_water_loop.name} Temp - #{radiant_clg_dsgn_sup_wtr_temp_f.round(0)}F",
                                                                                 schedule_type_limit: 'Temperature')
  chilled_water_loop.supplyOutletNode.setpointManagers.each do |spm|
    if spm.to_SetpointManagerScheduled.is_initialized
      spm = spm.to_SetpointManagerScheduled.get
      spm.setSchedule(chw_temp_sch)
      OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Changing chilled water loop setpoint for '#{chilled_water_loop.name}' to '#{chw_temp_sch.name}' to account for the radiant system.")
    end
  end

  # default temperature controls for radiant system
  zn_radiant_htg_dsgn_temp_f = 68.0
  zn_radiant_htg_dsgn_temp_c = OpenStudio.convert(zn_radiant_htg_dsgn_temp_f, 'F', 'C').get
  zn_radiant_clg_dsgn_temp_f = 74.0
  zn_radiant_clg_dsgn_temp_c = OpenStudio.convert(zn_radiant_clg_dsgn_temp_f, 'F', 'C').get

  htg_control_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                         zn_radiant_htg_dsgn_temp_c,
                                                                                         name: "Zone Radiant Loop Heating Threshold Temperature Schedule - #{zn_radiant_htg_dsgn_temp_f.round(0)}F",
                                                                                         schedule_type_limit: 'Temperature')
  clg_control_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                         zn_radiant_clg_dsgn_temp_c,
                                                                                         name: "Zone Radiant Loop Cooling Threshold Temperature Schedule - #{zn_radiant_clg_dsgn_temp_f.round(0)}F",
                                                                                         schedule_type_limit: 'Temperature')
  throttling_range_f = 4.0 # 2 degF on either side of control temperature
  throttling_range_c = OpenStudio.convert(throttling_range_f, 'F', 'C').get

  # create preset availability schedule for radiant loop
  radiant_avail_sch = OpenStudio::Model::ScheduleRuleset.new(model)
  radiant_avail_sch.setName('Radiant System Availability Schedule')

  unless radiant_lockout
    case radiant_availability_type.downcase
    when 'all_day'
      start_hour = 24
      start_minute = 0
      end_hour = 24
      end_minute = 0
    when 'afternoon_shutoff'
      start_hour = 15
      start_minute = 0
      end_hour = 22
      end_minute = 0
    when 'precool'
      start_hour = 10
      start_minute = 0
      end_hour = 22
      end_minute = 0
    when 'occupancy'
      start_hour = model_occ_hr_end.to_i
      start_minute = ((model_occ_hr_end % 1) * 60).to_i
      end_hour = model_occ_hr_start.to_i
      end_minute = ((model_occ_hr_start % 1) * 60).to_i
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Unsupported radiant availability preset '#{radiant_availability_type}'. Defaulting to all day operation.")
      start_hour = 24
      start_minute = 0
      end_hour = 24
      end_minute = 0
    end
  end

  # create custom availability schedule for radiant loop
  if radiant_lockout
    start_hour = radiant_lockout_start_time.to_i
    start_minute = ((radiant_lockout_start_time % 1) * 60).to_i
    end_hour = radiant_lockout_end_time.to_i
    end_minute = ((radiant_lockout_end_time % 1) * 60).to_i
  end

  # create availability schedules
  if end_hour > start_hour
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, start_hour, start_minute, 0), 1.0)
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, end_hour, end_minute, 0), 0.0)
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 1.0) if end_hour < 24
  elsif start_hour > end_hour
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, end_hour, end_minute, 0), 0.0)
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, start_hour, start_minute, 0), 1.0)
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0.0) if start_hour < 24
  else
    radiant_avail_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 1.0)
  end

  # convert to a two-pipe system if required
  if two_pipe_system
    model_two_pipe_loop(model, hot_water_loop, chilled_water_loop,
                        control_strategy: two_pipe_control_strategy,
                        lockout_temperature: two_pipe_lockout_temperature,
                        thermal_zones: thermal_zones)
  end

  # add supply water temperature control if enabled
  if plant_supply_water_temperature_control
    # add supply water temperature for heating plant loop
    model_add_plant_supply_water_temperature_control(model, hot_water_loop,
                                                     control_strategy: plant_supply_water_temperature_control_strategy,
                                                     sp_at_oat_low: hwsp_at_oat_low,
                                                     oat_low: hw_oat_low,
                                                     sp_at_oat_high: hwsp_at_oat_high,
                                                     oat_high: hw_oat_high,
                                                     thermal_zones: thermal_zones)

    # add supply water temperature for cooling plant loop
    model_add_plant_supply_water_temperature_control(model, chilled_water_loop,
                                                     control_strategy: plant_supply_water_temperature_control_strategy,
                                                     sp_at_oat_low: chwsp_at_oat_low,
                                                     oat_low: chw_oat_low,
                                                     sp_at_oat_high: chwsp_at_oat_high,
                                                     oat_high: chw_oat_high,
                                                     thermal_zones: thermal_zones)
  end

  # make a low temperature radiant loop for each zone
  radiant_loops = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding radiant loop for #{zone.name}.")
    if zone.name.to_s.include? ':'
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Thermal zone '#{zone.name}' has a restricted character ':' in the name and will not work with some EMS and output reporting objects. Please rename the zone.")
    end

    # create radiant coils
    if hot_water_loop
      radiant_loop_htg_coil = OpenStudio::Model::CoilHeatingLowTempRadiantVarFlow.new(model, htg_control_temp_sch)
      radiant_loop_htg_coil.setName("#{zone.name} Radiant Loop Heating Coil")
      radiant_loop_htg_coil.setHeatingControlThrottlingRange(throttling_range_c)
      hot_water_loop.addDemandBranchForComponent(radiant_loop_htg_coil)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Radiant loops require a hot water loop, but none was provided.')
    end

    if chilled_water_loop
      radiant_loop_clg_coil = OpenStudio::Model::CoilCoolingLowTempRadiantVarFlow.new(model, clg_control_temp_sch)
      radiant_loop_clg_coil.setName("#{zone.name} Radiant Loop Cooling Coil")
      radiant_loop_clg_coil.setCoolingControlThrottlingRange(throttling_range_c)
      chilled_water_loop.addDemandBranchForComponent(radiant_loop_clg_coil)
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Radiant loops require a chilled water loop, but none was provided.')
    end

    radiant_loop = OpenStudio::Model::ZoneHVACLowTempRadiantVarFlow.new(model,
                                                                        radiant_avail_sch,
                                                                        radiant_loop_htg_coil,
                                                                        radiant_loop_clg_coil)

    # assign internal source construction to floors in zone
    zone.spaces.each do |space|
      space.surfaces.each do |surface|
        if radiant_type == 'floor'
          if surface.surfaceType == 'Floor'
            if surface.outsideBoundaryCondition.include? 'Ground'
              surface.setConstruction(radiant_ground_slab_construction)
            elsif surface.outsideBoundaryCondition == 'Outdoors'
              surface.setConstruction(radiant_exterior_slab_construction)
            else # interior floor
              surface.setConstruction(radiant_interior_floor_slab_construction)

              # also assign construction to adjacent surface
              if surface.adjacentSurface.is_initialized
                adjacent_surface = surface.adjacentSurface.get
                adjacent_surface.setConstruction(rev_radiant_interior_floor_slab_construction)
              end
            end
          end
        elsif radiant_type == 'ceiling'
          if surface.surfaceType == 'RoofCeiling'
            if surface.outsideBoundaryCondition == 'Outdoors'
              surface.setConstruction(radiant_ceiling_slab_construction)
            else # interior ceiling
              surface.setConstruction(radiant_interior_ceiling_slab_construction)

              # also assign construction to adjacent surface
              if surface.adjacentSurface.is_initialized
                adjacent_surface = surface.adjacentSurface.get
                adjacent_surface.setConstruction(rev_radiant_interior_ceiling_slab_construction)
              end
            end
          end
        end
      end
    end

    # radiant loop surfaces
    radiant_loop.setName("#{zone.name} Radiant Loop")
    if radiant_type == 'floor'
      radiant_loop.setRadiantSurfaceType('Floors')
    elsif radiant_type == 'ceiling'
      radiant_loop.setRadiantSurfaceType('Ceilings')
    end

    # radiant loop layout details
    radiant_loop.setHydronicTubingInsideDiameter(0.015875) # 5/8 in. ID, 3/4 in. OD
    # @todo include a method to determine tubing length in the zone
    # loop_length = 7*zone.floorArea
    # radiant_loop.setHydronicTubingLength()
    radiant_loop.setNumberofCircuits('CalculateFromCircuitLength')
    radiant_loop.setCircuitLength(106.7)

    # radiant loop temperature controls
    radiant_loop.setTemperatureControlType(radiant_temperature_control_type)

    # radiant loop setpoint temperature response
    radiant_loop.setSetpointControlType(radiant_setpoint_control_type)
    radiant_loop.addToThermalZone(zone)
    radiant_loops << radiant_loop

    # rename nodes before adding EMS code
    OpenstudioStandards::HVAC.rename_plant_loop_nodes(model)

    # set radiant loop controls
    case control_strategy.downcase
    when 'proportional_control'
      # slab setpoint varies based on previous day zone conditions
      OpenstudioStandards::HVAC.model_add_radiant_proportional_controls(model, zone, radiant_loop,
                                                                        radiant_temperature_control_type: radiant_temperature_control_type,
                                                                        use_zone_occupancy_for_control: use_zone_occupancy_for_control,
                                                                        occupied_percentage_threshold: occupied_percentage_threshold,
                                                                        model_occ_hr_start: model_occ_hr_start,
                                                                        model_occ_hr_end: model_occ_hr_end,
                                                                        proportional_gain: proportional_gain,
                                                                        switch_over_time: switch_over_time)
    when 'oa_based_control'
      # slab setpoint varies based on outdoor weather
      OpenstudioStandards::HVAC.model_add_radiant_basic_controls(model, zone, radiant_loop,
                                                                 radiant_temperature_control_type: radiant_temperature_control_type,
                                                                 slab_setpoint_oa_control: true,
                                                                 switch_over_time: switch_over_time,
                                                                 slab_sp_at_oat_low: slab_sp_at_oat_low,
                                                                 slab_oat_low: slab_oat_low,
                                                                 slab_sp_at_oat_high: slab_sp_at_oat_high,
                                                                 slab_oat_high: slab_oat_high)
    when 'constant_control'
      # constant slab setpoint control
      OpenstudioStandards::HVAC.model_add_radiant_basic_controls(model, zone, radiant_loop,
                                                                 radiant_temperature_control_type: radiant_temperature_control_type,
                                                                 slab_setpoint_oa_control: false,
                                                                 switch_over_time: switch_over_time,
                                                                 slab_sp_at_oat_low: slab_sp_at_oat_low,
                                                                 slab_oat_low: slab_oat_low,
                                                                 slab_sp_at_oat_high: slab_sp_at_oat_high,
                                                                 slab_oat_high: slab_oat_high)
    end
  end
  return radiant_loops
end

#model_add_material(model, material_name) ⇒ OpenStudio::Model::Material

Create a material from the openstudio standards dataset.

Parameters:

Returns:

  • (OpenStudio::Model::Material)

    material object



2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2900

def model_add_material(model, material_name)
  # First check model and return material if it already exists
  model.getMaterials.sort.each do |material|
    if material.name.get.to_s == material_name
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Already added material: #{material_name}")
      return material
    end
  end

  # Get the object data
  # For Simple Glazing materials:
  # Attempt to get properties from the name of the material
  material_type = nil
  if material_name.downcase.include?('simple glazing')
    material_type = 'SimpleGlazing'
    u_factor = nil
    shgc = nil
    vt = nil
    material_name.split.each_with_index do |item, i|
      prop_value = material_name.split[i + 1].to_f
      case item
      when 'U'
        unless u_factor.nil?
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple U-Factor values have been identified for #{material_name}: previous = #{u_factor}, new = #{prop_value}. Please check the material name. New U-Factor will be used.")
        end
        u_factor = prop_value
      when 'SHGC'
        unless shgc.nil?
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple SHGC values have been identified for #{material_name}: previous = #{shgc}, new = #{prop_value}. Please check the material name. New SHGC will be used.")
        end
        shgc = prop_value
      when 'VT'
        unless vt.nil?
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple VT values have been identified for #{material_name}: previous = #{vt}, new = #{prop_value}. Please check the material name. New SHGC will be used.")
        end
        vt = prop_value
      end
    end
    if u_factor.nil? && shgc.nil? && vt.nil?
      material_type = nil
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Properties of the simple glazing material named #{material_name} could not be identified from its name.")
    else
      if u_factor.nil?
        u_factor = 1.23
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the U-Factor for the simple glazing material named #{material_name}, a default value of 1.23 is used.")
      end
      if shgc.nil?
        shgc = 0.61
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the SHGC for the simple glazing material named #{material_name}, a default value of 0.61 is used.")
      end
      if vt.nil?
        vt = 0.81
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the VT for the simple glazing material named #{material_name}, a default value of 0.81 is used.")
      end
    end
  end
  # If no properties could be found or the material
  # is not of the simple glazing type, search the database
  if material_type.nil?
    data = model_find_object(standards_data['materials'], 'name' => material_name)
    unless data
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for material: #{material_name}, will not be created.")
      return OpenStudio::Model::OptionalMaterial.new
    end
    material_type = data['material_type']
  end

  material = nil
  case material_type
  when 'StandardOpaqueMaterial'
    material = OpenStudio::Model::StandardOpaqueMaterial.new(model)
    material.setName(material_name)

    material.setRoughness(data['roughness'].to_s)
    material.setThickness(OpenStudio.convert(data['thickness'].to_f, 'in', 'm').get)
    material.setThermalConductivity(OpenStudio.convert(data['conductivity'].to_f, 'Btu*in/hr*ft^2*R', 'W/m*K').get)
    material.setDensity(OpenStudio.convert(data['density'].to_f, 'lb/ft^3', 'kg/m^3').get)
    material.setSpecificHeat(OpenStudio.convert(data['specific_heat'].to_f, 'Btu/lb*R', 'J/kg*K').get)
    material.setThermalAbsorptance(data['thermal_absorptance'].to_f)
    material.setSolarAbsorptance(data['solar_absorptance'].to_f)
    material.setVisibleAbsorptance(data['visible_absorptance'].to_f)

  when 'MasslessOpaqueMaterial'
    material = OpenStudio::Model::MasslessOpaqueMaterial.new(model)
    material.setName(material_name)
    material.setThermalResistance(OpenStudio.convert(data['resistance'].to_f, 'hr*ft^2*R/Btu', 'm^2*K/W').get)
    material.setThermalConductivity(OpenStudio.convert(data['conductivity'].to_f, 'Btu*in/hr*ft^2*R', 'W/m*K').get)
    material.setThermalAbsorptance(data['thermal_absorptance'].to_f)
    material.setSolarAbsorptance(data['solar_absorptance'].to_f)
    material.setVisibleAbsorptance(data['visible_absorptance'].to_f)

  when 'AirGap'
    material = OpenStudio::Model::AirGap.new(model)
    material.setName(material_name)

    material.setThermalResistance(OpenStudio.convert(data['resistance'].to_f, 'hr*ft^2*R/Btu*in', 'm*K/W').get)

  when 'Gas'
    material = OpenStudio::Model::Gas.new(model)
    material.setName(material_name)

    material.setThickness(OpenStudio.convert(data['thickness'].to_f, 'in', 'm').get)
    material.setGasType(data['gas_type'].to_s)

  when 'SimpleGlazing'
    material = OpenStudio::Model::SimpleGlazing.new(model)
    material.setName(material_name)

    material.setUFactor(OpenStudio.convert(u_factor.to_f, 'Btu/hr*ft^2*R', 'W/m^2*K').get)
    material.setSolarHeatGainCoefficient(shgc.to_f)
    material.setVisibleTransmittance(vt.to_f)

  when 'StandardGlazing'
    material = OpenStudio::Model::StandardGlazing.new(model)
    material.setName(material_name)

    material.setOpticalDataType(data['optical_data_type'].to_s)
    material.setThickness(OpenStudio.convert(data['thickness'].to_f, 'in', 'm').get)
    material.setSolarTransmittanceatNormalIncidence(data['solar_transmittance_at_normal_incidence'].to_f)
    material.setFrontSideSolarReflectanceatNormalIncidence(data['front_side_solar_reflectance_at_normal_incidence'].to_f)
    material.setBackSideSolarReflectanceatNormalIncidence(data['back_side_solar_reflectance_at_normal_incidence'].to_f)
    material.setVisibleTransmittanceatNormalIncidence(data['visible_transmittance_at_normal_incidence'].to_f)
    material.setFrontSideVisibleReflectanceatNormalIncidence(data['front_side_visible_reflectance_at_normal_incidence'].to_f)
    material.setBackSideVisibleReflectanceatNormalIncidence(data['back_side_visible_reflectance_at_normal_incidence'].to_f)
    material.setInfraredTransmittanceatNormalIncidence(data['infrared_transmittance_at_normal_incidence'].to_f)
    material.setFrontSideInfraredHemisphericalEmissivity(data['front_side_infrared_hemispherical_emissivity'].to_f)
    material.setBackSideInfraredHemisphericalEmissivity(data['back_side_infrared_hemispherical_emissivity'].to_f)
    material.setThermalConductivity(OpenStudio.convert(data['conductivity'].to_f, 'Btu*in/hr*ft^2*R', 'W/m*K').get)
    material.setDirtCorrectionFactorforSolarandVisibleTransmittance(data['dirt_correction_factor_for_solar_and_visible_transmittance'].to_f)
    if /true/i =~ data['solar_diffusing'].to_s
      material.setSolarDiffusing(true)
    else
      material.setSolarDiffusing(false)
    end

  else
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "Unknown material type #{material_type}, cannot add material called #{material_name}.")
    exit
  end

  return material
end

#model_add_minisplit_hp(model, thermal_zones, cooling_type: 'Two Speed DX AC', heating_type: 'Single Speed DX', hvac_op_sch: nil) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a minisplit heatpump system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • cooling_type (String) (defaults to: 'Two Speed DX AC')

    valid choices are Two Speed DX AC, Single Speed DX AC, Single Speed Heat Pump

  • heating_type (String) (defaults to: 'Single Speed DX')

    valid choices are Single Speed DX

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting split AC air loop



3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3919

def model_add_minisplit_hp(model,
                           thermal_zones,
                           cooling_type: 'Two Speed DX AC',
                           heating_type: 'Single Speed DX',
                           hvac_op_sch: nil)

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # default design temperatures across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted temperatures for minisplit
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
  dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

  minisplit_hps = []
  thermal_zones.each do |zone|
    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    air_loop.setName("#{zone.name} Minisplit Heat Pump")
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding minisplit HP for #{zone.name}.")

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, sizing_option: 'NonCoincident')
    sizing_system.setAllOutdoorAirinCooling(false)
    sizing_system.setAllOutdoorAirinHeating(false)

    # create heating coil
    case heating_type
    when 'Single Speed DX'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                               name: "#{air_loop.name} Heating Coil",
                                                                               type: 'Residential Minisplit HP')
      htg_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(OpenStudio.convert(-30.0, 'F', 'C').get)
      htg_coil.setMaximumOutdoorDryBulbTemperatureforDefrostOperation(OpenStudio.convert(40.0, 'F', 'C').get)
      htg_coil.setCrankcaseHeaterCapacity(0)
      htg_coil.setDefrostStrategy('ReverseCycle')
      htg_coil.setDefrostControl('OnDemand')
      htg_coil.resetDefrostTimePeriodFraction
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "No heating coil type selected for minisplit HP for #{zone.name}.")
      htg_coil = nil
    end

    # create backup heating coil
    supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                   name: "#{air_loop.name} Electric Backup Htg Coil")

    # create cooling coil
    case cooling_type
    when 'Two Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                                            name: "#{air_loop.name} 2spd DX AC Clg Coil",
                                                                            type: 'Residential Minisplit HP')
    when 'Single Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} 1spd DX AC Clg Coil", type: 'Split AC')
    when 'Single Speed Heat Pump'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} 1spd DX HP Clg Coil", type: 'Heat Pump')
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "No cooling coil type selected for minisplit HP for #{zone.name}.")
      clg_coil = nil
    end

    # create fan
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Minisplit_HP_Fan',
                                                       fan_name: "#{air_loop.name} Fan",
                                                       end_use_subcategory: 'Minisplit HP Fans')
    fan.setAvailabilitySchedule(hvac_op_sch)

    # create unitary system (holds the coils and fan)
    unitary = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary.setName("#{air_loop.name} Unitary System")
    unitary.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
    unitary.setMaximumSupplyAirTemperature(OpenStudio.convert(200.0, 'F', 'C').get)
    unitary.setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(OpenStudio.convert(40.0, 'F', 'C').get)
    unitary.setControllingZoneorThermostatLocation(zone)
    unitary.addToNode(air_loop.supplyInletNode)
    unitary.setSupplyAirFlowRateWhenNoCoolingorHeatingisRequired(0.0)

    # attach the coils and fan
    unitary.setHeatingCoil(htg_coil) if htg_coil
    unitary.setCoolingCoil(clg_coil) if clg_coil
    unitary.setSupplementalHeatingCoil(supplemental_htg_coil) if supplemental_htg_coil
    unitary.setSupplyFan(fan)
    unitary.setFanPlacement('BlowThrough')
    unitary.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)

    # create a diffuser
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName(" #{zone.name} Direct Air")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    minisplit_hps << air_loop
  end

  return minisplit_hps
end

#model_add_plant_supply_water_temperature_control(model, plant_water_loop, control_strategy: 'outdoor_air', sp_at_oat_low: nil, oat_low: nil, sp_at_oat_high: nil, oat_high: nil, thermal_zones: []) ⇒ Object

Adds supply water temperature control on specified plant water loops.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • plant_water_loop (OpenStudio::Model::PlantLoop)

    plant water loop to add supply water temperature control.

  • control_strategy (String) (defaults to: 'outdoor_air')

    Method to determine how to control the plant's supply water temperature (swt). 'outdoor_air' - The plant's swt will be proportional to the outdoor air based on the next 4 parameters. 'zone_demand' - The plant's swt will be determined by preponderance of zone demand. Requires thermal_zone defined.

  • sp_at_oat_low (Double) (defaults to: nil)

    supply water temperature setpoint, in F, at the outdoor low temperature.

  • oat_low (Double) (defaults to: nil)

    outdoor drybulb air temperature, in F, for low setpoint.

  • sp_at_oat_high (Double) (defaults to: nil)

    supply water temperature setpoint, in F, at the outdoor high temperature.

  • oat_high (Double) (defaults to: nil)

    outdoor drybulb air temperature, in F, for high setpoint.

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>) (defaults to: [])

    array of zones



6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6340

def model_add_plant_supply_water_temperature_control(model, plant_water_loop,
                                                     control_strategy: 'outdoor_air',
                                                     sp_at_oat_low: nil,
                                                     oat_low: nil,
                                                     sp_at_oat_high: nil,
                                                     oat_high: nil,
                                                     thermal_zones: [])

  # check that all required temperature parameters are defined
  if sp_at_oat_low.nil? && oat_low.nil? && sp_at_oat_high.nil? && oat_high.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'At least one of the required temperature parameter is nil.')
  end

  # remove any existing setpoint manager on the plant water loop
  exisiting_setpoint_managers = plant_water_loop.loopTemperatureSetpointNode.setpointManagers
  exisiting_setpoint_managers.each(&:disconnect)

  if control_strategy == 'outdoor_air'
    # create supply water temperature setpoint managers for plant based on outdoor temperature
    water_loop_setpoint_manager = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
    water_loop_setpoint_manager.setName("#{plant_water_loop.name.get} Supply Water Temperature Control")
    water_loop_setpoint_manager.setControlVariable('Temperature')
    water_loop_setpoint_manager.setSetpointatOutdoorLowTemperature(OpenStudio.convert(sp_at_oat_low, 'F', 'C').get)
    water_loop_setpoint_manager.setOutdoorLowTemperature(OpenStudio.convert(oat_low, 'F', 'C').get)
    water_loop_setpoint_manager.setSetpointatOutdoorHighTemperature(OpenStudio.convert(sp_at_oat_high, 'F', 'C').get)
    water_loop_setpoint_manager.setOutdoorHighTemperature(OpenStudio.convert(oat_high, 'F', 'C').get)
    water_loop_setpoint_manager.addToNode(plant_water_loop.loopTemperatureSetpointNode)
  else
    # create supply water temperature setpoint managers for plant based on zone heating and cooling demand
    # check if zone heat and cool requests program exists, if not create it
    determine_zone_cooling_needs_prg = model.getEnergyManagementSystemProgramByName('Determine_Zone_Cooling_Needs')
    determine_zone_heating_needs_prg = model.getEnergyManagementSystemProgramByName('Determine_Zone_Heating_Needs')
    unless determine_zone_cooling_needs_prg.is_initialized && determine_zone_heating_needs_prg.is_initialized
      model_add_zone_heat_cool_request_count_program(model, thermal_zones)
    end

    plant_water_loop_name = OpenstudioStandards::HVAC.ems_friendly_name(plant_water_loop.name)

    if plant_water_loop.componentType.valueName == 'Heating'
      swt_upper_limit = sp_at_oat_low.nil? ? OpenStudio.convert(120, 'F', 'C').get : OpenStudio.convert(sp_at_oat_low, 'F', 'C').get
      swt_lower_limit = sp_at_oat_high.nil? ? OpenStudio.convert(80, 'F', 'C').get : OpenStudio.convert(sp_at_oat_high, 'F', 'C').get
      swt_init = OpenStudio.convert(100, 'F', 'C').get
      zone_demand_var = 'Zone_Heating_Ratio'
      swt_inc_condition_var = '> 0.70'
      swt_dec_condition_var = '< 0.30'
    else
      swt_upper_limit = sp_at_oat_low.nil? ? OpenStudio.convert(70, 'F', 'C').get : OpenStudio.convert(sp_at_oat_low, 'F', 'C').get
      swt_lower_limit = sp_at_oat_high.nil? ? OpenStudio.convert(55, 'F', 'C').get : OpenStudio.convert(sp_at_oat_high, 'F', 'C').get
      swt_init = OpenStudio.convert(62, 'F', 'C').get
      zone_demand_var = 'Zone_Cooling_Ratio'
      swt_inc_condition_var = '< 0.30'
      swt_dec_condition_var = '> 0.70'
    end

    # plant loop supply water control actuator
    sch_plant_swt_ctrl = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                         swt_init,
                                                                                         name: "#{plant_water_loop_name}_Sch_Supply_Water_Temperature",
                                                                                         schedule_type_limit: 'Temperature')

    cmd_plant_water_ctrl = OpenStudio::Model::EnergyManagementSystemActuator.new(sch_plant_swt_ctrl,
                                                                                 'Schedule:Year',
                                                                                 'Schedule Value')
    cmd_plant_water_ctrl.setName("#{plant_water_loop_name}_supply_water_ctrl")

    # create plant loop setpoint manager
    water_loop_setpoint_manager = OpenStudio::Model::SetpointManagerScheduled.new(model,
                                                                                  sch_plant_swt_ctrl)
    water_loop_setpoint_manager.setName("#{plant_water_loop.name.get} Supply Water Temperature Control")
    water_loop_setpoint_manager.setControlVariable('Temperature')
    water_loop_setpoint_manager.addToNode(plant_water_loop.loopTemperatureSetpointNode)

    # add uninitialized variables into constant program
    set_constant_values_prg_body = <<-EMS
      SET #{plant_water_loop_name}_supply_water_ctrl = #{swt_init}
    EMS

    set_constant_values_prg = model.getEnergyManagementSystemProgramByName('Set_Plant_Constant_Values')
    if set_constant_values_prg.is_initialized
      set_constant_values_prg = set_constant_values_prg.get
      set_constant_values_prg.addLine(set_constant_values_prg_body)
    else
      set_constant_values_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
      set_constant_values_prg.setName('Set_Plant_Constant_Values')
      set_constant_values_prg.setBody(set_constant_values_prg_body)
    end

    # program for supply water temperature control in the plot
    determine_plant_swt_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    determine_plant_swt_prg.setName("Determine_#{plant_water_loop_name}_Supply_Water_Temperature")
    determine_plant_swt_prg_body = <<-EMS
      SET SWT_Increase = 1,
      SET SWT_Decrease = 1,
      SET SWT_upper_limit = #{swt_upper_limit},
      SET SWT_lower_limit = #{swt_lower_limit},
      IF #{zone_demand_var} #{swt_inc_condition_var} && (@Mod CurrentTime 1) == 0,
        SET #{plant_water_loop_name}_supply_water_ctrl = #{plant_water_loop_name}_supply_water_ctrl + SWT_Increase,
      ELSEIF #{zone_demand_var} #{swt_dec_condition_var} && (@Mod CurrentTime 1) == 0,
        SET #{plant_water_loop_name}_supply_water_ctrl = #{plant_water_loop_name}_supply_water_ctrl - SWT_Decrease,
      ELSE,
        SET #{plant_water_loop_name}_supply_water_ctrl = #{plant_water_loop_name}_supply_water_ctrl,
      ENDIF,
      IF #{plant_water_loop_name}_supply_water_ctrl > SWT_upper_limit,
        SET #{plant_water_loop_name}_supply_water_ctrl = SWT_upper_limit
      ENDIF,
      IF #{plant_water_loop_name}_supply_water_ctrl < SWT_lower_limit,
        SET #{plant_water_loop_name}_supply_water_ctrl = SWT_lower_limit
      ENDIF
    EMS
    determine_plant_swt_prg.setBody(determine_plant_swt_prg_body)

    # create EMS program manager objects
    programs_at_beginning_of_timestep = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
    programs_at_beginning_of_timestep.setName("#{plant_water_loop_name}_Demand_Based_Supply_Water_Temperature_At_Beginning_Of_Timestep")
    programs_at_beginning_of_timestep.setCallingPoint('BeginTimestepBeforePredictor')
    programs_at_beginning_of_timestep.addProgram(determine_plant_swt_prg)

    initialize_constant_parameters = model.getEnergyManagementSystemProgramCallingManagerByName('Initialize_Constant_Parameters')
    if initialize_constant_parameters.is_initialized
      initialize_constant_parameters = initialize_constant_parameters.get
      # add program if it does not exist in manager
      existing_program_names = initialize_constant_parameters.programs.collect { |prg| prg.name.get.downcase }
      unless existing_program_names.include? set_constant_values_prg.name.get.downcase
        initialize_constant_parameters.addProgram(set_constant_values_prg)
      end
    else
      initialize_constant_parameters = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
      initialize_constant_parameters.setName('Initialize_Constant_Parameters')
      initialize_constant_parameters.setCallingPoint('BeginNewEnvironment')
      initialize_constant_parameters.addProgram(set_constant_values_prg)
    end

    initialize_constant_parameters_after_warmup = model.getEnergyManagementSystemProgramCallingManagerByName('Initialize_Constant_Parameters_After_Warmup')
    if initialize_constant_parameters_after_warmup.is_initialized
      initialize_constant_parameters_after_warmup = initialize_constant_parameters_after_warmup.get
      # add program if it does not exist in manager
      existing_program_names = initialize_constant_parameters_after_warmup.programs.collect { |prg| prg.name.get.downcase }
      unless existing_program_names.include? set_constant_values_prg.name.get.downcase
        initialize_constant_parameters_after_warmup.addProgram(set_constant_values_prg)
      end
    else
      initialize_constant_parameters_after_warmup = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
      initialize_constant_parameters_after_warmup.setName('Initialize_Constant_Parameters_After_Warmup')
      initialize_constant_parameters_after_warmup.setCallingPoint('AfterNewEnvironmentWarmUpIsComplete')
      initialize_constant_parameters_after_warmup.addProgram(set_constant_values_prg)
    end
  end
end

#model_add_prm_baseline_system(model, system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones, zone_fan_scheds) ⇒ Boolean

TODO:

Add 90.1-2013 systems 11-13

Add the specified baseline system type to the specified zones based on the specified template. For some multi-zone system types, the standards require identifying zones whose loads or schedules are outliers and putting these systems on separate single-zone systems. This method does that.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • system_type (String)

    The system type. Valid choices are PTHP, PTAC, PSZ_AC, PSZ_HP, PVAV_Reheat, PVAV_PFP_Boxes, VAV_Reheat, VAV_PFP_Boxes, Gas_Furnace, Electric_Furnace, which are also returned by the method OpenStudio::Model::Model.prm_baseline_system_type.

  • main_heat_fuel (String)

    main heating fuel. Valid choices are Electricity, NaturalGas, DistrictHeating, DistrictHeatingWater, DistrictHeatingSteam

  • zone_heat_fuel (String)

    zone heating/reheat fuel. Valid choices are Electricity, NaturalGas, DistrictHeating, DistrictHeatingWater, DistrictHeatingSteam

  • cool_fuel (String)

    cooling fuel. Valid choices are Electricity, DistrictCooling

  • zones (Array<OpenStudio::Model::ThermalZone>)

    an array of zones

Returns:

  • (Boolean)

    returns true if successful, false if not



1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1412

def model_add_prm_baseline_system(model, system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones, zone_fan_scheds)
  case system_type
    when 'PTAC' # System 1
      unless zones.empty?
        # Retrieve the existing hot water loop or add a new one if necessary.
        hot_water_loop = nil
        hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                           model.getPlantLoopByName('Hot Water Loop').get
                         else
                           model_add_hw_loop(model, main_heat_fuel)
                         end

        # Add a hot water PTAC to each zone
        model_add_ptac(model,
                       zones,
                       cooling_type: 'Single Speed DX AC',
                       heating_type: 'Water',
                       hot_water_loop: hot_water_loop,
                       fan_type: 'ConstantVolume')
      end

    when 'PTHP' # System 2
      unless zones.empty?
        # add an air-source packaged terminal heat pump with electric supplemental heat to each zone.
        model_add_pthp(model,
                       zones,
                       fan_type: 'ConstantVolume')
      end

    when 'PSZ_AC' # System 3
      unless zones.empty?
        heating_type = 'Gas'
        # if district heating
        hot_water_loop = nil
        if main_heat_fuel.include?('DistrictHeating')
          heating_type = 'Water'
          hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                             model.getPlantLoopByName('Hot Water Loop').get
                           else
                             model_add_hw_loop(model, main_heat_fuel)
                           end
        end

        cooling_type = 'Single Speed DX AC'
        # If district cooling
        chilled_water_loop = nil
        if cool_fuel == 'DistrictCooling'
          cooling_type = 'Water'
          chilled_water_loop = if model.getPlantLoopByName('Chilled Water Loop').is_initialized
                                 model.getPlantLoopByName('Chilled Water Loop').get
                               else
                                 model_add_chw_loop(model,
                                                    cooling_fuel: cool_fuel,
                                                    chw_pumping_type: 'const_pri')
                               end
        end

        # Add a PSZ-AC to each zone
        model_add_psz_ac(model,
                         zones,
                         cooling_type: cooling_type,
                         chilled_water_loop: chilled_water_loop,
                         heating_type: heating_type,
                         supplemental_heating_type: 'Gas',
                         hot_water_loop: hot_water_loop,
                         fan_location: 'DrawThrough',
                         fan_type: 'ConstantVolume')
      end

    when 'PSZ_HP' # System 4
      unless zones.empty?
        # Add an air-source packaged single zone heat pump with electric supplemental heat to each zone.
        model_add_psz_ac(model,
                         zones,
                         system_name: 'PSZ-HP',
                         cooling_type: 'Single Speed Heat Pump',
                         heating_type: 'Single Speed Heat Pump',
                         supplemental_heating_type: 'Electric',
                         fan_location: 'DrawThrough',
                         fan_type: 'ConstantVolume')
      end

    when 'PVAV_Reheat' # System 5
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model, main_heat_fuel)
                       end

      # If district cooling
      chilled_water_loop = nil
      if cool_fuel == 'DistrictCooling'
        chilled_water_loop = if model.getPlantLoopByName('Chilled Water Loop').is_initialized
                               model.getPlantLoopByName('Chilled Water Loop').get
                             else
                               model_add_chw_loop(model,
                                                  cooling_fuel: cool_fuel,
                                                  chw_pumping_type: 'const_pri')
                             end
      end

      # If electric zone heat
      electric_reheat = false
      if zone_heat_fuel == 'Electricity'
        electric_reheat = true
      end

      # Group zones by story
      story_zone_lists = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model, zones)

      # For the array of zones on each story,
      # separate the primary zones from the secondary zones.
      # Add the baseline system type to the primary zones
      # and add the suplemental system type to the secondary zones.
      story_zone_lists.each do |story_group|
        # Differentiate primary and secondary zones
        pri_sec_zone_lists = model_differentiate_primary_secondary_thermal_zones(model, story_group, zone_fan_scheds)
        pri_zones = pri_sec_zone_lists['primary']
        sec_zones = pri_sec_zone_lists['secondary']
        zone_op_hrs = pri_sec_zone_lists['zone_op_hrs']

        # Add a PVAV with Reheat for the primary zones
        stories = []
        story_group[0].spaces.each do |space|
          min_z = OpenstudioStandards::Geometry.building_story_get_minimum_height(space.buildingStory.get)
          stories << [space.buildingStory.get.name.get, min_z]
        end
        story_name = stories.min_by { |nm, z| z }[0]
        system_name = "#{story_name} PVAV_Reheat (Sys5)"

        # If and only if there are primary zones to attach to the loop
        # counter example: floor with only one elevator machine room that get classified as sec_zones
        unless pri_zones.empty?
          air_loop = model_add_pvav(model,
                                    pri_zones,
                                    system_name: system_name,
                                    hot_water_loop: hot_water_loop,
                                    chilled_water_loop: chilled_water_loop,
                                    electric_reheat: electric_reheat)
          model_system_outdoor_air_sizing_vrp_method(air_loop)
          air_loop_hvac_apply_vav_damper_action(air_loop)
          model_create_multizone_fan_schedule(model, zone_op_hrs, pri_zones, system_name)
        end

        # Add a PSZ_AC for each secondary zone
        unless sec_zones.empty?
          model_add_prm_baseline_system(model, 'PSZ_AC', main_heat_fuel, zone_heat_fuel, cool_fuel, sec_zones, zone_fan_scheds)
        end
      end

    when 'PVAV_PFP_Boxes' # System 6
      # If district cooling
      chilled_water_loop = nil
      if cool_fuel == 'DistrictCooling'
        chilled_water_loop = if model.getPlantLoopByName('Chilled Water Loop').is_initialized
                               model.getPlantLoopByName('Chilled Water Loop').get
                             else
                               model_add_chw_loop(model,
                                                  cooling_fuel: cool_fuel,
                                                  chw_pumping_type: 'const_pri')
                             end
      end

      # Group zones by story
      story_zone_lists = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model, zones)

      # For the array of zones on each story,
      # separate the primary zones from the secondary zones.
      # Add the baseline system type to the primary zones
      # and add the suplemental system type to the secondary zones.
      story_zone_lists.each do |story_group|
        # Differentiate primary and secondary zones
        pri_sec_zone_lists = model_differentiate_primary_secondary_thermal_zones(model, story_group, zone_fan_scheds)
        pri_zones = pri_sec_zone_lists['primary']
        sec_zones = pri_sec_zone_lists['secondary']
        zone_op_hrs = pri_sec_zone_lists['zone_op_hrs']

        # Add an VAV for the primary zones
        stories = []
        story_group[0].spaces.each do |space|
          min_z = OpenstudioStandards::Geometry.building_story_get_minimum_height(space.buildingStory.get)
          stories << [space.buildingStory.get.name.get, min_z]
        end
        story_name = stories.min_by { |nm, z| z }[0]
        system_name = "#{story_name} PVAV_PFP_Boxes (Sys6)"
        # If and only if there are primary zones to attach to the loop
        unless pri_zones.empty?
          model_add_pvav_pfp_boxes(model,
                                   pri_zones,
                                   system_name: system_name,
                                   chilled_water_loop: chilled_water_loop,
                                   fan_efficiency: 0.62,
                                   fan_motor_efficiency: 0.9,
                                   fan_pressure_rise: 4.0)
          model_create_multizone_fan_schedule(model, zone_op_hrs, pri_zones, system_name)
        end
        # Add a PSZ_HP for each secondary zone
        unless sec_zones.empty?
          model_add_prm_baseline_system(model, 'PSZ_HP', main_heat_fuel, zone_heat_fuel, cool_fuel, sec_zones, zone_fan_scheds)
        end
      end

    when 'VAV_Reheat' # System 7
      # Retrieve the existing hot water loop or add a new one if necessary.
      hot_water_loop = nil
      hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                         model.getPlantLoopByName('Hot Water Loop').get
                       else
                         model_add_hw_loop(model, main_heat_fuel)
                       end

      # Retrieve the existing chilled water loop or add a new one if necessary.
      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      else
        if cool_fuel == 'DistrictCooling'
          chilled_water_loop = model_add_chw_loop(model,
                                                  cooling_fuel: cool_fuel,
                                                  chw_pumping_type: 'const_pri')
        else
          fan_type = model_cw_loop_cooling_tower_fan_type(model)
          condenser_water_loop = model_add_cw_loop(model,
                                                   cooling_tower_type: 'Open Cooling Tower',
                                                   cooling_tower_fan_type: 'Propeller or Axial',
                                                   cooling_tower_capacity_control: fan_type,
                                                   number_of_cells_per_tower: 1,
                                                   number_cooling_towers: 1)
          chilled_water_loop = model_add_chw_loop(model,
                                                  chw_pumping_type: 'const_pri_var_sec',
                                                  chiller_cooling_type: 'WaterCooled',
                                                  chiller_compressor_type: 'Rotary Screw',
                                                  condenser_water_loop: condenser_water_loop)
        end
      end

      # If electric zone heat
      reheat_type = 'Water'
      if zone_heat_fuel == 'Electricity'
        reheat_type = 'Electricity'
      end

      # Group zones by story
      story_zone_lists = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model, zones)

      # For the array of zones on each story, separate the primary zones from the secondary zones.
      # Add the baseline system type to the primary zones and add the suplemental system type to the secondary zones.
      story_zone_lists.each do |story_group|
        # The OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model)  NO LONGER returns empty lists when a given floor doesn't have any of the zones
        # So NO need to filter it out otherwise you get an error undefined method `spaces' for nil:NilClass
        # next if zones.empty?

        # Differentiate primary and secondary zones
        pri_sec_zone_lists = model_differentiate_primary_secondary_thermal_zones(model, story_group, zone_fan_scheds)
        pri_zones = pri_sec_zone_lists['primary']
        sec_zones = pri_sec_zone_lists['secondary']
        zone_op_hrs = pri_sec_zone_lists['zone_op_hrs']

        # Add a VAV for the primary zones
        stories = []
        story_group[0].spaces.each do |space|
          min_z = OpenstudioStandards::Geometry.building_story_get_minimum_height(space.buildingStory.get)
          stories << [space.buildingStory.get.name.get, min_z]
        end
        story_name = stories.min_by { |nm, z| z }[0]
        system_name = "#{story_name} VAV_Reheat (Sys7)"

        # If and only if there are primary zones to attach to the loop
        # counter example: floor with only one elevator machine room that get classified as sec_zones
        unless pri_zones.empty?
          # if the loop configuration is primary / secondary loop
          if chilled_water_loop.additionalProperties.hasFeature('secondary_loop_name')
            chilled_water_loop = model.getPlantLoopByName(chilled_water_loop.additionalProperties.getFeatureAsString('secondary_loop_name').get).get
          end
          air_loop = model_add_vav_reheat(model,
                                          pri_zones,
                                          system_name: system_name,
                                          reheat_type: reheat_type,
                                          hot_water_loop: hot_water_loop,
                                          chilled_water_loop: chilled_water_loop,
                                          fan_efficiency: 0.62,
                                          fan_motor_efficiency: 0.9,
                                          fan_pressure_rise: 4.0)
          model_system_outdoor_air_sizing_vrp_method(air_loop)
          air_loop_hvac_apply_vav_damper_action(air_loop)
          model_create_multizone_fan_schedule(model, zone_op_hrs, pri_zones, system_name)
        end

        # Add a PSZ_AC for each secondary zone
        unless sec_zones.empty?
          model_add_prm_baseline_system(model, 'PSZ_AC', main_heat_fuel, zone_heat_fuel, cool_fuel, sec_zones, zone_fan_scheds)
        end
      end

    when 'VAV_PFP_Boxes' # System 8
      # Retrieve the existing chilled water loop or add a new one if necessary.
      chilled_water_loop = nil
      if model.getPlantLoopByName('Chilled Water Loop').is_initialized
        chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
      else
        if cool_fuel == 'DistrictCooling'
          chilled_water_loop = model_add_chw_loop(model,
                                                  cooling_fuel: cool_fuel,
                                                  chw_pumping_type: 'const_pri')
        else
          fan_type = model_cw_loop_cooling_tower_fan_type(model)
          condenser_water_loop = model_add_cw_loop(model,
                                                   cooling_tower_type: 'Open Cooling Tower',
                                                   cooling_tower_fan_type: 'Propeller or Axial',
                                                   cooling_tower_capacity_control: fan_type,
                                                   number_of_cells_per_tower: 1,
                                                   number_cooling_towers: 1)
          chilled_water_loop = model_add_chw_loop(model,
                                                  chw_pumping_type: 'const_pri_var_sec',
                                                  chiller_cooling_type: 'WaterCooled',
                                                  chiller_compressor_type: 'Rotary Screw',
                                                  condenser_water_loop: condenser_water_loop)
        end
      end

      # Group zones by story
      story_zone_lists = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model, zones)

      # For the array of zones on each story,
      # separate the primary zones from the secondary zones.
      # Add the baseline system type to the primary zones
      # and add the suplemental system type to the secondary zones.
      story_zone_lists.each do |story_group|
        # Differentiate primary and secondary zones
        pri_sec_zone_lists = model_differentiate_primary_secondary_thermal_zones(model, story_group, zone_fan_scheds)
        pri_zones = pri_sec_zone_lists['primary']
        sec_zones = pri_sec_zone_lists['secondary']
        zone_op_hrs = pri_sec_zone_lists['zone_op_hrs']

        # Add an VAV for the primary zones
        stories = []
        story_group[0].spaces.each do |space|
          min_z = OpenstudioStandards::Geometry.building_story_get_minimum_height(space.buildingStory.get)
          stories << [space.buildingStory.get.name.get, min_z]
        end
        story_name = stories.min_by { |nm, z| z }[0]
        system_name = "#{story_name} VAV_PFP_Boxes (Sys8)"
        # If and only if there are primary zones to attach to the loop
        unless pri_zones.empty?
          if chilled_water_loop.additionalProperties.hasFeature('secondary_loop_name')
            chilled_water_loop = model.getPlantLoopByName(chilled_water_loop.additionalProperties.getFeatureAsString('secondary_loop_name').get).get
          end
          model_add_vav_pfp_boxes(model,
                                  pri_zones,
                                  system_name: system_name,
                                  chilled_water_loop: chilled_water_loop,
                                  fan_efficiency: 0.62,
                                  fan_motor_efficiency: 0.9,
                                  fan_pressure_rise: 4.0)

          model_create_multizone_fan_schedule(model, zone_op_hrs, pri_zones, system_name)
        end
        # Add a PSZ_HP for each secondary zone
        unless sec_zones.empty?
          model_add_prm_baseline_system(model, 'PSZ_HP', main_heat_fuel, zone_heat_fuel, cool_fuel, sec_zones, zone_fan_scheds)
        end
      end

    when 'Gas_Furnace' # System 9
      unless zones.empty?
        # If district heating
        hot_water_loop = nil
        if main_heat_fuel.include?('DistrictHeating')
          hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                             model.getPlantLoopByName('Hot Water Loop').get
                           else
                             model_add_hw_loop(model, main_heat_fuel)
                           end
        end
        # Add a System 9 - Gas Unit Heater to each zone
        model_add_unitheater(model,
                             zones,
                             fan_control_type: 'ConstantVolume',
                             fan_pressure_rise: 0.2,
                             heating_type: main_heat_fuel,
                             hot_water_loop: hot_water_loop)
      end

    when 'Electric_Furnace' # System 10
      unless zones.empty?
        # Add a System 10 - Electric Unit Heater to each zone
        model_add_unitheater(model,
                             zones,
                             fan_control_type: 'ConstantVolume',
                             fan_pressure_rise: 0.2,
                             heating_type: main_heat_fuel)
      end

    when 'SZ_CV' # System 12 (gas or district heat) or System 13 (electric resistance heat)
      unless zones.empty?
        hot_water_loop = nil
        if zone_heat_fuel.include?('DistrictHeating') || zone_heat_fuel == 'NaturalGas'
          heating_type = 'Water'
          hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                             model.getPlantLoopByName('Hot Water Loop').get
                           else
                             model_add_hw_loop(model, main_heat_fuel)
                           end
        else
          # If no hot water loop is defined, heat will default to electric resistance
          heating_type = 'Electric'
        end
        cooling_type = 'Water'
        chilled_water_loop = if model.getPlantLoopByName('Chilled Water Loop').is_initialized
                               model.getPlantLoopByName('Chilled Water Loop').get
                             else
                               model_add_chw_loop(model,
                                                  cooling_fuel: cool_fuel,
                                                  chw_pumping_type: 'const_pri')
                             end

        model_add_four_pipe_fan_coil(model,
                                     zones,
                                     chilled_water_loop,
                                     hot_water_loop: hot_water_loop,
                                     ventilation: true,
                                     capacity_control_method: 'ConstantVolume')
      end
    when 'SZ_VAV' # System 11, chilled water, heating type varies by climate zone
      unless zones.empty?
        # htg type
        climate_zone = OpenstudioStandards::Weather.model_get_climate_zone(model)
        case climate_zone
          when 'ASHRAE 169-2006-0A',
            'ASHRAE 169-2006-0B',
            'ASHRAE 169-2006-1A',
            'ASHRAE 169-2006-1B',
            'ASHRAE 169-2006-2A',
            'ASHRAE 169-2006-2B',
            'ASHRAE 169-2013-0A',
            'ASHRAE 169-2013-0B',
            'ASHRAE 169-2013-1A',
            'ASHRAE 169-2013-1B',
            'ASHRAE 169-2013-2A',
            'ASHRAE 169-2013-2B'
            heating_type = 'Electric'
            hot_water_loop = nil
          else
            hot_water_loop = if model.getPlantLoopByName('Hot Water Loop').is_initialized
                               model.getPlantLoopByName('Hot Water Loop').get
                             else
                               hot_water_loop = model_add_hw_loop(model, main_heat_fuel)
                             end
            heating_type = 'Water'
        end

        # clg type
        chilled_water_loop = if model.getPlantLoopByName('Chilled Water Loop').is_initialized
                               model.getPlantLoopByName('Chilled Water Loop').get
                             else
                               chilled_water_loop = model_add_chw_loop(model, chw_pumping_type: 'const_pri')
                             end

        model_add_psz_vav(model,
                          zones,
                          heating_type: heating_type,
                          cooling_type: 'WaterCooled',
                          supplemental_heating_type: nil,
                          hvac_op_sch: nil,
                          fan_type: 'PSZ_VAV_System_Fan',
                          oa_damper_sch: nil,
                          hot_water_loop: hot_water_loop,
                          chilled_water_loop: chilled_water_loop,
                          minimum_volume_setpoint: 0.5)
      end
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "System type #{system_type} is not a valid choice, nothing will be added to the model.")
      return false
  end
  return true
end

#model_add_prm_elevators(model) ⇒ Object

Function to add baseline elevators based on user data Only applicable to stable baseline

Parameters:



4965
4966
4967
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 4965

def model_add_prm_elevators(model)
  return false
end

#model_add_psz_ac(model, thermal_zones, system_name: nil, cooling_type: 'Single Speed DX AC', chilled_water_loop: nil, hot_water_loop: nil, heating_type: nil, supplemental_heating_type: nil, fan_location: 'DrawThrough', fan_type: 'ConstantVolume', hvac_op_sch: nil, oa_damper_sch: nil) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates a PSZ-AC system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • cooling_type (String) (defaults to: 'Single Speed DX AC')

    valid choices are Water, Two Speed DX AC, Single Speed DX AC, Single Speed Heat Pump, Water To Air Heat Pump

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect cooling coil to, or nil

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect heating coil to, or nil

  • heating_type (String) (defaults to: nil)

    valid choices are NaturalGas, Electricity, Water, Single Speed Heat Pump, Water To Air Heat Pump, or nil (no heat)

  • supplemental_heating_type (String) (defaults to: nil)

    valid choices are Electricity, NaturalGas, nil (no heat)

  • fan_location (String) (defaults to: 'DrawThrough')

    valid choices are BlowThrough, DrawThrough

  • fan_type (String) (defaults to: 'ConstantVolume')

    valid choices are ConstantVolume, Cycling

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    an array of the resulting PSZ-AC air loops



2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 2729

def model_add_psz_ac(model,
                     thermal_zones,
                     system_name: nil,
                     cooling_type: 'Single Speed DX AC',
                     chilled_water_loop: nil,
                     hot_water_loop: nil,
                     heating_type: nil,
                     supplemental_heating_type: nil,
                     fan_location: 'DrawThrough',
                     fan_type: 'ConstantVolume',
                     hvac_op_sch: nil,
                     oa_damper_sch: nil)

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # create a PSZ-AC for each zone
  air_loops = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding PSZ-AC for #{zone.name}.")

    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    if system_name.nil?
      air_loop.setName("#{zone.name} PSZ-AC")
    else
      air_loop.setName("#{zone.name} #{system_name}")
    end

    # default design temperatures and settings used across all air loops
    dsgn_temps = standard_design_sizing_temperatures
    unless hot_water_loop.nil?
      hw_temp_c = hot_water_loop.sizingPlant.designLoopExitTemperature
      hw_delta_t_k = hot_water_loop.sizingPlant.loopDesignTemperatureDifference
    end

    # adjusted design heating temperature for psz_ac
    dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
    dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
    dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
    dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 1.0)

    # air handler controls
    # add a setpoint manager single zone reheat to control the supply air temperature
    setpoint_mgr_single_zone_reheat = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
    setpoint_mgr_single_zone_reheat.setName("#{zone.name} Setpoint Manager SZ Reheat")
    setpoint_mgr_single_zone_reheat.setControlZone(zone)
    setpoint_mgr_single_zone_reheat.setMinimumSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.addToNode(air_loop.supplyOutletNode)

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    # create heating coil
    case heating_type
    when 'NaturalGas', 'Gas'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                   name: "#{air_loop.name} Gas Htg Coil")
    when 'Water'
      if hot_water_loop.nil?
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No hot water plant loop supplied')
        return false
      end
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                     hot_water_loop,
                                                                     name: "#{air_loop.name} Water Htg Coil",
                                                                     rated_inlet_water_temperature: hw_temp_c,
                                                                     rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                                     rated_inlet_air_temperature: dsgn_temps['prehtg_dsgn_sup_air_temp_c'],
                                                                     rated_outlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'])
    when 'Single Speed Heat Pump'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                               name: "#{zone.name} HP Htg Coil",
                                                                               type: 'PSZ-AC',
                                                                               cop: 3.3)
    when 'Water To Air Heat Pump'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water_to_air_heat_pump_equation_fit(model,
                                                                                                   hot_water_loop,
                                                                                                   name: "#{air_loop.name} Water-to-Air HP Htg Coil")
    when 'Electricity', 'Electric'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{air_loop.name} Electric Htg Coil")
    else
      # zero-capacity, always-off electric heating coil
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{air_loop.name} No Heat",
                                                                        schedule: model.alwaysOffDiscreteSchedule,
                                                                        nominal_capacity: 0.0)
    end

    # create supplemental heating coil
    case supplemental_heating_type
    when 'Electricity', 'Electric'
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                     name: "#{air_loop.name} Electric Backup Htg Coil")
    when 'NaturalGas', 'Gas'
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                                name: "#{air_loop.name} Gas Backup Htg Coil")
    else
      # Zero-capacity, always-off electric heating coil
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                     name: "#{air_loop.name} No Heat",
                                                                                     schedule: model.alwaysOffDiscreteSchedule,
                                                                                     nominal_capacity: 0.0)
    end

    # create cooling coil
    case cooling_type
    when 'Water'
      if chilled_water_loop.nil?
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No chilled water plant loop supplied')
        return false
      end
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                                     chilled_water_loop,
                                                                     name: "#{air_loop.name} Water Clg Coil")
    when 'Two Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                                            name: "#{air_loop.name} 2spd DX AC Clg Coil")
    when 'Single Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} 1spd DX AC Clg Coil",
                                                                               type: 'PSZ-AC')
    when 'Single Speed Heat Pump'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{air_loop.name} 1spd DX HP Clg Coil",
                                                                               type: 'Heat Pump')
      # clg_coil.setMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation(OpenStudio::OptionalDouble.new(10.0))
      # clg_coil.setRatedSensibleHeatRatio(0.69)
      # clg_coil.setBasinHeaterCapacity(10)
      # clg_coil.setBasinHeaterSetpointTemperature(2.0)
    when 'Water To Air Heat Pump'
      if chilled_water_loop.nil?
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No chilled water plant loop supplied')
        return false
      end
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_water_to_air_heat_pump_equation_fit(model,
                                                                                                   chilled_water_loop,
                                                                                                   name: "#{air_loop.name} Water-to-Air HP Clg Coil")
    else
      clg_coil = nil
    end

    # Use a Fan:OnOff in the unitary system object
    case fan_type
    when 'Cycling'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'Packaged_RTU_SZ_AC_Cycling_Fan',
                                                         fan_name: "#{air_loop.name} Fan")
    when 'ConstantVolume'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'Packaged_RTU_SZ_AC_CAV_OnOff_Fan',
                                                         fan_name: "#{air_loop.name} Fan")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'Invalid fan_type')
      return false
    end

    # fan location
    if fan_location.nil?
      fan_location = 'DrawThrough'
    end
    case fan_location
    when 'DrawThrough', 'BlowThrough'
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "Setting fan location for #{fan.name} to #{fan_location}.")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "Invalid fan_location #{fan_location} for fan #{fan.name}.")
      return false
    end

    # construct unitary system object
    unitary_system = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary_system.setSupplyFan(fan) unless fan.nil?
    unitary_system.setHeatingCoil(htg_coil) unless htg_coil.nil?
    unitary_system.setCoolingCoil(clg_coil) unless clg_coil.nil?
    unitary_system.setSupplementalHeatingCoil(supplemental_htg_coil) unless supplemental_htg_coil.nil?
    unitary_system.setControllingZoneorThermostatLocation(zone)
    unitary_system.setFanPlacement(fan_location)
    unitary_system.addToNode(air_loop.supplyInletNode)

    # added logic and naming for heat pumps
    case heating_type
    when 'Water To Air Heat Pump'
      unitary_system.setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(OpenStudio.convert(40.0, 'F', 'C').get)
      unitary_system.setName("#{air_loop.name} Unitary HP")
      unitary_system.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
      if model.version < OpenStudio::VersionString.new('3.7.0')
        unitary_system.setSupplyAirFlowRateMethodDuringCoolingOperation('SupplyAirFlowRate')
        unitary_system.setSupplyAirFlowRateMethodDuringHeatingOperation('SupplyAirFlowRate')
        unitary_system.setSupplyAirFlowRateMethodWhenNoCoolingorHeatingisRequired('SupplyAirFlowRate')
      else
        unitary_system.autosizeSupplyAirFlowRateDuringCoolingOperation
        unitary_system.autosizeSupplyAirFlowRateDuringHeatingOperation
        unitary_system.autosizeSupplyAirFlowRateWhenNoCoolingorHeatingisRequired
      end
    when 'Single Speed Heat Pump'
      unitary_system.setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(OpenStudio.convert(40.0, 'F', 'C').get)
      unitary_system.setName("#{air_loop.name} Unitary HP")
    else
      unitary_system.setName("#{air_loop.name} Unitary AC")
    end

    # specify control logic
    unitary_system.setAvailabilitySchedule(hvac_op_sch)
    if fan_type == 'Cycling'
      unitary_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)
    else # constant volume operation
      unitary_system.setSupplyAirFanOperatingModeSchedule(hvac_op_sch)
    end

    # add the OA system
    oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
    oa_controller.setName("#{air_loop.name} OA System Controller")
    oa_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
    oa_controller.autosizeMinimumOutdoorAirFlowRate
    oa_controller.resetEconomizerMinimumLimitDryBulbTemperature
    oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
    oa_system.setName("#{air_loop.name} OA System")
    oa_system.addToNode(air_loop.supplyInletNode)

    # @todo enable economizer maximum fraction outdoor air schedule input
    # econ_eff_sch = model_add_schedule(model, 'RetailStandalone PSZ_Econ_MaxOAFrac_Sch')

    # set air loop availability controls and night cycle manager, after oa system added
    air_loop.setAvailabilitySchedule(hvac_op_sch)
    air_loop.setNightCycleControlType('CycleOnAny')

    if model.version < OpenStudio::VersionString.new('3.5.0')
      avail_mgr = air_loop.availabilityManager
      if avail_mgr.is_initialized
        avail_mgr = avail_mgr.get
      else
        avail_mgr = nil
      end
    else
      avail_mgr = air_loop.availabilityManagers[0]
    end

    if !avail_mgr.nil? && avail_mgr.to_AvailabilityManagerNightCycle.is_initialized
      avail_mgr = avail_mgr.to_AvailabilityManagerNightCycle.get
      avail_mgr.setCyclingRunTime(1800)
    end

    # create a diffuser and attach the zone/diffuser pair to the air loop
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{air_loop.name} Diffuser")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)
    air_loops << air_loop
  end

  return air_loops
end

#model_add_psz_vav(model, thermal_zones, system_name: nil, heating_type: nil, cooling_type: 'AirCooled', supplemental_heating_type: nil, hvac_op_sch: nil, fan_type: 'VAV_System_Fan', oa_damper_sch: nil, hot_water_loop: nil, chilled_water_loop: nil, minimum_volume_setpoint: nil) ⇒ Array<OpenStudio::Model::AirLoopHVAC>

Creates a packaged single zone VAV system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • heating_type (String) (defaults to: nil)

    valid choices are NaturalGas, Electricity, Water, nil (no heat)

  • supplemental_heating_type (String) (defaults to: nil)

    valid choices are Electricity, NaturalGas, nil (no heat)

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    an array of the resulting PSZ-AC air loops



3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3009

def model_add_psz_vav(model,
                      thermal_zones,
                      system_name: nil,
                      heating_type: nil,
                      cooling_type: 'AirCooled',
                      supplemental_heating_type: nil,
                      hvac_op_sch: nil,
                      fan_type: 'VAV_System_Fan',
                      oa_damper_sch: nil,
                      hot_water_loop: nil,
                      chilled_water_loop: nil,
                      minimum_volume_setpoint: nil)

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # create a PSZ-VAV for each zone
  air_loops = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding PSZ-VAV for #{zone.name}.")

    air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
    if system_name.nil?
      air_loop.setName("#{zone.name} PSZ-VAV")
    else
      air_loop.setName("#{zone.name} #{system_name}")
    end

    # default design temperatures used across all air loops
    dsgn_temps = standard_design_sizing_temperatures

    # adjusted zone design heating temperature for psz_vav
    dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
    dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

    # default design settings used across all air loops
    sizing_system = adjust_sizing_system(air_loop, dsgn_temps)

    # air handler controls
    # add a setpoint manager single zone reheat to control the supply air temperature
    setpoint_mgr_single_zone_reheat = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
    setpoint_mgr_single_zone_reheat.setName("#{zone.name} Setpoint Manager SZ Reheat")
    setpoint_mgr_single_zone_reheat.setControlZone(zone)
    setpoint_mgr_single_zone_reheat.setMinimumSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    setpoint_mgr_single_zone_reheat.addToNode(air_loop.supplyOutletNode)

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])

    # create fan
    # @type [OpenStudio::Model::FanVariableVolume] fan
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       fan_type,
                                                       fan_name: "#{air_loop.name} Fan",
                                                       end_use_subcategory: 'VAV System Fans')
    fan.setAvailabilitySchedule(hvac_op_sch)

    # create heating coil
    case heating_type
    when 'NaturalGas', 'Gas'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                   name: "#{air_loop.name} Gas Htg Coil")
    when 'Electricity', 'Electric'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{air_loop.name} Electric Htg Coil")
    when 'Water'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                     hot_water_loop,
                                                                     name: "#{air_loop.name} Water Htg Coil")
    else
      # Zero-capacity, always-off electric heating coil
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{air_loop.name} No Heat",
                                                                        schedule: model.alwaysOffDiscreteSchedule,
                                                                        nominal_capacity: 0.0)
    end

    # create supplemental heating coil
    case supplemental_heating_type
    when 'Electricity', 'Electric'
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                     name: "#{air_loop.name} Electric Backup Htg Coil")
    when 'NaturalGas', 'Gas'
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                                name: "#{air_loop.name} Gas Backup Htg Coil")
    else
      # zero-capacity, always-off electric heating coil
      supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                     name: "#{air_loop.name} No Backup Heat",
                                                                                     schedule: model.alwaysOffDiscreteSchedule,
                                                                                     nominal_capacity: 0.0)
    end

    # create cooling coil
    case cooling_type
    when 'WaterCooled'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                                     chilled_water_loop,
                                                                     name: "#{air_loop.name} Clg Coil")
    else # 'AirCooled'
      clg_coil = OpenStudio::Model::CoilCoolingDXVariableSpeed.new(model)
      clg_coil.setName("#{air_loop.name} Var spd DX AC Clg Coil")
      clg_coil.setBasinHeaterCapacity(10.0)
      clg_coil.setBasinHeaterSetpointTemperature(2.0)
      # first speed level
      clg_spd_1 = OpenStudio::Model::CoilCoolingDXVariableSpeedSpeedData.new(model)
      clg_coil.addSpeed(clg_spd_1)
      clg_coil.setNominalSpeedLevel(1)
    end

    # @todo enable economizer maximum fraction outdoor air schedule input
    # econ_eff_sch = model_add_schedule(model, 'RetailStandalone PSZ_Econ_MaxOAFrac_Sch')

    # wrap coils in a unitary system
    unitary_system = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
    unitary_system.setSupplyFan(fan)
    unitary_system.setHeatingCoil(htg_coil)
    unitary_system.setCoolingCoil(clg_coil)
    unitary_system.setSupplementalHeatingCoil(supplemental_htg_coil)
    unitary_system.setName("#{zone.name} Unitary PSZ-VAV")
    # The following control strategy can lead to "Developer Error: Component sizing incomplete."
    # EnergyPlus severe (not fatal) errors if there is no heating design load
    unitary_system.setControlType('SingleZoneVAV')
    unitary_system.setControllingZoneorThermostatLocation(zone)
    unitary_system.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    unitary_system.setFanPlacement('BlowThrough')
    if model.version < OpenStudio::VersionString.new('3.7.0')
      unitary_system.setSupplyAirFlowRateMethodDuringCoolingOperation('SupplyAirFlowRate')
      unitary_system.setSupplyAirFlowRateMethodDuringHeatingOperation('SupplyAirFlowRate')
      if minimum_volume_setpoint.nil?
        unitary_system.setSupplyAirFlowRateMethodWhenNoCoolingorHeatingisRequired('SupplyAirFlowRate')
      else
        unitary_system.setSupplyAirFlowRateMethodWhenNoCoolingorHeatingisRequired('FractionOfAutosizedCoolingValue')
        unitary_system.setFractionofAutosizedDesignCoolingSupplyAirFlowRateWhenNoCoolingorHeatingisRequired(minimum_volume_setpoint)
      end
    else
      unitary_system.autosizeSupplyAirFlowRateDuringCoolingOperation
      unitary_system.autosizeSupplyAirFlowRateDuringHeatingOperation
      if minimum_volume_setpoint.nil?
        unitary_system.autosizeSupplyAirFlowRateWhenNoCoolingorHeatingisRequired
      else
        unitary_system.setFractionofAutosizedDesignCoolingSupplyAirFlowRateWhenNoCoolingorHeatingisRequired(minimum_volume_setpoint)
      end
    end
    unitary_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOnDiscreteSchedule)
    unitary_system.addToNode(air_loop.supplyInletNode)

    # create outdoor air system
    oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
    oa_controller.setName("#{air_loop.name} OA Sys Controller")
    oa_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
    oa_controller.autosizeMinimumOutdoorAirFlowRate
    oa_controller.resetEconomizerMinimumLimitDryBulbTemperature
    oa_controller.setHeatRecoveryBypassControlType('BypassWhenOAFlowGreaterThanMinimum')
    oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
    oa_system.setName("#{air_loop.name} OA System")
    oa_system.addToNode(air_loop.supplyInletNode)

    # set air loop availability controls and night cycle manager, after oa system added
    air_loop.setAvailabilitySchedule(hvac_op_sch)
    air_loop.setNightCycleControlType('CycleOnAny')

    # create a VAV no reheat terminal and attach the zone/terminal pair to the air loop
    diffuser = OpenStudio::Model::AirTerminalSingleDuctVAVNoReheat.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{air_loop.name} Diffuser")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)
    air_loops << air_loop
  end

  return air_loops
end

#model_add_ptac(model, thermal_zones, cooling_type: 'Two Speed DX AC', heating_type: 'Gas', hot_water_loop: nil, fan_type: 'Cycling', ventilation: true) ⇒ Array<OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner>

Creates a PTAC system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • cooling_type (String) (defaults to: 'Two Speed DX AC')

    valid choices are Two Speed DX AC, Single Speed DX AC

  • heating_type (String) (defaults to: 'Gas')

    valid choices are NaturalGas, Electricity, Water, nil (no heat)

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect heating coil to. Set to nil for heating types besides water

  • fan_type (String) (defaults to: 'Cycling')

    valid choices are ConstantVolume, Cycling

  • ventilation (Boolean) (defaults to: true)

    If true, ventilation will be supplied through the unit. If false, no ventilation will be supplied through the unit, with the expectation that it will be provided by a DOAS or separate system.

Returns:

  • (Array<OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner>)

    an array of the resulting PTACs



4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4037

def model_add_ptac(model,
                   thermal_zones,
                   cooling_type: 'Two Speed DX AC',
                   heating_type: 'Gas',
                   hot_water_loop: nil,
                   fan_type: 'Cycling',
                   ventilation: true)

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures
  unless hot_water_loop.nil?
    hw_temp_c = hot_water_loop.sizingPlant.designLoopExitTemperature
    hw_delta_t_k = hot_water_loop.sizingPlant.loopDesignTemperatureDifference
  end

  # adjusted zone design temperatures for ptac
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['zn_clg_dsgn_sup_air_temp_f'] = 57.0
  dsgn_temps['zn_clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_clg_dsgn_sup_air_temp_f'], 'F', 'C').get

  # make a PTAC for each zone
  ptacs = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding PTAC for #{zone.name}.")

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneCoolingDesignSupplyAirHumidityRatio(0.008)
    sizing_zone.setZoneHeatingDesignSupplyAirHumidityRatio(0.008)

    # add fan
    if fan_type == 'ConstantVolume'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'PTAC_CAV_Fan',
                                                         fan_name: "#{zone.name} PTAC Fan")
    elsif fan_type == 'Cycling'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'PTAC_Cycling_Fan',
                                                         fan_name: "#{zone.name} PTAC Fan")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "ptac_fan_type of #{fan_type} is not recognized.")
    end
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # add heating coil
    case heating_type
    when 'NaturalGas', 'Gas'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                   name: "#{zone.name} PTAC Gas Htg Coil")
    when 'Electricity', 'Electric'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{zone.name} PTAC Electric Htg Coil")
    when nil
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{zone.name} PTAC No Heat",
                                                                        schedule: model.alwaysOffDiscreteSchedule,
                                                                        nominal_capacity: 0)
    when 'Water'
      if hot_water_loop.nil?
        OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No hot water plant loop supplied')
        return false
      end
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                     hot_water_loop,
                                                                     name: "#{hot_water_loop.name} Water Htg Coil",
                                                                     rated_inlet_water_temperature: hw_temp_c,
                                                                     rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k))
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "ptac_heating_type of #{heating_type} is not recognized.")
    end

    # add cooling coil
    if cooling_type == 'Two Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                                            name: "#{zone.name} PTAC 2spd DX AC Clg Coil")
    elsif cooling_type == 'Single Speed DX AC'
      clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                               name: "#{zone.name} PTAC 1spd DX AC Clg Coil",
                                                                               type: 'PTAC')
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "ptac_cooling_type of #{cooling_type} is not recognized.")
    end

    # wrap coils in a PTAC system
    ptac_system = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(model,
                                                                                model.alwaysOnDiscreteSchedule,
                                                                                fan,
                                                                                htg_coil,
                                                                                clg_coil)
    ptac_system.setName("#{zone.name} PTAC")
    ptac_system.setFanPlacement('DrawThrough')
    if fan_type == 'ConstantVolume'
      ptac_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOnDiscreteSchedule)
    else
      ptac_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)
    end
    unless ventilation
      ptac_system.setOutdoorAirFlowRateDuringCoolingOperation(0.0)
      ptac_system.setOutdoorAirFlowRateDuringHeatingOperation(0.0)
      ptac_system.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(0.0)
    end
    ptac_system.addToThermalZone(zone)
    ptacs << ptac_system
  end

  return ptacs
end

#model_add_pthp(model, thermal_zones, fan_type: 'Cycling', ventilation: true) ⇒ Array<OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner>

Creates a PTHP system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • fan_type (String) (defaults to: 'Cycling')

    valid choices are ConstantVolume, Cycling

  • ventilation (Boolean) (defaults to: true)

    If true, ventilation will be supplied through the unit. If false, no ventilation will be supplied through the unit, with the expectation that it will be provided by a DOAS or separate system.

Returns:

  • (Array<OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner>)

    an array of the resulting PTACs.



4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4156

def model_add_pthp(model,
                   thermal_zones,
                   fan_type: 'Cycling',
                   ventilation: true)

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted zone design temperatures for pthp
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['zn_clg_dsgn_sup_air_temp_f'] = 57.0
  dsgn_temps['zn_clg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_clg_dsgn_sup_air_temp_f'], 'F', 'C').get

  # make a PTHP for each zone
  pthps = []
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding PTHP for #{zone.name}.")

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneCoolingDesignSupplyAirHumidityRatio(0.008)
    sizing_zone.setZoneHeatingDesignSupplyAirHumidityRatio(0.008)

    # add fan
    if fan_type == 'ConstantVolume'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'PTAC_CAV_Fan',
                                                         fan_name: "#{zone.name} PTHP Fan")
    elsif fan_type == 'Cycling'
      fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                         'PTAC_Cycling_Fan',
                                                         fan_name: "#{zone.name} PTHP Fan")
    else
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "PTHP fan_type of #{fan_type} is not recognized.")
      return false
    end
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # add heating coil
    htg_coil = OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                             name: "#{zone.name} PTHP Htg Coil")
    # add cooling coil
    clg_coil = OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                             name: "#{zone.name} PTHP Clg Coil",
                                                                             type: 'Heat Pump')
    # supplemental heating coil
    supplemental_htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                                   name: "#{zone.name} PTHP Supplemental Htg Coil")
    # wrap coils in a PTHP system
    pthp_system = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model,
                                                                          model.alwaysOnDiscreteSchedule,
                                                                          fan,
                                                                          htg_coil,
                                                                          clg_coil,
                                                                          supplemental_htg_coil)
    pthp_system.setName("#{zone.name} PTHP")
    pthp_system.setFanPlacement('DrawThrough')
    pthp_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)
    if fan_type == 'ConstantVolume'
      pthp_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOnDiscreteSchedule)
    else
      pthp_system.setSupplyAirFanOperatingModeSchedule(model.alwaysOffDiscreteSchedule)
    end
    unless ventilation
      pthp_system.setOutdoorAirFlowRateDuringCoolingOperation(0.0)
      pthp_system.setOutdoorAirFlowRateDuringHeatingOperation(0.0)
      pthp_system.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(0.0)
    end
    pthp_system.addToThermalZone(zone)
    pthps << pthp_system
  end

  return pthps
end

#model_add_pvav(model, thermal_zones, system_name: nil, return_plenum: nil, hot_water_loop: nil, chilled_water_loop: nil, heating_type: nil, electric_reheat: false, hvac_op_sch: nil, oa_damper_sch: nil, econo_ctrl_mthd: nil) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a packaged VAV system and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • return_plenum (OpenStudio::Model::ThermalZone) (defaults to: nil)

    the zone to attach as the supply plenum, or nil, in which case no return plenum will be used

  • hot_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    hot water loop to connect heating and reheat coils to. If nil, will be electric heat and electric reheat

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect cooling coils to. If nil, will be DX cooling

  • heating_type (String) (defaults to: nil)

    main heating coil fuel type valid choices are NaturalGas, Electricity, Water, or nil (defaults to NaturalGas)

  • electric_reheat (Boolean) (defaults to: false)

    if true electric reheat coils, if false the reheat coils served by hot_water_loop

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

  • econo_ctrl_mthd (String) (defaults to: nil)

    economizer control type

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting packaged VAV air loop



2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 2213

def model_add_pvav(model,
                   thermal_zones,
                   system_name: nil,
                   return_plenum: nil,
                   hot_water_loop: nil,
                   chilled_water_loop: nil,
                   heating_type: nil,
                   electric_reheat: false,
                   hvac_op_sch: nil,
                   oa_damper_sch: nil,
                   econo_ctrl_mthd: nil)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding Packaged VAV for #{thermal_zones.size} zones.")

  # create air handler
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName("#{thermal_zones.size} Zone PVAV")
  else
    air_loop.setName(system_name)
  end

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures
  unless hot_water_loop.nil?
    hw_temp_c = hot_water_loop.sizingPlant.designLoopExitTemperature
    hw_delta_t_k = hot_water_loop.sizingPlant.loopDesignTemperatureDifference
  end

  # adjusted zone design heating temperature for pvav unless it would cause a temperature higher than reheat water supply temperature
  unless !hot_water_loop.nil? && hw_temp_c < OpenStudio.convert(140.0, 'F', 'C').get
    dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
    dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  end

  # default design settings used across all air loops
  sizing_system = adjust_sizing_system(air_loop, dsgn_temps)

  # air handler controls
  sa_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                dsgn_temps['clg_dsgn_sup_air_temp_c'],
                                                                                name: "Supply Air Temp - #{dsgn_temps['clg_dsgn_sup_air_temp_f']}F",
                                                                                schedule_type_limit: 'Temperature')
  sa_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, sa_temp_sch)
  sa_stpt_manager.setName("#{air_loop.name} Supply Air Setpoint Manager")
  sa_stpt_manager.addToNode(air_loop.supplyOutletNode)

  # create fan
  fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                     'VAV_default',
                                                     fan_name: "#{air_loop.name} Fan")
  fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  fan.addToNode(air_loop.supplyInletNode)

  # create heating coil
  if hot_water_loop.nil?
    if heating_type == 'Electricity'
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        air_loop_node: air_loop.supplyInletNode,
                                                                        name: "#{air_loop.name} Main Electric Htg Coil")
    else # default to NaturalGas
      htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                   air_loop_node: air_loop.supplyInletNode,
                                                                   name: "#{air_loop.name} Main Gas Htg Coil")
    end
  else
    htg_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model, hot_water_loop,
                                                                   air_loop_node: air_loop.supplyInletNode,
                                                                   name: "#{air_loop.name} Main Htg Coil",
                                                                   rated_inlet_water_temperature: hw_temp_c,
                                                                   rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                                   rated_inlet_air_temperature: dsgn_temps['prehtg_dsgn_sup_air_temp_c'],
                                                                   rated_outlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'])
  end

  # set the setpointmanager for the central/preheat coil if required
  model_set_central_preheat_coil_spm(model, thermal_zones, htg_coil)

  # create cooling coil
  if chilled_water_loop.nil?
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX Clg Coil",
                                                               type: 'OS default')
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Clg Coil")
  end

  # outdoor air intake system
  oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_intake_controller.setName("#{air_loop.name} OA Controller")
  oa_intake_controller.setMinimumLimitType('FixedMinimum')
  oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
  oa_intake_controller.resetMaximumFractionofOutdoorAirSchedule
  oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
  unless econo_ctrl_mthd.nil?
    oa_intake_controller.setEconomizerControlType(econo_ctrl_mthd)
  end
  unless oa_damper_sch.nil?
    oa_intake_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
  end
  controller_mv = oa_intake_controller.controllerMechanicalVentilation
  controller_mv.setName("#{air_loop.name} Mechanical Ventilation Controller")
  controller_mv.setSystemOutdoorAirMethod('ZoneSum')
  oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
  oa_intake.setName("#{air_loop.name} OA System")
  oa_intake.addToNode(air_loop.supplyInletNode)

  # set air loop availability controls and night cycle manager, after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)
  air_loop.setNightCycleControlType('CycleOnAny')

  if model.version < OpenStudio::VersionString.new('3.5.0')
    avail_mgr = air_loop.availabilityManager
    if avail_mgr.is_initialized
      avail_mgr = avail_mgr.get
    else
      avail_mgr = nil
    end
  else
    avail_mgr = air_loop.availabilityManagers[0]
  end

  if !avail_mgr.nil? && avail_mgr.to_AvailabilityManagerNightCycle.is_initialized
    avail_mgr = avail_mgr.to_AvailabilityManagerNightCycle.get
    avail_mgr.setCyclingRunTime(1800)
  end

  # attach the VAV system to each zone
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "Adding PVAV terminal for #{zone.name}")

    # create reheat coil
    if electric_reheat || hot_water_loop.nil?
      rht_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                        name: "#{zone.name} Electric Reheat Coil")
    else
      rht_coil = OpenstudioStandards::HVAC.create_coil_heating_water(model,
                                                                     hot_water_loop,
                                                                     name: "#{zone.name} Reheat Coil",
                                                                     rated_inlet_water_temperature: hw_temp_c,
                                                                     rated_outlet_water_temperature: (hw_temp_c - hw_delta_t_k),
                                                                     rated_inlet_air_temperature: dsgn_temps['htg_dsgn_sup_air_temp_c'],
                                                                     rated_outlet_air_temperature: dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    end

    # create VAV terminal
    terminal = OpenStudio::Model::AirTerminalSingleDuctVAVReheat.new(model, model.alwaysOnDiscreteSchedule, rht_coil)
    terminal.setName("#{zone.name} VAV Terminal")
    if model.version < OpenStudio::VersionString.new('3.0.1')
      terminal.setZoneMinimumAirFlowMethod('Constant')
    else
      terminal.setZoneMinimumAirFlowInputMethod('Constant')
    end
    # default to single maximum control logic
    terminal.setDamperHeatingAction('Normal')
    terminal.setMaximumReheatAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    air_loop.multiAddBranchForZone(zone, terminal.to_HVACComponent.get)
    oa_rate = OpenstudioStandards::ThermalZone.thermal_zone_get_outdoor_airflow_rate_per_area(zone)
    air_terminal_single_duct_vav_reheat_apply_initial_prototype_damper_position(terminal, oa_rate)

    unless return_plenum.nil?
      zone.setReturnPlenum(return_plenum)
    end

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
  end

  return air_loop
end

#model_add_pvav_pfp_boxes(model, thermal_zones, system_name: nil, chilled_water_loop: nil, hvac_op_sch: nil, oa_damper_sch: nil, fan_efficiency: 0.62, fan_motor_efficiency: 0.9, fan_pressure_rise: 4.0) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a packaged VAV system with parallel fan powered boxes and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • system_name (String) (defaults to: nil)

    the name of the system, or nil in which case it will be defaulted

  • chilled_water_loop (OpenStudio::Model::PlantLoop) (defaults to: nil)

    chilled water loop to connect cooling coils to. If nil, will be DX cooling

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule or nil in which case will be defaulted to always open

  • fan_efficiency (Double) (defaults to: 0.62)

    fan total efficiency, including motor and impeller

  • fan_motor_efficiency (Double) (defaults to: 0.9)

    fan motor efficiency

  • fan_pressure_rise (Double) (defaults to: 4.0)

    fan pressure rise, inH2O

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting VAV air loop



2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 2416

def model_add_pvav_pfp_boxes(model,
                             thermal_zones,
                             system_name: nil,
                             chilled_water_loop: nil,
                             hvac_op_sch: nil,
                             oa_damper_sch: nil,
                             fan_efficiency: 0.62,
                             fan_motor_efficiency: 0.9,
                             fan_pressure_rise: 4.0)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding PVAV with PFP Boxes and Reheat system for #{thermal_zones.size} zones.")

  # create air handler
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  if system_name.nil?
    air_loop.setName("#{thermal_zones.size} Zone PVAV with PFP Boxes and Reheat")
  else
    air_loop.setName(system_name)
  end

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # default design temperatures and settings used across all air loops
  dsgn_temps = standard_design_sizing_temperatures
  sizing_system = adjust_sizing_system(air_loop, dsgn_temps)

  # air handler controls
  sa_temp_sch = OpenstudioStandards::Schedules.create_constant_schedule_ruleset(model,
                                                                                dsgn_temps['clg_dsgn_sup_air_temp_c'],
                                                                                name: "Supply Air Temp - #{dsgn_temps['clg_dsgn_sup_air_temp_f']}F",
                                                                                schedule_type_limit: 'Temperature')
  sa_stpt_manager = OpenStudio::Model::SetpointManagerScheduled.new(model, sa_temp_sch)
  sa_stpt_manager.setName("#{air_loop.name} Supply Air Setpoint Manager")
  sa_stpt_manager.addToNode(air_loop.supplyOutletNode)

  # create fan
  # @type [OpenStudio::Model::FanVariableVolume] fan
  fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                     'VAV_System_Fan',
                                                     fan_name: "#{air_loop.name} Fan",
                                                     fan_efficiency: fan_efficiency,
                                                     pressure_rise: fan_pressure_rise,
                                                     motor_efficiency: fan_motor_efficiency,
                                                     end_use_subcategory: 'VAV System Fans')
  fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  fan.addToNode(air_loop.supplyInletNode)

  # create heating coil
  htg_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                    air_loop_node: air_loop.supplyInletNode,
                                                                    name: "#{air_loop.name} Main Htg Coil")

  # set the setpointmanager for the central/preheat coil if required
  model_set_central_preheat_coil_spm(model, thermal_zones, htg_coil)

  # create cooling coil
  if chilled_water_loop.nil?
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX Clg Coil", type: 'OS default')
  else
    OpenstudioStandards::HVAC.create_coil_cooling_water(model,
                                                        chilled_water_loop,
                                                        air_loop_node: air_loop.supplyInletNode,
                                                        name: "#{air_loop.name} Clg Coil")
  end

  # create outdoor air intake system
  oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_intake_controller.setName("#{air_loop.name} OA Controller")
  oa_intake_controller.setMinimumLimitType('FixedMinimum')
  oa_intake_controller.autosizeMinimumOutdoorAirFlowRate
  oa_intake_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
  oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
  controller_mv = oa_intake_controller.controllerMechanicalVentilation
  controller_mv.setName("#{air_loop.name} Vent Controller")
  controller_mv.setSystemOutdoorAirMethod('ZoneSum')

  oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
  oa_intake.setName("#{air_loop.name} OA System")
  oa_intake.addToNode(air_loop.supplyInletNode)

  # set air loop availability controls and night cycle manager, after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)
  air_loop.setNightCycleControlType('CycleOnAny')

  # attach the VAV system to each zone
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Model.Model', "Adding PVAV PFP Box to zone #{zone.name}")

    # create electric reheat coil
    rht_coil = OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                                      name: "#{zone.name} Electric Reheat Coil")

    # create terminal fan
    # @type [OpenStudio::Model::FanConstantVolume] pfp_fan
    pfp_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                           'PFP_Fan',
                                                           fan_name: "#{zone.name} PFP Term Fan")
    pfp_fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # parallel fan powered terminal
    pfp_terminal = OpenStudio::Model::AirTerminalSingleDuctParallelPIUReheat.new(model,
                                                                                 model.alwaysOnDiscreteSchedule,
                                                                                 pfp_fan,
                                                                                 rht_coil)
    pfp_terminal.setName("#{zone.name} PFP Term")
    air_loop.multiAddBranchForZone(zone, pfp_terminal.to_HVACComponent.get)

    # adjust zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setCoolingDesignAirFlowMethod('DesignDay')
    sizing_zone.setHeatingDesignAirFlowMethod('DesignDay')
    sizing_zone.setHeatingMaximumAirFlowFraction(1.0)
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
  end

  return air_loop
end

#model_add_refrigeration_case(model, thermal_zone, case_type, size_category) ⇒ OpenStudio::Model::RefrigerationCase

Adds a refrigerated case to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zone (OpenStudio::Model::ThermalZone)

    the thermal zone where the case is located, and which will be impacted by the case's thermal load.

  • case_type (String)

    the case type/name. For valid choices refer to the ""Refrigerated Cases" tab on the OpenStudio_Standards spreadsheet. This parameter is used also by the "Refrigeration System Lineup" tab.

  • size_category (String)

    size category of the building area. Valid choices are: "<35k ft2", "35k - 50k ft2", ">50k ft2"

Returns:

  • (OpenStudio::Model::RefrigerationCase)

    the refrigeration case



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb', line 15

def model_add_refrigeration_case(model, thermal_zone, case_type, size_category)
  # Get the case properties
  #

  search_criteria = {
    'template' => template,
    'case_type' => case_type,
    'size_category' => size_category
  }

  props = model_find_object(standards_data['refrigerated_cases'], search_criteria)
  if props.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Could not find refrigerated case properties for: #{search_criteria}.")
    return nil
  end

  # Capacity, defrost, anti-sweat
  case_length = OpenStudio.convert(props['case_length'], 'ft', 'm').get
  case_temp = OpenStudio.convert(props['case_temp'], 'F', 'C').get
  cooling_capacity_per_length = OpenStudio.convert(props['cooling_capacity_per_length'], 'Btu/hr*ft', 'W/m').get
  evap_fan_power_per_length = OpenStudio.convert(props['evap_fan_power_per_length'], 'W/ft', 'W/m').get
  if props['evap_temp']
    evap_temp_c = OpenStudio.convert(props['evap_temp'], 'F', 'C').get
  end
  lighting_w_per_m = OpenStudio.convert(props['lighting_per_ft'], 'W/ft', 'W/m').get
  if props['lighting_schedule']
    case_lighting_schedule = model_add_schedule(model, props['lighting_schedule'])
  else
    case_lighting_schedule = model.alwaysOnDiscreteSchedule
  end
  fraction_of_lighting_energy_to_case = props['fraction_of_lighting_energy_to_case']
  if props['latent_case_credit_curve_name']
    latent_case_credit_curve = model_add_curve(model, props['latent_case_credit_curve_name'])
  end
  defrost_power_per_length = OpenStudio.convert(props['defrost_power_per_length'], 'W/ft', 'W/m').get
  defrost_type = props['defrost_type']
  if props['defrost_correction_type']
    defrost_correction_type = props['defrost_correction_type']
  end
  if props['defrost_correction_curve_name']
    defrost_correction_curve_name = model_add_curve(model, props['defrost_correction_curve_name'])
  end
  if props['anti_sweat_power']
    anti_sweat_power = OpenStudio.convert(props['anti_sweat_power'], 'W/ft', 'W/m').get
  end
  if props['minimum_anti_sweat_heater_power_per_unit_length']
    minimum_anti_sweat_heater_power_per_unit_length = OpenStudio.convert(props['minimum_anti_sweat_heater_power_per_unit_length'], 'W/ft', 'W/m').get
  end
  if props['anti_sweat_heater_control']
    if props['anti_sweat_heater_control'] == 'RelativeHumidity'
      anti_sweat_heater_control = 'Linear'
    else
      anti_sweat_heater_control = props['anti_sweat_heater_control']
    end
  end
  if props['under_case_hvac_return_air_fraction']
    under_case_hvac_return_air_fraction = props['under_case_hvac_return_air_fraction']
  end
  if props['fractionofantisweatheaterenergytocase']
    fractionofantisweatheaterenergytocase = props['fractionofantisweatheaterenergytocase']
  end

  # Case
  ref_case = OpenStudio::Model::RefrigerationCase.new(model, model.alwaysOnDiscreteSchedule)
  ref_case.setName(case_type)
  ref_case.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  ref_case.setThermalZone(thermal_zone)
  ref_case.setRatedAmbientTemperature(OpenStudio.convert(75, 'F', 'C').get)
  ref_case.setRatedLatentHeatRatio(props['latent_heat_ratio']) if props['latent_heat_ratio']
  ref_case.setRatedRuntimeFraction(props['rated_runtime_fraction']) if props['rated_runtime_fraction']
  ref_case.setCaseLength(case_length)
  ref_case.setCaseOperatingTemperature(case_temp)
  ref_case.setRatedTotalCoolingCapacityperUnitLength(cooling_capacity_per_length)
  cooling_capacity_w = ref_case.caseLength * ref_case.ratedTotalCoolingCapacityperUnitLength
  cooling_capacity_btu_per_hr = OpenStudio.convert(cooling_capacity_w, 'W', 'Btu/hr').get
  ref_case.setStandardCaseFanPowerperUnitLength(evap_fan_power_per_length)
  ref_case.setOperatingCaseFanPowerperUnitLength(evap_fan_power_per_length)
  if props['evap_temp']
    ref_case.setDesignEvaporatorTemperatureorBrineInletTemperature(evap_temp_c)
  end
  ref_case.setStandardCaseLightingPowerperUnitLength(lighting_w_per_m)
  ref_case.setInstalledCaseLightingPowerperUnitLength(lighting_w_per_m)
  ref_case.setCaseLightingSchedule(case_lighting_schedule)

  if props['latent_case_credit_curve_name']
    ref_case.setLatentCaseCreditCurve(latent_case_credit_curve)
  end
  ref_case.setCaseDefrostPowerperUnitLength(defrost_power_per_length)
  if props['defrost_type']
    ref_case.setCaseDefrostType(defrost_type)
  end
  ref_case.setDefrostEnergyCorrectionCurveType(defrost_correction_type)
  if props['defrost_correction_curve_name']
    ref_case.setDefrostEnergyCorrectionCurve(defrost_correction_curve_name)
  end
  if props['anti_sweat_power']
    ref_case.setCaseAntiSweatHeaterPowerperUnitLength(anti_sweat_power)
  end
  ref_case.setFractionofAntiSweatHeaterEnergytoCase(fractionofantisweatheaterenergytocase)
  if props['fraction_of_lighting_energy_to_case']
    ref_case.setFractionofLightingEnergytoCase(fraction_of_lighting_energy_to_case)
  end
  if props['minimum_anti_sweat_heater_power_per_unit_length']
    ref_case.setMinimumAntiSweatHeaterPowerperUnitLength(minimum_anti_sweat_heater_power_per_unit_length)
  end
  if props['anti_sweat_heater_control']
    ref_case.setAntiSweatHeaterControlType(anti_sweat_heater_control)
  end
  ref_case.setHumidityatZeroAntiSweatHeaterEnergy(0)
  if props['under_case_hvac_return_air_fraction']
    ref_case.setUnderCaseHVACReturnAirFraction(under_case_hvac_return_air_fraction)
  else
    ref_case.setUnderCaseHVACReturnAirFraction(0)
  end
  if props['restocking_schedule']
    if props['restocking_schedule'].downcase == 'always off'
      # restocking_sch = model.alwaysOffDiscreteSchedule
      ref_case.resetRefrigeratedCaseRestockingSchedule
    else
      restocking_sch = model_add_schedule(model, props['restocking_schedule'])
      ref_case.setRefrigeratedCaseRestockingSchedule(restocking_sch)
    end
  else
    ref_case.resetRefrigeratedCaseRestockingSchedule
  end

  if props['case_category']
    ref_case_addprops = ref_case.additionalProperties
    ref_case_addprops.setFeature('case_category', props['case_category'])
  end

  length_ft = OpenStudio.convert(case_length, 'm', 'ft').get
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', "Added #{length_ft.round} ft display case called #{case_type} with a cooling capacity of #{cooling_capacity_btu_per_hr.round} Btu/hr to #{thermal_zone.name}.")

  return ref_case
end

#model_add_refrigeration_compressor(model, compressor_name) ⇒ OpenStudio::Model::RefrigerationCompressor

Adds a refrigeration compressor to the model

Parameters:

Returns:

  • (OpenStudio::Model::RefrigerationCompressor)

    the refrigeration compressor



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb', line 366

def model_add_refrigeration_compressor(model, compressor_name)
  # Get the compressor properties
  search_criteria = {
    'template' => template,
    'compressor_name' => compressor_name
  }

  props = model_find_object(standards_data['refrigeration_compressors'], search_criteria)
  if props.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "Could not find refrigeration compressor properties for: #{search_criteria}.")
    return nil
  end

  # Performance curves
  pwr_curve_name = props['power_curve']
  cap_curve_name = props['capacity_curve']

  # Make the compressor
  compressor = OpenStudio::Model::RefrigerationCompressor.new(model)
  compressor.setRefrigerationCompressorPowerCurve(model_add_curve(model, pwr_curve_name))
  compressor.setRefrigerationCompressorCapacityCurve(model_add_curve(model, cap_curve_name))

  return compressor
end

#model_add_refrigeration_system(model, compressor_type, system_name, cases, walkins, thermal_zone) ⇒ Boolean

TODO:

Move refrigeration compressors to spreadsheet

Adds a full commercial refrigeration rack to the model, as would be found in a supermarket

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • compressor_type (String)

    the system temperature range valid choices are Low Temp, Med Temp

  • system_name (String)

    the name of the refrigeration system

  • cases (Array<Hash>)

    an array of cases with keys: case_type and space_names

  • walkins (Array<Hashs>)

    an array of walkins with keys: walkin_type, space_names, and number_of_walkins

  • thermal_zone (OpenStudio::Model::ThermalZone)

    the thermal zone where the refrigeration piping is located

Returns:

  • (Boolean)

    returns true if successful, false if not



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb', line 403

def model_add_refrigeration_system(model,
                                   compressor_type,
                                   system_name,
                                   cases,
                                   walkins,
                                   thermal_zone)

  # Refrigeration system
  ref_sys = OpenStudio::Model::RefrigerationSystem.new(model)
  ref_sys.setName(system_name.to_s)
  ref_sys.setSuctionPipingZone(thermal_zone)

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model',
                     "Adding #{compressor_type} refrigeration system called #{system_name} with #{cases.size} cases and #{walkins.size} walkins.")

  # Compressors (20 for each system)
  for i in 0...20
    compressor = model_add_refrigeration_compressor(model, compressor_type)
    ref_sys.addCompressor(compressor)
  end

  size_category = 'Any'
  # Cases
  cooling_cap = 0
  i = 0
  cases.each do |case_|
    zone = model_get_zones_from_spaces_on_system(model, case_)[0]
    ref_case = model_add_refrigeration_case(model, zone, case_['case_type'], size_category)
    return false if ref_case.nil?

    ########################################
    # Defrost schedule
    defrost_sch = OpenStudio::Model::ScheduleRuleset.new(model)
    defrost_sch.setName("#{ref_case.name} Defrost")
    defrost_sch.defaultDaySchedule.setName("#{ref_case.name} Defrost Default")
    defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 0, 0), 0)
    defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 59, 0), 1)
    defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)
    # Dripdown schedule
    dripdown_sch = OpenStudio::Model::ScheduleRuleset.new(model)
    dripdown_sch.setName("#{ref_case.name} Defrost")
    dripdown_sch.defaultDaySchedule.setName("#{ref_case.name} Defrost Default")
    dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 0, 0), 0)
    dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 59, 0), 1)
    dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)
    # Case Credit Schedule
    case_credit_sch = OpenStudio::Model::ScheduleRuleset.new(model)
    case_credit_sch.setName("#{ref_case.name} Case Credit")
    case_credit_sch.defaultDaySchedule.setName("#{ref_case.name} Case Credit Default")
    case_credit_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 7, 0, 0), 0.2)
    case_credit_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 21, 0, 0), 0.4)
    case_credit_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0.2)
    ref_case.setCaseDefrostSchedule(defrost_sch)
    ref_case.setCaseDefrostDripDownSchedule(dripdown_sch)
    ref_case.setCaseCreditFractionSchedule(case_credit_sch)
    ########################################
    ref_sys.addCase(ref_case)
    i += 1
  end

  # Walkins
  walkins.each do |walkin|
    for i in 0...walkin['number_of_walkins']

      zone = model_get_zones_from_spaces_on_system(model, walkin)[0]
      ref_walkin = model_add_refrigeration_walkin(model, zone, size_category, walkin['walkin_type'])
      return false if ref_walkin.nil?

      ########################################
      # Defrost schedule
      defrost_sch = OpenStudio::Model::ScheduleRuleset.new(model)
      defrost_sch.setName("#{ref_walkin.name} Defrost")
      defrost_sch.defaultDaySchedule.setName("#{ref_walkin.name} Defrost Default")
      defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 0, 0), 0)
      defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 59, 0), 1)
      defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i + 10, 0, 0), 0)
      defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i + 10, 59, 0), 1)
      defrost_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)
      # Dripdown schedule
      dripdown_sch = OpenStudio::Model::ScheduleRuleset.new(model)
      dripdown_sch.setName("#{ref_walkin.name} Defrost")
      dripdown_sch.defaultDaySchedule.setName("#{ref_walkin.name} Defrost Default")
      dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 0, 0), 0)
      dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i, 59, 0), 1)
      dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i + 10, 0, 0), 0)
      dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, i + 10, 59, 0), 1)
      dripdown_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)
      ref_walkin.setDefrostSchedule(defrost_sch)
      ref_walkin.setDefrostDripDownSchedule(dripdown_sch)
      ref_sys.addWalkin(ref_walkin)
      ########################################
      cooling_cap += ref_walkin.ratedCoilCoolingCapacity # calculate total cooling capacity of the cases + walkins
    end
  end

  # Condenser capacity
  # The heat rejection rate from the condenser is equal to the rated capacity of all the display cases and walk-ins connected to the compressor rack
  # plus the power rating of the compressors making up the compressor rack.
  # Assuming a COP of 1.3 for low-temperature compressor racks and a COP of 2.0 for medium-temperature compressor racks,
  # the required condenser capacity is approximated as follows:
  # Note the factor 1.2 has been included to over-estimate the condenser size.  The total capacity of the display cases can be calculated
  # from their rated cooling capacity times the length of the cases.  The capacity of each of the walk-ins is specified directly.
  condensor_cap = if compressor_type == 'Low Temp'
                    1.2 * cooling_cap * (1 + (1 / 1.3))
                  else
                    1.2 * cooling_cap * (1 + (1 / 2.0))
                  end
  condenser_coefficient_2 = condensor_cap / 5.6
  condenser_curve = OpenStudio::Model::CurveLinear.new(model)
  condenser_curve.setCoefficient1Constant(0)
  condenser_curve.setCoefficient2x(condenser_coefficient_2)
  condenser_curve.setMinimumValueofx(1.4)
  condenser_curve.setMaximumValueofx(33.3)

  # Condenser fan power
  # The condenser fan power can be estimated from the heat rejection capacity of the condenser as follows:
  condenser_fan_pwr = (0.0441 * condensor_cap) + 695

  # Condenser
  condenser = OpenStudio::Model::RefrigerationCondenserAirCooled.new(model)
  condenser.setRatedFanPower(condenser_fan_pwr)
  condenser.setRatedEffectiveTotalHeatRejectionRateCurve(condenser_curve)
  condenser.setCondenserFanSpeedControlType('Fixed')
  condenser.setMinimumFanAirFlowRatio(0.1)

  ref_sys.setRefrigerationCondenser(condenser)

  return true
end

#model_add_refrigeration_walkin(model, thermal_zone, size_category, walkin_type) ⇒ OpenStudio::Model::RefrigerationWalkIn

Adds a refrigerated walkin unit to the model

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zone (OpenStudio::Model::ThermalZone)

    the thermal zone where the walkin is located, and which will be impacted by the walkin's thermal load.

  • size_category (String)

    size category of the building area. Valid choices are: "<35k ft2", "35k - 50k ft2", ">50k ft2"

  • walkin_type (String)

    the walkin type/name. For valid choices, refer to the "Refrigerated Walkins" tab on the OpenStudio_Standards spreadsheet. This parameter is used also by the "Refrigeration System Lineup" tab.

Returns:

  • (OpenStudio::Model::RefrigerationWalkIn)

    the walk in refrigerator



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb', line 163

def model_add_refrigeration_walkin(model, thermal_zone, size_category, walkin_type)
  # Get the walkin properties
  search_criteria = {
    'template' => template,
    'size_category' => size_category,
    'walkin_type' => walkin_type
  }

  props = model_find_object(standards_data['refrigeration_walkins'], search_criteria)
  if props.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Prototype.refrigeration', "Could not find walkin properties for: #{search_criteria}.")
    return nil
  end

  # Capacity, defrost, lighting
  walkin_type = props['walkin_type']
  if props['rated_cooling_capacity']
    rated_cooling_capacity = OpenStudio.convert(props['rated_cooling_capacity'], 'Btu/h', 'W').get
  end
  if props['cooling_capacity_c0']
    cooling_capacity_c0 = OpenStudio.convert(OpenStudio.convert(props['cooling_capacity_c0'], 'Btu/h', 'W').get, 'W/ft', 'W/m').get
  end
  if props['cooling_capacity_c1']
    cooling_capacity_c1 = OpenStudio.convert(OpenStudio.convert(props['cooling_capacity_c1'], 'Btu/h', 'W').get, 'W/ft', 'W/m').get
  end
  if props['cooling_capacity_c2']
    cooling_capacity_c2 = OpenStudio.convert(OpenStudio.convert(props['cooling_capacity_c2'], 'Btu/h', 'W').get, 'W/ft', 'W/m').get
  end
  if props['fan_power_mult']
    fan_power_mult = props['fan_power_mult']
  end
  if props['lighting_power_mult']
    lighting_power_mult = props['lighting_power_mult']
  end
  if props['reachin_door_area_mult']
    reachin_door_area_mult = OpenStudio.convert(props['reachin_door_area_mult'], 'ft^2', 'm^2').get
  end
  operating_temp = OpenStudio.convert(props['operating_temp'], 'F', 'C').get
  if props['source_temp']
    source_temp = OpenStudio.convert(props['source_temp'], 'F', 'C').get
  end
  if props['defrost_control_type']
    defrost_control_type = props['defrost_control_type']
  end
  defrost_type = props['defrost_type']
  defrost_power_mult = props['defrost_power_mult']
  defrost_power = props['defrost_power']
  ratedtotalheatingpower = props['ratedtotalheatingpower']
  ratedcirculationfanpower = props['ratedcirculationfanpower']
  fan_power = props['fan_power']
  lighting_power = props['lighting_power']
  # lighting_power_mult = props_ref_system['lighting_power_mult']
  if props['insulated_floor_u']
    insulated_floor_u = OpenStudio.convert(props['insulated_floor_u'], 'Btu/ft^2*h*R', 'W/m^2*K').get
  end
  if props['insulated_surface_u']
    insulated_surface_u = OpenStudio.convert(props['insulated_surface_u'], 'Btu/ft^2*h*R', 'W/m^2*K').get
  end
  if props['stocking_door_u']
    insulated_door_u = OpenStudio.convert(props['stocking_door_u'], 'Btu/ft^2*h*R', 'W/m^2*K').get
  end
  if props['glass_reachin_door_u_value']
    glass_reachin_door_u_value = OpenStudio.convert(props['glass_reachin_door_u_value'], 'Btu/ft^2*h*R', 'W/m^2*K').get
  end
  if props['reachin_door_area']
    reachin_door_area = OpenStudio.convert(props['reachin_door_area'], 'ft^2', 'm^2').get
  else
    reachin_door_area = 0.0
  end
  if props['total_insulated_surface_area']
    total_insulated_surface_area = OpenStudio.convert(props['total_insulated_surface_area'], 'ft^2', 'm^2').get
  end
  if props['height_of_glass_reachin_doors']
    height_of_glass_reachin_doors = OpenStudio.convert(props['height_of_glass_reachin_doors'], 'ft', 'm').get
  end
  if props['area_of_stocking_doors']
    area_of_stocking_doors = OpenStudio.convert(props['area_of_stocking_doors'], 'ft^2', 'm^2').get
  end
  if props['floor_surface_area']
    floor_surface_area = OpenStudio.convert(props['floor_surface_area'], 'ft^2', 'm^2').get
  end
  if props['height_of_stocking_doors']
    height_of_stocking_doors = OpenStudio.convert(props['height_of_stocking_doors'], 'ft', 'm').get
  end
  lightingschedule = props['lighting_schedule']
  temperatureterminationdefrostfractiontoice = props['temperatureterminationdefrostfractiontoice']

  # Calculated properties
  if rated_cooling_capacity.nil?
    rated_cooling_capacity = (cooling_capacity_c2 * (floor_surface_area ^ 2)) + (cooling_capacity_c1 * floor_surface_area) + cooling_capacity_c0
  end
  if defrost_power.nil?
    defrost_power = defrost_power_mult * rated_cooling_capacity
  end
  if total_insulated_surface_area.nil?
    total_insulated_surface_area = (1.7226 * floor_surface_area) + 28.653
  end
  if fan_power.nil?
    fan_power = fan_power_mult * rated_cooling_capacity
  end
  if lighting_power.nil?
    lighting_power = lighting_power_mult * floor_surface_area
  end

  # Check validity of thermal zone
  if OpenstudioStandards::ThermalZone.thermal_zone_plenum?(thermal_zone)
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Prototype.refrigeration', "Thermal zone #{thermal_zone.name} is a plenum; cannot add walkins to a plenum.")
    return nil
  end

  # Walk-In
  ref_walkin = OpenStudio::Model::RefrigerationWalkIn.new(model, model.alwaysOnDiscreteSchedule)
  ref_walkin.setName(walkin_type.to_s)
  ref_walkin.setZoneBoundaryThermalZone(thermal_zone)
  ref_walkin.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  ref_walkin.setRatedCoilCoolingCapacity(rated_cooling_capacity)
  rated_cooling_capacity_btu_per_hr = OpenStudio.convert(rated_cooling_capacity, 'W', 'Btu/hr').get
  ref_walkin.setOperatingTemperature(operating_temp)
  if props['source_temp']
    ref_walkin.setRatedCoolingSourceTemperature(source_temp)
  end
  if props['defrost_control_type']
    ref_walkin.setDefrostControlType(defrost_control_type)
  end
  ref_walkin.setDefrostType(defrost_type)
  ref_walkin.setDefrostPower(defrost_power)
  if props['ratedtotalheatingpower']
    ref_walkin.setRatedTotalHeatingPower(ratedtotalheatingpower)
  end
  if props['ratedcirculationfanpower']
    ref_walkin.setRatedCirculationFanPower(ratedcirculationfanpower)
  end
  ref_walkin.setRatedCoolingCoilFanPower(fan_power)
  ref_walkin.setRatedTotalLightingPower(lighting_power)
  if props['insulated_floor_u']
    ref_walkin.setInsulatedFloorUValue(insulated_floor_u)
  end
  if props['insulated_surface_u']
    ref_walkin.setZoneBoundaryInsulatedSurfaceUValueFacingZone(insulated_surface_u)
  end
  if props['stocking_door_u']
    ref_walkin.setZoneBoundaryStockingDoorUValueFacingZone(insulated_door_u)
  end
  if props['reachin_door_area']
    ref_walkin.setZoneBoundaryAreaofGlassReachInDoorsFacingZone(reachin_door_area)
  end
  if props['total_insulated_surface_area']
    ref_walkin.setZoneBoundaryTotalInsulatedSurfaceAreaFacingZone(total_insulated_surface_area)
  end
  if props['area_of_stocking_doors']
    ref_walkin.setZoneBoundaryAreaofStockingDoorsFacingZone(area_of_stocking_doors)
  end
  if props['floor_surface_area']
    ref_walkin.setInsulatedFloorSurfaceArea(floor_surface_area)
  end
  if props['height_of_glass_reachin_doors']
    ref_walkin.setZoneBoundaryHeightofGlassReachInDoorsFacingZone(height_of_glass_reachin_doors)
  end
  if props['height_of_stocking_doors']
    ref_walkin.setZoneBoundaryHeightofStockingDoorsFacingZone(height_of_stocking_doors)
  end
  if props['glass_reachin_door_u_value']
    ref_walkin.setZoneBoundaryGlassReachInDoorUValueFacingZone(glass_reachin_door_u_value)
  end
  if props['temperatureterminationdefrostfractiontoice']
    ref_walkin.setTemperatureTerminationDefrostFractiontoIce(temperatureterminationdefrostfractiontoice)
  end

  if props['restocking_schedule']
    if props['restocking_schedule'].downcase == 'always off'
      # restocking_sch = model.alwaysOffDiscreteSchedule
      ref_walkin.resetRestockingSchedule
    else
      restocking_sch = model_add_schedule(model, props['restocking_schedule'])
      ref_walkin.setRestockingSchedule(restocking_sch)
    end
  else
    ref_walkin.resetRestockingSchedule
  end

  ref_walkin.setLightingSchedule(model_add_schedule(model, lightingschedule))
  ref_walkin.setZoneBoundaryStockingDoorOpeningScheduleFacingZone(model_add_schedule(model, 'door_wi_sched'))

  ref_walkin_addprops = ref_walkin.additionalProperties
  ref_walkin_addprops.setFeature('motor_category', props['motor_category'])

  # Add doorway protection
  if props['doorway_protection_type']
    ref_walkin.zoneBoundaries.each do |zb|
      zb.setStockingDoorOpeningProtectionTypeFacingZone(props['doorway_protection_type'])
    end
  end

  insulated_floor_area_ft2 = OpenStudio.convert(floor_surface_area, 'm^2', 'ft^2').get
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', "Added #{insulated_floor_area_ft2.round} ft2 walkin called #{walkin_type} with a capacity of #{rated_cooling_capacity_btu_per_hr.round} Btu/hr to #{thermal_zone.name}.")

  return ref_walkin
end

#model_add_residential_erv(model, thermal_zones, min_oa_flow_m3_per_s_per_m2 = nil) ⇒ Array<OpenStudio::Model::ZoneHVACEnergyRecoveryVentilator>

Add a residential ERV: standalone ERV that operates to provide OA, used in conjuction with a system that having mechanical cooling and a heating coil

Parameters:

Returns:

  • (Array<OpenStudio::Model::ZoneHVACEnergyRecoveryVentilator>)

    an array of zone ERVs



5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5940

def model_add_residential_erv(model,
                              thermal_zones,
                              min_oa_flow_m3_per_s_per_m2 = nil)
  # Determine ERR and design basis when energy recovery is required
  # enthalpy_recovery_ratio = nil will trigger an ERV with no effectiveness that only provides OA
  enthalpy_recovery_ratio = nil

  # Process climate zone:
  # Moisture regime is not needed for climate zone 7 and 8
  climate_zone = OpenstudioStandards::Weather.model_get_climate_zone(model)
  climate_zone_code = climate_zone.split('-')[-1]
  climate_zone_code = 7 if ['7A', '7B'].include? climate_zone_code
  climate_zone_code = 8 if ['8A', '8B'].include? climate_zone_code

  case template
    when '90.1-2019', '90.1-2016'
      search_criteria = {
        'template' => template,
        'climate_zone' => climate_zone_code,
        'under_8000_hours' => false,
        'nontransient_dwelling' => true
      }
      metric = 'enthalpy_recovery_ratio'
    else
      search_criteria = {
        'template' => template,
        'climate_zone' => climate_zone_code,
        'under_8000_hours' => false
      }
      metric = 'energy_recovery_effectiveness'
  end

  # Pick the most stringent of the heating or cooling Enthalpy Recovery Ratio (ERR)
  # or Energy Recovery Effectiveness (ERE); ERR and ERE are virtually the same metrics
  erv_enthalpy_recovery_ratio = nil
  erv_enthalpy_recovery_ratios = model_find_objects(standards_data['energy_recovery'], search_criteria)
  erv_enthalpy_recovery_ratios.each do |erv_data|
    if erv_enthalpy_recovery_ratio.nil?
      erv_enthalpy_recovery_ratio = erv_data
    end
    if !erv_data[metric].nil? && (erv_enthalpy_recovery_ratio[metric] <= erv_data[metric])
      erv_enthalpy_recovery_ratio = erv_data
    end
  end

  # Extract ERR/ERE from data lookup
  if !erv_enthalpy_recovery_ratio.nil?
    if erv_enthalpy_recovery_ratio[metric].nil? & erv_enthalpy_recovery_ratio['design_conditions'].nil?
      # If not included in the data, an ERR of 50% is used
      enthalpy_recovery_ratio = 0.5
      case climate_zone
        when 'ASHRAE 169-2006-6B',
          'ASHRAE 169-2013-6B',
          'ASHRAE 169-2006-7A',
          'ASHRAE 169-2013-7A',
          'ASHRAE 169-2006-7B',
          'ASHRAE 169-2013-7B',
          'ASHRAE 169-2006-8A',
          'ASHRAE 169-2013-8A',
          'ASHRAE 169-2006-8B',
          'ASHRAE 169-2013-8B'
          design_conditions = 'heating'
        else
          design_conditions = 'cooling'
      end
    else
      design_conditions = erv_enthalpy_recovery_ratio['design_conditions'].downcase
      enthalpy_recovery_ratio = erv_enthalpy_recovery_ratio[metric]
    end
  end

  zone_ervs = []
  thermal_zones.each do |thermal_zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding standalone ERV for #{thermal_zone.name}.")

    # Fan power with energy recovery = 0.934 W/cfm
    supply_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                              'ERV_Supply_Fan',
                                                              fan_name: "#{thermal_zone.name} ERV Supply Fan")
    exhaust_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                               'ERV_Supply_Fan',
                                                               fan_name: "#{thermal_zone.name} ERV Exhaust Fan")
    supply_fan.setMotorEfficiency(0.48)
    exhaust_fan.setMotorEfficiency(0.48)
    supply_fan.setFanTotalEfficiency(0.303158)
    exhaust_fan.setFanTotalEfficiency(0.303158)
    supply_fan.setPressureRise(270.64755)
    exhaust_fan.setPressureRise(270.64755)

    # Create heat exchanger
    heat_exchanger = OpenstudioStandards::HVAC.create_heat_exchanger_air_to_air_sensible_and_latent(model,
                                                                                                    name: "#{thermal_zone.name} ERV HX",
                                                                                                    type: 'Rotary',
                                                                                                    economizer_lockout: false,
                                                                                                    supply_air_outlet_temperature_control: false,
                                                                                                    frost_control_type: 'ExhaustOnly')
    heat_exchanger.setThresholdTemperature(-23.3)
    heat_exchanger.setInitialDefrostTimeFraction(0.167)
    heat_exchanger.setRateofDefrostTimeFractionIncrease(1.44)
    heat_exchanger.setAvailabilitySchedule(model_add_schedule(model, 'Always On - No Design Day'))
    heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency_enthalpy_recovery_ratio(heat_exchanger, enthalpy_recovery_ratio, design_conditions, climate_zone)

    # Create ERV Controller
    erv_controller = OpenStudio::Model::ZoneHVACEnergyRecoveryVentilatorController.new(model)
    erv_controller.setName("#{thermal_zone.name} ERV Controller")
    erv_controller.setControlHighIndoorHumidityBasedonOutdoorHumidityRatio(false)

    # Create ERV
    erv = OpenStudio::Model::ZoneHVACEnergyRecoveryVentilator.new(model, heat_exchanger, supply_fan, exhaust_fan)
    erv.setName("#{thermal_zone.name} ERV")
    erv.setController(erv_controller)
    erv.addToThermalZone(thermal_zone)

    # Set OA requirements; Assumes a default of 55 cfm
    if min_oa_flow_m3_per_s_per_m2.nil?
      erv.setSupplyAirFlowRate(OpenStudio.convert(55.0, 'cfm', 'm^3/s').get)
      erv.setExhaustAirFlowRate(OpenStudio.convert(55.0, 'cfm', 'm^3/s').get)
    else
      erv.setVentilationRateperUnitFloorArea(min_oa_flow_m3_per_s_per_m2)
    end
    erv.setVentilationRateperOccupant(0.0)

    # Ensure the ERV takes priority, so ventilation load is included when treated by other zonal systems
    # From EnergyPlus I/O reference:
    # "For situations where one or more equipment types has limited capacity or limited control capability, order the
    #  sequence so that the most controllable piece of equipment runs last. For example, with a dedicated outdoor air
    #  system (DOAS), the air terminal for the DOAS should be assigned Heating Sequence = 1 and Cooling Sequence = 1.
    #  Any other equipment should be assigned sequence 2 or higher so that it will see the net load after the DOAS air
    #  is added to the zone."
    thermal_zone.setCoolingPriority(erv.to_ModelObject.get, 1)
    thermal_zone.setHeatingPriority(erv.to_ModelObject.get, 1)

    zone_ervs << erv
  end

  return zone_ervs
end

#model_add_residential_ventilator(model, thermal_zones, min_oa_flow_m3_per_s_per_m2 = nil) ⇒ Array<OpenStudio::Model::ZoneHVACUnitVentilator>

Add a residential ventilation: standalone unit ventilation and zone exhaust that operates to provide OA, used in conjuction with a system that having mechanical cooling and a heating coil

Parameters:

Returns:

  • (Array<OpenStudio::Model::ZoneHVACUnitVentilator>)

    an array of zone Unit Ventilators



6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6084

def model_add_residential_ventilator(model,
                                     thermal_zones,
                                     min_oa_flow_m3_per_s_per_m2 = nil)
  unit_ventilators = []
  thermal_zones.each do |thermal_zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding standalone unit ventilator for #{thermal_zone.name}.")

    # Fan power with no energy recovery = 0.806 W/cfm
    supply_fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                              'ERV_Supply_Fan',
                                                              fan_name: "#{thermal_zone.name} Ventilator Supply Fan")
    supply_fan.setMotorEfficiency(0.48)
    supply_fan.setFanTotalEfficiency(0.303158)
    supply_fan.setPressureRise(233.6875)

    unit_ventilator = OpenStudio::Model::ZoneHVACUnitVentilator.new(model, supply_fan)
    unit_ventilator.setName("#{thermal_zone.name} Unit Ventilator")
    unit_ventilator.addToThermalZone(thermal_zone)
    fan_zone_exhaust = OpenstudioStandards::HVAC.create_fan_zone_exhaust(model,
                                                                         fan_name: "#{thermal_zone.name} Exhaust Fan",
                                                                         fan_efficiency: 0.303158,
                                                                         pressure_rise: 233.6875)

    # Set OA requirements; Assumes a default of 55 cfm
    if min_oa_flow_m3_per_s_per_m2.nil?
      unit_ventilator.setMaximumSupplyAirFlowRate(OpenStudio.convert(55.0, 'cfm', 'm^3/s').get)
      fan_zone_exhaust.setMaximumFlowRate(OpenStudio.convert(55.0, 'cfm', 'm^3/s').get)
    else
      unit_ventilator.setMaximumSupplyAirFlowRate(min_oa_flow_m3_per_s_per_m2)
      fan_zone_exhaust.setMaximumFlowRate(min_oa_flow_m3_per_s_per_m2)
    end

    # Ensure the unit ventilator takes priority, so ventilation load is included when treated by other zonal systems
    # From EnergyPlus I/O reference:
    # "For situations where one or more equipment types has limited capacity or limited control capability, order the
    #  sequence so that the most controllable piece of equipment runs last. For example, with a dedicated outdoor air
    #  system (DOAS), the air terminal for the DOAS should be assigned Heating Sequence = 1 and Cooling Sequence = 1.
    #  Any other equipment should be assigned sequence 2 or higher so that it will see the net load after the DOAS air
    #  is added to the zone."
    thermal_zone.setCoolingPriority(unit_ventilator.to_ModelObject.get, 1)
    thermal_zone.setHeatingPriority(unit_ventilator.to_ModelObject.get, 1)

    unit_ventilators << unit_ventilator
  end

  return unit_ventilators
end

#model_add_schedule(model, schedule_name) ⇒ ScheduleRuleset

TODO:

make return an OptionalScheduleRuleset

Create a schedule from the openstudio standards dataset and add it to the model.

Parameters:

Returns:

  • (ScheduleRuleset)

    the resulting schedule ruleset



2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2767

def model_add_schedule(model, schedule_name)
  return nil if schedule_name.nil? || schedule_name == ''

  # First check model and return schedule if it already exists
  model.getSchedules.sort.each do |schedule|
    if schedule.name.get.to_s == schedule_name
      OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Model', "Already added schedule: #{schedule_name}")
      return schedule
    end
  end

  require 'date'

  # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding schedule: #{schedule_name}")

  # Find all the schedule rules that match the name
  rules = model_find_objects(standards_data['schedules'], 'name' => schedule_name)
  if rules.empty?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "Cannot find data for schedule: #{schedule_name}, will not be created.")
    return model.alwaysOnDiscreteSchedule
  end

  # Make a schedule ruleset
  sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
  sch_ruleset.setName(schedule_name.to_s)

  # Loop through the rules, making one for each row in the spreadsheet
  rules.each do |rule|
    day_types = rule['day_types']
    start_date = DateTime.parse(rule['start_date'])
    end_date = DateTime.parse(rule['end_date'])
    sch_type = rule['type']
    values = rule['values']

    # Day Type choices: Wkdy, Wknd, Mon, Tue, Wed, Thu, Fri, Sat, Sun, WntrDsn, SmrDsn, Hol
    # Default
    if day_types.include?('Default')
      day_sch = sch_ruleset.defaultDaySchedule
      day_sch.setName("#{schedule_name} Default")
      model_add_vals_to_sch(model, day_sch, sch_type, values)
      if model.version < OpenStudio::VersionString.new('3.8.0')
        day_sch.setInterpolatetoTimestep(false)
      else
        day_sch.setInterpolatetoTimestep('No')
      end
    end

    # Winter Design Day
    if day_types.include?('WntrDsn')
      day_sch = OpenStudio::Model::ScheduleDay.new(model)
      sch_ruleset.setWinterDesignDaySchedule(day_sch)
      day_sch = sch_ruleset.winterDesignDaySchedule
      day_sch.setName("#{schedule_name} Winter Design Day")
      model_add_vals_to_sch(model, day_sch, sch_type, values)
      if model.version < OpenStudio::VersionString.new('3.8.0')
        day_sch.setInterpolatetoTimestep(false)
      else
        day_sch.setInterpolatetoTimestep('No')
      end
    end

    # Summer Design Day
    if day_types.include?('SmrDsn')
      day_sch = OpenStudio::Model::ScheduleDay.new(model)
      sch_ruleset.setSummerDesignDaySchedule(day_sch)
      day_sch = sch_ruleset.summerDesignDaySchedule
      day_sch.setName("#{schedule_name} Summer Design Day")
      model_add_vals_to_sch(model, day_sch, sch_type, values)
      if model.version < OpenStudio::VersionString.new('3.8.0')
        day_sch.setInterpolatetoTimestep(false)
      else
        day_sch.setInterpolatetoTimestep('No')
      end
    end

    # Other days (weekdays, weekends, etc)
    if day_types.include?('Wknd') ||
       day_types.include?('Wkdy') ||
       day_types.include?('Sat') ||
       day_types.include?('Sun') ||
       day_types.include?('Mon') ||
       day_types.include?('Tue') ||
       day_types.include?('Wed') ||
       day_types.include?('Thu') ||
       day_types.include?('Fri')

      # Make the Rule
      sch_rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
      day_sch = sch_rule.daySchedule
      day_sch.setName("#{schedule_name} #{day_types} Day")
      model_add_vals_to_sch(model, day_sch, sch_type, values)
      if model.version < OpenStudio::VersionString.new('3.8.0')
        day_sch.setInterpolatetoTimestep(false)
      else
        day_sch.setInterpolatetoTimestep('No')
      end

      # Set the dates when the rule applies
      sch_rule.setStartDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_date.month.to_i), start_date.day.to_i))
      sch_rule.setEndDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_date.month.to_i), end_date.day.to_i))

      # Set the days when the rule applies
      # Weekends
      if day_types.include?('Wknd')
        sch_rule.setApplySaturday(true)
        sch_rule.setApplySunday(true)
      end
      # Weekdays
      if day_types.include?('Wkdy')
        sch_rule.setApplyMonday(true)
        sch_rule.setApplyTuesday(true)
        sch_rule.setApplyWednesday(true)
        sch_rule.setApplyThursday(true)
        sch_rule.setApplyFriday(true)
      end
      # Individual Days
      sch_rule.setApplyMonday(true) if day_types.include?('Mon')
      sch_rule.setApplyTuesday(true) if day_types.include?('Tue')
      sch_rule.setApplyWednesday(true) if day_types.include?('Wed')
      sch_rule.setApplyThursday(true) if day_types.include?('Thu')
      sch_rule.setApplyFriday(true) if day_types.include?('Fri')
      sch_rule.setApplySaturday(true) if day_types.include?('Sat')
      sch_rule.setApplySunday(true) if day_types.include?('Sun')
    end
  end
  return sch_ruleset
end

#model_add_split_ac(model, thermal_zones, cooling_type: 'Two Speed DX AC', heating_type: 'Single Speed Heat Pump', supplemental_heating_type: 'Gas', fan_type: 'Cycling', hvac_op_sch: nil, oa_damper_sch: nil, econ_max_oa_frac_sch: nil) ⇒ OpenStudio::Model::AirLoopHVAC

Creates a split DX AC system for each zone and adds it to the model.

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

  • cooling_type (String) (defaults to: 'Two Speed DX AC')

    valid choices are Two Speed DX AC, Single Speed DX AC, Single Speed Heat Pump

  • heating_type (String) (defaults to: 'Single Speed Heat Pump')

    valid choices are Gas, Single Speed Heat Pump

  • supplemental_heating_type (String) (defaults to: 'Gas')

    valid choices are Electric, Gas

  • fan_type (String) (defaults to: 'Cycling')

    valid choices are ConstantVolume, Cycling

  • hvac_op_sch (String) (defaults to: nil)

    name of the HVAC operation schedule or nil in which case will be defaulted to always on

  • oa_damper_sch (String) (defaults to: nil)

    name of the oa damper schedule, or nil in which case will be defaulted to always open

  • econ_max_oa_frac_sch (String) (defaults to: nil)

    name of the economizer maximum outdoor air fraction schedule

Returns:

  • (OpenStudio::Model::AirLoopHVAC)

    the resulting split AC air loop



3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3763

def model_add_split_ac(model,
                       thermal_zones,
                       cooling_type: 'Two Speed DX AC',
                       heating_type: 'Single Speed Heat Pump',
                       supplemental_heating_type: 'Gas',
                       fan_type: 'Cycling',
                       hvac_op_sch: nil,
                       oa_damper_sch: nil,
                       econ_max_oa_frac_sch: nil)

  # create a split AC for each group of thermal zones
  air_loop = OpenStudio::Model::AirLoopHVAC.new(model)
  thermal_zones_name = thermal_zones.map(&:name).join(' - ')
  air_loop.setName("#{thermal_zones_name} SAC")

  # hvac operation schedule
  if hvac_op_sch.nil?
    hvac_op_sch = model.alwaysOnDiscreteSchedule
  else
    hvac_op_sch = model_add_schedule(model, hvac_op_sch)
  end

  # oa damper schedule
  if oa_damper_sch.nil?
    oa_damper_sch = model.alwaysOnDiscreteSchedule
  else
    oa_damper_sch = model_add_schedule(model, oa_damper_sch)
  end

  # default design temperatures used across all air loops
  dsgn_temps = standard_design_sizing_temperatures

  # adjusted zone design heating temperature for split_ac
  dsgn_temps['zn_htg_dsgn_sup_air_temp_f'] = 122.0
  dsgn_temps['zn_htg_dsgn_sup_air_temp_c'] = OpenStudio.convert(dsgn_temps['zn_htg_dsgn_sup_air_temp_f'], 'F', 'C').get
  dsgn_temps['htg_dsgn_sup_air_temp_f'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_f']
  dsgn_temps['htg_dsgn_sup_air_temp_c'] = dsgn_temps['zn_htg_dsgn_sup_air_temp_c']

  # default design settings used across all air loops
  sizing_system = adjust_sizing_system(air_loop, dsgn_temps, min_sys_airflow_ratio: 1.0, sizing_option: 'NonCoincident')

  # air handler controls
  # add a setpoint manager single zone reheat to control the supply air temperature
  setpoint_mgr_single_zone_reheat = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
  setpoint_mgr_single_zone_reheat.setName("#{air_loop.name} Setpoint Manager SZ Reheat")
  setpoint_mgr_single_zone_reheat.setControlZone(thermal_zones[0])
  setpoint_mgr_single_zone_reheat.setMinimumSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
  setpoint_mgr_single_zone_reheat.setMaximumSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
  setpoint_mgr_single_zone_reheat.addToNode(air_loop.supplyOutletNode)

  # add the components to the air loop in order from closest to zone to furthest from zone
  # create fan
  fan = nil
  if fan_type == 'ConstantVolume'
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Split_AC_CAV_Fan',
                                                       fan_name: "#{air_loop.name} Fan",
                                                       end_use_subcategory: 'CAV System Fans')
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  elsif fan_type == 'Cycling'
    fan = OpenstudioStandards::HVAC.create_typical_fan(model,
                                                       'Split_AC_Cycling_Fan',
                                                       fan_name: "#{air_loop.name} Fan",
                                                       end_use_subcategory: 'CAV System Fans')
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  else
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', "fan_type #{fan_type} invalid for split AC system.")
  end
  fan.addToNode(air_loop.supplyInletNode) unless fan.nil?

  # create supplemental heating coil
  if supplemental_heating_type == 'Electric'
    OpenstudioStandards::HVAC.create_coil_heating_electric(model,
                                                           air_loop_node: air_loop.supplyInletNode,
                                                           name: "#{air_loop.name} Electric Backup Htg Coil")
  elsif supplemental_heating_type == 'Gas'
    OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                      air_loop_node: air_loop.supplyInletNode,
                                                      name: "#{air_loop.name} Gas Backup Htg Coil")
  end

  # create heating coil
  if heating_type == 'Gas'
    htg_coil = OpenstudioStandards::HVAC.create_coil_heating_gas(model,
                                                                 air_loop_node: air_loop.supplyInletNode,
                                                                 name: "#{air_loop.name} Gas Htg Coil")
    htg_part_load_fraction_correlation = OpenStudio::Model::CurveCubic.new(model)
    htg_part_load_fraction_correlation.setCoefficient1Constant(0.8)
    htg_part_load_fraction_correlation.setCoefficient2x(0.2)
    htg_part_load_fraction_correlation.setCoefficient3xPOW2(0.0)
    htg_part_load_fraction_correlation.setCoefficient4xPOW3(0.0)
    htg_part_load_fraction_correlation.setMinimumValueofx(0.0)
    htg_part_load_fraction_correlation.setMaximumValueofx(1.0)
    htg_coil.setPartLoadFractionCorrelationCurve(htg_part_load_fraction_correlation)
  elsif heating_type == 'Single Speed Heat Pump'
    OpenstudioStandards::HVAC.create_coil_heating_dx_single_speed(model,
                                                                  air_loop_node: air_loop.supplyInletNode,
                                                                  name: "#{air_loop.name} HP Htg Coil")
  end

  # create cooling coil
  if cooling_type == 'Two Speed DX AC'
    OpenstudioStandards::HVAC.create_coil_cooling_dx_two_speed(model,
                                                               air_loop_node: air_loop.supplyInletNode,
                                                               name: "#{air_loop.name} 2spd DX AC Clg Coil")
  elsif cooling_type == 'Single Speed DX AC'
    OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                        air_loop_node: air_loop.supplyInletNode,
                                        name: "#{air_loop.name} 1spd DX AC Clg Coil", type: 'Split AC')
  elsif cooling_type == 'Single Speed Heat Pump'
    OpenstudioStandards::HVAC.create_coil_cooling_dx_single_speed(model,
                                                                  air_loop_node: air_loop.supplyInletNode,
                                                                  name: "#{air_loop.name} 1spd DX HP Clg Coil", type: 'Heat Pump')
  end

  # create outdoor air controller
  oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_controller.setName("#{air_loop.name} OA System Controller")
  oa_controller.setMinimumOutdoorAirSchedule(oa_damper_sch)
  oa_controller.autosizeMinimumOutdoorAirFlowRate
  oa_controller.resetEconomizerMinimumLimitDryBulbTemperature
  oa_controller.setMaximumFractionofOutdoorAirSchedule(model_add_schedule(model, econ_max_oa_frac_sch)) unless econ_max_oa_frac_sch.nil?
  oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
  oa_system.setName("#{air_loop.name} OA System")
  oa_system.addToNode(air_loop.supplyInletNode)

  # set air loop availability controls after oa system added
  air_loop.setAvailabilitySchedule(hvac_op_sch)

  # create a diffuser and attach the zone/diffuser pair to the air loop
  thermal_zones.each do |zone|
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Adding #{zone.name} to split DX AC system.")

    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
    diffuser.setName("#{zone.name} SAC Diffuser")
    air_loop.multiAddBranchForZone(zone, diffuser.to_HVACComponent.get)

    # zone sizing
    sizing_zone = zone.sizingZone
    sizing_zone.setZoneCoolingDesignSupplyAirTemperature(dsgn_temps['zn_clg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneHeatingDesignSupplyAirTemperature(dsgn_temps['zn_htg_dsgn_sup_air_temp_c'])
    sizing_zone.setZoneCoolingDesignSupplyAirHumidityRatio(0.008)
    sizing_zone.setZoneHeatingDesignSupplyAirHumidityRatio(0.008)
  end

  return air_loop
end

#model_add_swh(model, building_type, prototype_input) ⇒ Boolean

Add service water heating to the model

Parameters:

Returns:

  • (Boolean)

    returns true if successful, false if not



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/openstudio-standards/standards/Standards.ServiceWaterHeating.rb', line 8

def model_add_swh(model, building_type, prototype_input)
  OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started Adding Service Water Heating')

  # Add the main service water heating loop, if specified
  # for tall and super tall buildings, add main (multiple) and booster swh in model_custom_hvac_tweaks
  unless prototype_input['main_water_heater_volume'].nil? || (building_type == 'TallBuilding' || building_type == 'SuperTallBuilding')
    # Get the thermal zone for the water heater, if specified
    water_heater_zone = nil
    if prototype_input['main_water_heater_space_name']
      wh_space_name = prototype_input['main_water_heater_space_name']
      wh_space = model.getSpaceByName(wh_space_name)
      if wh_space.empty?
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Cannot find a space called #{wh_space_name} in the model, water heater will not be placed in a zone.")
      else
        wh_zone = wh_space.get.thermalZone
        if wh_zone.empty?
          OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Cannot find a zone that contains the space #{wh_space_name} in the model, water heater will not be placed in a zone.")
        else
          water_heater_zone = wh_zone.get
        end
      end
    end

    swh_fueltype = prototype_input