Class: NzeHvac

Inherits:
OpenStudio::Measure::ModelMeasure
  • Object
show all
Defined in:
lib/measures/nze_hvac/measure.rb

Overview

******************************************************************************* OpenStudio®, Copyright © Alliance for Sustainable Energy, LLC. See also openstudio.net/license *******************************************************************************

Instance Method Summary collapse

Instance Method Details

#add_system_to_zones(model, runner, hvac_system_type, zones, standard, doas_dcv: false) ⇒ Object



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
# File 'lib/measures/nze_hvac/measure.rb', line 25

def add_system_to_zones(model, runner, hvac_system_type, zones, standard,
                        doas_dcv: false)
  if doas_dcv
    doas_system_type = 'DOAS with DCV'
  else
    doas_system_type = 'DOAS'
  end

  # create HVAC system
  # use methods in openstudio-standards
  # Standard.model_add_hvac_system(model, system_type, main_heat_fuel, zone_heat_fuel, cool_fuel, zones)
  # can be combination systems or individual objects - depends on the type of system
  # todo - reenable fan_coil_capacity_control_method when major installer released with udpated standards gem from what shipped with 2.9.0
  case hvac_system_type.to_s
  when 'DOAS with fan coil chiller with boiler'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   zone_equipment_ventilation: false)
    # fan_coil_capacity_control_method: 'VariableFanVariableFlow')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'DOAS with fan coil chiller with central air source heat pump'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)
    # fan_coil_capacity_control_method: 'VariableFanVariableFlow')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'DOAS with fan coil air-cooled chiller with boiler'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)
  # fan_coil_capacity_control_method: 'VariableFanVariableFlow')

  when 'DOAS with fan coil air-cooled chiller with central air source heat pump'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)
  # fan_coil_capacity_control_method: 'VariableFanVariableFlow')

  # ventilation provided by zone fan coil unit in fan coil systems
  when 'Fan coil chiller with boiler'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature')
    # fan_coil_capacity_control_method: 'VariableFanVariableFlow')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'Fan coil chiller with central air source heat pump'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones)
    # fan_coil_capacity_control_method: 'VariableFanVariableFlow')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'Fan coil air-cooled chiller with boiler'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled')
  # fan_coil_capacity_control_method: 'VariableFanVariableFlow')

  when 'Fan coil air-cooled chiller with central air source heat pump'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
  # fan_coil_capacity_control_method: 'VariableFanVariableFlow')

  when 'DOAS with radiant slab chiller with boiler'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Radiant Slab', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'DOAS with radiant slab chiller with central air source heat pump'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Radiant Slab', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones)
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'DOAS with radiant slab air-cooled chiller with boiler'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Radiant Slab', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'DOAS with radiant slab air-cooled chiller with central air source heat pump'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   air_loop_heating_type: 'Water',
                                   air_loop_cooling_type: 'Water')
    standard.model_add_hvac_system(model, 'Radiant Slab', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'DOAS with VRF'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'DX',
                                   air_loop_cooling_type: 'DX')
    standard.model_add_hvac_system(model, 'VRF', ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'VRF'
    standard.model_add_hvac_system(model, 'VRF', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)

  when 'DOAS with water source heat pumps cooling tower with boiler'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature')
    standard.model_add_hvac_system(model, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   heat_pump_loop_cooling_type: 'CoolingTower',
                                   zone_equipment_ventilation: false)

  when 'DOAS with water source heat pumps with ground source heat pump'
    standard.model_add_hvac_system(model, doas_system_type, ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'DX',
                                   air_loop_cooling_type: 'DX')
    standard.model_add_hvac_system(model, 'Ground Source Heat Pumps', ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'Water source heat pumps cooling tower with boiler'
    standard.model_add_hvac_system(model, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   heat_pump_loop_cooling_type: 'CoolingTower')

  when 'Water source heat pumps with ground source heat pump'
    standard.model_add_hvac_system(model, 'Ground Source Heat Pumps', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)

  # PVAV systems by default use a DX coil for cooling
  when 'PVAV with gas boiler reheat'
    standard.model_add_hvac_system(model, 'PVAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature')

  when 'PVAV with central air source heat pump reheat'
    standard.model_add_hvac_system(model, 'PVAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones)

  when 'VAV chiller with gas boiler reheat'
    standard.model_add_hvac_system(model, 'VAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature')
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'VAV chiller with central air source heat pump reheat'
    standard.model_add_hvac_system(model, 'VAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones)
    chilled_water_loop = model.getPlantLoopByName('Chilled Water Loop').get
    condenser_water_loop = model.getPlantLoopByName('Condenser Water Loop').get
    standard.model_add_waterside_economizer(model, chilled_water_loop, condenser_water_loop,
                                            integrated: true)

  when 'VAV air-cooled chiller with gas boiler reheat'
    standard.model_add_hvac_system(model, 'VAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones,
                                   hot_water_loop_type: 'LowTemperature',
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV air-cooled chiller with central air source heat pump reheat'
    standard.model_add_hvac_system(model, 'VAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'PSZ-HP'
    standard.model_add_hvac_system(self, 'PSZ-HP', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)
  else
    runner.registerError("HVAC System #{hvac_system_type} not recognized")
    return false
  end
  runner.registerInfo("Added HVAC System type #{hvac_system_type} to the model for #{zones.size} zones")
end

#arguments(model) ⇒ Object



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
# File 'lib/measures/nze_hvac/measure.rb', line 230

def arguments(model)
  args = OpenStudio::Measure::OSArgumentVector.new

  # argument to remove existing hvac system
  remove_existing_hvac = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_existing_hvac', true)
  remove_existing_hvac.setDisplayName('Remove existing HVAC?')
  remove_existing_hvac.setDefaultValue(false)
  args << remove_existing_hvac

  # argument for HVAC system type
  hvac_system_type_choices = OpenStudio::StringVector.new
  hvac_system_type_choices << 'DOAS with fan coil chiller with boiler'
  hvac_system_type_choices << 'DOAS with fan coil chiller with central air source heat pump'
  hvac_system_type_choices << 'DOAS with fan coil air-cooled chiller with boiler'
  hvac_system_type_choices << 'DOAS with fan coil air-cooled chiller with central air source heat pump'
  hvac_system_type_choices << 'Fan coil chiller with boiler'
  hvac_system_type_choices << 'Fan coil chiller with central air source heat pump'
  hvac_system_type_choices << 'Fan coil air-cooled chiller with boiler'
  hvac_system_type_choices << 'Fan coil air-cooled chiller with central air source heat pump'
  hvac_system_type_choices << 'DOAS with radiant slab chiller with boiler'
  hvac_system_type_choices << 'DOAS with radiant slab chiller with central air source heat pump'
  hvac_system_type_choices << 'DOAS with radiant slab air-cooled chiller with boiler'
  hvac_system_type_choices << 'DOAS with radiant slab air-cooled chiller with central air source heat pump'
  hvac_system_type_choices << 'DOAS with VRF'
  hvac_system_type_choices << 'VRF'
  hvac_system_type_choices << 'DOAS with water source heat pumps cooling tower with boiler'
  hvac_system_type_choices << 'DOAS with water source heat pumps with ground source heat pump'
  hvac_system_type_choices << 'Water source heat pumps cooling tower with boiler'
  hvac_system_type_choices << 'Water source heat pumps with ground source heat pump'
  hvac_system_type_choices << 'VAV chiller with gas boiler reheat'
  hvac_system_type_choices << 'VAV chiller with central air source heat pump reheat'
  hvac_system_type_choices << 'VAV air-cooled chiller with gas boiler reheat'
  hvac_system_type_choices << 'VAV air-cooled chiller with central air source heat pump reheat'
  hvac_system_type_choices << 'PVAV with gas boiler reheat'
  hvac_system_type_choices << 'PVAV with central air source heat pump reheat'

  hvac_system_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_system_type', hvac_system_type_choices, true)
  hvac_system_type.setDisplayName('HVAC System Type:')
  hvac_system_type.setDescription('Details on HVAC system type in measure documentation.')
  hvac_system_type.setDefaultValue('DOAS with fan coil chiller with central air source heat pump')
  args << hvac_system_type

  # make the DOAS system have DCV controls
  doas_dcv = OpenStudio::Measure::OSArgument.makeBoolArgument('doas_dcv', true)
  doas_dcv.setDisplayName('DOAS capable of demand control ventilation?')
  doas_dcv.setDescription('If a DOAS system, this will make air terminals variable air volume instead of constant volume.')
  doas_dcv.setDefaultValue(false)
  args << doas_dcv

  # argument for how to partition HVAC system
  hvac_system_partition_choices = OpenStudio::StringVector.new
  hvac_system_partition_choices << 'Automatic Partition'
  hvac_system_partition_choices << 'Whole Building'
  hvac_system_partition_choices << 'One System Per Building Story'
  hvac_system_partition_choices << 'One System Per Building Type'

  hvac_system_partition = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_system_partition', hvac_system_partition_choices, true)
  hvac_system_partition.setDisplayName('HVAC System Partition:')
  hvac_system_partition.setDescription('Automatic Partition will separate the HVAC system by residential/non-residential and if loads and schedules are substantially different.')
  hvac_system_partition.setDefaultValue('Automatic Partition')
  args << hvac_system_partition

  # add an argument for ventilation schedule

  return args
end

#descriptionObject

human readable description



16
17
18
# File 'lib/measures/nze_hvac/measure.rb', line 16

def description
  return 'This measure replaces the existing HVAC system if any with the user selected HVAC system.  The user can select how to partition the system, applying it to the whole building, a system per building type, a system per building story, or automatically partition based on residential/non-residential occupany types and space loads.'
end

#modeler_descriptionObject

human readable description of modeling approach



21
22
23
# File 'lib/measures/nze_hvac/measure.rb', line 21

def modeler_description
  return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'
end

#nameObject



11
12
13
# File 'lib/measures/nze_hvac/measure.rb', line 11

def name
  return 'NZEHVAC'
end

#run(model, runner, user_arguments) ⇒ Object

end the arguments method



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
# File 'lib/measures/nze_hvac/measure.rb', line 297

def run(model, runner, user_arguments)
  super(model, runner, user_arguments)

  # use the built-in error checking
  if !runner.validateUserArguments(arguments(model), user_arguments)
    return false
  end

  # assign user inputs
  remove_existing_hvac = runner.getBoolArgumentValue('remove_existing_hvac', user_arguments)
  hvac_system_type = runner.getOptionalStringArgumentValue('hvac_system_type', user_arguments)
  doas_dcv = runner.getBoolArgumentValue('doas_dcv', user_arguments)
  hvac_system_partition = runner.getOptionalStringArgumentValue('hvac_system_partition', user_arguments)
  hvac_system_partition = hvac_system_partition.to_s

  # standard to access methods in openstudio-standards
  std = Standard.build('NREL ZNE Ready 2017')

  # ensure standards building type is set
  unless model.getBuilding.standardsBuildingType.is_initialized
    dominant_building_type = std.model_get_standards_building_type(model)
    if dominant_building_type.nil?
      # use office building type if none in model
      model.getBuilding.setStandardsBuildingType('Office')
    else
      model.getBuilding.setStandardsBuildingType(dominant_building_type)
    end
  end

  # get the climate zone
  climate_zone_obj = model.getClimateZones.getClimateZone('ASHRAE', 2006)
  if climate_zone_obj.empty
    climate_zone_obj = model.getClimateZones.getClimateZone('ASHRAE', 2013)
  end

  if climate_zone_obj.empty
    runner.registerError('Please assign an ASHRAE climate zone to the model before running the measure.')
    return false
  else
    climate_zone = "ASHRAE 169-2006-#{climate_zone_obj.value}"
  end

  # remove existing hvac system from model
  if remove_existing_hvac
    runner.registerInfo('Removing existing HVAC systems from the model')
    std.remove_hvac(model)
  end

  # exclude plenum zones, zones without thermostats, and zones with no floor area
  conditioned_zones = []
  model.getThermalZones.each do |zone|
    next if OpenstudioStandards::ThermalZone.thermal_zone_plenum?(zone)
    next if !OpenstudioStandards::ThermalZone.thermal_zone_heated?(zone) && !OpenstudioStandards::ThermalZone.thermal_zone_cooled?(zone)
    conditioned_zones << zone
  end

  # logic to partition thermal zones to be served by different HVAC systems
  case hvac_system_partition

    when 'Automatic Partition'
      # group zones by occupancy type (residential/nonresidential)
      # split non-dominant groups if their total area exceeds 20,000 ft2.
      sys_groups = OpenstudioStandards::Geometry.model_group_thermal_zones_by_occupancy_type(model, min_area_m2: OpenStudio.convert(20000, 'ft^2', 'm^2').get)

      # assume secondary system type is PSZ-AC for VAV Reheat otherwise assume same hvac system type
      sec_sys_type = hvac_system_type # same as primary system type
      sec_sys_type = 'PSZ-HP' if (hvac_system_type.to_s == 'VAV Reheat') || (hvac_system_type.to_s == 'PVAV Reheat')

      sys_groups.each do |sys_group|
        # add the primary system to the primary zones and the secondary system to any zones that are different
        # differentiate primary and secondary zones based on operating hours and internal loads (same as 90.1 PRM)
        pri_sec_zone_lists = std.model_differentiate_primary_secondary_thermal_zones(model, sys_group['zones'])

        # add the primary system to the primary zones
        add_system_to_zones(model, runner, hvac_system_type, pri_sec_zone_lists['primary'], std, doas_dcv: doas_dcv)

        # add the secondary system to the secondary zones (if any)
        if !pri_sec_zone_lists['secondary'].empty?
          runner.registerInfo("Secondary system type is #{sec_sys_type}")
          add_system_to_zones(model, runner, sec_sys_type, pri_sec_zone_lists['secondary'], std, doas_dcv: doas_dcv)
        end
      end

    when 'Whole Building'
      add_system_to_zones(model, runner, hvac_system_type, conditioned_zones, std, doas_dcv: doas_dcv)

    when 'One System Per Building Story'
      story_groups = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_story(model, conditioned_zones)
      story_groups.each do |story_zones|
        add_system_to_zones(model, runner, hvac_system_type, story_zones, std, doas_dcv: doas_dcv)
      end

    when 'One System Per Building Type'
      system_groups = OpenstudioStandards::Geometry.model_group_thermal_zones_by_building_type(model, min_area_m2: 0.0)
      system_groups.each do |system_group|
        add_system_to_zones(model, runner, hvac_system_type, system_group['zones'], std, doas_dcv: doas_dcv)
      end

    else
      runner.registerError('Invalid HVAC system partition choice')
      return false
  end

  # check that weather file exists for a sizing run
  if !model.weatherFile.is_initialized
    runner.registerError('Weather file not set. Cannot perform sizing run.')
    return false
  end

  # ensure sizing OA method is aligned
  model.getControllerMechanicalVentilations.each do |controller|
    controller.setSystemOutdoorAirMethod('ZoneSum')
  end

  # logic to ensure variable, not cycling, pump operation for chillers
  model.getChillerElectricEIRs.each { |chiller| chiller.setChillerFlowMode('LeavingSetpointModulated') }

  # log the build messages and errors to a file before sizing run in case of failure
  log_messages_to_file("#{Dir.pwd}/openstudio-standards.log", debug = true)

  # perform a sizing run to get equipment sizes for efficiency standards
  if std.model_run_sizing_run(model, "#{Dir.pwd}/SizingRun") == false
    runner.registerError("Unable to perform sizing run for hvac system #{hvac_system_type} for this model.  Check the openstudio-standards.log in this measure for more details.")
    log_messages_to_file("#{Dir.pwd}/openstudio-standards.log", debug = true)
    return false
  end

  # apply the HVAC efficiency standards
  std.model_apply_hvac_efficiency_standard(model, climate_zone)

  # log the build messages and errors to a file
  log_messages_to_file("#{Dir.pwd}/openstudio-standards.log", debug = true)

  runner.registerFinalCondition("Added system type #{hvac_system_type} to model.")

  return true
end