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.Surface.rb,
lib/openstudio-standards/standards/Standards.FanOnOff.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.PlanarSurface.rb,
lib/openstudio-standards/standards/Standards.BoilerHotWater.rb,
lib/openstudio-standards/standards/Standards.CoilHeatingGas.rb,
lib/openstudio-standards/standards/Standards.FanZoneExhaust.rb,
lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb,
lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb,
lib/openstudio-standards/standards/Standards.FanConstantVolume.rb,
lib/openstudio-standards/standards/Standards.FanVariableVolume.rb,
lib/openstudio-standards/standards/Standards.PumpConstantSpeed.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/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/prototypes/common/objects/Prototype.utilities.rb,
lib/openstudio-standards/standards/Standards.CoolingTowerVariableSpeed.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.Model.hvac.rb,
lib/openstudio-standards/standards/Standards.HeaderedPumpsConstantSpeed.rb,
lib/openstudio-standards/standards/Standards.HeaderedPumpsVariableSpeed.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.BoilerHotWater.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingGas.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.CoilCoolingWater.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingWater.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.PumpVariableSpeed.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.Model.transformers.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingElectric.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.ControllerWaterCoil.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingDXTwoSpeed.rb,
lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb,
lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.radiant_system_controls.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CentralAirSourceHeatPump.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingDXSingleSpeed.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingDXSingleSpeed.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.AirConditionerVariableRefrigerantFlow.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingWaterToAirHeatPumpEquationFit.rb,
lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingWaterToAirHeatPumpEquationFit.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

Surface collapse

PlantLoop collapse

SpaceType collapse

SubSurface collapse

AirLoopHVAC collapse

FluidCooler collapse

ThermalZone collapse

PlanarSurface collapse

BoilerHotWater collapse

CoilHeatingGas collapse

ScheduleRuleset collapse

WaterHeaterMixed collapse

ZoneHVACComponent collapse

ChillerElectricEIR collapse

HeatExchangerSensLat collapse

CoilCoolingDXMultiSpeed collapse

CoilHeatingDXMultiSpeed collapse

CoilHeatingGasMultiStage collapse

utilities collapse

Cooling Tower collapse

Sizing System collapse

hvac_systems collapse

refrigeration collapse

Boiler Hot Water collapse

AirTerminalSingleDuctVAVReheat collapse

CoilCoolingWater collapse

CoilHeatingWater collapse

CoilHeatingElectric collapse

ControllerWaterCoil collapse

CoilCoolingDXTwoSpeed collapse

AirConditionerVariableRefrigerantFlow collapse

AirTerminalSingleDuctParallelPIUReheat collapse

Central Air Source Heat Pump collapse

CoilCoolingDXSingleSpeed collapse

CoilHeatingDXSingleSpeed collapse

CoilCoolingWaterToAirHeatPumpEquationFit collapse

CoilHeatingWaterToAirHeatPumpEquationFit collapse

HeatExchangerAirToAirSensibleAndLatent collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PrototypeFan

apply_base_fan_variables, #create_fan_by_name, #get_fan_from_standards, #lookup_fan_curve_coefficients_from_json, #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_heat_pump?, #coil_dx_heating_type, #coil_dx_packaged_terminal_application, #coil_dx_plf_fplr, #coil_dx_subcategory

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_brake_horsepower, #pump_motor_horsepower, #pump_pumppower, #pump_rated_w_per_gpm, #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

#afue_to_thermal_eff(afue) ⇒ Double

A helper method to convert from AFUE to thermal efficiency

Parameters:

  • afue (Double)

    Annual Fuel Utilization Efficiency

Returns:

  • (Double)

    Thermal efficiency (%)



423
424
425
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 423

def afue_to_thermal_eff(afue)
  return afue
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



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
# File 'lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb', line 48

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 = air_conditioner_variable_refrigerant_flow_find_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 = 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 = 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 = 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 = 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 = 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 = 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 = 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_capacity(air_conditioner_variable_refrigerant_flow) ⇒ Double

Find capacity in W

Parameters:

  • air_conditioner_variable_refrigerant_flow (OpenStudio::Model::AirConditionerVariableRefrigerantFlow)

    vrf unit

Returns:

  • (Double)

    capacity in W



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/openstudio-standards/standards/Standards.AirConditionerVariableRefrigerantFlow.rb', line 30

def air_conditioner_variable_refrigerant_flow_find_capacity(air_conditioner_variable_refrigerant_flow)
  capacity_w = nil
  if air_conditioner_variable_refrigerant_flow.grossRatedTotalCoolingCapacity.is_initialized
    capacity_w = air_conditioner_variable_refrigerant_flow.grossRatedTotalCoolingCapacity.get
  elsif air_conditioner_variable_refrigerant_flow.autosizedGrossRatedTotalCoolingCapacity.is_initialized
    capacity_w = air_conditioner_variable_refrigerant_flow.autosizedGrossRatedTotalCoolingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{air_conditioner_variable_refrigerant_flow.name} capacity is not available, cannot apply efficiency standard.")
    return false
  end

  return capacity_w
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.")
        fan_variable_volume_set_control_type(fan, 'Multi Zone VAV with VSD and Fixed SP 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 = ems_friendly_name(air_loop_hvac.name)

  # Get the zone name
  zone = air_loop_hvac.thermalZones[0]
  zn_name_clean = 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
          fan_variable_volume_set_control_type(fan, vsd_curve_type)
        # No Part Load Fan Pressure Control
        else
          fan_variable_volume_set_control_type(fan, '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
    ##       fan_variable_volume_set_control_type(fan, 'Multi Zone VAV with VSD and Static Pressure Reset')
    ##     # Part Load Fan Pressure Control only
    ##     elsif plr_req && !spr_req
    ##       fan_variable_volume_set_control_type(fan, 'Multi Zone VAV with VSD and Fixed SP Setpoint')
    ##     # Static Pressure Reset only
    ##     elsif !plr_req && spr_req
    ##       fan_variable_volume_set_control_type(fan, 'Multi Zone VAV with VSD and Fixed SP Setpoint')
    ##     # No Control Required
    ##     else
    ##       fan_variable_volume_set_control_type(fan, 'Multi Zone VAV with AF or BI Riding 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
        fan_variable_volume_set_control_type(fan, 'Single Zone VAV Fan')
      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 = 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 ®

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:

  • zone (OpenStudio::Model::ThermalZone)

    thermal zone

  • mdp (Double)

    minimum damper position

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 VSD and SP 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 = coil_cooling_dx_multi_speed_find_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_reheat_type(air_terminal_single_duct_vav_reheat) ⇒ String

Determines whether the terminal has a NaturalGas, Electricity, or HotWater reheat coil.

Parameters:

  • air_terminal_single_duct_vav_reheat (OpenStudio::Model::AirTerminalSingleDuctVAVReheat)

    the air terminal object

Returns:

  • (String)

    reheat type. One of NaturalGas, Electricity, or HotWater.



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.AirTerminalSingleDuctVAVReheat.rb', line 69

def air_terminal_single_duct_vav_reheat_reheat_type(air_terminal_single_duct_vav_reheat)
  type = nil

  if air_terminal_single_duct_vav_reheat.to_AirTerminalSingleDuctVAVNoReheat.is_initialized
    return nil
  end

  # Get the reheat coil
  rht_coil = air_terminal_single_duct_vav_reheat.reheatCoil
  if rht_coil.to_CoilHeatingElectric.is_initialized
    type = 'Electricity'
  elsif rht_coil.to_CoilHeatingWater.is_initialized
    type = 'HotWater'
  elsif rht_coil.to_CoilHeatingGas.is_initialized
    type = 'NaturalGas'
  end

  return type
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



657
658
659
660
661
662
663
664
# File 'lib/openstudio-standards/standards/Standards.SpaceType.rb', line 657

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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • ratio (Double)

    ratio

  • surface_type (String) (defaults to: 'Wall')

    surface type

Returns:

  • (Boolean)

    returns true if successful, false if not



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
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5581

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



135
136
137
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 135

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



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
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 143

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 = boiler_hot_water_find_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 = 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 = 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_capacity(boiler_hot_water) ⇒ Double

Find capacity in W

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

Returns:

  • (Double)

    capacity in W



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 41

def boiler_hot_water_find_capacity(boiler_hot_water)
  capacity_w = nil
  if boiler_hot_water.nominalCapacity.is_initialized
    capacity_w = boiler_hot_water.nominalCapacity.get
  elsif boiler_hot_water.autosizedNominalCapacity.is_initialized
    capacity_w = boiler_hot_water.autosizedNominalCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name} capacity is not available, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  return capacity_w
end

#boiler_hot_water_find_design_water_flow_rate(boiler_hot_water) ⇒ Double

Find design water flow rate in m^3/s

Parameters:

  • boiler_hot_water (OpenStudio::Model::BoilerHotWater)

    hot water boiler object

Returns:

  • (Double)

    design water flow rate in m^3/s



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 60

def boiler_hot_water_find_design_water_flow_rate(boiler_hot_water)
  design_water_flow_rate_m3_per_s = nil
  if boiler_hot_water.designWaterFlowRate.is_initialized
    design_water_flow_rate_m3_per_s = boiler_hot_water.designWaterFlowRate.get
  elsif boiler_hot_water.autosizedDesignWaterFlowRate.is_initialized
    design_water_flow_rate_m3_per_s = boiler_hot_water.autosizedDesignWaterFlowRate.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{boiler_hot_water.name} design water flow rate is not available.")
    return false
  end

  return design_water_flow_rate_m3_per_s
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



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
# File 'lib/openstudio-standards/standards/Standards.BoilerHotWater.rb', line 79

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 = boiler_hot_water_find_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 = 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 = 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



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
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 209

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 = chiller_electric_eir_find_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 = eer_to_cop(chlr_props['minimum_energy_efficiency_ratio'])
    elsif !chlr_props['minimum_kilowatts_per_tons'].nil?
      cop = 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 = 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_capacity(chiller_electric_eir) ⇒ Double

Finds capacity in W

Parameters:

  • chiller_electric_eir (OpenStudio::Model::ChillerElectricEIR)

    chiller object

Returns:

  • (Double)

    capacity in W to be used for find object



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 72

def chiller_electric_eir_find_capacity(chiller_electric_eir)
  if chiller_electric_eir.referenceCapacity.is_initialized
    capacity_w = chiller_electric_eir.referenceCapacity.get
  elsif chiller_electric_eir.autosizedReferenceCapacity.is_initialized
    capacity_w = chiller_electric_eir.autosizedReferenceCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name} capacity is not available, cannot apply efficiency standard.")
    return false
  end

  return capacity_w
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



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 131

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



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 187

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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 159

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)



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
# File 'lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb', line 89

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 = chiller_electric_eir_find_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 = eer_to_cop(chlr_props['minimum_energy_efficiency_ratio'])
    elsif !chlr_props['minimum_kilowatts_per_tons'].nil?
      cop = 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 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'))) && !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 = 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_find_capacity(coil_cooling_dx_multi_speed) ⇒ Double

Finds capacity in W

Parameters:

  • coil_cooling_dx_multi_speed (OpenStudio::Model::CoilCoolingDXMultiSpeed)

    coil cooling dx multi speed object

Returns:

  • (Double)

    capacity in W to be used for find object



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb', line 227

def coil_cooling_dx_multi_speed_find_capacity(coil_cooling_dx_multi_speed)
  capacity_w = nil
  clg_stages = coil_cooling_dx_multi_speed.stages
  if clg_stages.last.grossRatedTotalCoolingCapacity.is_initialized
    capacity_w = clg_stages.last.grossRatedTotalCoolingCapacity.get
  elsif (clg_stages.size == 1) && coil_cooling_dx_multi_speed.stages[0].autosizedSpeedRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_multi_speed.stages[0].autosizedSpeedRatedTotalCoolingCapacity.get
  elsif (clg_stages.size == 2) && coil_cooling_dx_multi_speed.stages[1].autosizedGrossRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_multi_speed.stages[1].autosizedGrossRatedTotalCoolingCapacity.get
  elsif (clg_stages.size == 3) && coil_cooling_dx_multi_speed.stages[2].autosizedGrossRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_multi_speed.stages[2].autosizedSpeedRatedTotalCoolingCapacity.get
  elsif (clg_stages.size == 4) && coil_cooling_dx_multi_speed.stages[3].autosizedGrossRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_multi_speed.stages[3].autosizedGrossRatedTotalCoolingCapacity.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

  return capacity_w
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



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb', line 253

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 = coil_cooling_dx_multi_speed_find_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 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'))) && !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 = 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} #{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 = 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} #{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 = 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} #{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 = 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} #{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 = 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 = 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} #{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 = 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} #{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



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb', line 223

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 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 !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
  capacity_w = coil_cooling_dx_single_speed_find_capacity(coil_cooling_dx_single_speed, necb_ref_hp, equipment_type)
  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_find_capacity(coil_cooling_dx_single_speed, necb_ref_hp = false, equipment_type = nil) ⇒ Double

Finds capacity in W

Parameters:

  • coil_cooling_dx_single_speed (OpenStudio::Model::CoilCoolingDXSingleSpeed)

    coil cooling dx single speed object

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

  • equipment_type (String) (defaults to: nil)

    type of equipment that this coil object belongs to.

Returns:

  • (Double)

    capacity in W to be used for find object



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb', line 12

def coil_cooling_dx_single_speed_find_capacity(coil_cooling_dx_single_speed, necb_ref_hp = false, equipment_type = nil)
  capacity_w = nil
  if coil_cooling_dx_single_speed.ratedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_single_speed.ratedTotalCoolingCapacity.get
  elsif coil_cooling_dx_single_speed.autosizedRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_single_speed.autosizedRatedTotalCoolingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name} capacity is not available, cannot apply efficiency standard.")
    return 0.0
  end

  # If it's a PTAC or PTHP System, we need to divide the capacity by the potential zone multiplier
  # because the COP is dependent on capacity, and the capacity should be the capacity of a single zone, not all the zones
  if ['PTAC', 'PTHP'].include?(coil_dx_subcategory(coil_cooling_dx_single_speed)) || ['PTAC', 'PTHP'].include?(equipment_type)
    mult = 1
    comp = coil_cooling_dx_single_speed.containingZoneHVACComponent
    if comp.is_initialized && comp.get.thermalZone.is_initialized
      mult = comp.get.thermalZone.get.multiplier
      if mult > 1
        total_cap = capacity_w
        capacity_w /= mult
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, total capacity of #{OpenStudio.convert(total_cap, 'W', 'kBtu/hr').get.round(2)}kBTU/hr was divided by the zone multiplier of #{mult} to give #{capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get.round(2)}kBTU/hr.")
      end
    end
  end

  return capacity_w
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)



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb', line 48

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 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 !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

  capacity_w = coil_cooling_dx_single_speed_find_capacity(coil_cooling_dx_single_speed, necb_ref_hp, equipment_type)
  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
  pthp_eer_coeff_1 = ac_props['pthp_eer_coefficient_1']
  pthp_eer_coeff_2 = ac_props['pthp_eer_coefficient_2']
  if equipment_type == '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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb', line 144

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
  capacity_w = coil_cooling_dx_two_speed_find_capacity(coil_cooling_dx_two_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 efficiencies data depending on whether it is a unitary AC or a heat pump
  coil_efficiency_data = if 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'))) && !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_find_capacity(coil_cooling_dx_two_speed) ⇒ Double

Finds capacity in W

Parameters:

  • coil_cooling_dx_two_speed (OpenStudio::Model::CoilCoolingDXTwoSpeed)

    coil cooling dx two speed object

Returns:

  • (Double)

    capacity in W to be used for find object



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

def coil_cooling_dx_two_speed_find_capacity(coil_cooling_dx_two_speed)
  capacity_w = nil
  if coil_cooling_dx_two_speed.ratedHighSpeedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_two_speed.ratedHighSpeedTotalCoolingCapacity.get
  elsif coil_cooling_dx_two_speed.autosizedRatedHighSpeedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_dx_two_speed.autosizedRatedHighSpeedTotalCoolingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXTwoSpeed', "For #{coil_cooling_dx_two_speed.name} capacity is not available, cannot apply efficiency standard.")
    return 0.0
  end

  return capacity_w
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)



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb', line 29

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']
  capacity_w = coil_cooling_dx_two_speed_find_capacity(coil_cooling_dx_two_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

  # Define database
  if 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'))) && !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

  # 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb', line 115

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 = coil_cooling_water_to_air_heat_pump_find_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_find_capacity(coil_cooling_water_to_air_heat_pump) ⇒ Double

Finds capacity in W

Parameters:

  • coil_cooling_water_to_air_heat_pump (OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit)

    coil cooling object

Returns:

  • (Double)

    capacity in W to be used for find object



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

def coil_cooling_water_to_air_heat_pump_find_capacity(coil_cooling_water_to_air_heat_pump)
  capacity_w = nil
  if coil_cooling_water_to_air_heat_pump.ratedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_water_to_air_heat_pump.ratedTotalCoolingCapacity.get
  elsif coil_cooling_water_to_air_heat_pump.autosizedRatedTotalCoolingCapacity.is_initialized
    capacity_w = coil_cooling_water_to_air_heat_pump.autosizedRatedTotalCoolingCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingWaterToAirHeatPumpEquationFit', "For #{coil_cooling_water_to_air_heat_pump.name} capacity is not available, cannot apply efficiency standard.")
    return 0.0
  end

  return capacity_w
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)



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
# File 'lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb', line 27

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 = coil_cooling_water_to_air_heat_pump_find_capacity(coil_cooling_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
  return nil unless capacity_kbtu_per_hr > 0.0

  # 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 = 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 = 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 = 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_defrost_eir_curve_limits(htg_coil) ⇒ Boolean

sets defrost curve limits

Parameters:

  • htg_coil (OpenStudio::Model::CoilHeatingDXSingleSpeed)

    a DX heating coil

Returns:

  • (Boolean)

    returns true if successful, false if not



203
204
205
206
207
208
209
210
211
212
213
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingDXSingleSpeed.rb', line 203

def coil_heating_dx_single_speed_apply_defrost_eir_curve_limits(htg_coil)
  return false unless htg_coil.defrostEnergyInputRatioFunctionofTemperatureCurve.is_initialized

  def_eir_f_of_temp = htg_coil.defrostEnergyInputRatioFunctionofTemperatureCurve.get.to_CurveBiquadratic.get
  def_eir_f_of_temp.setMinimumValueofx(12.77778)
  def_eir_f_of_temp.setMaximumValueofx(23.88889)
  def_eir_f_of_temp.setMinimumValueofy(21.11111)
  def_eir_f_of_temp.setMaximumValueofy(46.11111)

  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



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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb', line 237

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 = coil_heating_dx_single_speed_find_capacity(coil_heating_dx_single_speed, necb_ref_hp)
  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 !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_find_capacity(coil_heating_dx_single_speed, necb_ref_hp = false) ⇒ Double

Finds capacity in W. This is the cooling capacity of the paired DX cooling coil.

Parameters:

  • coil_heating_dx_single_speed (OpenStudio::Model::CoilHeatingDXSingleSpeed)

    coil heating dx single speed object

  • necb_ref_hp (Boolean) (defaults to: false)

    for compatability with NECB ruleset only.

Returns:

  • (Double)

    capacity in W to be used for find object



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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb', line 11

def coil_heating_dx_single_speed_find_capacity(coil_heating_dx_single_speed, necb_ref_hp = false)
  capacity_w = nil

  # Get the paired cooling coil
  clg_coil = nil

  # Unitary and zone equipment
  if coil_heating_dx_single_speed.airLoopHVAC.empty?
    if coil_heating_dx_single_speed.containingHVACComponent.is_initialized
      containing_comp = coil_heating_dx_single_speed.containingHVACComponent.get
      if containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAir.is_initialized
        clg_coil = containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAir.get.coolingCoil
      elsif containing_comp.to_AirLoopHVACUnitarySystem.is_initialized
        unitary = containing_comp.to_AirLoopHVACUnitarySystem.get
        if unitary.coolingCoil.is_initialized
          clg_coil = unitary.coolingCoil.get
        end
      end
      # @todo Add other unitary systems
    elsif coil_heating_dx_single_speed.containingZoneHVACComponent.is_initialized
      containing_comp = coil_heating_dx_single_speed.containingZoneHVACComponent.get
      # PTHP
      if containing_comp.to_ZoneHVACPackagedTerminalHeatPump.is_initialized
        pthp = containing_comp.to_ZoneHVACPackagedTerminalHeatPump.get
        clg_coil = containing_comp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil
      end
    end
  end

  # On AirLoop directly
  if coil_heating_dx_single_speed.airLoopHVAC.is_initialized
    air_loop = coil_heating_dx_single_speed.airLoopHVAC.get
    # Check for the presence of any other type of cooling coil
    clg_types = ['OS:Coil:Cooling:DX:SingleSpeed',
                 'OS:Coil:Cooling:DX:TwoSpeed',
                 'OS:Coil:Cooling:DX:MultiSpeed']
    clg_types.each do |ct|
      coils = air_loop.supplyComponents(ct.to_IddObjectType)
      next if coils.empty?

      clg_coil = coils[0]
      break # Stop on first DX cooling coil found
    end
  end

  # If no paired cooling coil was found,
  # throw an error and fall back to the heating capacity
  # of the DX heating coil
  if clg_coil.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, the paired DX cooling coil could not be found to determine capacity. Efficiency will incorrectly be based on DX coil's heating capacity.")
    if coil_heating_dx_single_speed.ratedTotalHeatingCapacity.is_initialized
      capacity_w = coil_heating_dx_single_speed.ratedTotalHeatingCapacity.get
    elsif coil_heating_dx_single_speed.autosizedRatedTotalHeatingCapacity.is_initialized
      capacity_w = coil_heating_dx_single_speed.autosizedRatedTotalHeatingCapacity.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name} capacity is not available, cannot apply efficiency standard to paired DX heating coil.")
      return 0.0
    end
    return capacity_w
  end

  # If a coil was found, cast to the correct type
  if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXSingleSpeed.get
    capacity_w = coil_cooling_dx_single_speed_find_capacity(clg_coil)
  elsif clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXTwoSpeed.get
    capacity_w = coil_cooling_dx_two_speed_find_capacity(clg_coil)
  elsif clg_coil.to_CoilCoolingDXMultiSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXMultiSpeed.get
    capacity_w = coil_cooling_dx_multi_speed_find_capacity(clg_coil)
  end

  # If it's a PTAC or PTHP System, we need to divide the capacity by the potential zone multiplier
  # because the COP is dependent on capacity, and the capacity should be the capacity of a single zone, not all the zones
  if ['PTAC', 'PTHP'].include?(coil_dx_subcategory(coil_heating_dx_single_speed))
    mult = 1
    comp = coil_heating_dx_single_speed.containingZoneHVACComponent
    if comp.is_initialized && comp.get.thermalZone.is_initialized
      mult = comp.get.thermalZone.get.multiplier
      if mult > 1
        total_cap = capacity_w
        capacity_w /= mult
        OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, total capacity of #{OpenStudio.convert(total_cap, 'W', 'kBtu/hr').get.round(2)}kBTU/hr was divided by the zone multiplier of #{mult} to give #{capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get.round(2)}kBTU/hr.")
      end
    end
  end

  return capacity_w
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.

Returns:

  • (Double)

    full load efficiency (COP)



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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb', line 108

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 = coil_heating_dx_single_speed_find_capacity(coil_heating_dx_single_speed, necb_ref_hp)
  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 !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
  if equipment_type == '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 = 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 = 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 = 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 = 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 = 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

  # 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 = coil_heating_gas_find_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 = 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 = 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_apply_prototype_efficiency(coil_heating_gas) ⇒ Boolean

Updates the efficiency of some gas heating coils per the prototype assumptions. Defaults to making no changes.

Parameters:

  • coil_heating_gas (OpenStudio::Model::CoilHeatingGas)

    a gas heating coil

Returns:

  • (Boolean)

    returns true if successful, false if not



68
69
70
71
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingGas.rb', line 68

def coil_heating_gas_apply_prototype_efficiency(coil_heating_gas)
  # do nothing
  return true
end

#coil_heating_gas_find_capacity(coil_heating_gas) ⇒ Double, false

Retrieves the capacity of an OpenStudio::Model::CoilHeatingGas in watts

Parameters:

  • coil_heating_gas (OpenStudio::Model::CoilHeatingGas)

    the gas heating coil

Returns:

  • (Double, false)

    a double representing the capacity of the CoilHeatingGas object in watts. If unsuccessful in determining the capacity, this function returns false.



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

def coil_heating_gas_find_capacity(coil_heating_gas)
  capacity_w = nil
  if coil_heating_gas.nominalCapacity.is_initialized
    capacity_w = coil_heating_gas.nominalCapacity.get
  elsif coil_heating_gas.autosizedNominalCapacity.is_initialized
    capacity_w = coil_heating_gas.autosizedNominalCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGas', "For #{coil_heating_gas.name} capacity is not available, cannot apply efficiency standard.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  return capacity_w
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_capacity(coil_heating_gas_multi_stage) ⇒ Double

Finds capacity in W

Parameters:

  • coil_heating_gas_multi_stage (OpenStudio::Model::CoilHeatingGasMultiStage)

    coil heating gas multi stage object

Returns:

  • (Double)

    capacity in W to be used for find object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb', line 53

def coil_heating_gas_multi_stage_find_capacity(coil_heating_gas_multi_stage)
  capacity_w = nil
  htg_stages = coil_heating_gas_multi_stage.stages
  if htg_stages.last.nominalCapacity.is_initialized
    capacity_w = htg_stages.last.nominalCapacity.get
  elsif (htg_stages.size == 1) && coil_heating_gas_multi_stage.stages[0].autosizedNominalCapacity.is_initialized
    capacity_w = coil_heating_gas_multi_stage.stages[0].autosizedNominalCapacity.get
  elsif (htg_stages.size == 2) && coil_heating_gas_multi_stage.stages[1].autosizedNominalCapacity.is_initialized
    capacity_w = coil_heating_gas_multi_stage.stages[1].autosizedNominalCapacity.get
  elsif (htg_stages.size == 3) && coil_heating_gas_multi_stage.stages[2].autosizedNominalCapacity.is_initialized
    capacity_w = coil_heating_gas_multi_stage.stages[2].autosizedNominalCapacity.get
  elsif (htg_stages.size == 4) && coil_heating_gas_multi_stage.stages[3].autosizedNominalCapacity.is_initialized
    capacity_w = coil_heating_gas_multi_stage.stages[3].autosizedNominalCapacity.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "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
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



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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 133

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 = coil_heating_water_to_air_heat_pump_find_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_find_capacity(coil_heating_water_to_air_heat_pump) ⇒ Double

Finds capacity in W. This is the cooling capacity of the paired cooling coil.

Parameters:

  • coil_heating_water_to_air_heat_pump (OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit)

    coil heating object

Returns:

  • (Double)

    capacity in W to be used for find 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
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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 9

def coil_heating_water_to_air_heat_pump_find_capacity(coil_heating_water_to_air_heat_pump)
  capacity_w = nil

  # Get the paired cooling coil
  clg_coil = nil

  # Unitary and zone equipment
  if coil_heating_water_to_air_heat_pump.airLoopHVAC.empty?
    if coil_heating_water_to_air_heat_pump.containingHVACComponent.is_initialized
      containing_comp = coil_heating_water_to_air_heat_pump.containingHVACComponent.get
      if containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAir.is_initialized
        clg_coil = containing_comp.to_AirLoopHVACUnitaryHeatPumpAirToAir.get.coolingCoil
      elsif containing_comp.to_AirLoopHVACUnitarySystem.is_initialized
        unitary = containing_comp.to_AirLoopHVACUnitarySystem.get
        if unitary.coolingCoil.is_initialized
          clg_coil = unitary.coolingCoil.get
        end
      end
    elsif coil_heating_water_to_air_heat_pump.containingZoneHVACComponent.is_initialized
      containing_comp = coil_heating_water_to_air_heat_pump.containingZoneHVACComponent.get
      # PTHP
      if containing_comp.to_ZoneHVACPackagedTerminalHeatPump.is_initialized
        clg_coil = containing_comp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil
      # WSHP
      elsif containing_comp.to_ZoneHVACWaterToAirHeatPump.is_initialized
        clg_coil = containing_comp.to_ZoneHVACWaterToAirHeatPump.get.coolingCoil
      end
    end
  end

  # On AirLoop directly
  if coil_heating_water_to_air_heat_pump.airLoopHVAC.is_initialized
    air_loop = coil_heating_water_to_air_heat_pump.airLoopHVAC.get
    # Check for the presence of any other type of cooling coil
    clg_types = ['OS:Coil:Cooling:DX:SingleSpeed',
                 'OS:Coil:Cooling:DX:TwoSpeed',
                 'OS:Coil:Cooling:DX:MultiSpeed']
    clg_types.each do |ct|
      coils = air_loop.supplyComponents(ct.to_IddObjectType)
      next if coils.empty?

      clg_coil = coils[0]
      break # Stop on first cooling coil found
    end
  end

  # If no paired cooling coil was found,
  # throw an error and fall back to the heating capacity of the heating coil
  if clg_coil.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{coil_heating_water_to_air_heat_pump.name}, the paired cooling coil could not be found to determine capacity. Efficiency will incorrectly be based on coil's heating capacity.")
    if coil_heating_water_to_air_heat_pump.ratedTotalHeatingCapacity.is_initialized
      capacity_w = coil_heating_water_to_air_heat_pump.ratedTotalHeatingCapacity.get
    elsif coil_heating_water_to_air_heat_pump.autosizedRatedTotalHeatingCapacity.is_initialized
      capacity_w = coil_heating_water_to_air_heat_pump.autosizedRatedTotalHeatingCapacity.get
    else
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingWaterToAirHeatPumpEquationFit', "For #{coil_heating_water_to_air_heat_pump.name} capacity is not available, cannot apply efficiency standard to paired heating coil.")
      return 0.0
    end
    return capacity_w
  end

  # If a coil was found, cast to the correct type
  if clg_coil.to_CoilCoolingDXSingleSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXSingleSpeed.get
    capacity_w = coil_cooling_dx_single_speed_find_capacity(clg_coil)
  elsif clg_coil.to_CoilCoolingDXTwoSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXTwoSpeed.get
    capacity_w = coil_cooling_dx_two_speed_find_capacity(clg_coil)
  elsif clg_coil.to_CoilCoolingDXMultiSpeed.is_initialized
    clg_coil = clg_coil.to_CoilCoolingDXMultiSpeed.get
    capacity_w = coil_cooling_dx_multi_speed_find_capacity(clg_coil)
  elsif clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized
    clg_coil = clg_coil.to_CoilCoolingWaterToAirHeatPumpEquationFit.get
    capacity_w = coil_cooling_water_to_air_heat_pump_find_capacity(clg_coil)
  end

  return capacity_w
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)



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
# File 'lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 93

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 = coil_heating_water_to_air_heat_pump_find_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

#combustion_eff_to_thermal_eff(combustion_eff) ⇒ Double

A helper method to convert from combustion efficiency to thermal efficiency

Parameters:

  • combustion_eff (Double)

    Combustion efficiency (%)

Returns:

  • (Double)

    Thermal efficiency (%)



441
442
443
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 441

def combustion_eff_to_thermal_eff(combustion_eff)
  return combustion_eff - 0.007
end

#controller_water_coil_set_convergence_limits(controller_water_coil) ⇒ Boolean

TODO:

Figure out what the reason for this is, because it seems like a workaround for an E+ bug that was probably addressed long ago.

Sets the convergence tolerance to 0.0001 deltaC for all hot water coils.

Parameters:

  • controller_water_coil (OpenStudio::Model::ControllerWaterCoil)

    controller water coil object

Returns:

  • (Boolean)

    returns true if successful, false if not



9
10
11
12
13
14
15
16
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.ControllerWaterCoil.rb', line 9

def controller_water_coil_set_convergence_limits(controller_water_coil)
  controller_action = controller_water_coil.action
  if controller_action.is_initialized && controller_action.get == 'Normal'
    controller_water_coil.setControllerConvergenceTolerance(0.0001)
  end

  return true
end

#convert_curve_biquadratic(coeffs, ip_to_si = true) ⇒ Array<Double>

Convert biquadratic curves that are a function of temperature from IP (F) to SI © or vice-versa. The curve is of the form z = C1 + C2*x + C3*x^2 + C4*y + C5*y^2 + C6*x*y where C1, C2, … are the coefficients, x is the first independent variable (in F or C) y is the second independent variable (in F or C) and z is the resulting value

Parameters:

  • coeffs (Array<Double>)

    an array of 6 coefficients, in order

Returns:

  • (Array<Double>)

    the revised coefficients in the new unit system

Author:

  • Scott Horowitz, NREL



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 465

def convert_curve_biquadratic(coeffs, ip_to_si = true)
  if ip_to_si
    # Convert IP curves to SI curves
    si_coeffs = []
    si_coeffs << (coeffs[0] + (32.0 * (coeffs[1] + coeffs[3])) + (1024.0 * (coeffs[2] + coeffs[4] + coeffs[5])))
    si_coeffs << ((9.0 / 5.0 * coeffs[1]) + (576.0 / 5.0 * coeffs[2]) + (288.0 / 5.0 * coeffs[5]))
    si_coeffs << (81.0 / 25.0 * coeffs[2])
    si_coeffs << ((9.0 / 5.0 * coeffs[3]) + (576.0 / 5.0 * coeffs[4]) + (288.0 / 5.0 * coeffs[5]))
    si_coeffs << (81.0 / 25.0 * coeffs[4])
    si_coeffs << (81.0 / 25.0 * coeffs[5])
    return si_coeffs
  else
    # Convert SI curves to IP curves
    ip_coeffs = []
    ip_coeffs << (coeffs[0] - (160.0 / 9.0 * (coeffs[1] + coeffs[3])) + (25_600.0 / 81.0 * (coeffs[2] + coeffs[4] + coeffs[5])))
    ip_coeffs << (5.0 / 9.0 * (coeffs[1] - (320.0 / 9.0 * coeffs[2]) - (160.0 / 9.0 * coeffs[5])))
    ip_coeffs << (25.0 / 81.0 * coeffs[2])
    ip_coeffs << (5.0 / 9.0 * (coeffs[3] - (320.0 / 9.0 * coeffs[4]) - (160.0 / 9.0 * coeffs[5])))
    ip_coeffs << (25.0 / 81.0 * coeffs[4])
    ip_coeffs << (25.0 / 81.0 * coeffs[5])
    return ip_coeffs
  end
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

#cop_heating_to_cop_heating_no_fan(coph47, capacity_w) ⇒ Double

Convert from COP_H to COP (no fan) for heat pump heating coils

Parameters:

  • coph47 (Double)

    coefficient of performance at 47F Tdb, 42F Twb

  • capacity_w (Double)

    the heating capacity at AHRI rating conditions, in W

Returns:

  • (Double)

    Coefficient of Performance (COP)



293
294
295
296
297
298
299
300
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 293

def cop_heating_to_cop_heating_no_fan(coph47, capacity_w)
  # Convert the capacity to Btu/hr
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  cop = (1.48E-7 * coph47 * capacity_btu_per_hr) + (1.062 * coph47)

  return cop
end

#cop_no_fan_to_eer(cop, capacity_w = nil) ⇒ Double

Convert from COP (no fan) to EER

Parameters:

  • cop (Double)

    COP

Returns:

  • (Double)

    Energy Efficiency Ratio (EER)



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 353

def cop_no_fan_to_eer(cop, capacity_w = nil)
  if capacity_w.nil?
    # From Thornton et al. 2011
    # r is the ratio of supply fan power to total equipment power at the rating condition,
    # assumed to be 0.12 for the reference buildngs per Thornton et al. 2011.
    r = 0.12
    eer = OpenStudio.convert(1.0, 'W', 'Btu/h').get * ((cop * (1 - r)) - r)
  else
    # The 90.1-2013 method
    # Convert the capacity to Btu/hr
    capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
    eer = cop / ((7.84E-8 * capacity_btu_per_hr) + 0.338)
  end

  return eer
end

#cop_no_fan_to_seer(cop) ⇒ Double

Convert from COP to SEER

Parameters:

  • cop (Double)

    COP

Returns:

  • (Double)

    Seasonal Energy Efficiency Ratio



255
256
257
258
259
260
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 255

def cop_no_fan_to_seer(cop)
  delta = (0.3796**2) - (4.0 * 0.0076 * cop)
  seer = ((-delta**0.5) + 0.3796) / (2.0 * 0.0076)

  return seer
end

#cop_to_eer(cop) ⇒ Double

Convert from COP to EER

Parameters:

  • cop (Double)

    Coefficient of Performance (COP)

Returns:

  • (Double)

    Energy Efficiency Ratio (EER)



398
399
400
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 398

def cop_to_eer(cop)
  return cop * OpenStudio.convert(1.0, 'W', 'Btu/h').get
end

#cop_to_kw_per_ton(cop) ⇒ Double

Convert from COP to kW/ton

Parameters:

  • cop (Double)

    Coefficient of Performance (COP)

Returns:

  • (Double)

    kW of input power per ton of cooling



406
407
408
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 406

def cop_to_kw_per_ton(cop)
  return 3.517 / cop
end

#cop_to_seer(cop) ⇒ Double

Convert from COP to SEER (with fan) for cooling coils per the method specified in Thornton et al. 2011

Parameters:

  • cop (Double)

    Coefficient of Performance (COP)

Returns:

  • (Double)

    seasonal energy efficiency ratio (SEER)



279
280
281
282
283
284
285
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 279

def cop_to_seer(cop)
  eer = cop_to_eer(cop)
  delta = (1.1088**2) - (4.0 * 0.0182 * eer)
  seer = (1.1088 - (delta**0.5)) / (2.0 * 0.0182)

  return seer
end

#create_air_conditioner_variable_refrigerant_flow(model, name: 'VRF System', schedule: nil, type: nil, cooling_cop: 4.287, heating_cop: 4.147, heat_recovery: true, defrost_strategy: 'Resistive', condenser_type: 'AirCooled', condenser_loop: nil, master_zone: nil, priority_control_type: 'LoadPriority') ⇒ OpenStudio::Model::AirConditionerVariableRefrigerantFlow

Prototype AirConditionerVariableRefrigerantFlow object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • name (String) (defaults to: 'VRF System')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • type (String) (defaults to: nil)

    the type of unit to reference for the correct curve set

  • cooling_cop (Double) (defaults to: 4.287)

    rated cooling coefficient of performance

  • heating_cop (Double) (defaults to: 4.147)

    rated heating coefficient of performance

  • heat_recovery (Boolean) (defaults to: true)

    does the unit have heat recovery

  • defrost_strategy (String) (defaults to: 'Resistive')

    type of defrost strategy. options are ReverseCycle or Resistive

  • condenser_type (String) (defaults to: 'AirCooled')

    type of condenser options are AirCooled (default), WaterCooled, and EvaporativelyCooled. if WaterCooled, the user most include a condenser_loop

  • master_zone (<OpenStudio::Model::ThermalZone>) (defaults to: nil)

    master control zone to switch between heating and cooling

  • priority_control_type (String) (defaults to: 'LoadPriority')

    type of master thermostat priority control type options are LoadPriority, ZonePriority, ThermostatOffsetPriority, MasterThermostatPriority

Returns:

  • (OpenStudio::Model::AirConditionerVariableRefrigerantFlow)

    the vrf unit



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.AirConditionerVariableRefrigerantFlow.rb', line 22

def create_air_conditioner_variable_refrigerant_flow(model,
                                                     name: 'VRF System',
                                                     schedule: nil,
                                                     type: nil,
                                                     cooling_cop: 4.287,
                                                     heating_cop: 4.147,
                                                     heat_recovery: true,
                                                     defrost_strategy: 'Resistive',
                                                     condenser_type: 'AirCooled',
                                                     condenser_loop: nil,
                                                     master_zone: nil,
                                                     priority_control_type: 'LoadPriority')

  vrf_outdoor_unit = OpenStudio::Model::AirConditionerVariableRefrigerantFlow.new(model)

  # set name
  if name.nil?
    vrf_outdoor_unit.setName('VRF System')
  else
    vrf_outdoor_unit.setName(name)
  end

  # set availability schedule
  if schedule.nil?
    # default always on
    availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    availability_schedule = model_add_schedule(model, schedule)

    if availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      availability_schedule = model.alwaysOffDiscreteSchedule
    elsif availability_schedule.nil?
      availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    availability_schedule = schedule
  else
    availability_schedule = model.alwaysOnDiscreteSchedule
  end
  vrf_outdoor_unit.setAvailabilitySchedule(availability_schedule)

  # set cops
  if model.version < OpenStudio::VersionString.new('2.9.0')
    vrf_outdoor_unit.setRatedCoolingCOP(cooling_cop)
  else
    vrf_outdoor_unit.setGrossRatedCoolingCOP(cooling_cop)
  end
  vrf_outdoor_unit.setRatedHeatingCOP(heating_cop)

  # heat recovery
  if heat_recovery
    vrf_outdoor_unit.setHeatPumpWasteHeatRecovery(true)
  else
    vrf_outdoor_unit.setHeatPumpWasteHeatRecovery(false)
  end

  # defrost strategy
  vrf_outdoor_unit.setDefrostStrategy(defrost_strategy)

  # defaults
  vrf_outdoor_unit.setMinimumOutdoorTemperatureinCoolingMode(-15.0)
  vrf_outdoor_unit.setMaximumOutdoorTemperatureinCoolingMode(50.0)
  vrf_outdoor_unit.setMinimumOutdoorTemperatureinHeatingMode(-25.0)
  vrf_outdoor_unit.setMaximumOutdoorTemperatureinHeatingMode(16.1)
  vrf_outdoor_unit.setMinimumOutdoorTemperatureinHeatRecoveryMode(-10.0)
  vrf_outdoor_unit.setMaximumOutdoorTemperatureinHeatRecoveryMode(27.2)
  vrf_outdoor_unit.setEquivalentPipingLengthusedforPipingCorrectionFactorinCoolingMode(30.48)
  vrf_outdoor_unit.setEquivalentPipingLengthusedforPipingCorrectionFactorinHeatingMode(30.48)
  vrf_outdoor_unit.setVerticalHeightusedforPipingCorrectionFactor(10.668)

  # condenser type
  if condenser_type == 'WaterCooled'
    vrf_outdoor_unit.setString(56, condenser_type)
    # require condenser_loop
    unless condenser_loop
      OpenStudio.logFree(OpenStudio::Error, 'openstudio.Model.Model', 'Must specify condenser_loop for vrf_outdoor_unit if WaterCooled')
    end
    condenser_loop.addDemandBranchForComponent(vrf_outdoor_unit)
  elsif condenser_type == 'EvaporativelyCooled'
    vrf_outdoor_unit.setString(56, condenser_type)
  end

  # set master zone
  unless master_zone.to_ThermalZone.empty?
    vrf_outdoor_unit.setZoneforMasterThermostatLocation(master_zone)
    vrf_outdoor_unit.setMasterThermostatPriorityControlType(priority_control_type)
  end

  vrf_cool_cap_f_of_low_temp = nil
  vrf_cool_cap_ratio_boundary = nil
  vrf_cool_cap_f_of_high_temp = nil
  vrf_cool_eir_f_of_low_temp = nil
  vrf_cool_eir_ratio_boundary = nil
  vrf_cool_eir_f_of_high_temp = nil
  vrf_cooling_eir_low_plr = nil
  vrf_cooling_eir_high_plr = nil
  vrf_cooling_comb_ratio = nil
  vrf_cooling_cplffplr = nil
  vrf_heat_cap_f_of_low_temp = nil
  vrf_heat_cap_ratio_boundary = nil
  vrf_heat_cap_f_of_high_temp = nil
  vrf_heat_eir_f_of_low_temp = nil
  vrf_heat_eir_boundary = nil
  vrf_heat_eir_f_of_high_temp = nil
  vrf_heating_eir_low_plr = nil
  vrf_heating_eir_hi_plr = nil
  vrf_heating_comb_ratio = nil
  vrf_heating_cplffplr = nil
  vrf_defrost_eir_f_of_temp = nil

  # curve sets
  if type == 'OS default'

    # use OS default curves

  else # default curve set

    # based on DAIKINREYQ 120 on BCL

    # Cooling Capacity Ratio Modifier Function of Low Temperature Curve
    vrf_cool_cap_f_of_low_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_cool_cap_f_of_low_temp.setName('vrf_cool_cap_f_of_low_temp')
    vrf_cool_cap_f_of_low_temp.setCoefficient1Constant(-1.69653019339465)
    vrf_cool_cap_f_of_low_temp.setCoefficient2x(0.207248180531939)
    vrf_cool_cap_f_of_low_temp.setCoefficient3xPOW2(-0.00343146229659024)
    vrf_cool_cap_f_of_low_temp.setCoefficient4y(0.016381597419714)
    vrf_cool_cap_f_of_low_temp.setCoefficient5yPOW2(-6.7387172629965e-05)
    vrf_cool_cap_f_of_low_temp.setCoefficient6xTIMESY(-0.000849848402870241)
    vrf_cool_cap_f_of_low_temp.setMinimumValueofx(13.9)
    vrf_cool_cap_f_of_low_temp.setMaximumValueofx(23.9)
    vrf_cool_cap_f_of_low_temp.setMinimumValueofy(-5.0)
    vrf_cool_cap_f_of_low_temp.setMaximumValueofy(43.3)
    vrf_cool_cap_f_of_low_temp.setMinimumCurveOutput(0.59)
    vrf_cool_cap_f_of_low_temp.setMaximumCurveOutput(1.33)

    # Cooling Capacity Ratio Boundary Curve
    vrf_cool_cap_ratio_boundary = OpenStudio::Model::CurveCubic.new(model)
    vrf_cool_cap_ratio_boundary.setName('vrf_cool_cap_ratio_boundary')
    vrf_cool_cap_ratio_boundary.setCoefficient1Constant(25.73)
    vrf_cool_cap_ratio_boundary.setCoefficient2x(-0.03150043)
    vrf_cool_cap_ratio_boundary.setCoefficient3xPOW2(-0.01416595)
    vrf_cool_cap_ratio_boundary.setCoefficient4xPOW3(0.0)
    vrf_cool_cap_ratio_boundary.setMinimumValueofx(11.0)
    vrf_cool_cap_ratio_boundary.setMaximumValueofx(30.0)

    # Cooling Capacity Ratio Modifier Function of High Temperature Curve
    vrf_cool_cap_f_of_high_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_cool_cap_f_of_high_temp.setName('vrf_cool_cap_f_of_high_temp')
    vrf_cool_cap_f_of_high_temp.setCoefficient1Constant(0.6867358)
    vrf_cool_cap_f_of_high_temp.setCoefficient2x(0.0207631)
    vrf_cool_cap_f_of_high_temp.setCoefficient3xPOW2(0.0005447)
    vrf_cool_cap_f_of_high_temp.setCoefficient4y(-0.0016218)
    vrf_cool_cap_f_of_high_temp.setCoefficient5yPOW2(-4.259e-07)
    vrf_cool_cap_f_of_high_temp.setCoefficient6xTIMESY(-0.0003392)
    vrf_cool_cap_f_of_high_temp.setMinimumValueofx(15.0)
    vrf_cool_cap_f_of_high_temp.setMaximumValueofx(24.0)
    vrf_cool_cap_f_of_high_temp.setMinimumValueofy(16.0)
    vrf_cool_cap_f_of_high_temp.setMaximumValueofy(43.0)

    # Cooling Energy Input Ratio Modifier Function of Low Temperature Curve
    vrf_cool_eir_f_of_low_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_cool_eir_f_of_low_temp.setName('vrf_cool_eir_f_of_low_temp')
    vrf_cool_eir_f_of_low_temp.setCoefficient1Constant(-1.61908214818635)
    vrf_cool_eir_f_of_low_temp.setCoefficient2x(0.185964818731756)
    vrf_cool_eir_f_of_low_temp.setCoefficient3xPOW2(-0.00389610393381592)
    vrf_cool_eir_f_of_low_temp.setCoefficient4y(-0.00901995326324613)
    vrf_cool_eir_f_of_low_temp.setCoefficient5yPOW2(0.00030340007815629)
    vrf_cool_eir_f_of_low_temp.setCoefficient6xTIMESY(0.000476048529099348)
    vrf_cool_eir_f_of_low_temp.setMinimumValueofx(13.9)
    vrf_cool_eir_f_of_low_temp.setMaximumValueofx(23.9)
    vrf_cool_eir_f_of_low_temp.setMinimumValueofy(-5.0)
    vrf_cool_eir_f_of_low_temp.setMaximumValueofy(43.3)
    vrf_cool_eir_f_of_low_temp.setMinimumCurveOutput(0.27)
    vrf_cool_eir_f_of_low_temp.setMaximumCurveOutput(1.15)

    # Cooling Energy Input Ratio Boundary Curve
    vrf_cool_eir_ratio_boundary = OpenStudio::Model::CurveCubic.new(model)
    vrf_cool_eir_ratio_boundary.setName('vrf_cool_eir_ratio_boundary')
    vrf_cool_eir_ratio_boundary.setCoefficient1Constant(25.73473775)
    vrf_cool_eir_ratio_boundary.setCoefficient2x(-0.03150043)
    vrf_cool_eir_ratio_boundary.setCoefficient3xPOW2(-0.01416595)
    vrf_cool_eir_ratio_boundary.setCoefficient4xPOW3(0.0)
    vrf_cool_eir_ratio_boundary.setMinimumValueofx(15.0)
    vrf_cool_eir_ratio_boundary.setMaximumValueofx(24.0)

    # Cooling Energy Input Ratio Modifier Function of High Temperature Curve
    vrf_cool_eir_f_of_high_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_cool_eir_f_of_high_temp.setName('vrf_cool_eir_f_of_high_temp')
    vrf_cool_eir_f_of_high_temp.setCoefficient1Constant(-1.4395110176)
    vrf_cool_eir_f_of_high_temp.setCoefficient2x(0.1619850459)
    vrf_cool_eir_f_of_high_temp.setCoefficient3xPOW2(-0.0034911781)
    vrf_cool_eir_f_of_high_temp.setCoefficient4y(0.0269442645)
    vrf_cool_eir_f_of_high_temp.setCoefficient5yPOW2(0.0001346163)
    vrf_cool_eir_f_of_high_temp.setCoefficient6xTIMESY(-0.0006714941)
    vrf_cool_eir_f_of_high_temp.setMinimumValueofx(15.0)
    vrf_cool_eir_f_of_high_temp.setMaximumValueofx(23.9)
    vrf_cool_eir_f_of_high_temp.setMinimumValueofy(16.8)
    vrf_cool_eir_f_of_high_temp.setMaximumValueofy(43.3)

    # Cooling Energy Input Ratio Modifier Function of Low Part-Load Ratio Curve
    vrf_cooling_eir_low_plr = OpenStudio::Model::CurveCubic.new(model)
    vrf_cooling_eir_low_plr.setName('vrf_cool_eir_f_of_low_temp')
    vrf_cooling_eir_low_plr.setCoefficient1Constant(0.0734992169827752)
    vrf_cooling_eir_low_plr.setCoefficient2x(0.334783365234032)
    vrf_cooling_eir_low_plr.setCoefficient3xPOW2(0.591613015486343)
    vrf_cooling_eir_low_plr.setCoefficient4xPOW3(0.0)
    vrf_cooling_eir_low_plr.setMinimumValueofx(0.25)
    vrf_cooling_eir_low_plr.setMaximumValueofx(1.0)
    vrf_cooling_eir_low_plr.setMinimumCurveOutput(0.0)
    vrf_cooling_eir_low_plr.setMaximumCurveOutput(1.0)

    # Cooling Energy Input Ratio Modifier Function of High Part-Load Ratio Curve
    vrf_cooling_eir_high_plr = OpenStudio::Model::CurveCubic.new(model)
    vrf_cooling_eir_high_plr.setName('vrf_cooling_eir_high_plr')
    vrf_cooling_eir_high_plr.setCoefficient1Constant(1.0)
    vrf_cooling_eir_high_plr.setCoefficient2x(0.0)
    vrf_cooling_eir_high_plr.setCoefficient3xPOW2(0.0)
    vrf_cooling_eir_high_plr.setCoefficient4xPOW3(0.0)
    vrf_cooling_eir_high_plr.setMinimumValueofx(1.0)
    vrf_cooling_eir_high_plr.setMaximumValueofx(1.5)

    # Cooling Combination Ratio Correction Factor Curve
    vrf_cooling_comb_ratio = OpenStudio::Model::CurveCubic.new(model)
    vrf_cooling_comb_ratio.setName('vrf_cooling_comb_ratio')
    vrf_cooling_comb_ratio.setCoefficient1Constant(0.24034)
    vrf_cooling_comb_ratio.setCoefficient2x(-0.21873)
    vrf_cooling_comb_ratio.setCoefficient3xPOW2(1.97941)
    vrf_cooling_comb_ratio.setCoefficient4xPOW3(-1.02636)
    vrf_cooling_comb_ratio.setMinimumValueofx(0.5)
    vrf_cooling_comb_ratio.setMaximumValueofx(2.0)
    vrf_cooling_comb_ratio.setMinimumCurveOutput(0.5)
    vrf_cooling_comb_ratio.setMaximumCurveOutput(1.056)

    # Cooling Part-Load Fraction Correlation Curve
    vrf_cooling_cplffplr = OpenStudio::Model::CurveCubic.new(model)
    vrf_cooling_cplffplr.setName('vrf_cooling_cplffplr')
    vrf_cooling_cplffplr.setCoefficient1Constant(0.85)
    vrf_cooling_cplffplr.setCoefficient2x(0.15)
    vrf_cooling_cplffplr.setCoefficient3xPOW2(0.0)
    vrf_cooling_cplffplr.setCoefficient4xPOW3(0.0)
    vrf_cooling_cplffplr.setMinimumValueofx(1.0)
    vrf_cooling_cplffplr.setMaximumValueofx(1.0)

    # Heating Capacity Ratio Modifier Function of Low Temperature Curve Name
    vrf_heat_cap_f_of_low_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_heat_cap_f_of_low_temp.setName('vrf_heat_cap_f_of_low_temp')
    vrf_heat_cap_f_of_low_temp.setCoefficient1Constant(0.983220174655636)
    vrf_heat_cap_f_of_low_temp.setCoefficient2x(0.0157167577703294)
    vrf_heat_cap_f_of_low_temp.setCoefficient3xPOW2(-0.000835032422884084)
    vrf_heat_cap_f_of_low_temp.setCoefficient4y(0.0522939264581759)
    vrf_heat_cap_f_of_low_temp.setCoefficient5yPOW2(-0.000531556035364549)
    vrf_heat_cap_f_of_low_temp.setCoefficient6xTIMESY(-0.00190605953116024)
    vrf_heat_cap_f_of_low_temp.setMinimumValueofx(16.1)
    vrf_heat_cap_f_of_low_temp.setMaximumValueofx(23.9)
    vrf_heat_cap_f_of_low_temp.setMinimumValueofy(-25.0)
    vrf_heat_cap_f_of_low_temp.setMaximumValueofy(13.3)
    vrf_heat_cap_f_of_low_temp.setMinimumCurveOutput(0.515151515151515)
    vrf_heat_cap_f_of_low_temp.setMaximumCurveOutput(1.2)

    # Heating Capacity Ratio Boundary Curve Name
    vrf_heat_cap_ratio_boundary = OpenStudio::Model::CurveCubic.new(model)
    vrf_heat_cap_ratio_boundary.setName('vrf_heat_cap_ratio_boundary')
    vrf_heat_cap_ratio_boundary.setCoefficient1Constant(58.577)
    vrf_heat_cap_ratio_boundary.setCoefficient2x(-3.0255)
    vrf_heat_cap_ratio_boundary.setCoefficient3xPOW2(0.0193)
    vrf_heat_cap_ratio_boundary.setCoefficient4xPOW3(0.0)
    vrf_heat_cap_ratio_boundary.setMinimumValueofx(15)
    vrf_heat_cap_ratio_boundary.setMaximumValueofx(23.9)

    # Heating Capacity Ratio Modifier Function of High Temperature Curve Name
    vrf_heat_cap_f_of_high_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_heat_cap_f_of_high_temp.setName('vrf_heat_cap_f_of_high_temp')
    vrf_heat_cap_f_of_high_temp.setCoefficient1Constant(2.5859872368)
    vrf_heat_cap_f_of_high_temp.setCoefficient2x(-0.0953227101)
    vrf_heat_cap_f_of_high_temp.setCoefficient3xPOW2(0.0009553288)
    vrf_heat_cap_f_of_high_temp.setCoefficient4y(0.0)
    vrf_heat_cap_f_of_high_temp.setCoefficient5yPOW2(0.0)
    vrf_heat_cap_f_of_high_temp.setCoefficient6xTIMESY(0.0)
    vrf_heat_cap_f_of_high_temp.setMinimumValueofx(21.1)
    vrf_heat_cap_f_of_high_temp.setMaximumValueofx(27.2)
    vrf_heat_cap_f_of_high_temp.setMinimumValueofy(-944)
    vrf_heat_cap_f_of_high_temp.setMaximumValueofy(15)

    # Heating Energy Input Ratio Modifier Function of Low Temperature Curve Name
    vrf_heat_eir_f_of_low_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_heat_eir_f_of_low_temp.setName('vrf_heat_eir_f_of_low_temp')
    vrf_heat_eir_f_of_low_temp.setCoefficient1Constant(0.756830029796909)
    vrf_heat_eir_f_of_low_temp.setCoefficient2x(0.0457499799042671)
    vrf_heat_eir_f_of_low_temp.setCoefficient3xPOW2(-0.00136357240431388)
    vrf_heat_eir_f_of_low_temp.setCoefficient4y(0.0554884599902023)
    vrf_heat_eir_f_of_low_temp.setCoefficient5yPOW2(-0.00120700875497686)
    vrf_heat_eir_f_of_low_temp.setCoefficient6xTIMESY(-0.00303329271420931)
    vrf_heat_eir_f_of_low_temp.setMinimumValueofx(16.1)
    vrf_heat_eir_f_of_low_temp.setMaximumValueofx(23.9)
    vrf_heat_eir_f_of_low_temp.setMinimumValueofy(-25.0)
    vrf_heat_eir_f_of_low_temp.setMaximumValueofy(13.3)
    vrf_heat_eir_f_of_low_temp.setMinimumCurveOutput(0.7)
    vrf_heat_eir_f_of_low_temp.setMaximumCurveOutput(1.184)

    # Heating Energy Input Ratio Boundary Curve Name
    vrf_heat_eir_boundary = OpenStudio::Model::CurveCubic.new(model)
    vrf_heat_eir_boundary.setName('vrf_heat_eir_boundary')
    vrf_heat_eir_boundary.setCoefficient1Constant(58.577)
    vrf_heat_eir_boundary.setCoefficient2x(-3.0255)
    vrf_heat_eir_boundary.setCoefficient3xPOW2(0.0193)
    vrf_heat_eir_boundary.setCoefficient4xPOW3(0.0)
    vrf_heat_eir_boundary.setMinimumValueofx(15.0)
    vrf_heat_eir_boundary.setMaximumValueofx(23.9)

    # Heating Energy Input Ratio Modifier Function of High Temperature Curve Name
    vrf_heat_eir_f_of_high_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_heat_eir_f_of_high_temp.setName('vrf_heat_eir_f_of_high_temp')
    vrf_heat_eir_f_of_high_temp.setCoefficient1Constant(1.3885703646)
    vrf_heat_eir_f_of_high_temp.setCoefficient2x(-0.0229771462)
    vrf_heat_eir_f_of_high_temp.setCoefficient3xPOW2(0.000537274)
    vrf_heat_eir_f_of_high_temp.setCoefficient4y(-0.0273936962)
    vrf_heat_eir_f_of_high_temp.setCoefficient5yPOW2(0.0004030426)
    vrf_heat_eir_f_of_high_temp.setCoefficient6xTIMESY(-5.9786e-05)
    vrf_heat_eir_f_of_high_temp.setMinimumValueofx(21.1)
    vrf_heat_eir_f_of_high_temp.setMaximumValueofx(27.2)
    vrf_heat_eir_f_of_high_temp.setMinimumValueofy(0.0)
    vrf_heat_eir_f_of_high_temp.setMaximumValueofy(1.0)

    # Heating Performance Curve Outdoor Temperature Type
    vrf_outdoor_unit.setHeatingPerformanceCurveOutdoorTemperatureType('WetBulbTemperature')

    # Heating Energy Input Ratio Modifier Function of Low Part-Load Ratio Curve Name
    vrf_heating_eir_low_plr = OpenStudio::Model::CurveCubic.new(model)
    vrf_heating_eir_low_plr.setName('vrf_heating_eir_low_plr')
    vrf_heating_eir_low_plr.setCoefficient1Constant(0.0724906507105475)
    vrf_heating_eir_low_plr.setCoefficient2x(0.658189977561701)
    vrf_heating_eir_low_plr.setCoefficient3xPOW2(0.269259536275246)
    vrf_heating_eir_low_plr.setCoefficient4xPOW3(0.0)
    vrf_heating_eir_low_plr.setMinimumValueofx(0.25)
    vrf_heating_eir_low_plr.setMaximumValueofx(1.0)
    vrf_heating_eir_low_plr.setMinimumCurveOutput(0.0)
    vrf_heating_eir_low_plr.setMaximumCurveOutput(1.0)

    # Heating Energy Input Ratio Modifier Function of High Part-Load Ratio Curve Name
    vrf_heating_eir_hi_plr = OpenStudio::Model::CurveCubic.new(model)
    vrf_heating_eir_hi_plr.setName('vrf_heating_eir_hi_plr')
    vrf_heating_eir_hi_plr.setCoefficient1Constant(1.0)
    vrf_heating_eir_hi_plr.setCoefficient2x(0.0)
    vrf_heating_eir_hi_plr.setCoefficient3xPOW2(0.0)
    vrf_heating_eir_hi_plr.setCoefficient4xPOW3(0.0)
    vrf_heating_eir_hi_plr.setMinimumValueofx(1.0)
    vrf_heating_eir_hi_plr.setMaximumValueofx(1.5)

    # Heating Combination Ratio Correction Factor Curve Name
    vrf_heating_comb_ratio = OpenStudio::Model::CurveCubic.new(model)
    vrf_heating_comb_ratio.setName('vrf_heating_comb_ratio')
    vrf_heating_comb_ratio.setCoefficient1Constant(0.62115)
    vrf_heating_comb_ratio.setCoefficient2x(-1.55798)
    vrf_heating_comb_ratio.setCoefficient3xPOW2(3.36817)
    vrf_heating_comb_ratio.setCoefficient4xPOW3(-1.4224)
    vrf_heating_comb_ratio.setMinimumValueofx(0.5)
    vrf_heating_comb_ratio.setMaximumValueofx(2.0)
    vrf_heating_comb_ratio.setMinimumCurveOutput(0.5)
    vrf_heating_comb_ratio.setMaximumCurveOutput(1.155)

    # Heating Part-Load Fraction Correlation Curve Name
    vrf_heating_cplffplr = OpenStudio::Model::CurveCubic.new(model)
    vrf_heating_cplffplr.setName('vrf_heating_cplffplr')
    vrf_heating_cplffplr.setCoefficient1Constant(0.85)
    vrf_heating_cplffplr.setCoefficient2x(0.15)
    vrf_heating_cplffplr.setCoefficient3xPOW2(0.0)
    vrf_heating_cplffplr.setCoefficient4xPOW3(0.0)
    vrf_heating_cplffplr.setMinimumValueofx(1.0)
    vrf_heating_cplffplr.setMaximumValueofx(1.0)

    # Defrost Energy Input Ratio Modifier Function of Temperature Curve
    vrf_defrost_eir_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    vrf_defrost_eir_f_of_temp.setName('vrf_defrost_eir_f_of_temp')
    vrf_defrost_eir_f_of_temp.setCoefficient1Constant(-1.61908214818635)
    vrf_defrost_eir_f_of_temp.setCoefficient2x(0.185964818731756)
    vrf_defrost_eir_f_of_temp.setCoefficient3xPOW2(-0.00389610393381592)
    vrf_defrost_eir_f_of_temp.setCoefficient4y(-0.00901995326324613)
    vrf_defrost_eir_f_of_temp.setCoefficient5yPOW2(0.00030340007815629)
    vrf_defrost_eir_f_of_temp.setCoefficient6xTIMESY(0.000476048529099348)
    vrf_defrost_eir_f_of_temp.setMinimumValueofx(13.9)
    vrf_defrost_eir_f_of_temp.setMaximumValueofx(23.9)
    vrf_defrost_eir_f_of_temp.setMinimumValueofy(-5.0)
    vrf_defrost_eir_f_of_temp.setMaximumValueofy(50.0)
    vrf_defrost_eir_f_of_temp.setMinimumCurveOutput(0.27)
    vrf_defrost_eir_f_of_temp.setMaximumCurveOutput(1.155)

    # set defrost control
    vrf_outdoor_unit.setDefrostStrategy('ReverseCycle')
    vrf_outdoor_unit.setDefrostControl('OnDemand')

  end

  vrf_outdoor_unit.setCoolingCapacityRatioModifierFunctionofLowTemperatureCurve(vrf_cool_cap_f_of_low_temp) unless vrf_cool_cap_f_of_low_temp.nil?
  vrf_outdoor_unit.setCoolingCapacityRatioBoundaryCurve(vrf_cool_cap_ratio_boundary) unless vrf_cool_cap_ratio_boundary.nil?
  vrf_outdoor_unit.setCoolingCapacityRatioModifierFunctionofHighTemperatureCurve(vrf_cool_cap_f_of_high_temp) unless vrf_cool_cap_f_of_high_temp.nil?
  vrf_outdoor_unit.setCoolingEnergyInputRatioModifierFunctionofLowTemperatureCurve(vrf_cool_eir_f_of_low_temp) unless vrf_cool_eir_f_of_low_temp.nil?
  vrf_outdoor_unit.setCoolingEnergyInputRatioBoundaryCurve(vrf_cool_eir_ratio_boundary) unless vrf_cool_eir_ratio_boundary.nil?
  vrf_outdoor_unit.setCoolingEnergyInputRatioModifierFunctionofHighTemperatureCurve(vrf_cool_eir_f_of_high_temp) unless vrf_cool_eir_f_of_high_temp.nil?
  vrf_outdoor_unit.setCoolingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve(vrf_cooling_eir_low_plr) unless vrf_cooling_eir_low_plr.nil?
  vrf_outdoor_unit.setCoolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve(vrf_cooling_eir_high_plr) unless vrf_cooling_eir_high_plr.nil?
  vrf_outdoor_unit.setCoolingCombinationRatioCorrectionFactorCurve(vrf_cooling_comb_ratio) unless vrf_cooling_comb_ratio.nil?
  vrf_outdoor_unit.setCoolingPartLoadFractionCorrelationCurve(vrf_cooling_cplffplr) unless vrf_cooling_cplffplr.nil?
  vrf_outdoor_unit.setHeatingCapacityRatioModifierFunctionofLowTemperatureCurve(vrf_heat_cap_f_of_low_temp) unless vrf_heat_cap_f_of_low_temp.nil?
  vrf_outdoor_unit.setHeatingCapacityRatioBoundaryCurve(vrf_heat_cap_ratio_boundary) unless vrf_heat_cap_ratio_boundary.nil?
  vrf_outdoor_unit.setHeatingCapacityRatioModifierFunctionofHighTemperatureCurve(vrf_heat_cap_f_of_high_temp) unless vrf_heat_cap_f_of_high_temp.nil?
  vrf_outdoor_unit.setHeatingEnergyInputRatioModifierFunctionofLowTemperatureCurve(vrf_heat_eir_f_of_low_temp) unless vrf_heat_eir_f_of_low_temp.nil?
  vrf_outdoor_unit.setHeatingEnergyInputRatioBoundaryCurve(vrf_heat_eir_boundary) unless vrf_heat_eir_boundary.nil?
  vrf_outdoor_unit.setHeatingEnergyInputRatioModifierFunctionofHighTemperatureCurve(vrf_heat_eir_f_of_high_temp) unless vrf_heat_eir_f_of_high_temp.nil?
  vrf_outdoor_unit.setHeatingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve(vrf_heating_eir_low_plr) unless vrf_heating_eir_low_plr.nil?
  vrf_outdoor_unit.setHeatingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve(vrf_heating_eir_hi_plr) unless vrf_heating_eir_hi_plr.nil?
  vrf_outdoor_unit.setHeatingCombinationRatioCorrectionFactorCurve(vrf_heating_comb_ratio) unless vrf_heating_comb_ratio.nil?
  vrf_outdoor_unit.setHeatingPartLoadFractionCorrelationCurve(vrf_heating_cplffplr) unless vrf_heating_cplffplr.nil?
  vrf_outdoor_unit.setDefrostEnergyInputRatioModifierFunctionofTemperatureCurve(vrf_defrost_eir_f_of_temp) unless vrf_defrost_eir_f_of_temp.nil?

  return vrf_outdoor_unit
end

#create_boiler_hot_water(model, hot_water_loop: nil, name: 'Boiler', fuel_type: 'NaturalGas', draft_type: 'Natural', nominal_thermal_efficiency: 0.80, eff_curve_temp_eval_var: 'LeavingBoiler', flow_mode: 'LeavingSetpointModulated', lvg_temp_dsgn_f: 180.0, out_temp_lmt_f: 203.0, min_plr: 0.0, max_plr: 1.2, opt_plr: 1.0, sizing_factor: nil) ⇒ OpenStudio::Model::BoilerHotWater

Prototype BoilerHotWater object

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • hot_water_loop (<OpenStudio::Model::PlantLoop>) (defaults to: nil)

    a hot water loop served by the boiler

  • name (String) (defaults to: 'Boiler')

    the name of the boiler, or nil in which case it will be defaulted

  • fuel_type (String) (defaults to: 'NaturalGas')

    type of fuel serving the boiler

  • draft_type (String) (defaults to: 'Natural')

    Boiler type Condensing, MechanicalNoncondensing, Natural (default)

  • nominal_thermal_efficiency (Double) (defaults to: 0.80)

    boiler nominal thermal efficiency

  • eff_curve_temp_eval_var (String) (defaults to: 'LeavingBoiler')

    LeavingBoiler or EnteringBoiler temperature for the boiler efficiency curve

  • flow_mode (String) (defaults to: 'LeavingSetpointModulated')

    boiler flow mode

  • lvg_temp_dsgn_f (Double) (defaults to: 180.0)

    boiler leaving design temperature in degrees Fahrenheit note that this field is deprecated in OS versions 3.0+

  • out_temp_lmt_f (Double) (defaults to: 203.0)

    boiler outlet temperature limit in degrees Fahrenheit

  • min_plr (Double) (defaults to: 0.0)

    boiler minimum part load ratio

  • max_plr (Double) (defaults to: 1.2)

    boiler maximum part load ratio

  • opt_plr (Double) (defaults to: 1.0)

    boiler optimum part load ratio

  • sizing_factor (Double) (defaults to: nil)

    boiler oversizing factor

Returns:

  • (OpenStudio::Model::BoilerHotWater)

    the boiler object



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.BoilerHotWater.rb', line 22

def create_boiler_hot_water(model,
                            hot_water_loop: nil,
                            name: 'Boiler',
                            fuel_type: 'NaturalGas',
                            draft_type: 'Natural',
                            nominal_thermal_efficiency: 0.80,
                            eff_curve_temp_eval_var: 'LeavingBoiler',
                            flow_mode: 'LeavingSetpointModulated',
                            lvg_temp_dsgn_f: 180.0, # 82.22 degrees Celsius
                            out_temp_lmt_f: 203.0, # 95.0 degrees Celsius
                            min_plr: 0.0,
                            max_plr: 1.2,
                            opt_plr: 1.0,
                            sizing_factor: nil)

  # create the boiler
  boiler = OpenStudio::Model::BoilerHotWater.new(model)
  if name.nil?
    if hot_water_loop.nil?
      boiler.setName('Boiler')
    else
      boiler.setName("#{hot_water_loop.name} Boiler")
    end
  else
    boiler.setName(name)
  end

  if fuel_type.nil? || fuel_type == 'Gas'
    boiler.setFuelType('NaturalGas')
  elsif fuel_type == 'Propane' || fuel_type == 'PropaneGas'
    boiler.setFuelType('Propane')
  else
    boiler.setFuelType(fuel_type)
  end

  if nominal_thermal_efficiency.nil?
    boiler.setNominalThermalEfficiency(0.8)
  else
    boiler.setNominalThermalEfficiency(nominal_thermal_efficiency)
  end

  if eff_curve_temp_eval_var.nil?
    boiler.setEfficiencyCurveTemperatureEvaluationVariable('LeavingBoiler')
  else
    boiler.setEfficiencyCurveTemperatureEvaluationVariable(eff_curve_temp_eval_var)
  end

  if flow_mode.nil?
    boiler.setBoilerFlowMode('LeavingSetpointModulated')
  else
    boiler.setBoilerFlowMode(flow_mode)
  end

  if model.version < OpenStudio::VersionString.new('3.0.0')
    if lvg_temp_dsgn_f.nil?
      boiler.setDesignWaterOutletTemperature(OpenStudio.convert(180.0, 'F', 'C').get)
    else
      boiler.setDesignWaterOutletTemperature(OpenStudio.convert(lvg_temp_dsgn_f, 'F', 'C').get)
    end
  end

  if out_temp_lmt_f.nil?
    boiler.setWaterOutletUpperTemperatureLimit(OpenStudio.convert(203.0, 'F', 'C').get)
  else
    boiler.setWaterOutletUpperTemperatureLimit(OpenStudio.convert(out_temp_lmt_f, 'F', 'C').get)
  end

  # logic to set different defaults for condensing boilers if not specified
  if draft_type == 'Condensing'
    if model.version < OpenStudio::VersionString.new('3.0.0') && lvg_temp_dsgn_f.nil?
      # default to 120 degrees Fahrenheit (48.49 degrees Celsius)
      boiler.setDesignWaterOutletTemperature(OpenStudio.convert(120.0, 'F', 'C').get)
    end
    boiler.setNominalThermalEfficiency(0.96) if nominal_thermal_efficiency.nil?
  end

  if min_plr.nil?
    boiler.setMinimumPartLoadRatio(0.0)
  else
    boiler.setMinimumPartLoadRatio(min_plr)
  end

  if max_plr.nil?
    boiler.setMaximumPartLoadRatio(1.2)
  else
    boiler.setMaximumPartLoadRatio(max_plr)
  end

  if opt_plr.nil?
    boiler.setOptimumPartLoadRatio(1.0)
  else
    boiler.setOptimumPartLoadRatio(opt_plr)
  end

  boiler.setSizingFactor(sizing_factor) unless sizing_factor.nil?

  # add to supply side of hot water loop if specified
  hot_water_loop.addSupplyBranchForComponent(boiler) unless hot_water_loop.nil?

  return boiler
end

#create_central_air_source_heat_pump(model, hot_water_loop, name: nil, cop: 3.65) ⇒ OpenStudio::Model::PlantComponentUserDefined

TODO:

update curve to better calculate based on the rated cop

TODO:

refactor to use the new EnergyPlus central air source heat pump object when it becomes available set hot_water_loop to an optional keyword argument, and add input keyword arguments for other characteristics

Prototype CentralAirSourceHeatPump object using PlantComponentUserDefined

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • hot_water_loop (<OpenStudio::Model::PlantLoop>)

    a hot water loop served by the central air source heat pump

  • name (String) (defaults to: nil)

    the name of the central air source heat pump, or nil in which case it will be defaulted

  • cop (Double) (defaults to: 3.65)

    air source heat pump rated cop

Returns:

  • (OpenStudio::Model::PlantComponentUserDefined)

    a plant component representing the air source heat pump



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CentralAirSourceHeatPump.rb', line 14

def create_central_air_source_heat_pump(model,
                                        hot_water_loop,
                                        name: nil,
                                        cop: 3.65)

  # create the PlantComponentUserDefined object as a proxy for the Central Air Source Heat Pump
  plant_comp = OpenStudio::Model::PlantComponentUserDefined.new(model)
  if name.nil?
    if hot_water_loop.nil?
      name = 'Central Air Source Heat Pump'
    else
      name = "#{hot_water_loop.name} Central Air Source Heat Pump"
    end
  end

  # change equipment name for EMS validity
  plant_comp.setName(ems_friendly_name(name))

  # set plant component properties
  plant_comp.setPlantLoadingMode('MeetsLoadWithNominalCapacityHiOutLimit')
  plant_comp.setPlantLoopFlowRequestMode('NeedsFlowIfLoopOn')

  # plant design volume flow rate internal variable
  vdot_des_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Plant Design Volume Flow Rate')
  vdot_des_int_var.setName("#{plant_comp.name}_Vdot_Des_Int_Var")
  vdot_des_int_var.setInternalDataIndexKeyName(hot_water_loop.handle.to_s)

  # inlet temperature internal variable
  tin_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Inlet Temperature for Plant Connection 1')
  tin_int_var.setName("#{plant_comp.name}_Tin_Int_Var")
  tin_int_var.setInternalDataIndexKeyName(plant_comp.handle.to_s)

  # inlet mass flow rate internal variable
  mdot_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Inlet Mass Flow Rate for Plant Connection 1')
  mdot_int_var.setName("#{plant_comp.name}_Mdot_Int_Var")
  mdot_int_var.setInternalDataIndexKeyName(plant_comp.handle.to_s)

  # inlet specific heat internal variable
  cp_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Inlet Specific Heat for Plant Connection 1')
  cp_int_var.setName("#{plant_comp.name}_Cp_Int_Var")
  cp_int_var.setInternalDataIndexKeyName(plant_comp.handle.to_s)

  # inlet density internal variable
  rho_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Inlet Density for Plant Connection 1')
  rho_int_var.setName("#{plant_comp.name}_rho_Int_Var")
  rho_int_var.setInternalDataIndexKeyName(plant_comp.handle.to_s)

  # load request internal variable
  load_int_var = OpenStudio::Model::EnergyManagementSystemInternalVariable.new(model, 'Load Request for Plant Connection 1')
  load_int_var.setName("#{plant_comp.name}_Load_Int_Var")
  load_int_var.setInternalDataIndexKeyName(plant_comp.handle.to_s)

  # supply outlet node setpoint temperature sensor
  setpt_mgr_sch_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
  setpt_mgr_sch_sen.setName("#{plant_comp.name}_Setpt_Mgr_Temp_Sen")
  hot_water_loop.supplyOutletNode.setpointManagers.each do |m|
    if m.to_SetpointManagerScheduled.is_initialized
      setpt_mgr_sch_sen.setKeyName(m.to_SetpointManagerScheduled.get.schedule.name.to_s)
    end
  end

  # outdoor air drybulb temperature sensor
  oa_dbt_sen = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Site Outdoor Air Drybulb Temperature')
  oa_dbt_sen.setName("#{plant_comp.name}_OA_DBT_Sen")
  oa_dbt_sen.setKeyName('Environment')

  # minimum mass flow rate actuator
  mdot_min_act = plant_comp.minimumMassFlowRateActuator.get
  mdot_min_act.setName("#{plant_comp.name}_Mdot_Min_Act")

  # maximum mass flow rate actuator
  mdot_max_act = plant_comp.maximumMassFlowRateActuator.get
  mdot_max_act.setName("#{plant_comp.name}_Mdot_Max_Act")

  # design flow rate actuator
  vdot_des_act = plant_comp.designVolumeFlowRateActuator.get
  vdot_des_act.setName("#{plant_comp.name}_Vdot_Des_Act")

  # minimum loading capacity actuator
  cap_min_act = plant_comp.minimumLoadingCapacityActuator.get
  cap_min_act.setName("#{plant_comp.name}_Cap_Min_Act")

  # maximum loading capacity actuator
  cap_max_act = plant_comp.maximumLoadingCapacityActuator.get
  cap_max_act.setName("#{plant_comp.name}_Cap_Max_Act")

  # optimal loading capacity actuator
  cap_opt_act = plant_comp.optimalLoadingCapacityActuator.get
  cap_opt_act.setName("#{plant_comp.name}_Cap_Opt_Act")

  # outlet temperature actuator
  tout_act = plant_comp.outletTemperatureActuator.get
  tout_act.setName("#{plant_comp.name}_Tout_Act")

  # mass flow rate actuator
  mdot_req_act = plant_comp.massFlowRateActuator.get
  mdot_req_act.setName("#{plant_comp.name}_Mdot_Req_Act")

  # heat pump COP curve
  constant_coeff = 1.932 + (cop - 3.65)
  hp_cop_curve = OpenStudio::Model::CurveQuadratic.new(model)
  hp_cop_curve.setCoefficient1Constant(constant_coeff)
  hp_cop_curve.setCoefficient2x(0.227674286)
  hp_cop_curve.setCoefficient3xPOW2(-0.007313143)
  hp_cop_curve.setMinimumValueofx(1.67)
  hp_cop_curve.setMaximumValueofx(12.78)
  hp_cop_curve.setInputUnitTypeforX('Temperature')
  hp_cop_curve.setOutputUnitType('Dimensionless')

  # heat pump COP curve index variable
  hp_cop_curve_idx_var = OpenStudio::Model::EnergyManagementSystemCurveOrTableIndexVariable.new(model, hp_cop_curve)

  # high outlet temperature limit actuator
  tout_max_act = OpenStudio::Model::EnergyManagementSystemActuator.new(plant_comp, 'Plant Connection 1', 'High Outlet Temperature Limit')
  tout_max_act.setName("#{plant_comp.name}_Tout_Max_Act")

  # init program
  init_pgrm = plant_comp.plantInitializationProgram.get
  init_pgrm.setName("#{plant_comp.name}_Init_Pgrm")
  init_pgrm_body = <<-EMS
  SET Loop_Exit_Temp = #{hot_water_loop.sizingPlant.designLoopExitTemperature}
  SET Loop_Delta_Temp = #{hot_water_loop.sizingPlant.loopDesignTemperatureDifference}
  SET Cp = @CPHW Loop_Exit_Temp
  SET rho = @RhoH2O Loop_Exit_Temp
  SET #{vdot_des_act.handle} = #{vdot_des_int_var.handle}
  SET #{mdot_min_act.handle} = 0
  SET Mdot_Max = #{vdot_des_int_var.handle} * rho
  SET #{mdot_max_act.handle} = Mdot_Max
  SET Cap = Mdot_Max * Cp * Loop_Delta_Temp
  SET #{cap_min_act.handle} = 0
  SET #{cap_max_act.handle} = Cap
  SET #{cap_opt_act.handle} = 1 * Cap
  EMS
  init_pgrm.setBody(init_pgrm_body)

  # sim program
  sim_pgrm = plant_comp.plantSimulationProgram.get
  sim_pgrm.setName("#{plant_comp.name}_Sim_Pgrm")
  sim_pgrm_body = <<-EMS
  SET tmp = #{load_int_var.handle}
  SET tmp = #{tin_int_var.handle}
  SET tmp = #{mdot_int_var.handle}
  SET #{tout_max_act.handle} = 75.0
  IF #{load_int_var.handle} == 0
  SET #{tout_act.handle} = #{tin_int_var.handle}
  SET #{mdot_req_act.handle} = 0
  SET Elec = 0
  RETURN
  ENDIF
  IF #{load_int_var.handle} >= #{cap_max_act.handle}
  SET Qdot = #{cap_max_act.handle}
  SET Mdot = #{mdot_max_act.handle}
  SET #{mdot_req_act.handle} = Mdot
  SET #{tout_act.handle} = (Qdot / (Mdot * #{cp_int_var.handle})) + #{tin_int_var.handle}
  IF #{tout_act.handle} > #{tout_max_act.handle}
  SET #{tout_act.handle} = #{tout_max_act.handle}
  SET Qdot = Mdot * #{cp_int_var.handle} * (#{tout_act.handle} - #{tin_int_var.handle})
  ENDIF
  ELSE
  SET Qdot = #{load_int_var.handle}
  SET #{tout_act.handle} = #{setpt_mgr_sch_sen.handle}
  SET Mdot = Qdot / (#{cp_int_var.handle} * (#{tout_act.handle} - #{tin_int_var.handle}))
  SET #{mdot_req_act.handle} = Mdot
  ENDIF
  SET Tdb = #{oa_dbt_sen.handle}
  SET COP = @CurveValue #{hp_cop_curve_idx_var.handle} Tdb
  SET EIR = 1 / COP
  SET Pwr = Qdot * EIR
  SET Elec = Pwr * SystemTimestep * 3600
  EMS
  sim_pgrm.setBody(sim_pgrm_body)

  # init program calling manager
  init_mgr = plant_comp.plantInitializationProgramCallingManager.get
  init_mgr.setName("#{plant_comp.name}_Init_Pgrm_Mgr")

  # sim program calling manager
  sim_mgr = plant_comp.plantSimulationProgramCallingManager.get
  sim_mgr.setName("#{plant_comp.name}_Sim_Pgrm_Mgr")

  # metered output variable
  elec_mtr_out_var = OpenStudio::Model::EnergyManagementSystemMeteredOutputVariable.new(model, "#{plant_comp.name} Electricity Consumption")
  elec_mtr_out_var.setName("#{plant_comp.name} Electricity Consumption")
  elec_mtr_out_var.setEMSVariableName('Elec')
  elec_mtr_out_var.setUpdateFrequency('SystemTimestep')
  elec_mtr_out_var.setString(4, sim_pgrm.handle.to_s)
  elec_mtr_out_var.setResourceType('Electricity')
  elec_mtr_out_var.setGroupType('HVAC')
  elec_mtr_out_var.setEndUseCategory('Heating')
  elec_mtr_out_var.setEndUseSubcategory('')
  elec_mtr_out_var.setUnits('J')

  # add to supply side of hot water loop if specified
  hot_water_loop.addSupplyBranchForComponent(plant_comp) unless hot_water_loop.nil?

  # add operation scheme
  htg_op_scheme = OpenStudio::Model::PlantEquipmentOperationHeatingLoad.new(model)
  htg_op_scheme.addEquipment(1000000000, plant_comp)
  hot_water_loop.setPlantEquipmentOperationHeatingLoad(htg_op_scheme)

  return plant_comp
end

#create_coil_cooling_dx_single_speed(model, air_loop_node: nil, name: '1spd DX Clg Coil', schedule: nil, type: nil, cop: nil) ⇒ OpenStudio::Model::CoilCoolingDXTwoSpeed

Prototype CoilCoolingDXSingleSpeed object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: '1spd DX Clg Coil')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • type (String) (defaults to: nil)

    the type of single speed DX coil to reference the correct curve set

  • cop (Double) (defaults to: nil)

    rated cooling coefficient of performance

Returns:

  • (OpenStudio::Model::CoilCoolingDXTwoSpeed)

    the DX cooling coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingDXSingleSpeed.rb', line 14

def create_coil_cooling_dx_single_speed(model,
                                        air_loop_node: nil,
                                        name: '1spd DX Clg Coil',
                                        schedule: nil,
                                        type: nil,
                                        cop: nil)

  clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model)

  # add to air loop if specified
  clg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  clg_coil.setName(name)

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  clg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # set coil cop
  clg_coil.setRatedCOP(cop) unless cop.nil?

  clg_cap_f_of_temp = nil
  clg_cap_f_of_flow = nil
  clg_energy_input_ratio_f_of_temp = nil
  clg_energy_input_ratio_f_of_flow = nil
  clg_part_load_ratio = nil

  # curve sets
  case type
  when 'OS default'
    # use OS defaults

  when 'Heat Pump'
    # "PSZ-AC_Unitary_PackagecoolCapFT"
    clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_cap_f_of_temp.setCoefficient1Constant(0.766956)
    clg_cap_f_of_temp.setCoefficient2x(0.0107756)
    clg_cap_f_of_temp.setCoefficient3xPOW2(-0.0000414703)
    clg_cap_f_of_temp.setCoefficient4y(0.00134961)
    clg_cap_f_of_temp.setCoefficient5yPOW2(-0.000261144)
    clg_cap_f_of_temp.setCoefficient6xTIMESY(0.000457488)
    clg_cap_f_of_temp.setMinimumValueofx(12.78)
    clg_cap_f_of_temp.setMaximumValueofx(23.89)
    clg_cap_f_of_temp.setMinimumValueofy(21.1)
    clg_cap_f_of_temp.setMaximumValueofy(46.1)

    clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_cap_f_of_flow.setCoefficient1Constant(0.8)
    clg_cap_f_of_flow.setCoefficient2x(0.2)
    clg_cap_f_of_flow.setCoefficient3xPOW2(0.0)
    clg_cap_f_of_flow.setMinimumValueofx(0.5)
    clg_cap_f_of_flow.setMaximumValueofx(1.5)

    clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.297145)
    clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.0430933)
    clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000748766)
    clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.00597727)
    clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000482112)
    clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000956448)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofx(12.78)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofx(23.89)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofy(21.1)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.1)

    clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.156)
    clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1816)
    clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)
    clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)
    clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)

    clg_part_load_ratio = OpenStudio::Model::CurveQuadratic.new(model)
    clg_part_load_ratio.setCoefficient1Constant(0.85)
    clg_part_load_ratio.setCoefficient2x(0.15)
    clg_part_load_ratio.setCoefficient3xPOW2(0.0)
    clg_part_load_ratio.setMinimumValueofx(0.0)
    clg_part_load_ratio.setMaximumValueofx(1.0)

  when 'PSZ-AC'
    # Defaults to "DOE Ref DX Clg Coil Cool-Cap-fT"
    clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_cap_f_of_temp.setCoefficient1Constant(0.9712123)
    clg_cap_f_of_temp.setCoefficient2x(-0.015275502)
    clg_cap_f_of_temp.setCoefficient3xPOW2(0.0014434524)
    clg_cap_f_of_temp.setCoefficient4y(-0.00039321)
    clg_cap_f_of_temp.setCoefficient5yPOW2(-0.0000068364)
    clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.0002905956)
    clg_cap_f_of_temp.setMinimumValueofx(-100.0)
    clg_cap_f_of_temp.setMaximumValueofx(100.0)
    clg_cap_f_of_temp.setMinimumValueofy(-100.0)
    clg_cap_f_of_temp.setMaximumValueofy(100.0)

    clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_cap_f_of_flow.setCoefficient1Constant(1.0)
    clg_cap_f_of_flow.setCoefficient2x(0.0)
    clg_cap_f_of_flow.setCoefficient3xPOW2(0.0)
    clg_cap_f_of_flow.setMinimumValueofx(-100.0)
    clg_cap_f_of_flow.setMaximumValueofx(100.0)

    # "DOE Ref DX Clg Coil Cool-EIR-fT",
    clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.28687133)
    clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.023902164)
    clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000810648)
    clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.013458546)
    clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.0003389364)
    clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.0004870044)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofx(-100.0)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofx(100.0)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofy(-100.0)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofy(100.0)

    clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.0)
    clg_energy_input_ratio_f_of_flow.setCoefficient2x(0.0)
    clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0)
    clg_energy_input_ratio_f_of_flow.setMinimumValueofx(-100.0)
    clg_energy_input_ratio_f_of_flow.setMaximumValueofx(100.0)

    # "DOE Ref DX Clg Coil Cool-PLF-fPLR"
    clg_part_load_ratio = OpenStudio::Model::CurveQuadratic.new(model)
    clg_part_load_ratio.setCoefficient1Constant(0.90949556)
    clg_part_load_ratio.setCoefficient2x(0.09864773)
    clg_part_load_ratio.setCoefficient3xPOW2(-0.00819488)
    clg_part_load_ratio.setMinimumValueofx(0.0)
    clg_part_load_ratio.setMaximumValueofx(1.0)
    clg_part_load_ratio.setMinimumCurveOutput(0.7)
    clg_part_load_ratio.setMaximumCurveOutput(1.0)

  when 'Window AC'
    # Performance curves
    # From Frigidaire 10.7 EER unit in Winkler et. al. Lab Testing of Window ACs (2013)
    # @note These coefficients are in SI UNITS
    cool_cap_ft_coeffs_si = [0.6405, 0.01568, 0.0004531, 0.001615, -0.0001825, 0.00006614]
    cool_eir_ft_coeffs_si = [2.287, -0.1732, 0.004745, 0.01662, 0.000484, -0.001306]
    cool_cap_fflow_coeffs = [0.887, 0.1128, 0]
    cool_eir_fflow_coeffs = [1.763, -0.6081, 0]
    cool_plf_fplr_coeffs = [0.78, 0.22, 0]

    # Make the curves
    clg_cap_f_of_temp = create_curve_biquadratic(model, cool_cap_ft_coeffs_si, 'RoomAC-Cap-fT', 0, 100, 0, 100, nil, nil)
    clg_cap_f_of_flow = create_curve_quadratic(model, cool_cap_fflow_coeffs, 'RoomAC-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, cool_eir_ft_coeffs_si, 'RoomAC-EIR-fT', 0, 100, 0, 100, nil, nil)
    clg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, cool_eir_fflow_coeffs, 'RoomAC-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_part_load_ratio = create_curve_quadratic(model, cool_plf_fplr_coeffs, 'RoomAC-PLF-fPLR', 0, 1, 0, 1, is_dimensionless = true)

  when 'Residential Central AC'
    # Performance curves
    # These coefficients are in IP UNITS
    cool_cap_ft_coeffs_ip = [3.670270705, -0.098652414, 0.000955906, 0.006552414, -0.0000156, -0.000131877]
    cool_eir_ft_coeffs_ip = [-3.302695861, 0.137871531, -0.001056996, -0.012573945, 0.000214638, -0.000145054]
    cool_cap_fflow_coeffs = [0.718605468, 0.410099989, -0.128705457]
    cool_eir_fflow_coeffs = [1.32299905, -0.477711207, 0.154712157]
    cool_plf_fplr_coeffs = [0.8, 0.2, 0]

    # Convert coefficients from IP to SI
    cool_cap_ft_coeffs_si = convert_curve_biquadratic(cool_cap_ft_coeffs_ip)
    cool_eir_ft_coeffs_si = convert_curve_biquadratic(cool_eir_ft_coeffs_ip)

    # Make the curves
    clg_cap_f_of_temp = create_curve_biquadratic(model, cool_cap_ft_coeffs_si, 'AC-Cap-fT', 0, 100, 0, 100, nil, nil)
    clg_cap_f_of_flow = create_curve_quadratic(model, cool_cap_fflow_coeffs, 'AC-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, cool_eir_ft_coeffs_si, 'AC-EIR-fT', 0, 100, 0, 100, nil, nil)
    clg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, cool_eir_fflow_coeffs, 'AC-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_part_load_ratio = create_curve_quadratic(model, cool_plf_fplr_coeffs, 'AC-PLF-fPLR', 0, 1, 0, 1, is_dimensionless = true)

  when 'Residential Central ASHP'
    # Performance curves
    # These coefficients are in IP UNITS
    cool_cap_ft_coeffs_ip = [3.68637657, -0.098352478, 0.000956357, 0.005838141, -0.0000127, -0.000131702]
    cool_eir_ft_coeffs_ip = [-3.437356399, 0.136656369, -0.001049231, -0.0079378, 0.000185435, -0.0001441]
    cool_cap_fflow_coeffs = [0.718664047, 0.41797409, -0.136638137]
    cool_eir_fflow_coeffs = [1.143487507, -0.13943972, -0.004047787]
    cool_plf_fplr_coeffs = [0.8, 0.2, 0]

    # Convert coefficients from IP to SI
    cool_cap_ft_coeffs_si = convert_curve_biquadratic(cool_cap_ft_coeffs_ip)
    cool_eir_ft_coeffs_si = convert_curve_biquadratic(cool_eir_ft_coeffs_ip)

    # Make the curves
    clg_cap_f_of_temp = create_curve_biquadratic(model, cool_cap_ft_coeffs_si, 'Cool-Cap-fT', 0, 100, 0, 100, nil, nil)
    clg_cap_f_of_flow = create_curve_quadratic(model, cool_cap_fflow_coeffs, 'Cool-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, cool_eir_ft_coeffs_si, 'Cool-EIR-fT', 0, 100, 0, 100, nil, nil)
    clg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, cool_eir_fflow_coeffs, 'Cool-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_part_load_ratio = create_curve_quadratic(model, cool_plf_fplr_coeffs, 'Cool-PLF-fPLR', 0, 1, 0, 1, is_dimensionless = true)

  else # default curve set, type == 'Split AC' || 'PTAC'
    clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_cap_f_of_temp.setCoefficient1Constant(0.942587793)
    clg_cap_f_of_temp.setCoefficient2x(0.009543347)
    clg_cap_f_of_temp.setCoefficient3xPOW2(0.00068377)
    clg_cap_f_of_temp.setCoefficient4y(-0.011042676)
    clg_cap_f_of_temp.setCoefficient5yPOW2(0.000005249)
    clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.00000972)
    clg_cap_f_of_temp.setMinimumValueofx(12.77778)
    clg_cap_f_of_temp.setMaximumValueofx(23.88889)
    clg_cap_f_of_temp.setMinimumValueofy(23.88889)
    clg_cap_f_of_temp.setMaximumValueofy(46.11111)

    clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_cap_f_of_flow.setCoefficient1Constant(0.8)
    clg_cap_f_of_flow.setCoefficient2x(0.2)
    clg_cap_f_of_flow.setCoefficient3xPOW2(0)
    clg_cap_f_of_flow.setMinimumValueofx(0.5)
    clg_cap_f_of_flow.setMaximumValueofx(1.5)

    clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.342414409)
    clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.034885008)
    clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.0006237)
    clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.004977216)
    clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000437951)
    clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000728028)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofx(12.77778)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofx(23.88889)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofy(23.88889)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.11111)

    clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.1552)
    clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1808)
    clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)
    clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)
    clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)

    clg_part_load_ratio = OpenStudio::Model::CurveQuadratic.new(model)
    clg_part_load_ratio.setCoefficient1Constant(0.85)
    clg_part_load_ratio.setCoefficient2x(0.15)
    clg_part_load_ratio.setCoefficient3xPOW2(0.0)
    clg_part_load_ratio.setMinimumValueofx(0.0)
    clg_part_load_ratio.setMaximumValueofx(1.0)
    clg_part_load_ratio.setMinimumCurveOutput(0.7)
    clg_part_load_ratio.setMaximumCurveOutput(1.0)

  end

  clg_coil.setTotalCoolingCapacityFunctionOfTemperatureCurve(clg_cap_f_of_temp) unless clg_cap_f_of_temp.nil?
  clg_coil.setTotalCoolingCapacityFunctionOfFlowFractionCurve(clg_cap_f_of_flow) unless clg_cap_f_of_flow.nil?
  clg_coil.setEnergyInputRatioFunctionOfTemperatureCurve(clg_energy_input_ratio_f_of_temp) unless clg_energy_input_ratio_f_of_temp.nil?
  clg_coil.setEnergyInputRatioFunctionOfFlowFractionCurve(clg_energy_input_ratio_f_of_flow) unless clg_energy_input_ratio_f_of_flow.nil?
  clg_coil.setPartLoadFractionCorrelationCurve(clg_part_load_ratio) unless clg_part_load_ratio.nil?

  return clg_coil
end

#create_coil_cooling_dx_two_speed(model, air_loop_node: nil, name: '2spd DX Clg Coil', schedule: nil, type: nil) ⇒ OpenStudio::Model::CoilCoolingDXTwoSpeed

Prototype CoilCoolingDXTwoSpeed object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: '2spd DX Clg Coil')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • type (String) (defaults to: nil)

    the type of two speed DX coil to reference the correct curve set

Returns:

  • (OpenStudio::Model::CoilCoolingDXTwoSpeed)

    the DX cooling coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingDXTwoSpeed.rb', line 13

def create_coil_cooling_dx_two_speed(model,
                                     air_loop_node: nil,
                                     name: '2spd DX Clg Coil',
                                     schedule: nil,
                                     type: nil)

  clg_coil = OpenStudio::Model::CoilCoolingDXTwoSpeed.new(model)

  # add to air loop if specified
  clg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  clg_coil.setName(name)

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  clg_coil.setAvailabilitySchedule(coil_availability_schedule)

  clg_cap_f_of_temp = nil
  clg_cap_f_of_flow = nil
  clg_energy_input_ratio_f_of_temp = nil
  clg_energy_input_ratio_f_of_flow = nil
  clg_part_load_ratio = nil
  clg_cap_f_of_temp_low_spd = nil
  clg_energy_input_ratio_f_of_temp_low_spd = nil

  # curve sets
  if type == 'OS default'
    # use OS defaults
  elsif type == 'Residential Minisplit HP'
    # Performance curves
    # These coefficients are in SI units
    cool_cap_ft_coeffs_si = [0.7531983499655835, 0.003618193903031667, 0.0, 0.006574385031351544, -6.87181191015432e-05, 0.0]
    cool_eir_ft_coeffs_si = [-0.06376924779982301, -0.0013360593470367282, 1.413060577993827e-05, 0.019433076486584752, -4.91395947154321e-05, -4.909341249475308e-05]
    cool_cap_fflow_coeffs = [1, 0, 0]
    cool_eir_fflow_coeffs = [1, 0, 0]
    cool_plf_fplr_coeffs = [0.89, 0.11, 0]

    # Make the curves
    clg_cap_f_of_temp = create_curve_biquadratic(model, cool_cap_ft_coeffs_si, 'Cool-Cap-fT', 0, 100, 0, 100, nil, nil)
    clg_cap_f_of_flow = create_curve_quadratic(model, cool_cap_fflow_coeffs, 'Cool-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, cool_eir_ft_coeffs_si, 'Cool-EIR-fT', 0, 100, 0, 100, nil, nil)
    clg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, cool_eir_fflow_coeffs, 'Cool-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    clg_part_load_ratio = create_curve_quadratic(model, cool_plf_fplr_coeffs, 'Cool-PLF-fPLR', 0, 1, 0, 1, is_dimensionless = true)
    clg_cap_f_of_temp_low_spd = create_curve_biquadratic(model, cool_cap_ft_coeffs_si, 'Cool-Cap-fT', 0, 100, 0, 100, nil, nil)
    clg_energy_input_ratio_f_of_temp_low_spd = create_curve_biquadratic(model, cool_eir_ft_coeffs_si, 'Cool-EIR-fT', 0, 100, 0, 100, nil, nil)
    clg_coil.setRatedLowSpeedSensibleHeatRatio(0.73)
    clg_coil.setCondenserType('AirCooled')
  else # default curve set, type == 'PSZ-AC' || 'Split AC' || 'PTAC'
    clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_cap_f_of_temp.setCoefficient1Constant(0.42415)
    clg_cap_f_of_temp.setCoefficient2x(0.04426)
    clg_cap_f_of_temp.setCoefficient3xPOW2(-0.00042)
    clg_cap_f_of_temp.setCoefficient4y(0.00333)
    clg_cap_f_of_temp.setCoefficient5yPOW2(-0.00008)
    clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.00021)
    clg_cap_f_of_temp.setMinimumValueofx(17.0)
    clg_cap_f_of_temp.setMaximumValueofx(22.0)
    clg_cap_f_of_temp.setMinimumValueofy(13.0)
    clg_cap_f_of_temp.setMaximumValueofy(46.0)

    clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_cap_f_of_flow.setCoefficient1Constant(0.77136)
    clg_cap_f_of_flow.setCoefficient2x(0.34053)
    clg_cap_f_of_flow.setCoefficient3xPOW2(-0.11088)
    clg_cap_f_of_flow.setMinimumValueofx(0.75918)
    clg_cap_f_of_flow.setMaximumValueofx(1.13877)

    clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.23649)
    clg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.02431)
    clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00057)
    clg_energy_input_ratio_f_of_temp.setCoefficient4y(-0.01434)
    clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.00063)
    clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.00038)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofx(17.0)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofx(22.0)
    clg_energy_input_ratio_f_of_temp.setMinimumValueofy(13.0)
    clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.0)

    clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.20550)
    clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.32953)
    clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.12308)
    clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.75918)
    clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.13877)

    clg_part_load_ratio = OpenStudio::Model::CurveQuadratic.new(model)
    clg_part_load_ratio.setCoefficient1Constant(0.77100)
    clg_part_load_ratio.setCoefficient2x(0.22900)
    clg_part_load_ratio.setCoefficient3xPOW2(0.0)
    clg_part_load_ratio.setMinimumValueofx(0.0)
    clg_part_load_ratio.setMaximumValueofx(1.0)

    clg_cap_f_of_temp_low_spd = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_cap_f_of_temp_low_spd.setCoefficient1Constant(0.42415)
    clg_cap_f_of_temp_low_spd.setCoefficient2x(0.04426)
    clg_cap_f_of_temp_low_spd.setCoefficient3xPOW2(-0.00042)
    clg_cap_f_of_temp_low_spd.setCoefficient4y(0.00333)
    clg_cap_f_of_temp_low_spd.setCoefficient5yPOW2(-0.00008)
    clg_cap_f_of_temp_low_spd.setCoefficient6xTIMESY(-0.00021)
    clg_cap_f_of_temp_low_spd.setMinimumValueofx(17.0)
    clg_cap_f_of_temp_low_spd.setMaximumValueofx(22.0)
    clg_cap_f_of_temp_low_spd.setMinimumValueofy(13.0)
    clg_cap_f_of_temp_low_spd.setMaximumValueofy(46.0)

    clg_energy_input_ratio_f_of_temp_low_spd = OpenStudio::Model::CurveBiquadratic.new(model)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient1Constant(1.23649)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient2x(-0.02431)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient3xPOW2(0.00057)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient4y(-0.01434)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient5yPOW2(0.00063)
    clg_energy_input_ratio_f_of_temp_low_spd.setCoefficient6xTIMESY(-0.00038)
    clg_energy_input_ratio_f_of_temp_low_spd.setMinimumValueofx(17.0)
    clg_energy_input_ratio_f_of_temp_low_spd.setMaximumValueofx(22.0)
    clg_energy_input_ratio_f_of_temp_low_spd.setMinimumValueofy(13.0)
    clg_energy_input_ratio_f_of_temp_low_spd.setMaximumValueofy(46.0)

    clg_coil.setRatedLowSpeedSensibleHeatRatio(OpenStudio::OptionalDouble.new(0.69))
    clg_coil.setBasinHeaterCapacity(10)
    clg_coil.setBasinHeaterSetpointTemperature(2.0)
  end

  clg_coil.setTotalCoolingCapacityFunctionOfTemperatureCurve(clg_cap_f_of_temp) unless clg_cap_f_of_temp.nil?
  clg_coil.setTotalCoolingCapacityFunctionOfFlowFractionCurve(clg_cap_f_of_flow) unless clg_cap_f_of_flow.nil?
  clg_coil.setEnergyInputRatioFunctionOfTemperatureCurve(clg_energy_input_ratio_f_of_temp) unless clg_energy_input_ratio_f_of_temp.nil?
  clg_coil.setEnergyInputRatioFunctionOfFlowFractionCurve(clg_energy_input_ratio_f_of_flow) unless clg_energy_input_ratio_f_of_flow.nil?
  clg_coil.setPartLoadFractionCorrelationCurve(clg_part_load_ratio) unless clg_part_load_ratio.nil?
  clg_coil.setLowSpeedTotalCoolingCapacityFunctionOfTemperatureCurve(clg_cap_f_of_temp_low_spd) unless clg_cap_f_of_temp_low_spd.nil?
  clg_coil.setLowSpeedEnergyInputRatioFunctionOfTemperatureCurve(clg_energy_input_ratio_f_of_temp_low_spd) unless clg_energy_input_ratio_f_of_temp_low_spd.nil?

  return clg_coil
end

#create_coil_cooling_water(model, chilled_water_loop, air_loop_node: nil, name: 'Clg Coil', schedule: nil, design_inlet_water_temperature: nil, design_inlet_air_temperature: nil, design_outlet_air_temperature: nil) ⇒ OpenStudio::Model::CoilCoolingWater

Prototype CoilCoolingWater object

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • chilled_water_loop (<OpenStudio::Model::PlantLoop>)

    the coil will be placed on the demand side of this plant loop

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Clg Coil')

    the name of the coil, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • design_inlet_water_temperature (Double) (defaults to: nil)

    design inlet water temperature in degrees Celsius, default is nil

  • design_inlet_air_temperature (Double) (defaults to: nil)

    design inlet air temperature in degrees Celsius, default is nil

  • design_outlet_air_temperature (Double) (defaults to: nil)

    design outlet air temperature in degrees Celsius, default is nil

Returns:

  • (OpenStudio::Model::CoilCoolingWater)

    the cooling coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingWater.rb', line 15

def create_coil_cooling_water(model,
                              chilled_water_loop,
                              air_loop_node: nil,
                              name: 'Clg Coil',
                              schedule: nil,
                              design_inlet_water_temperature: nil,
                              design_inlet_air_temperature: nil,
                              design_outlet_air_temperature: nil)

  clg_coil = OpenStudio::Model::CoilCoolingWater.new(model)

  # add to chilled water loop
  chilled_water_loop.addDemandBranchForComponent(clg_coil)

  # add to air loop if specified
  clg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  if name.nil?
    clg_coil.setName('Clg Coil')
  else
    clg_coil.setName(name)
  end

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  clg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # rated temperatures
  if design_inlet_water_temperature.nil?
    clg_coil.autosizeDesignInletWaterTemperature
  else
    clg_coil.setDesignInletWaterTemperature(design_inlet_water_temperature)
  end
  clg_coil.setDesignInletAirTemperature(design_inlet_air_temperature) unless design_inlet_air_temperature.nil?
  clg_coil.setDesignOutletAirTemperature(design_outlet_air_temperature) unless design_outlet_air_temperature.nil?

  # defaults
  clg_coil.setHeatExchangerConfiguration('CrossFlow')

  # coil controller properties
  # @note These inputs will get overwritten if addToNode or addDemandBranchForComponent is called on the htg_coil object after this
  clg_coil_controller = clg_coil.controllerWaterCoil.get
  clg_coil_controller.setName("#{clg_coil.name} Controller")
  clg_coil_controller.setAction('Reverse')
  clg_coil_controller.setMinimumActuatedFlow(0.0)

  return clg_coil
end

#create_coil_cooling_water_to_air_heat_pump_equation_fit(model, plant_loop, air_loop_node: nil, name: 'Water-to-Air HP Clg Coil', type: nil, cop: 3.4) ⇒ OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit

Prototype CoilCoolingWaterToAirHeatPumpEquationFit object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • plant_loop (<OpenStudio::Model::PlantLoop>)

    the coil will be placed on the demand side of this plant loop

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Water-to-Air HP Clg Coil')

    the name of the system, or nil in which case it will be defaulted

  • type (String) (defaults to: nil)

    the type of coil to reference the correct curve set

  • cop (Double) (defaults to: 3.4)

    rated cooling coefficient of performance

Returns:

  • (OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit)

    the cooling coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingWaterToAirHeatPumpEquationFit.rb', line 14

def create_coil_cooling_water_to_air_heat_pump_equation_fit(model,
                                                            plant_loop,
                                                            air_loop_node: nil,
                                                            name: 'Water-to-Air HP Clg Coil',
                                                            type: nil,
                                                            cop: 3.4)

  clg_coil = OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit.new(model)

  # add to air loop if specified
  clg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  clg_coil.setName(name)

  # add to plant loop
  if plant_loop.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No plant loop supplied for cooling coil')
    return false
  end
  plant_loop.addDemandBranchForComponent(clg_coil)

  # set coil cop
  if cop.nil?
    clg_coil.setRatedCoolingCoefficientofPerformance(3.4)
  else
    clg_coil.setRatedCoolingCoefficientofPerformance(cop)
  end

  # curve sets
  if type == 'OS default'
    # use OS default curves
  else # default curve set
    if model.version < OpenStudio::VersionString.new('3.2.0')
      clg_coil.setTotalCoolingCapacityCoefficient1(-4.30266987344639)
      clg_coil.setTotalCoolingCapacityCoefficient2(7.18536990534372)
      clg_coil.setTotalCoolingCapacityCoefficient3(-2.23946714486189)
      clg_coil.setTotalCoolingCapacityCoefficient4(0.139995928440879)
      clg_coil.setTotalCoolingCapacityCoefficient5(0.102660179888915)
      clg_coil.setSensibleCoolingCapacityCoefficient1(6.0019444814887)
      clg_coil.setSensibleCoolingCapacityCoefficient2(22.6300677244073)
      clg_coil.setSensibleCoolingCapacityCoefficient3(-26.7960783730934)
      clg_coil.setSensibleCoolingCapacityCoefficient4(-1.72374720346819)
      clg_coil.setSensibleCoolingCapacityCoefficient5(0.490644802367817)
      clg_coil.setSensibleCoolingCapacityCoefficient6(0.0693119353468141)
      clg_coil.setCoolingPowerConsumptionCoefficient1(-5.67775976415698)
      clg_coil.setCoolingPowerConsumptionCoefficient2(0.438988156976704)
      clg_coil.setCoolingPowerConsumptionCoefficient3(5.845277342193)
      clg_coil.setCoolingPowerConsumptionCoefficient4(0.141605667000125)
      clg_coil.setCoolingPowerConsumptionCoefficient5(-0.168727936032429)
    else
      if model.getCurveByName('Water to Air Heat Pump Total Cooling Capacity Curve').is_initialized
        total_cooling_capacity_curve = model.getCurveByName('Water to Air Heat Pump Total Cooling Capacity Curve').get
        total_cooling_capacity_curve = total_cooling_capacity_curve.to_CurveQuadLinear.get
      else
        total_cooling_capacity_curve = OpenStudio::Model::CurveQuadLinear.new(model)
        total_cooling_capacity_curve.setName('Water to Air Heat Pump Total Cooling Capacity Curve')
        total_cooling_capacity_curve.setCoefficient1Constant(-4.30266987344639)
        total_cooling_capacity_curve.setCoefficient2w(7.18536990534372)
        total_cooling_capacity_curve.setCoefficient3x(-2.23946714486189)
        total_cooling_capacity_curve.setCoefficient4y(0.139995928440879)
        total_cooling_capacity_curve.setCoefficient5z(0.102660179888915)
        total_cooling_capacity_curve.setMinimumValueofw(-100)
        total_cooling_capacity_curve.setMaximumValueofw(100)
        total_cooling_capacity_curve.setMinimumValueofx(-100)
        total_cooling_capacity_curve.setMaximumValueofx(100)
        total_cooling_capacity_curve.setMinimumValueofy(0)
        total_cooling_capacity_curve.setMaximumValueofy(100)
        total_cooling_capacity_curve.setMinimumValueofz(0)
        total_cooling_capacity_curve.setMaximumValueofz(100)
      end
      clg_coil.setTotalCoolingCapacityCurve(total_cooling_capacity_curve)

      if model.getCurveByName('Water to Air Heat Pump Sensible Cooling Capacity Curve').is_initialized
        sensible_cooling_capacity_curve = model.getCurveByName('Water to Air Heat Pump Sensible Cooling Capacity Curve').get
        sensible_cooling_capacity_curve = sensible_cooling_capacity_curve.to_CurveQuintLinear.get
      else
        sensible_cooling_capacity_curve = OpenStudio::Model::CurveQuintLinear.new(model)
        sensible_cooling_capacity_curve.setName('Water to Air Heat Pump Sensible Cooling Capacity Curve')
        sensible_cooling_capacity_curve.setCoefficient1Constant(6.0019444814887)
        sensible_cooling_capacity_curve.setCoefficient2v(22.6300677244073)
        sensible_cooling_capacity_curve.setCoefficient3w(-26.7960783730934)
        sensible_cooling_capacity_curve.setCoefficient4x(-1.72374720346819)
        sensible_cooling_capacity_curve.setCoefficient5y(0.490644802367817)
        sensible_cooling_capacity_curve.setCoefficient6z(0.0693119353468141)
        sensible_cooling_capacity_curve.setMinimumValueofw(-100)
        sensible_cooling_capacity_curve.setMaximumValueofw(100)
        sensible_cooling_capacity_curve.setMinimumValueofx(-100)
        sensible_cooling_capacity_curve.setMaximumValueofx(100)
        sensible_cooling_capacity_curve.setMinimumValueofy(0)
        sensible_cooling_capacity_curve.setMaximumValueofy(100)
        sensible_cooling_capacity_curve.setMinimumValueofz(0)
        sensible_cooling_capacity_curve.setMaximumValueofz(100)
      end
      clg_coil.setSensibleCoolingCapacityCurve(sensible_cooling_capacity_curve)

      if model.getCurveByName('Water to Air Heat Pump Cooling Power Consumption Curve').is_initialized
        cooling_power_consumption_curve = model.getCurveByName('Water to Air Heat Pump Cooling Power Consumption Curve').get
        cooling_power_consumption_curve = cooling_power_consumption_curve.to_CurveQuadLinear.get
      else
        cooling_power_consumption_curve = OpenStudio::Model::CurveQuadLinear.new(model)
        cooling_power_consumption_curve.setName('Water to Air Heat Pump Cooling Power Consumption Curve')
        cooling_power_consumption_curve.setCoefficient1Constant(-5.67775976415698)
        cooling_power_consumption_curve.setCoefficient2w(0.438988156976704)
        cooling_power_consumption_curve.setCoefficient3x(5.845277342193)
        cooling_power_consumption_curve.setCoefficient4y(0.141605667000125)
        cooling_power_consumption_curve.setCoefficient5z(-0.168727936032429)
        cooling_power_consumption_curve.setMinimumValueofw(-100)
        cooling_power_consumption_curve.setMaximumValueofw(100)
        cooling_power_consumption_curve.setMinimumValueofx(-100)
        cooling_power_consumption_curve.setMaximumValueofx(100)
        cooling_power_consumption_curve.setMinimumValueofy(0)
        cooling_power_consumption_curve.setMaximumValueofy(100)
        cooling_power_consumption_curve.setMinimumValueofz(0)
        cooling_power_consumption_curve.setMaximumValueofz(100)
      end
      clg_coil.setCoolingPowerConsumptionCurve(cooling_power_consumption_curve)
    end

    # part load fraction correlation curve added as a required curve in OS v3.7.0
    if model.version > OpenStudio::VersionString.new('3.6.1')
      if model.getCurveByName('Water to Air Heat Pump Part Load Fraction Correlation Curve').is_initialized
        part_load_correlation_curve = model.getCurveByName('Water to Air Heat Pump Part Load Fraction Correlation Curve').get
        part_load_correlation_curve = part_load_correlation_curve.to_CurveLinear.get
      else
        part_load_correlation_curve = OpenStudio::Model::CurveLinear.new(model)
        part_load_correlation_curve.setName('Water to Air Heat Pump Part Load Fraction Correlation Curve')
        part_load_correlation_curve.setCoefficient1Constant(0.833746458696111)
        part_load_correlation_curve.setCoefficient2x(0.166253541303889)
        part_load_correlation_curve.setMinimumValueofx(0)
        part_load_correlation_curve.setMaximumValueofx(1)
        part_load_correlation_curve.setMinimumCurveOutput(0)
        part_load_correlation_curve.setMaximumCurveOutput(1)
      end
      clg_coil.setPartLoadFractionCorrelationCurve(part_load_correlation_curve)
    end
  end

  return clg_coil
end

#create_coil_heating_dx_single_speed(model, air_loop_node: nil, name: '1spd DX Htg Coil', schedule: nil, type: nil, cop: 3.3, defrost_strategy: 'ReverseCycle') ⇒ OpenStudio::Model::CoilHeatingDXSingleSpeed

Prototype CoilHeatingDXSingleSpeed object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: '1spd DX Htg Coil')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • type (String) (defaults to: nil)

    the type of single speed DX coil to reference the correct curve set

  • cop (Double) (defaults to: 3.3)

    rated heating coefficient of performance

  • defrost_strategy (String) (defaults to: 'ReverseCycle')

    type of defrost strategy. options are reverse-cycle or resistive

Returns:

  • (OpenStudio::Model::CoilHeatingDXSingleSpeed)

    the DX heating coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingDXSingleSpeed.rb', line 15

def create_coil_heating_dx_single_speed(model,
                                        air_loop_node: nil,
                                        name: '1spd DX Htg Coil',
                                        schedule: nil,
                                        type: nil,
                                        cop: 3.3,
                                        defrost_strategy: 'ReverseCycle')

  htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new(model)

  # add to air loop if specified
  htg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  htg_coil.setName(name)

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  htg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # set coil cop
  if cop.nil?
    htg_coil.setRatedCOP(3.3)
  else
    htg_coil.setRatedCOP(cop)
  end

  htg_cap_f_of_temp = nil
  htg_cap_f_of_flow = nil
  htg_energy_input_ratio_f_of_temp = nil
  htg_energy_input_ratio_f_of_flow = nil
  htg_part_load_fraction = nil
  def_eir_f_of_temp = nil

  # curve sets
  case type
  when 'OS default'
    # use OS defaults
  when 'Residential Central Air Source HP'
    # Performance curves
    # These coefficients are in IP UNITS
    heat_cap_ft_coeffs_ip = [0.566333415, -0.000744164, -0.0000103, 0.009414634, 0.0000506, -0.00000675]
    heat_eir_ft_coeffs_ip = [0.718398423, 0.003498178, 0.000142202, -0.005724331, 0.00014085, -0.000215321]
    heat_cap_fflow_coeffs = [0.694045465, 0.474207981, -0.168253446]
    heat_eir_fflow_coeffs = [2.185418751, -1.942827919, 0.757409168]
    heat_plf_fplr_coeffs = [0.8, 0.2, 0]
    defrost_eir_coeffs = [0.1528, 0, 0, 0, 0, 0]

    # Convert coefficients from IP to SI
    heat_cap_ft_coeffs_si = convert_curve_biquadratic(heat_cap_ft_coeffs_ip)
    heat_eir_ft_coeffs_si = convert_curve_biquadratic(heat_eir_ft_coeffs_ip)

    htg_cap_f_of_temp = create_curve_biquadratic(model, heat_cap_ft_coeffs_si, 'Heat-Cap-fT', 0, 100, 0, 100, nil, nil)
    htg_cap_f_of_flow = create_curve_quadratic(model, heat_cap_fflow_coeffs, 'Heat-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    htg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, heat_eir_ft_coeffs_si, 'Heat-EIR-fT', 0, 100, 0, 100, nil, nil)
    htg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, heat_eir_fflow_coeffs, 'Heat-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    htg_part_load_fraction = create_curve_quadratic(model, heat_plf_fplr_coeffs, 'Heat-PLF-fPLR', 0, 1, 0, 1, is_dimensionless = true)

    # Heating defrost curve for reverse cycle
    def_eir_f_of_temp = create_curve_biquadratic(model, defrost_eir_coeffs, 'DefrostEIR', -100, 100, -100, 100, nil, nil)
  when 'Residential Minisplit HP'
    # Performance curves
    # These coefficients are in SI UNITS
    heat_cap_ft_coeffs_si = [1.14715889038462, -0.010386676170938, 0, 0.00865384615384615, 0, 0]
    heat_eir_ft_coeffs_si = [0.9999941697687026, 0.004684593830254383, 5.901286675833333e-05, -0.0028624467783091973, 1.3041120194135802e-05, -0.00016172918478765433]
    heat_cap_fflow_coeffs = [1, 0, 0]
    heat_eir_fflow_coeffs = [1, 0, 0]
    heat_plf_fplr_coeffs = [0.89, 0.11, 0]
    defrost_eir_coeffs = [0.1528, 0, 0, 0, 0, 0]

    htg_cap_f_of_temp = create_curve_biquadratic(model, heat_cap_ft_coeffs_si, 'Heat-Cap-fT', -100, 100, -100, 100, nil, nil)
    htg_cap_f_of_flow = create_curve_quadratic(model, heat_cap_fflow_coeffs, 'Heat-Cap-fFF', 0, 2, 0, 2, is_dimensionless = true)
    htg_energy_input_ratio_f_of_temp = create_curve_biquadratic(model, heat_eir_ft_coeffs_si, 'Heat-EIR-fT', -100, 100, -100, 100, nil, nil)
    htg_energy_input_ratio_f_of_flow = create_curve_quadratic(model, heat_eir_fflow_coeffs, 'Heat-EIR-fFF', 0, 2, 0, 2, is_dimensionless = true)
    htg_part_load_fraction = create_curve_quadratic(model, heat_plf_fplr_coeffs, 'Heat-PLF-fPLR', 0, 1, 0.6, 1, is_dimensionless = true)

    # Heating defrost curve for reverse cycle
    def_eir_f_of_temp = create_curve_biquadratic(model, defrost_eir_coeffs, 'Defrost EIR', -100, 100, -100, 100, nil, nil)
  else # default curve set
    htg_cap_f_of_temp = OpenStudio::Model::CurveCubic.new(model)
    htg_cap_f_of_temp.setName("#{htg_coil.name} Htg Cap Func of Temp Curve")
    htg_cap_f_of_temp.setCoefficient1Constant(0.758746)
    htg_cap_f_of_temp.setCoefficient2x(0.027626)
    htg_cap_f_of_temp.setCoefficient3xPOW2(0.000148716)
    htg_cap_f_of_temp.setCoefficient4xPOW3(0.0000034992)
    htg_cap_f_of_temp.setMinimumValueofx(-20.0)
    htg_cap_f_of_temp.setMaximumValueofx(20.0)

    htg_cap_f_of_flow = OpenStudio::Model::CurveCubic.new(model)
    htg_cap_f_of_flow.setName("#{htg_coil.name} Htg Cap Func of Flow Frac Curve")
    htg_cap_f_of_flow.setCoefficient1Constant(0.84)
    htg_cap_f_of_flow.setCoefficient2x(0.16)
    htg_cap_f_of_flow.setCoefficient3xPOW2(0.0)
    htg_cap_f_of_flow.setCoefficient4xPOW3(0.0)
    htg_cap_f_of_flow.setMinimumValueofx(0.5)
    htg_cap_f_of_flow.setMaximumValueofx(1.5)

    htg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveCubic.new(model)
    htg_energy_input_ratio_f_of_temp.setName("#{htg_coil.name} EIR Func of Temp Curve")
    htg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.19248)
    htg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.0300438)
    htg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00103745)
    htg_energy_input_ratio_f_of_temp.setCoefficient4xPOW3(-0.000023328)
    htg_energy_input_ratio_f_of_temp.setMinimumValueofx(-20.0)
    htg_energy_input_ratio_f_of_temp.setMaximumValueofx(20.0)

    htg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)
    htg_energy_input_ratio_f_of_flow.setName("#{htg_coil.name} EIR Func of Flow Frac Curve")
    htg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.3824)
    htg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.4336)
    htg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0512)
    htg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.0)
    htg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.0)

    htg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)
    htg_part_load_fraction.setName("#{htg_coil.name} PLR Correlation Curve")
    htg_part_load_fraction.setCoefficient1Constant(0.85)
    htg_part_load_fraction.setCoefficient2x(0.15)
    htg_part_load_fraction.setCoefficient3xPOW2(0.0)
    htg_part_load_fraction.setMinimumValueofx(0.0)
    htg_part_load_fraction.setMaximumValueofx(1.0)

    unless defrost_strategy == 'Resistive'
      def_eir_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
      def_eir_f_of_temp.setName("#{htg_coil.name} Defrost EIR Func of Temp Curve")
      def_eir_f_of_temp.setCoefficient1Constant(0.297145)
      def_eir_f_of_temp.setCoefficient2x(0.0430933)
      def_eir_f_of_temp.setCoefficient3xPOW2(-0.000748766)
      def_eir_f_of_temp.setCoefficient4y(0.00597727)
      def_eir_f_of_temp.setCoefficient5yPOW2(0.000482112)
      def_eir_f_of_temp.setCoefficient6xTIMESY(-0.000956448)
      def_eir_f_of_temp.setMinimumValueofx(-23.33333)
      def_eir_f_of_temp.setMaximumValueofx(29.44444)
      def_eir_f_of_temp.setMinimumValueofy(-23.33333)
      def_eir_f_of_temp.setMaximumValueofy(29.44444)
    end
  end

  if type == 'PSZ-AC'
    htg_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-12.2)
    htg_coil.setMaximumOutdoorDryBulbTemperatureforDefrostOperation(1.67)
    htg_coil.setCrankcaseHeaterCapacity(50.0)
    htg_coil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(4.4)
    htg_coil.setDefrostControl('OnDemand')

    def_eir_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)
    def_eir_f_of_temp.setName("#{htg_coil.name} Defrost EIR Func of Temp Curve")
    def_eir_f_of_temp.setCoefficient1Constant(0.297145)
    def_eir_f_of_temp.setCoefficient2x(0.0430933)
    def_eir_f_of_temp.setCoefficient3xPOW2(-0.000748766)
    def_eir_f_of_temp.setCoefficient4y(0.00597727)
    def_eir_f_of_temp.setCoefficient5yPOW2(0.000482112)
    def_eir_f_of_temp.setCoefficient6xTIMESY(-0.000956448)
    def_eir_f_of_temp.setMinimumValueofx(-23.33333)
    def_eir_f_of_temp.setMaximumValueofx(29.44444)
    def_eir_f_of_temp.setMinimumValueofy(-23.33333)
    def_eir_f_of_temp.setMaximumValueofy(29.44444)
  end

  htg_coil.setTotalHeatingCapacityFunctionofTemperatureCurve(htg_cap_f_of_temp) unless htg_cap_f_of_temp.nil?
  htg_coil.setTotalHeatingCapacityFunctionofFlowFractionCurve(htg_cap_f_of_flow) unless htg_cap_f_of_flow.nil?
  htg_coil.setEnergyInputRatioFunctionofTemperatureCurve(htg_energy_input_ratio_f_of_temp) unless htg_energy_input_ratio_f_of_temp.nil?
  htg_coil.setEnergyInputRatioFunctionofFlowFractionCurve(htg_energy_input_ratio_f_of_flow) unless htg_energy_input_ratio_f_of_flow.nil?
  htg_coil.setPartLoadFractionCorrelationCurve(htg_part_load_fraction) unless htg_part_load_fraction.nil?
  htg_coil.setDefrostEnergyInputRatioFunctionofTemperatureCurve(def_eir_f_of_temp) unless def_eir_f_of_temp.nil?
  htg_coil.setDefrostStrategy(defrost_strategy)
  htg_coil.setDefrostControl('OnDemand')

  return htg_coil
end

#create_coil_heating_electric(model, air_loop_node: nil, name: 'Electric Htg Coil', schedule: nil, nominal_capacity: nil, efficiency: 1.0) ⇒ OpenStudio::Model::CoilHeatingElectric

Prototype CoilHeatingElectric object

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Electric Htg Coil')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • nominal_capacity (Double) (defaults to: nil)

    rated nominal capacity

  • efficiency (Double) (defaults to: 1.0)

    rated heating efficiency

Returns:

  • (OpenStudio::Model::CoilHeatingElectric)

    the electric heating coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingElectric.rb', line 13

def create_coil_heating_electric(model,
                                 air_loop_node: nil,
                                 name: 'Electric Htg Coil',
                                 schedule: nil,
                                 nominal_capacity: nil,
                                 efficiency: 1.0)

  htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model)

  # add to air loop if specified
  htg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  htg_coil.setName(name)

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  htg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # set capacity
  htg_coil.setNominalCapacity(nominal_capacity) unless nominal_capacity.nil?

  # set efficiency
  htg_coil.setEfficiency(efficiency) unless efficiency.nil?

  return htg_coil
end

#create_coil_heating_gas(model, air_loop_node: nil, name: 'Gas Htg Coil', schedule: nil, nominal_capacity: nil, efficiency: 0.80) ⇒ OpenStudio::Model::CoilHeatingGas

Prototype CoilHeatingGas object

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Gas Htg Coil')

    the name of the system, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • nominal_capacity (Double) (defaults to: nil)

    rated nominal capacity

  • efficiency (Double) (defaults to: 0.80)

    rated heating efficiency

Returns:

  • (OpenStudio::Model::CoilHeatingGas)

    the gas heating coil



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.CoilHeatingGas.rb', line 13

def create_coil_heating_gas(model,
                            air_loop_node: nil,
                            name: 'Gas Htg Coil',
                            schedule: nil,
                            nominal_capacity: nil,
                            efficiency: 0.80)

  htg_coil = OpenStudio::Model::CoilHeatingGas.new(model)

  # add to air loop if specified
  htg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  htg_coil.setName(name)

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  htg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # set capacity
  htg_coil.setNominalCapacity(nominal_capacity) unless nominal_capacity.nil?

  # set efficiency
  htg_coil.setGasBurnerEfficiency(efficiency)

  # defaults
  if model.version < OpenStudio::VersionString.new('3.7.0')
    htg_coil.setParasiticElectricLoad(0.0)
    htg_coil.setParasiticGasLoad(0.0)
  else
    htg_coil.setOnCycleParasiticElectricLoad(0.0)
    htg_coil.setOffCycleParasiticGasLoad(0.0)
  end

  return htg_coil
end

#create_coil_heating_water(model, hot_water_loop, air_loop_node: nil, name: 'Htg Coil', schedule: nil, rated_inlet_water_temperature: nil, rated_outlet_water_temperature: nil, rated_inlet_air_temperature: 16.6, rated_outlet_air_temperature: 32.2, controller_convergence_tolerance: 0.1) ⇒ OpenStudio::Model::CoilHeatingWater

Prototype CoilHeatingWater object

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • hot_water_loop (<OpenStudio::Model::PlantLoop>)

    the coil will be placed on the demand side of this plant loop

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Htg Coil')

    the name of the coil, or nil in which case it will be defaulted

  • schedule (String) (defaults to: nil)

    name of the availability schedule, or [<OpenStudio::Model::Schedule>] Schedule object, or nil in which case default to always on

  • rated_inlet_water_temperature (Double) (defaults to: nil)

    rated inlet water temperature in degrees Celsius, default is hot water loop design exit temperature

  • rated_outlet_water_temperature (Double) (defaults to: nil)

    rated outlet water temperature in degrees Celsius, default is hot water loop design return temperature

  • rated_inlet_air_temperature (Double) (defaults to: 16.6)

    rated inlet air temperature in degrees Celsius, default is 16.6 (62F)

  • rated_outlet_air_temperature (Double) (defaults to: 32.2)

    rated outlet air temperature in degrees Celsius, default is 32.2 (90F)

  • controller_convergence_tolerance (Double) (defaults to: 0.1)

    controller convergence tolerance

Returns:

  • (OpenStudio::Model::CoilHeatingWater)

    the heating coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingWater.rb', line 17

def create_coil_heating_water(model,
                              hot_water_loop,
                              air_loop_node: nil,
                              name: 'Htg Coil',
                              schedule: nil,
                              rated_inlet_water_temperature: nil,
                              rated_outlet_water_temperature: nil,
                              rated_inlet_air_temperature: 16.6,
                              rated_outlet_air_temperature: 32.2,
                              controller_convergence_tolerance: 0.1)

  htg_coil = OpenStudio::Model::CoilHeatingWater.new(model)

  # add to hot water loop
  hot_water_loop.addDemandBranchForComponent(htg_coil)

  # add to air loop if specified
  htg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  if name.nil?
    htg_coil.setName('Htg Coil')
  else
    htg_coil.setName(name)
  end

  # set coil availability schedule
  if schedule.nil?
    # default always on
    coil_availability_schedule = model.alwaysOnDiscreteSchedule
  elsif schedule.instance_of?(String)
    coil_availability_schedule = model_add_schedule(model, schedule)

    if coil_availability_schedule.nil? && schedule == 'alwaysOffDiscreteSchedule'
      coil_availability_schedule = model.alwaysOffDiscreteSchedule
    elsif coil_availability_schedule.nil?
      coil_availability_schedule = model.alwaysOnDiscreteSchedule
    end
  elsif !schedule.to_Schedule.empty?
    coil_availability_schedule = schedule
  end
  htg_coil.setAvailabilitySchedule(coil_availability_schedule)

  # rated water temperatures, use hot water loop temperatures if defined
  if rated_inlet_water_temperature.nil?
    rated_inlet_water_temperature = hot_water_loop.sizingPlant.designLoopExitTemperature
    htg_coil.setRatedInletWaterTemperature(rated_inlet_water_temperature)
  else
    htg_coil.setRatedInletWaterTemperature(rated_inlet_water_temperature)
  end
  if rated_outlet_water_temperature.nil?
    rated_outlet_water_temperature = rated_inlet_water_temperature - hot_water_loop.sizingPlant.loopDesignTemperatureDifference
    htg_coil.setRatedOutletWaterTemperature(rated_outlet_water_temperature)
  else
    htg_coil.setRatedOutletWaterTemperature(rated_outlet_water_temperature)
  end

  # rated air temperatures
  if rated_inlet_air_temperature.nil?
    htg_coil.setRatedInletAirTemperature(16.6)
  else
    htg_coil.setRatedInletAirTemperature(rated_inlet_air_temperature)
  end
  if rated_outlet_air_temperature.nil?
    htg_coil.setRatedOutletAirTemperature(32.2)
  else
    htg_coil.setRatedOutletAirTemperature(rated_outlet_air_temperature)
  end

  # coil controller properties
  # @note These inputs will get overwritten if addToNode or addDemandBranchForComponent is called on the htg_coil object after this
  htg_coil_controller = htg_coil.controllerWaterCoil.get
  htg_coil_controller.setName("#{htg_coil.name} Controller")
  htg_coil_controller.setMinimumActuatedFlow(0.0)
  htg_coil_controller.setControllerConvergenceTolerance(controller_convergence_tolerance) unless controller_convergence_tolerance.nil?

  return htg_coil
end

#create_coil_heating_water_to_air_heat_pump_equation_fit(model, plant_loop, air_loop_node: nil, name: 'Water-to-Air HP Htg Coil', type: nil, cop: 4.2) ⇒ OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit

Prototype CoilHeatingWaterToAirHeatPumpEquationFit object Enters in default curves for coil by type of coil

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • plant_loop (<OpenStudio::Model::PlantLoop>)

    the coil will be placed on the demand side of this plant loop

  • air_loop_node (<OpenStudio::Model::Node>) (defaults to: nil)

    the coil will be placed on this node of the air loop

  • name (String) (defaults to: 'Water-to-Air HP Htg Coil')

    the name of the system, or nil in which case it will be defaulted

  • type (String) (defaults to: nil)

    the type of coil to reference the correct curve set

  • cop (Double) (defaults to: 4.2)

    rated heating coefficient of performance

Returns:

  • (OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit)

    the heating coil



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingWaterToAirHeatPumpEquationFit.rb', line 14

def create_coil_heating_water_to_air_heat_pump_equation_fit(model,
                                                            plant_loop,
                                                            air_loop_node: nil,
                                                            name: 'Water-to-Air HP Htg Coil',
                                                            type: nil,
                                                            cop: 4.2)

  htg_coil = OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit.new(model)

  # add to air loop if specified
  htg_coil.addToNode(air_loop_node) unless air_loop_node.nil?

  # set coil name
  htg_coil.setName(name)

  # add to plant loop
  if plant_loop.nil?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'No plant loop supplied for heating coil')
    return false
  end
  plant_loop.addDemandBranchForComponent(htg_coil)

  # set coil cop
  if cop.nil?
    htg_coil.setRatedHeatingCoefficientofPerformance(4.2)
  else
    htg_coil.setRatedHeatingCoefficientofPerformance(cop)
  end

  # curve sets
  if type == 'OS default'
    # use OS default curves
  else # default curve set
    if model.version < OpenStudio::VersionString.new('3.2.0')
      htg_coil.setHeatingCapacityCoefficient1(0.237847462869254)
      htg_coil.setHeatingCapacityCoefficient2(-3.35823796081626)
      htg_coil.setHeatingCapacityCoefficient3(3.80640467406376)
      htg_coil.setHeatingCapacityCoefficient4(0.179200417311554)
      htg_coil.setHeatingCapacityCoefficient5(0.12860719846082)
      htg_coil.setHeatingPowerConsumptionCoefficient1(-3.79175529243238)
      htg_coil.setHeatingPowerConsumptionCoefficient2(3.38799239505527)
      htg_coil.setHeatingPowerConsumptionCoefficient3(1.5022612076303)
      htg_coil.setHeatingPowerConsumptionCoefficient4(-0.177653510577989)
      htg_coil.setHeatingPowerConsumptionCoefficient5(-0.103079864171839)
    else
      if model.getCurveByName('Water to Air Heat Pump Heating Capacity Curve').is_initialized
        heating_capacity_curve = model.getCurveByName('Water to Air Heat Pump Heating Capacity Curve').get
        heating_capacity_curve = heating_capacity_curve.to_CurveQuadLinear.get
      else
        heating_capacity_curve = OpenStudio::Model::CurveQuadLinear.new(model)
        heating_capacity_curve.setName('Water to Air Heat Pump Heating Capacity Curve')
        heating_capacity_curve.setCoefficient1Constant(0.237847462869254)
        heating_capacity_curve.setCoefficient2w(-3.35823796081626)
        heating_capacity_curve.setCoefficient3x(3.80640467406376)
        heating_capacity_curve.setCoefficient4y(0.179200417311554)
        heating_capacity_curve.setCoefficient5z(0.12860719846082)
        heating_capacity_curve.setMinimumValueofw(-100)
        heating_capacity_curve.setMaximumValueofw(100)
        heating_capacity_curve.setMinimumValueofx(-100)
        heating_capacity_curve.setMaximumValueofx(100)
        heating_capacity_curve.setMinimumValueofy(0)
        heating_capacity_curve.setMaximumValueofy(100)
        heating_capacity_curve.setMinimumValueofz(0)
        heating_capacity_curve.setMaximumValueofz(100)
      end
      htg_coil.setHeatingCapacityCurve(heating_capacity_curve)

      if model.getCurveByName('Water to Air Heat Pump Heating Power Consumption Curve').is_initialized
        heating_power_consumption_curve = model.getCurveByName('Water to Air Heat Pump Heating Power Consumption Curve').get
        heating_power_consumption_curve = heating_power_consumption_curve.to_CurveQuadLinear.get
      else
        heating_power_consumption_curve = OpenStudio::Model::CurveQuadLinear.new(model)
        heating_power_consumption_curve.setName('Water to Air Heat Pump Heating Power Consumption Curve')
        heating_power_consumption_curve.setCoefficient1Constant(-3.79175529243238)
        heating_power_consumption_curve.setCoefficient2w(3.38799239505527)
        heating_power_consumption_curve.setCoefficient3x(1.5022612076303)
        heating_power_consumption_curve.setCoefficient4y(-0.177653510577989)
        heating_power_consumption_curve.setCoefficient5z(-0.103079864171839)
        heating_power_consumption_curve.setMinimumValueofw(-100)
        heating_power_consumption_curve.setMaximumValueofw(100)
        heating_power_consumption_curve.setMinimumValueofx(-100)
        heating_power_consumption_curve.setMaximumValueofx(100)
        heating_power_consumption_curve.setMinimumValueofy(0)
        heating_power_consumption_curve.setMaximumValueofy(100)
        heating_power_consumption_curve.setMinimumValueofz(0)
        heating_power_consumption_curve.setMaximumValueofz(100)
      end
      htg_coil.setHeatingPowerConsumptionCurve(heating_power_consumption_curve)
    end

    # part load fraction correlation curve added as a required curve in OS v3.7.0
    if model.version > OpenStudio::VersionString.new('3.6.1')
      if model.getCurveByName('Water to Air Heat Pump Part Load Fraction Correlation Curve').is_initialized
        part_load_correlation_curve = model.getCurveByName('Water to Air Heat Pump Part Load Fraction Correlation Curve').get
        part_load_correlation_curve = part_load_correlation_curve.to_CurveLinear.get
      else
        part_load_correlation_curve = OpenStudio::Model::CurveLinear.new(model)
        part_load_correlation_curve.setName('Water to Air Heat Pump Part Load Fraction Correlation Curve')
        part_load_correlation_curve.setCoefficient1Constant(0.833746458696111)
        part_load_correlation_curve.setCoefficient2x(0.166253541303889)
        part_load_correlation_curve.setMinimumValueofx(0)
        part_load_correlation_curve.setMaximumValueofx(1)
        part_load_correlation_curve.setMinimumCurveOutput(0)
        part_load_correlation_curve.setMaximumCurveOutput(1)
      end
      htg_coil.setPartLoadFractionCorrelationCurve(part_load_correlation_curve)
    end
  end

  return htg_coil
end

#create_curve_bicubic(model, coeffs, crv_name, min_x, max_x, min_y, max_y, min_out, max_out) ⇒ OpenStudio::Model::CurveBicubic

Create a bicubic curve of the form z = C1 + C2*x + C3*x^2 + C4*y + C5*y^2 + C6*x*y + C7*x^3 + C8*y^3 + C9*x^2*y + C10*x*y^2

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • coeffs (Array<Double>)

    an array of 10 coefficients, in order

  • crv_name (String)

    the name of the curve

  • min_x (Double)

    the minimum value of independent variable X that will be used

  • max_x (Double)

    the maximum value of independent variable X that will be used

  • min_y (Double)

    the minimum value of independent variable Y that will be used

  • max_y (Double)

    the maximum value of independent variable Y that will be used

  • min_out (Double)

    the minimum value of dependent variable Z

  • max_out (Double)

    the maximum value of dependent variable Z

Returns:

  • (OpenStudio::Model::CurveBicubic)

    a bicubic curve

Author:

  • Scott Horowitz, NREL



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 535

def create_curve_bicubic(model, coeffs, crv_name, min_x, max_x, min_y, max_y, min_out, max_out)
  curve = OpenStudio::Model::CurveBicubic.new(model)
  curve.setName(crv_name)
  curve.setCoefficient1Constant(coeffs[0])
  curve.setCoefficient2x(coeffs[1])
  curve.setCoefficient3xPOW2(coeffs[2])
  curve.setCoefficient4y(coeffs[3])
  curve.setCoefficient5yPOW2(coeffs[4])
  curve.setCoefficient6xTIMESY(coeffs[5])
  curve.setCoefficient7xPOW3(coeffs[6])
  curve.setCoefficient8yPOW3(coeffs[7])
  curve.setCoefficient9xPOW2TIMESY(coeffs[8])
  curve.setCoefficient10xTIMESYPOW2(coeffs[9])
  curve.setMinimumValueofx(min_x) unless min_x.nil?
  curve.setMaximumValueofx(max_x) unless max_x.nil?
  curve.setMinimumValueofy(min_y) unless min_y.nil?
  curve.setMaximumValueofy(max_y) unless max_y.nil?
  curve.setMinimumCurveOutput(min_out) unless min_out.nil?
  curve.setMaximumCurveOutput(max_out) unless max_out.nil?
  return curve
end

#create_curve_biquadratic(model, coeffs, crv_name, min_x, max_x, min_y, max_y, min_out, max_out) ⇒ OpenStudio::Model::CurveBiquadratic

Create a biquadratic curve of the form z = C1 + C2*x + C3*x^2 + C4*y + C5*y^2 + C6*x*y

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • coeffs (Array<Double>)

    an array of 6 coefficients, in order

  • crv_name (String)

    the name of the curve

  • min_x (Double)

    the minimum value of independent variable X that will be used

  • max_x (Double)

    the maximum value of independent variable X that will be used

  • min_y (Double)

    the minimum value of independent variable Y that will be used

  • max_y (Double)

    the maximum value of independent variable Y that will be used

  • min_out (Double)

    the minimum value of dependent variable Z

  • max_out (Double)

    the maximum value of dependent variable Z

Returns:

  • (OpenStudio::Model::CurveBiquadratic)

    a biquadratic curve

Author:

  • Scott Horowitz, NREL



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 503

def create_curve_biquadratic(model, coeffs, crv_name, min_x, max_x, min_y, max_y, min_out, max_out)
  curve = OpenStudio::Model::CurveBiquadratic.new(model)
  curve.setName(crv_name)
  curve.setCoefficient1Constant(coeffs[0])
  curve.setCoefficient2x(coeffs[1])
  curve.setCoefficient3xPOW2(coeffs[2])
  curve.setCoefficient4y(coeffs[3])
  curve.setCoefficient5yPOW2(coeffs[4])
  curve.setCoefficient6xTIMESY(coeffs[5])
  curve.setMinimumValueofx(min_x) unless min_x.nil?
  curve.setMaximumValueofx(max_x) unless max_x.nil?
  curve.setMinimumValueofy(min_y) unless min_y.nil?
  curve.setMaximumValueofy(max_y) unless max_y.nil?
  curve.setMinimumCurveOutput(min_out) unless min_out.nil?
  curve.setMaximumCurveOutput(max_out) unless max_out.nil?
  return curve
end

#create_curve_cubic(model, coeffs, crv_name, min_x, max_x, min_out, max_out) ⇒ OpenStudio::Model::CurveCubic

Create a cubic curve of the form z = C1 + C2*x + C3*x^2 + C4*x^3

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • coeffs (Array<Double>)

    an array of 4 coefficients, in order

  • crv_name (String)

    the name of the curve

  • min_x (Double)

    the minimum value of independent variable X that will be used

  • max_x (Double)

    the maximum value of independent variable X that will be used

  • min_out (Double)

    the minimum value of dependent variable Z

  • max_out (Double)

    the maximum value of dependent variable Z

Returns:

  • (OpenStudio::Model::CurveCubic)

    a cubic curve

Author:

  • Scott Horowitz, NREL



600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 600

def create_curve_cubic(model, coeffs, crv_name, min_x, max_x, min_out, max_out)
  curve = OpenStudio::Model::CurveCubic.new(model)
  curve.setName(crv_name)
  curve.setCoefficient1Constant(coeffs[0])
  curve.setCoefficient2x(coeffs[1])
  curve.setCoefficient3xPOW2(coeffs[2])
  curve.setCoefficient4xPOW3(coeffs[3])
  curve.setMinimumValueofx(min_x) unless min_x.nil?
  curve.setMaximumValueofx(max_x) unless max_x.nil?
  curve.setMinimumCurveOutput(min_out) unless min_out.nil?
  curve.setMaximumCurveOutput(max_out) unless max_out.nil?
  return curve
end

#create_curve_exponent(model, coeffs, crv_name, min_x, max_x, min_out, max_out) ⇒ OpenStudio::Model::CurveExponent

Create an exponential curve of the form z = C1 + C2*x^C3

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • coeffs (Array<Double>)

    an array of 3 coefficients, in order

  • crv_name (String)

    the name of the curve

  • min_x (Double)

    the minimum value of independent variable X that will be used

  • max_x (Double)

    the maximum value of independent variable X that will be used

  • min_out (Double)

    the minimum value of dependent variable Z

  • max_out (Double)

    the maximum value of dependent variable Z

Returns:

  • (OpenStudio::Model::CurveExponent)

    an exponent curve

Author:

  • Scott Horowitz, NREL



626
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 626

def create_curve_exponent(model, coeffs, crv_name, min_x, max_x, min_out, max_out)
  curve = OpenStudio::Model::CurveExponent.new(model)
  curve.setName(crv_name)
  curve.setCoefficient1Constant(coeffs[0])
  curve.setCoefficient2Constant(coeffs[1])
  curve.setCoefficient3Constant(coeffs[2])
  curve.setMinimumValueofx(min_x) unless min_x.nil?
  curve.setMaximumValueofx(max_x) unless max_x.nil?
  curve.setMinimumCurveOutput(min_out) unless min_out.nil?
  curve.setMaximumCurveOutput(max_out) unless max_out.nil?
  return curve
end

#create_curve_quadratic(model, coeffs, crv_name, min_x, max_x, min_out, max_out, is_dimensionless = false) ⇒ OpenStudio::Model::CurveQuadratic

Create a quadratic curve of the form z = C1 + C2*x + C3*x^2

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • coeffs (Array<Double>)

    an array of 3 coefficients, in order

  • crv_name (String)

    the name of the curve

  • min_x (Double)

    the minimum value of independent variable X that will be used

  • max_x (Double)

    the maximum value of independent variable X that will be used

  • min_out (Double)

    the minimum value of dependent variable Z

  • max_out (Double)

    the maximum value of dependent variable Z

  • is_dimensionless (Boolean) (defaults to: false)

    if true, the X independent variable is considered unitless and the resulting output dependent variable is considered unitless

Returns:

  • (OpenStudio::Model::CurveQuadratic)

    a quadratic curve

Author:

  • Scott Horowitz, NREL



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 571

def create_curve_quadratic(model, coeffs, crv_name, min_x, max_x, min_out, max_out, is_dimensionless = false)
  curve = OpenStudio::Model::CurveQuadratic.new(model)
  curve.setName(crv_name)
  curve.setCoefficient1Constant(coeffs[0])
  curve.setCoefficient2x(coeffs[1])
  curve.setCoefficient3xPOW2(coeffs[2])
  curve.setMinimumValueofx(min_x) unless min_x.nil?
  curve.setMaximumValueofx(max_x) unless max_x.nil?
  curve.setMinimumCurveOutput(min_out) unless min_out.nil?
  curve.setMaximumCurveOutput(max_out) unless max_out.nil?
  if is_dimensionless
    curve.setInputUnitTypeforX('Dimensionless')
    curve.setOutputUnitType('Dimensionless')
  end
  return curve
end

#create_fan_constant_volume(model, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanConstantVolume

creates a constant volume fan

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanConstantVolume)

    constant volume fan object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 99

def create_fan_constant_volume(model,
                               fan_name: nil,
                               fan_efficiency: nil,
                               pressure_rise: nil,
                               motor_efficiency: nil,
                               motor_in_airstream_fraction: nil,
                               end_use_subcategory: nil)
  fan = OpenStudio::Model::FanConstantVolume.new(model)
  PrototypeFan.apply_base_fan_variables(fan,
                                        fan_name: fan_name,
                                        fan_efficiency: fan_efficiency,
                                        pressure_rise: pressure_rise,
                                        end_use_subcategory: end_use_subcategory)
  fan.setMotorEfficiency(motor_efficiency) unless motor_efficiency.nil?
  fan.setMotorInAirstreamFraction(motor_in_airstream_fraction) unless motor_in_airstream_fraction.nil?
  return fan
end

#create_fan_constant_volume_from_json(model, fan_json, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanConstantVolume

creates a constant volume fan from a json

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_json (Hash)

    hash of fan properties

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanConstantVolume)

    constant volume fan object



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 128

def create_fan_constant_volume_from_json(model,
                                         fan_json,
                                         fan_name: nil,
                                         fan_efficiency: nil,
                                         pressure_rise: nil,
                                         motor_efficiency: nil,
                                         motor_in_airstream_fraction: nil,
                                         end_use_subcategory: nil)
  # check values to use
  fan_efficiency ||= fan_json['fan_efficiency']
  pressure_rise ||= fan_json['pressure_rise']
  motor_efficiency ||= fan_json['motor_efficiency']
  motor_in_airstream_fraction ||= fan_json['motor_in_airstream_fraction']
  end_use_subcategory ||= fan_json['end_use_subcategory']

  # convert values
  pressure_rise = pressure_rise ? OpenStudio.convert(pressure_rise, 'inH_{2}O', 'Pa').get : nil

  # create fan
  fan = create_fan_constant_volume(model,
                                   fan_name: fan_name,
                                   fan_efficiency: fan_efficiency,
                                   pressure_rise: pressure_rise,
                                   motor_efficiency: motor_efficiency,
                                   motor_in_airstream_fraction: motor_in_airstream_fraction,
                                   end_use_subcategory: end_use_subcategory)
  return fan
end

#create_fan_on_off(model, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanOnOff

creates an on off fan

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanOnOff)

    on off fan object



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb', line 106

def create_fan_on_off(model,
                      fan_name: nil,
                      fan_efficiency: nil,
                      pressure_rise: nil,
                      motor_efficiency: nil,
                      motor_in_airstream_fraction: nil,
                      end_use_subcategory: nil)
  fan = OpenStudio::Model::FanOnOff.new(model)
  PrototypeFan.apply_base_fan_variables(fan,
                                        fan_name: fan_name,
                                        fan_efficiency: fan_efficiency,
                                        pressure_rise: pressure_rise,
                                        end_use_subcategory: end_use_subcategory)
  fan.setMotorEfficiency(motor_efficiency) unless motor_efficiency.nil?
  fan.setMotorInAirstreamFraction(motor_in_airstream_fraction) unless motor_in_airstream_fraction.nil?
  return fan
end

#create_fan_on_off_from_json(model, fan_json, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanOnOff

creates a on off fan from a json

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_json (Hash)

    hash of fan properties

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanOnOff)

    on off fan object



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb', line 135

def create_fan_on_off_from_json(model,
                                fan_json,
                                fan_name: nil,
                                fan_efficiency: nil,
                                pressure_rise: nil,
                                motor_efficiency: nil,
                                motor_in_airstream_fraction: nil,
                                end_use_subcategory: nil)
  # check values to use
  fan_efficiency ||= fan_json['fan_efficiency']
  pressure_rise ||= fan_json['pressure_rise']
  motor_efficiency ||= fan_json['motor_efficiency']
  motor_in_airstream_fraction ||= fan_json['motor_in_airstream_fraction']

  # convert values
  pressure_rise = pressure_rise ? OpenStudio.convert(pressure_rise, 'inH_{2}O', 'Pa').get : nil

  # create fan
  fan = create_fan_on_off(model,
                          fan_name: fan_name,
                          fan_efficiency: fan_efficiency,
                          pressure_rise: pressure_rise,
                          motor_efficiency: motor_efficiency,
                          motor_in_airstream_fraction: motor_in_airstream_fraction,
                          end_use_subcategory: end_use_subcategory)
  return fan
end

#create_fan_variable_volume(model, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, fan_power_minimum_flow_rate_input_method: nil, fan_power_minimum_flow_rate_fraction: nil, fan_power_coefficient_1: nil, fan_power_coefficient_2: nil, fan_power_coefficient_3: nil, fan_power_coefficient_4: nil, fan_power_coefficient_5: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanVariableVolume

creates a variable volume fan

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • fan_power_minimum_flow_rate_input_method (String) (defaults to: nil)

    options are Fraction, FixedFlowRate

  • fan_power_minimum_flow_rate_fraction (Double) (defaults to: nil)

    minimum flow rate fraction

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

  • fan_power_coefficient_1 (Double) (defaults to: nil)

    fan power coefficient 1

  • fan_power_coefficient_2 (Double) (defaults to: nil)

    fan power coefficient 2

  • fan_power_coefficient_3 (Double) (defaults to: nil)

    fan power coefficient 3

  • fan_power_coefficient_4 (Double) (defaults to: nil)

    fan power coefficient 4

  • fan_power_coefficient_5 (Double) (defaults to: nil)

    fan power coefficient 5

Returns:

  • (OpenStudio::Model::FanVariableVolume)

    variable volume fan object



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/prototypes/common/objects/Prototype.FanVariableVolume.rb', line 104

def create_fan_variable_volume(model,
                               fan_name: nil,
                               fan_efficiency: nil,
                               pressure_rise: nil,
                               motor_efficiency: nil,
                               motor_in_airstream_fraction: nil,
                               fan_power_minimum_flow_rate_input_method: nil,
                               fan_power_minimum_flow_rate_fraction: nil,
                               fan_power_coefficient_1: nil,
                               fan_power_coefficient_2: nil,
                               fan_power_coefficient_3: nil,
                               fan_power_coefficient_4: nil,
                               fan_power_coefficient_5: nil,
                               end_use_subcategory: nil)
  fan = OpenStudio::Model::FanVariableVolume.new(model)
  PrototypeFan.apply_base_fan_variables(fan,
                                        fan_name: fan_name,
                                        fan_efficiency: fan_efficiency,
                                        pressure_rise: pressure_rise,
                                        end_use_subcategory: end_use_subcategory)
  fan.setMotorEfficiency(motor_efficiency) unless motor_efficiency.nil?
  fan.setMotorInAirstreamFraction(motor_in_airstream_fraction) unless motor_in_airstream_fraction.nil?
  fan.setFanPowerMinimumFlowRateInputMethod(fan_power_minimum_flow_rate_input_method) unless fan_power_minimum_flow_rate_input_method.nil?
  fan.setFanPowerMinimumFlowFraction(fan_power_minimum_flow_rate_fraction) unless fan_power_minimum_flow_rate_fraction.nil?
  fan.setFanPowerCoefficient1(fan_power_coefficient_1) unless fan_power_coefficient_1.nil?
  fan.setFanPowerCoefficient2(fan_power_coefficient_2) unless fan_power_coefficient_2.nil?
  fan.setFanPowerCoefficient3(fan_power_coefficient_3) unless fan_power_coefficient_3.nil?
  fan.setFanPowerCoefficient4(fan_power_coefficient_4) unless fan_power_coefficient_4.nil?
  fan.setFanPowerCoefficient5(fan_power_coefficient_5) unless fan_power_coefficient_5.nil?
  return fan
end

#create_fan_variable_volume_from_json(model, fan_json, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, motor_efficiency: nil, motor_in_airstream_fraction: nil, fan_power_minimum_flow_rate_input_method: nil, fan_power_minimum_flow_rate_fraction: nil, end_use_subcategory: nil, fan_power_coefficient_1: nil, fan_power_coefficient_2: nil, fan_power_coefficient_3: nil, fan_power_coefficient_4: nil, fan_power_coefficient_5: nil) ⇒ OpenStudio::Model::FanVariableVolume

creates a variable volume fan from a json

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_json (Hash)

    hash of fan properties

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • motor_efficiency (Double) (defaults to: nil)

    fan motor efficiency

  • motor_in_airstream_fraction (Double) (defaults to: nil)

    fraction of motor heat in airstream

  • fan_power_minimum_flow_rate_input_method (String) (defaults to: nil)

    options are Fraction, FixedFlowRate

  • fan_power_minimum_flow_rate_fraction (Double) (defaults to: nil)

    minimum flow rate fraction

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

  • fan_power_coefficient_1 (Double) (defaults to: nil)

    fan power coefficient 1

  • fan_power_coefficient_2 (Double) (defaults to: nil)

    fan power coefficient 2

  • fan_power_coefficient_3 (Double) (defaults to: nil)

    fan power coefficient 3

  • fan_power_coefficient_4 (Double) (defaults to: nil)

    fan power coefficient 4

  • fan_power_coefficient_5 (Double) (defaults to: nil)

    fan power coefficient 5

Returns:

  • (OpenStudio::Model::FanVariableVolume)

    variable volume fan object



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb', line 154

def create_fan_variable_volume_from_json(model,
                                         fan_json,
                                         fan_name: nil,
                                         fan_efficiency: nil,
                                         pressure_rise: nil,
                                         motor_efficiency: nil,
                                         motor_in_airstream_fraction: nil,
                                         fan_power_minimum_flow_rate_input_method: nil,
                                         fan_power_minimum_flow_rate_fraction: nil,
                                         end_use_subcategory: nil,
                                         fan_power_coefficient_1: nil,
                                         fan_power_coefficient_2: nil,
                                         fan_power_coefficient_3: nil,
                                         fan_power_coefficient_4: nil,
                                         fan_power_coefficient_5: nil)
  # check values to use
  fan_efficiency ||= fan_json['fan_efficiency']
  pressure_rise ||= fan_json['pressure_rise']
  motor_efficiency ||= fan_json['motor_efficiency']
  motor_in_airstream_fraction ||= fan_json['motor_in_airstream_fraction']
  fan_power_minimum_flow_rate_input_method ||= fan_json['fan_power_minimum_flow_rate_input_method']
  fan_power_minimum_flow_rate_fraction ||= fan_json['fan_power_minimum_flow_rate_fraction']
  fan_power_coefficient_1 ||= fan_json['fan_power_coefficient_1']
  fan_power_coefficient_2 ||= fan_json['fan_power_coefficient_2']
  fan_power_coefficient_3 ||= fan_json['fan_power_coefficient_3']
  fan_power_coefficient_4 ||= fan_json['fan_power_coefficient_4']
  fan_power_coefficient_5 ||= fan_json['fan_power_coefficient_5']

  # convert values
  pressure_rise_pa = OpenStudio.convert(pressure_rise, 'inH_{2}O', 'Pa').get unless pressure_rise.nil?

  # create fan
  fan = create_fan_variable_volume(model,
                                   fan_name: fan_name,
                                   fan_efficiency: fan_efficiency,
                                   pressure_rise: pressure_rise_pa,
                                   motor_efficiency: motor_efficiency,
                                   motor_in_airstream_fraction: motor_in_airstream_fraction,
                                   fan_power_minimum_flow_rate_input_method: fan_power_minimum_flow_rate_input_method,
                                   fan_power_minimum_flow_rate_fraction: fan_power_minimum_flow_rate_fraction,
                                   end_use_subcategory: end_use_subcategory,
                                   fan_power_coefficient_1: fan_power_coefficient_1,
                                   fan_power_coefficient_2: fan_power_coefficient_2,
                                   fan_power_coefficient_3: fan_power_coefficient_3,
                                   fan_power_coefficient_4: fan_power_coefficient_4,
                                   fan_power_coefficient_5: fan_power_coefficient_5)
  return fan
end

#create_fan_zone_exhaust(model, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, system_availability_manager_coupling_mode: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanZoneExhaust

creates a FanZoneExhaust

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • system_availability_manager_coupling_mode (String) (defaults to: nil)

    coupling mode, options are Coupled, Decoupled

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanZoneExhaust)

    the exhaust fan



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanZoneExhaust.rb', line 72

def create_fan_zone_exhaust(model,
                            fan_name: nil,
                            fan_efficiency: nil,
                            pressure_rise: nil,
                            system_availability_manager_coupling_mode: nil,
                            end_use_subcategory: nil)
  fan = OpenStudio::Model::FanZoneExhaust.new(model)
  PrototypeFan.apply_base_fan_variables(fan,
                                        fan_name: fan_name,
                                        fan_efficiency: fan_efficiency,
                                        pressure_rise: pressure_rise,
                                        end_use_subcategory: end_use_subcategory)
  fan.setSystemAvailabilityManagerCouplingMode(system_availability_manager_coupling_mode) unless system_availability_manager_coupling_mode.nil?
  return fan
end

#create_fan_zone_exhaust_from_json(model, fan_json, fan_name: nil, fan_efficiency: nil, pressure_rise: nil, system_availability_manager_coupling_mode: nil, end_use_subcategory: nil) ⇒ OpenStudio::Model::FanZoneExhaust

creates a FanZoneExhaust from a json

Parameters:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • fan_json (Hash)

    hash of fan properties

  • fan_name (String) (defaults to: nil)

    fan name

  • fan_efficiency (Double) (defaults to: nil)

    fan efficiency

  • pressure_rise (Double) (defaults to: nil)

    fan pressure rise in Pa

  • system_availability_manager_coupling_mode (String) (defaults to: nil)

    coupling mode, options are Coupled, Decoupled

  • end_use_subcategory (String) (defaults to: nil)

    end use subcategory name

Returns:

  • (OpenStudio::Model::FanZoneExhaust)

    the exhaust fan



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.FanZoneExhaust.rb', line 37

def create_fan_zone_exhaust_from_json(model,
                                      fan_json,
                                      fan_name: nil,
                                      fan_efficiency: nil,
                                      pressure_rise: nil,
                                      system_availability_manager_coupling_mode: nil,
                                      end_use_subcategory: nil)

  # check values to use
  fan_efficiency ||= fan_json['fan_efficiency']
  pressure_rise ||= fan_json['pressure_rise']
  system_availability_manager_coupling_mode ||= fan_json['system_availability_manager_coupling_mode']

  # convert values
  pressure_rise = pressure_rise ? OpenStudio.convert(pressure_rise, 'inH_{2}O', 'Pa').get : nil

  # create fan
  fan = create_fan_zone_exhaust(model,
                                fan_name: fan_name,
                                fan_efficiency: fan_efficiency,
                                pressure_rise: pressure_rise,
                                system_availability_manager_coupling_mode: system_availability_manager_coupling_mode,
                                end_use_subcategory: end_use_subcategory)
  return fan
end

#default_air_barrierObject

Buildings by default are assumed to not have an air barrier



2349
2350
2351
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2349

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.



2343
2344
2345
2346
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2343

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

#eer_to_cop(eer) ⇒ Double

Convert from EER to COP

Parameters:

  • eer (Double)

    Energy Efficiency Ratio (EER)

Returns:

  • (Double)

    Coefficient of Performance (COP)



390
391
392
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 390

def eer_to_cop(eer)
  return eer / OpenStudio.convert(1.0, 'W', 'Btu/h').get
end

#eer_to_cop_no_fan(eer, capacity_w = nil) ⇒ Double

Convert from EER to COP (no fan)

Parameters:

  • eer (Double)

    Energy Efficiency Ratio (EER)

  • capacity_w (Double) (defaults to: nil)

    the heating capacity at AHRI rating conditions, in W

Returns:

  • (Double)

    Coefficient of Performance (COP)



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 331

def eer_to_cop_no_fan(eer, capacity_w = nil)
  if capacity_w.nil?
    # From Thornton et al. 2011
    # r is the ratio of supply fan power to total equipment power at the rating condition,
    # assumed to be 0.12 for the reference buildings per Thornton et al. 2011.
    r = 0.12
    cop = ((eer / OpenStudio.convert(1.0, 'W', 'Btu/h').get) + r) / (1 - r)
  else
    # The 90.1-2013 method
    # Convert the capacity to Btu/hr
    capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
    cop = (7.84E-8 * eer * capacity_btu_per_hr) + (0.338 * eer)
  end

  return cop
end

#ems_friendly_name(name) ⇒ String

converts existing string to ems friendly string

Parameters:

  • name (String)

    original name

Returns:

  • (String)

    the resulting EMS friendly string



887
888
889
890
891
892
893
894
895
896
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 887

def ems_friendly_name(name)
  # replace white space and special characters with underscore
  # \W is equivalent to [^a-zA-Z0-9_]
  new_name = name.to_s.gsub(/\W/, '_')

  # prepend ems_ in case the name starts with a number
  new_name = "ems_#{new_name}"

  return new_name
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



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/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 62

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
52
53
54
55
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb', line 11

def fan_constant_volume_apply_prototype_fan_pressure_rise(fan_constant_volume)
  # Don't modify unit heater fans
  return true if fan_constant_volume.name.to_s.include?('UnitHeater Fan')

  # 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



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb', line 69

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
62
# 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.



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
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 187

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



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
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 117

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.



177
178
179
180
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 177

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.



168
169
170
171
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 168

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_variable_volume_set_control_type(fan_variable_volume, control_type) ⇒ Boolean

Modify the fan curve coefficients to reflect a specific type of control.

Parameters:

  • fan_variable_volume (OpenStudio::Model::FanVariableVolume)

    variable volume fan object

  • control_type (String)

    valid choices are: Multi Zone VAV with discharge dampers, Multi Zone VAV with VSD and SP Setpoint Reset, Multi Zone VAV with AF or BI Riding Curve, Multi Zone VAV with AF or BI with Inlet Vanes, Multi Zone VAV with FC Riding Curve, Multi Zone VAV with FC with Inlet Vanes, Multi Zone VAV with Vane-axial with Variable Pitch Blades, Multi Zone VAV with VSD and Fixed SP Setpoint, Multi Zone VAV with VSD and Static Pressure Reset, Single Zone VAV Fan

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
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
# File 'lib/openstudio-standards/standards/Standards.FanVariableVolume.rb', line 21

def fan_variable_volume_set_control_type(fan_variable_volume, control_type)
  # Determine the coefficients
  coeff_a = nil
  coeff_b = nil
  coeff_c = nil
  coeff_d = nil
  min_pct_pwr = nil
  case control_type

  # add 'Multi Zone VAV with discharge dampers' and change the minimum fan power fraction of "Multi Zone VAV with VSD and Static Pressure Reset"
  when 'Multi Zone VAV with discharge dampers'
    coeff_a = 0.18984763
    coeff_b = 0.31447014
    coeff_c = 0.49568211
    coeff_d = 0.0
    min_pct_pwr = 0.25
  when 'Multi Zone VAV with VSD and SP Setpoint Reset'
    coeff_a = 0.04076
    coeff_b = 0.0881
    coeff_c = -0.0729
    coeff_d = 0.9437
    min_pct_pwr = 0.25
  when 'Multi Zone VAV with AF or BI Riding Curve'
    coeff_a = 0.1631
    coeff_b = 1.5901
    coeff_c = -0.8817
    coeff_d = 0.1281
    min_pct_pwr = 0.7
  when 'Multi Zone VAV with AF or BI with Inlet Vanes'
    coeff_a = 0.9977
    coeff_b = -0.659
    coeff_c = 0.9547
    coeff_d = -0.2936
    min_pct_pwr = 0.5
  when 'Multi Zone VAV with FC Riding Curve'
    coeff_a = 0.1224
    coeff_b = 0.612
    coeff_c = 0.5983
    coeff_d = -0.3334
    min_pct_pwr = 0.3
  when 'Multi Zone VAV with FC with Inlet Vanes'
    coeff_a = 0.3038
    coeff_b = -0.7608
    coeff_c = 2.2729
    coeff_d = -0.8169
    min_pct_pwr = 0.3
  when 'Multi Zone VAV with Vane-axial with Variable Pitch Blades'
    coeff_a = 0.1639
    coeff_b = -0.4016
    coeff_c = 1.9909
    coeff_d = -0.7541
    min_pct_pwr = 0.2
  when 'Multi Zone VAV with VSD and Fixed SP Setpoint'
    coeff_a = 0.0013
    coeff_b = 0.1470
    coeff_c = 0.9506
    coeff_d = -0.0998
    min_pct_pwr = 0.2
  when 'Multi Zone VAV with VSD and Static Pressure Reset'
    coeff_a = 0.04076
    coeff_b = 0.0881
    coeff_c = -0.0729
    coeff_d = 0.9437
    min_pct_pwr = 0.1
  when 'Single Zone VAV Fan'
    coeff_a = 0.027828
    coeff_b = 0.026583
    coeff_c = -0.087069
    coeff_d = 1.030920
    min_pct_pwr = 0.1
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.FanVariableVolume', "Fan control type '#{control_type}' not recognized, fan power coefficients will not be changed.")
    return false
  end

  OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.FanVariableVolume', "For #{fan_variable_volume.name}: Set fan curve coefficients to reflect control type of '#{control_type}'.")

  # Set the coefficients
  fan_variable_volume.setFanPowerCoefficient1(coeff_a)
  fan_variable_volume.setFanPowerCoefficient2(coeff_b)
  fan_variable_volume.setFanPowerCoefficient3(coeff_c)
  fan_variable_volume.setFanPowerCoefficient4(coeff_d)

  # Set the fan minimum power
  fan_variable_volume.setFanPowerMinimumFlowRateInputMethod('Fraction')
  fan_variable_volume.setFanPowerMinimumFlowFraction(min_pct_pwr)

  # Append the control type to the fan name
  # self.setName("#{self.name} #{control_type}")
  return true
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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

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



2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2175

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



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
1262
1263
1264
1265
1266
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1222

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



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
1211
1212
1213
1214
1215
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1147

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



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
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1114

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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • surface_type (String) (defaults to: 'Wall')

    surface type

Returns:

  • (Double)

    surface ratio



5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5616

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



2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2194

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

#headered_pumps_variable_speed_set_control_type(headered_pumps_variable_speed, control_type) ⇒ Boolean

Set the pump curve coefficients based on the specified control type.

Parameters:

  • headered_pumps_variable_speed (OpenStudio::Model::HeaderedPumpsVariableSpeed)

    headered variable speed pumps object

  • control_type (String)

    valid choices are Riding Curve, VSD No Reset, VSD DP Reset

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
52
53
54
# File 'lib/openstudio-standards/standards/Standards.HeaderedPumpsVariableSpeed.rb', line 11

def headered_pumps_variable_speed_set_control_type(headered_pumps_variable_speed, control_type)
  # Determine the coefficients
  coeff_a = nil
  coeff_b = nil
  coeff_c = nil
  coeff_d = nil
  case control_type
  when 'Constant Flow'
    coeff_a = 0.0
    coeff_b = 1.0
    coeff_c = 0.0
    coeff_d = 0.0
  when 'Riding Curve'
    coeff_a = 0.0
    coeff_b = 3.2485
    coeff_c = -4.7443
    coeff_d = 2.5294
  when 'VSD No Reset'
    coeff_a = 0.0
    coeff_b = 0.5726
    coeff_c = -0.301
    coeff_d = 0.7347
  when 'VSD DP Reset'
    coeff_a = 0.0
    coeff_b = 0.0205
    coeff_c = 0.4101
    coeff_d = 0.5753
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.HeaderedPumpsVariableSpeed', "Pump control type '#{control_type}' not recognized, pump coefficients will not be changed.")
    return false
  end

  # Set the coefficients
  headered_pumps_variable_speed.setCoefficient1ofthePartLoadPerformanceCurve(coeff_a)
  headered_pumps_variable_speed.setCoefficient2ofthePartLoadPerformanceCurve(coeff_b)
  headered_pumps_variable_speed.setCoefficient3ofthePartLoadPerformanceCurve(coeff_c)
  headered_pumps_variable_speed.setCoefficient4ofthePartLoadPerformanceCurve(coeff_d)
  headered_pumps_variable_speed.setPumpControlType('Intermittent')

  # Append the control type to the pump name
  # self.setName("#{self.name} #{control_type}")

  return true
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

#hspf_to_cop(hspf) ⇒ Double

Convert from HSPF to COP (with fan) for heat pump heating coils

Parameters:

  • hspf (Double)

    heating seasonal performance factor (HSPF)

Returns:

  • (Double)

    Coefficient of Performance (COP)



318
319
320
321
322
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 318

def hspf_to_cop(hspf)
  cop = (-0.0255 * hspf * hspf) + (0.6239 * hspf)

  return cop
end

#hspf_to_cop_no_fan(hspf) ⇒ Double

Convert from HSPF to COP (no fan) for heat pump heating coils

Parameters:

  • hspf (Double)

    heating seasonal performance factor (HSPF)

Returns:

  • (Double)

    Coefficient of Performance (COP)



307
308
309
310
311
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 307

def hspf_to_cop_no_fan(hspf)
  cop = (-0.0296 * hspf * hspf) + (0.7134 * hspf)

  return cop
end

#ieer_to_cop_no_fan(ieer) ⇒ Double

TODO:

Implement methods to handle IEER modeling

Note:

IEER is a weighted-average efficiency metrics at different load percentages, operataional and environemental conditions

Note:

IEER should be modeled by using performance curves that match a targeted efficiency values

Note:

This method estimates what a reasonable full load rated EER would be for a targeted IEER value

Note:

The regression used in this method is based on a survey of over 1,000 rated AHRI units with IEER ranging from 11.8 to 25.6

Convert from IEER to COP (no fan)

Parameters:

  • ieer (Double)

    Energy Efficiency Ratio (EER)

Returns:

  • (Double)

    Coefficient of Performance (COP)



380
381
382
383
384
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 380

def ieer_to_cop_no_fan(ieer)
  eer = 0.0183 * ieer * ieer - 0.4552 * ieer + 13.21

  return eer_to_cop_no_fan(eer)
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

#kw_per_ton_to_cop(kw_per_ton) ⇒ Double

A helper method to convert from kW/ton to COP

Parameters:

  • kw_per_ton (Double)

    kW of input power per ton of cooling

Returns:

  • (Double)

    Coefficient of Performance (COP)



414
415
416
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 414

def kw_per_ton_to_cop(kw_per_ton)
  return 3.517 / kw_per_ton
end

#load_hvac_map(hvac_map_file) ⇒ Hash

Loads a JSON file containing the space type map into a hash

Parameters:

  • hvac_map_file (String)

    path to JSON file, relative to the /data folder

Returns:

  • (Hash)

    returns a hash that contains the space type map



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb', line 221

def load_hvac_map(hvac_map_file)
  # Load the geometry .osm from relative to the data folder
  rel_path_to_hvac_map = "../../../../../data/#{hvac_map_file}"

  # Load the JSON depending on whether running from normal gem location
  # or from the embedded location in the OpenStudio CLI
  if File.dirname(__FILE__)[0] == ':'
    # running from embedded location in OpenStudio CLI
    hvac_map_string = load_resource_relative(rel_path_to_hvac_map)
    hvac_map = JSON.parse(hvac_map_string)
  else
    abs_path = File.join(File.dirname(__FILE__), rel_path_to_hvac_map)
    hvac_map = JSON.parse(File.read(abs_path)) if File.exist?(abs_path)
  end

  return hvac_map
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



5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 5643

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.



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
4612
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4586

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



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
2713
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 2562

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 = create_fan_by_name(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
  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?
    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
    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 = 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



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
5621
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5491

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 = create_coil_heating_dx_single_speed(model,
                                                     name: "#{air_loop.name} heating coil",
                                                     type: 'Residential Central Air Source HP',
                                                     cop: 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 = create_coil_heating_electric(model,
                                                           name: "#{air_loop.name} Supplemental Htg Coil")
    end

    # create cooling coil
    clg_coil = nil
    if cooling
      clg_coil = 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 = create_fan_by_name(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)
      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 = kw_per_ton_to_cop(1.188)
    when 'WaterCooled'
      default_cop = kw_per_ton_to_cop(0.66)
    else
      default_cop = 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



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
3297
3298
3299
3300
3301
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3056

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



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
3586
3587
3588
3589
3590
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3387

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



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
3592
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3392

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 = create_fan_by_name(model,
                               'CRAC_VAV_fan',
                               fan_name: "#{air_loop.name} Fan")
      fan.setAvailabilitySchedule(hvac_op_sch)
    elsif fan_type == 'ConstantVolume'
      fan = create_fan_by_name(model,
                               'CRAC_CAV_fan',
                               fan_name: "#{air_loop.name} Fan")
      fan.setAvailabilitySchedule(hvac_op_sch)
    elsif fan_type == 'Cycling'
      fan = create_fan_by_name(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 = create_coil_cooling_dx_two_speed(model,
                                                  name: "#{air_loop.name} 2spd DX AC Clg Coil")
    when 'Single Speed DX AC'
      clg_coil = 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



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3606

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 = create_fan_by_name(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
    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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • curve_name (String)

    name of the curve

Returns:

  • (OpenStudio::Model::Curve)

    curve object, nil if not found



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
3786
3787
3788
3789
3790
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 3597

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



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
3376
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3228

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
      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
      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 = create_fan_by_name(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 = 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 = 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 = 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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • space (OpenStudio::Model::Space)

    which space to assign the data center loads to

  • dc_watts_per_area (Double)

    data center load, in W/m^2

Returns:

  • (Boolean)

    returns true if successful, false if not



3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3203

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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

Returns:

  • (Boolean)

    returns true if successful, false if not



2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2330

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



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
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 1527

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 = create_fan_by_name(model,
                                    'Constant_DOAS_Fan',
                                    fan_name: 'DOAS Supply Fan',
                                    end_use_subcategory: 'DOAS Fans')
  else # 'DOASVAV'
    supply_fan = create_fan_by_name(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
    create_coil_heating_electric(model,
                                 air_loop_node: air_loop.supplyInletNode,
                                 name: "#{air_loop.name} Backup Htg Coil")
    # heat pump coil
    create_coil_heating_dx_single_speed(model,
                                        air_loop_node: air_loop.supplyInletNode,
                                        name: "#{air_loop.name} Htg Coil")
  else
    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?
    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
    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 = create_fan_by_name(model,
                                       'Constant_DOAS_Fan',
                                       fan_name: 'DOAS Exhaust Fan',
                                       end_use_subcategory: 'DOAS Fans')
    else # 'DOASVAV'
      exhaust_fan = create_fan_by_name(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 = create_coil_heating_electric(model, name: "#{zone.name} Electric Reheat Coil")
      else
        rht_coil = 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
1505
# 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 = create_fan_by_name(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
    create_coil_heating_electric(model,
                                 air_loop_node: air_loop.supplyInletNode,
                                 name: "#{air_loop.name} Backup Htg Coil")
    # heat pump coil
    create_coil_heating_dx_single_speed(model,
                                        air_loop_node: air_loop.supplyInletNode,
                                        name: "#{air_loop.name} Htg Coil")
  else
    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?
    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
    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_hx_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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • thermal_zones (Array<OpenStudio::Model::ThermalZone>)

    array of zones to connect to this system

Returns:

  • (Array<OpenStudio::Model::AirLoopHVAC>)

    the resulting evaporative coolers



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
4577
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4416

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("#{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("#{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("#{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 = create_fan_by_name(model,
                             'Evap_Cooler_Supply_Fan',
                             fan_name: "#{zone.name} Evap Cooler Supply Fan")
    fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)

    # Dummy zero-capacity cooling coil
    clg_coil = 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



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
6189
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6143

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.



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
4754
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4683

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 = 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 = 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 = 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 = create_fan_by_name(model,
                                   'Fan_Coil_VarSpeed_Fan',
                                   fan_name: "#{zone.name} Fan Coil Variable Fan",
                                   end_use_subcategory: 'FCU Fans')
    else
      fcu_fan = create_fan_by_name(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: 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



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
5479
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5360

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 = create_coil_heating_gas(model,
                                         name: "#{air_loop.name} Heating Coil",
                                         efficiency: afue_to_thermal_eff(afue))
    end

    # create cooling coil
    clg_coil = nil
    if cooling
      clg_coil = 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(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 = create_fan_by_name(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 = 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



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
4409
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4362

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 = 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 = 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? || true?(system['include_exhaust_fan'])
        include_exhaust_fan = true
      else
        include_exhaust_fan = false
      end
      if true?(system['demand_control_ventilation'])
        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



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
7528
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6904

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
  rename_air_loop_nodes(model)
  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'
      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 = 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



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
5933
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 5799

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.



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
5294
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 4833

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
    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
      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
      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
      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:

  • model (OpenStudio::Model::Model)

    OpenStudio model object

  • material_name (String)

    name of the material

Returns:

  • (OpenStudio::Model::Material)

    material object



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
3042
3043
3044
3045
3046
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 2905

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



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
4025
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 3920

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 = 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 = 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 = 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 = 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 = 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 = create_fan_by_name(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



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
6488
# File 'lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb', line 6341

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 = 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



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
1890
1891
1892
1893
1894
# File 'lib/openstudio-standards/standards/Standards.Model.rb', line 1417

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,