Class: OpenStudio::Model::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/to_openstudio/hvac/Model.hvac.rb,
lib/to_openstudio/hvac/radiant.rb

Overview

Note: This file is derived from the “Radiant Slab with DOAS” measure github.com/NREL/openstudio-model-articulation-gem/tree/develop/lib/measures/radiant_slab_with_doas It is intended that this file be updated if changes are made to the original measure

Instance Method Summary collapse

Instance Method Details

#add_cbecs_hvac_system(standard, system_type, zones) ⇒ Object

Adds the HVAC system as derived from the combinations of CBECS 2012 MAINHT and MAINCL fields. Mapping between combinations and HVAC systems per www.nrel.gov/docs/fy08osti/41956.pdf Table C-31



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
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
# File 'lib/to_openstudio/hvac/Model.hvac.rb', line 41

def add_cbecs_hvac_system(standard, system_type, zones)
  # the 'zones' argument includes zones that have heating, cooling, or both
  # if the HVAC system type serves a single zone, handle zones with only heating separately by adding unit heaters
  # applies to system types PTAC, PTHP, PSZ-AC, and Window AC
  heated_and_cooled_zones = zones.select { |zone| standard.thermal_zone_heated?(zone) && standard.thermal_zone_cooled?(zone) }
  heated_zones = zones.select { |zone| standard.thermal_zone_heated?(zone) }
  cooled_zones = zones.select { |zone| standard.thermal_zone_cooled?(zone) }
  cooled_only_zones = zones.select { |zone| !standard.thermal_zone_heated?(zone) && standard.thermal_zone_cooled?(zone) }
  heated_only_zones = zones.select { |zone| standard.thermal_zone_heated?(zone) && !standard.thermal_zone_cooled?(zone) }
  system_zones = heated_and_cooled_zones + cooled_only_zones

  # system type naming convention:
  # [ventilation strategy] [cooling system and plant] [heating system and plant]

  case system_type

  when 'ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'BoilerBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'ASHPBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_zones)

  when 'DHWBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)

  when 'EvapCoolers_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers_ASHPBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers_DHWBaseboard'
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers_Furnace'
    # Using unit heater to represent forced air furnace to limit to one airloop per thermal zone.
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers_UnitHeaters'
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'EvapCoolers'
    standard.model_add_hvac_system(self, 'Evaporative Cooler', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'DOAS_FCU_Chiller_Boiler'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_Chiller_ASHP'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_Chiller_DHW'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_Chiller_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_Chiller_GasHeaters'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_Chiller'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_ACChiller_Boiler'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_ACChiller_ASHP'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_ACChiller_DHW'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_ACChiller_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled', air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_ACChiller_GasHeaters'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled', air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_ACChiller'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled', air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled',
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_DCW_Boiler'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'NaturalGas', znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_DCW_ASHP'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'AirSourceHeatPump', znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_DCW_DHW'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_FCU_DCW_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_DCW_GasHeaters'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'DOAS_FCU_DCW'
    standard.model_add_hvac_system(self, 'DOAS', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   air_loop_heating_type: nil)
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_VRF'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'DX',
                                   air_loop_cooling_type: 'DX')
    standard.model_add_hvac_system(self, 'VRF', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)

  when 'DOAS_WSHP_FluidCooler_Boiler'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   heat_pump_loop_cooling_type: 'FluidCooler',
                                   zone_equipment_ventilation: false)

  when 'DOAS_WSHP_CoolingTower_Boiler'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   heat_pump_loop_cooling_type: 'CoolingTower',
                                   zone_equipment_ventilation: false)

  when 'DOAS_WSHP_GSHP'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   air_loop_heating_type: 'DX',
                                   air_loop_cooling_type: 'DX')
    standard.model_add_hvac_system(self, 'Ground Source Heat Pumps', ht = 'Electricity', znht = nil, cl = 'Electricity', zones,
                                   zone_equipment_ventilation: false)

  when 'DOAS_WSHP_DCW_DHW'
    standard.model_add_hvac_system(self, 'DOAS', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones,
                                   zone_equipment_ventilation: false)

  # ventilation provided by zone fan coil unit in fan coil systems
  when 'FCU_Chiller_Boiler'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones)

  when 'FCU_Chiller_ASHP'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones)

  when 'FCU_Chiller_DHW'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones)

  when 'FCU_Chiller_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'FCU_Chiller_GasHeaters'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'FCU_Chiller'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones)

  when 'FCU_ACChiller_Boiler'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'FCU_ACChiller_ASHP'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'FCU_ACChiller_DHW'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'FCU_ACChiller_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'FCU_ACChiller_GasHeaters'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'FCU_ACChiller'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'FCU_DCW_Boiler'
    standard.model_add_hvac_system(self, 'Fan Coil ', ht = 'NaturalGas', znht = nil, cl = 'DistrictCooling', zones)

  when 'FCU_DCW_ASHP'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'AirSourceHeatPump', znht = nil, cl = 'DistrictCooling', zones)

  when 'FCU_DCW_DHW'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones)

  when 'FCU_DCW_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'FCU_DCW_GasHeaters'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'FCU_DCW'
    standard.model_add_hvac_system(self, 'Fan Coil', ht = nil, znht = nil, cl = 'DistrictCooling', zones)

  when 'Furnace'
    # includes ventilation, whereas residential forced air furnace does not.
    standard.model_add_hvac_system(self, 'Forced Air Furnace', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)
  
  when 'Furnace_Electric'
    # includes ventilation, whereas residential forced air furnace does not.
    standard.model_add_hvac_system(self, 'Forced Air Furnace', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'GasHeaters'
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PTAC_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'PTAC_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PTAC_DHWBaseboard'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)

  when 'PTAC_GasHeaters'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PTAC_ElectricCoil'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = 'Electricity', cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PTAC_GasCoil'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = 'NaturalGas', cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PTAC_Boiler'
    standard.model_add_hvac_system(self, 'PTAC', ht = 'NaturalGas', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard gas boiler' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_only_zones)

  when 'PTAC_ASHP'
    standard.model_add_hvac_system(self, 'PTAC', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard central air source heat pump' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_only_zones)

  when 'PTAC_DHW'
    standard.model_add_hvac_system(self, 'PTAC', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard district hot water heat' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_only_zones)

  when 'PTAC'
    standard.model_add_hvac_system(self, 'PTAC', ht = nil, znht = nil, cl = 'Electricity', system_zones)

  when 'PTHP'
    standard.model_add_hvac_system(self, 'PTHP', ht = 'Electricity', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_DHWBaseboard'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_GasHeaters'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'Electricity', system_zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_ElectricCoil'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = 'Electricity', cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_GasCoil'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = 'NaturalGas', cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_Boiler'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'NaturalGas', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard gas boiler' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_ASHP'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'AirSourceHeatPump', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard central air source heat pump' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DHW'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'DistrictHeating', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard district hot water' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  when 'PSZAC_DCW_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'DistrictCooling', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_DCW_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'DistrictCooling', system_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_DCW_GasHeaters'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'DistrictCooling', system_zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'PSZAC_DCW_ElectricCoil'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = 'Electricity', cl = 'DistrictCooling', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DCW_GasCoil'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = 'NaturalGas', cl = 'DistrictCooling', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DCW_Boiler'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'NaturalGas', znht = nil, cl = 'DistrictCooling', system_zones)
    # use 'Baseboard gas boiler' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DCW_ASHP'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'AirSourceHeatPump', znht = nil, cl = 'DistrictCooling', system_zones)
    # use 'Baseboard central air source heat pump' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DCW_DHW'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', system_zones)
    # use 'Baseboard district hot water' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_only_zones)

  when 'PSZAC_DCW'
    standard.model_add_hvac_system(self, 'PSZ-AC', ht = nil, znht = nil, cl = 'DistrictCooling', cooled_zones)

  when 'PSZHP'
    standard.model_add_hvac_system(self, 'PSZ-HP', ht = 'Electricity', znht = nil, cl = 'Electricity', system_zones)
    # use 'Baseboard electric' for heated only zones
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_only_zones)

  # PVAV systems by default use a DX coil for cooling
  when 'PVAV_Boiler'
    standard.model_add_hvac_system(self, 'PVAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones)

  when 'PVAV_ASHP'
    standard.model_add_hvac_system(self, 'PVAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones)

  when 'PVAV_DHW'
    standard.model_add_hvac_system(self, 'PVAV Reheat', ht = 'DistrictHeating', znht = 'DistrictHeating', cl = 'Electricity', zones)

  when 'PVAV_PFP'
    standard.model_add_hvac_system(self, 'PVAV PFP Boxes', ht = 'Electricity', znht = 'Electricity', cl = 'Electricity', zones)

  when 'PVAV_BoilerElectricReheat'
    standard.model_add_hvac_system(self, 'PVAV Reheat', ht = 'Gas', znht = 'Electricity', cl = 'Electricity', zones)

  # all residential systems do not have ventilation
  when 'ResidentialAC_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Residential AC', ht = nil, znht = nil, cl = nil, cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'ResidentialAC_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'Residential AC', ht = nil, znht = nil, cl = nil, cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'ResidentialAC_ASHPBaseboard'
    standard.model_add_hvac_system(self, 'Residential AC', ht = nil, znht = nil, cl = nil, cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_zones)

  when 'ResidentialAC_DHWBaseboard'
    standard.model_add_hvac_system(self, 'Residential AC', ht = nil, znht = nil, cl = nil, cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)

  when 'ResidentialAC_ResidentialFurnace'
    standard.model_add_hvac_system(self, 'Residential Forced Air Furnace with AC', ht = nil, znht = nil, cl = nil, zones)

  when 'ResidentialAC'
    standard.model_add_hvac_system(self, 'Residential AC', ht = nil, znht = nil, cl = nil, cooled_zones)

  when 'ResidentialHP'
    standard.model_add_hvac_system(self, 'Residential Air Source Heat Pump', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)

  when 'ResidentialHPNoCool'
    standard.model_add_hvac_system(self, 'Residential Air Source Heat Pump', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'ResidentialFurnace'
    standard.model_add_hvac_system(self, 'Residential Forced Air Furnace', ht = 'NaturalGas', znht = nil, cl = nil, zones)

  when 'VAV_Chiller_Boiler'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones)

  when 'VAV_Chiller_ASHP'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones)

  when 'VAV_Chiller_DHW'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'DistrictHeating', znht = 'DistrictHeating', cl = 'Electricity', zones)

  when 'VAV_Chiller_PFP'
    standard.model_add_hvac_system(self, 'VAV PFP Boxes', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones)

  when 'VAV_Chiller_GasCoil'
    standard.model_add_hvac_system(self, 'VAV Gas Reheat', ht = 'NaturalGas', ht = 'NaturalGas', cl = 'Electricity', zones)

  when 'VAV_ACChiller_Boiler'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV_ACChiller_ASHP'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV_ACChiller_DHW'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'DistrictHeating', znht = 'DistrictHeating', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV_ACChiller_PFP'
    standard.model_add_hvac_system(self, 'VAV PFP Boxes', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV_ACChiller_GasCoil'
    standard.model_add_hvac_system(self, 'VAV Gas Reheat', ht = 'NaturalGas', ht = 'NaturalGas', cl = 'Electricity', zones,
                                   chilled_water_loop_cooling_type: 'AirCooled')

  when 'VAV_DCW_Boiler'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'DistrictCooling', zones)

  when 'VAV_DCW_ASHP'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'AirSourceHeatPump', znht = 'AirSourceHeatPump', cl = 'DistrictCooling', zones)

  when 'VAV_DCW_DHW'
    standard.model_add_hvac_system(self, 'VAV Reheat', ht = 'DistrictHeating', znht = 'DistrictHeating', cl = 'DistrictCooling', zones)

  when 'VAV_DCW_PFP'
    standard.model_add_hvac_system(self, 'VAV PFP Boxes', ht = 'NaturalGas', znht = 'NaturalGas', cl = 'DistrictCooling', zones)

  when 'VAV_DCW_GasCoil'
    standard.model_add_hvac_system(self, 'VAV Gas Reheat', ht = 'NaturalGas', ht = 'NaturalGas', cl = 'DistrictCooling', zones)

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

  when 'WSHP_FluidCooler_Boiler'
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   heat_pump_loop_cooling_type: 'FluidCooler')

  when 'WSHP_CoolingTower_Boiler'
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'NaturalGas', znht = nil, cl = 'Electricity', zones,
                                   heat_pump_loop_cooling_type: 'CoolingTower')

  when 'WSHP_GSHP'
    standard.model_add_hvac_system(self, 'Ground Source Heat Pumps', ht = 'Electricity', znht = nil, cl = 'Electricity', zones)

  when 'WSHP_DCW_DHW'
    standard.model_add_hvac_system(self, 'Water Source Heat Pumps', ht = 'DistrictHeating', znht = nil, cl = 'DistrictCooling', zones)

  when 'WindowAC_ElectricBaseboard'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'Electricity', znht = nil, cl = nil, heated_zones)

  when 'WindowAC_BoilerBaseboard'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'WindowAC_ASHPBaseboard'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'AirSourceHeatPump', znht = nil, cl = nil, heated_zones)

  when 'WindowAC_DHWBaseboard'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Baseboards', ht = 'DistrictHeating', znht = nil, cl = nil, heated_zones)

  when 'WindowAC_Furnace'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Forced Air Furnace', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'WindowAC_GasHeaters'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)
    standard.model_add_hvac_system(self, 'Unit Heaters', ht = 'NaturalGas', znht = nil, cl = nil, heated_zones)

  when 'WindowAC'
    standard.model_add_hvac_system(self, 'Window AC', ht = nil, znht = nil, cl = 'Electricity', cooled_zones)

  else
    puts "HVAC system type '#{system_type}' not recognized"

  end
end

#add_radiant_hvac_system(std, system_type, zones, rad_props) ⇒ Object

Adds a radiant HVAC system to the model



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
# File 'lib/to_openstudio/hvac/radiant.rb', line 38

def add_radiant_hvac_system(std, system_type, zones, rad_props)
  # the 'zones' argument includes zones that have heating, cooling, or both
  conditioned_zones = zones.select { |zone| std.thermal_zone_heated?(zone) && std.thermal_zone_cooled?(zone) }

  # get the climate zone from the model, which will help set water temerpatures
  climate_zone_obj = self.getClimateZones.getClimateZone('ASHRAE', 2006)
  if climate_zone_obj.empty
    climate_zone_obj = self.getClimateZones.getClimateZone('ASHRAE', 2013)
  end
  if climate_zone_obj.empty || climate_zone_obj.value == ''
      climate_zone = ''
    else
      climate_zone = climate_zone_obj.value
    end
  
  # get the radiant hot water temperature based on the climate zone
  case climate_zone
  when '0', '1'
    radiant_htg_dsgn_sup_wtr_temp_f = 90.0
    cz_mult = 2
  when '2', '2A', '2B'
    radiant_htg_dsgn_sup_wtr_temp_f = 100.0
    cz_mult = 2
  when '3', '3A', '3B', '3C'
    radiant_htg_dsgn_sup_wtr_temp_f = 100.0
    cz_mult = 3
  when '4', '4A', '4B', '4C'
    radiant_htg_dsgn_sup_wtr_temp_f = 100.0
    cz_mult = 4
  when '5', '5A', '5B', '5C'
    radiant_htg_dsgn_sup_wtr_temp_f = 110.0
    cz_mult = 4
  when '6', '6A', '6B'
    radiant_htg_dsgn_sup_wtr_temp_f = 120.0
    cz_mult = 4
  when '7', '8'
    radiant_htg_dsgn_sup_wtr_temp_f = 120.0
    cz_mult = 5
  else  # unrecognized climate zone; default to climate zone 4
    radiant_htg_dsgn_sup_wtr_temp_f = 100.0
    cz_mult = 4
  end

  # create the hot water loop
  if system_type.include? 'ASHP'
    boiler_fuel_type = 'ASHP'
  elsif system_type.include? 'Boiler'
    boiler_fuel_type = 'NaturalGas'
  elsif system_type.include? 'DHW'
    boiler_fuel_type = 'DistrictHeating'
  end
  hot_water_loop = std.model_add_hw_loop(
    self,
    boiler_fuel_type,
    dsgn_sup_wtr_temp: radiant_htg_dsgn_sup_wtr_temp_f,
    dsgn_sup_wtr_temp_delt: 10.0)

  # create the chilled water loop
  if system_type.include? 'Radiant_Chiller'  # water-cooled chiller
    # make condenser water loop
    fan_type = std.model_cw_loop_cooling_tower_fan_type(self)
    condenser_water_loop = std.model_add_cw_loop(
      self,
      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)
    # make chilled water loop
    chilled_water_loop = std.model_add_chw_loop(
      self,
      chw_pumping_type: 'const_pri_var_sec',
      dsgn_sup_wtr_temp: 55.0,
      dsgn_sup_wtr_temp_delt: 5.0,
      chiller_cooling_type: 'WaterCooled',
      condenser_water_loop: condenser_water_loop)
  elsif system_type.include? 'Radiant_ACChiller'  # air-cooled chiller
    chilled_water_loop = std.model_add_chw_loop(
      self,
      chw_pumping_type: 'const_pri_var_sec',
      dsgn_sup_wtr_temp: 55.0,
      dsgn_sup_wtr_temp_delt: 5.0,
      chiller_cooling_type: 'AirCooled')
  else  # district chilled water cooled
      chilled_water_loop = std.model_add_chw_loop(
        self,
        cooling_fuel: 'DistrictCooling',
        chw_pumping_type: 'const_pri_var_sec',
        dsgn_sup_wtr_temp: 55.0,
        dsgn_sup_wtr_temp_delt: 5.0)
  end

  # get the various controls for the radiant system
  if rad_props[:minimum_operation_time]
    minimum_operation = rad_props[:minimum_operation_time]
  else
    minimum_operation = 1
  end
  if rad_props[:switch_over_time]
    switch_over_time = rad_props[:switch_over_time]
  else
    switch_over_time = 24
  end

  # get the start and end hour from the input zones
  start_hour, end_hour = start_end_hour_from_zones_occupancy(zones)

  # add radiant system to the conditioned zones
  include_carpet = false
  control_strategy = 'proportional_control'
  if rad_props[:radiant_type]
    radiant_type = rad_props[:radiant_type].downcase
    if radiant_type == 'floorwithcarpet'
      radiant_type = 'floor'
      include_carpet = true
    elsif radiant_type == 'ceilingmetalpanel' || radiant_type == 'floorwithhardwood'
      control_strategy = 'default'
    end
  else
    radiant_type = 'floor'
  end

  radiant_loops = model_add_low_temp_radiant(
    std, conditioned_zones, hot_water_loop, chilled_water_loop,
    radiant_type: radiant_type,
    control_strategy: control_strategy,
    include_carpet: include_carpet,
    model_occ_hr_start: start_hour,
    model_occ_hr_end: end_hour,
    minimum_operation: minimum_operation,
    switch_over_time: switch_over_time,
    cz_mult: cz_mult)

  # if the equipment includes a DOAS, then add it
  if system_type.include? 'DOAS_'
    std.model_add_doas(self, conditioned_zones)
  end

end

#model_add_low_temp_radiant(std, thermal_zones, hot_water_loop, chilled_water_loop, radiant_type: 'floor', include_carpet: true, carpet_thickness_in: 0.25, model_occ_hr_start: 1.0, model_occ_hr_end: 24.0, control_strategy: 'proportional_control', proportional_gain: 0.3, minimum_operation: 1, weekend_temperature_reset: 2, early_reset_out_arg: 20, switch_over_time: 24.0, cz_mult: 4) ⇒ Object



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
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
# File 'lib/to_openstudio/hvac/radiant.rb', line 265

def model_add_low_temp_radiant(std,
                               thermal_zones,
                               hot_water_loop,
                               chilled_water_loop,
                               radiant_type: 'floor',
                               include_carpet: true,
                               carpet_thickness_in: 0.25,
                               model_occ_hr_start: 1.0,
                               model_occ_hr_end: 24.0,
                               control_strategy: 'proportional_control',
                               proportional_gain: 0.3,
                               minimum_operation: 1,
                               weekend_temperature_reset: 2,
                               early_reset_out_arg: 20,
                               switch_over_time: 24.0,
                               cz_mult: 4)

  # create internal source constructions for surfaces
  OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Model.Model', "Replacing constructions with new radiant slab constructions.")

  # create materials
  # concrete slab materials
  mat_concrete_3_5in = OpenStudio::Model::StandardOpaqueMaterial.new(self, '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(self, 'MediumRough', 0.0381, 2.31, 2322, 832)
  mat_concrete_1_5in.setName('Radiant Slab Concrete - 1.5 in')

  metal_mat = nil
  air_gap_mat = nil
  wood_mat = nil
  wood_floor_insulation = nil
  gypsum_ceiling_mat = nil
  if radiant_type == 'ceilingmetalpanel'
    metal_mat = OpenStudio::Model::StandardOpaqueMaterial.new(self, 'MediumSmooth', 0.003175, 30, 7680, 418)
    metal_mat.setName('Radiant Metal Layer - 0.125 in')
    air_gap_mat = OpenStudio::Model::MasslessOpaqueMaterial.new(self, 'Smooth', 0.004572)
    air_gap_mat.setName('Generic Ceiling Air Gap - R 0.025')
  elsif radiant_type == 'floorwithhardwood'
    wood_mat = OpenStudio::Model::StandardOpaqueMaterial.new(self, 'MediumSmooth', 0.01905, 0.15, 608, 1629)
    wood_mat.setName('Radiant Hardwood Flooring - 0.75 in')
    wood_floor_insulation = OpenStudio::Model::StandardOpaqueMaterial.new(self, 'Rough', 0.0508, 0.02, 56.06, 1210)
    wood_floor_insulation.setName('Radiant Subfloor Insulation - 4.0 in')
    gypsum_ceiling_mat = OpenStudio::Model::StandardOpaqueMaterial.new(self, 'Smooth', 0.0127, 0.16, 800, 1089)
    gypsum_ceiling_mat.setName('Gypsum Ceiling for Radiant Hardwood Flooring - 0.5 in')
  end

  mat_refl_roof_membrane = self.getStandardOpaqueMaterialByName('Roof Membrane - Highly Reflective')
  if mat_refl_roof_membrane.is_initialized
    mat_refl_roof_membrane = self.getStandardOpaqueMaterialByName('Roof Membrane - Highly Reflective').get
  else
    mat_refl_roof_membrane = OpenStudio::Model::StandardOpaqueMaterial.new(self, '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(self, '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(self, '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(self, '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(self, '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
  radiant_ground_slab_construction = nil
  radiant_exterior_slab_construction = nil
  radiant_interior_floor_slab_construction = nil
  radiant_interior_ceiling_slab_construction = nil
  radiant_ceiling_slab_construction = nil
  radiant_interior_ceiling_metal_construction = nil
  radiant_ceiling_metal_construction = nil

  if radiant_type == 'floor'
    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(2)
    radiant_interior_floor_slab_construction.setTubeSpacing(0.2286) # 9 inches
  elsif radiant_type == 'ceiling'
    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 + 1)
    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
  elsif radiant_type == 'ceilingmetalpanel'
    layers = []
    layers << mat_concrete_3_5in
    layers << air_gap_mat
    layers << metal_mat
    layers << metal_mat
    radiant_interior_ceiling_metal_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
    radiant_interior_ceiling_metal_construction.setName('Radiant Interior Ceiling Metal Construction')
    radiant_interior_ceiling_metal_construction.setSourcePresentAfterLayerNumber(3)
    radiant_interior_ceiling_metal_construction.setTemperatureCalculationRequestedAfterLayerNumber(4)
    radiant_interior_ceiling_metal_construction.setTubeSpacing(0.1524) # 6 inches
    
    layers = []
    layers << mat_refl_roof_membrane
    layers << mat_roof_insulation
    layers << mat_concrete_3_5in
    layers << air_gap_mat
    layers << metal_mat
    layers << metal_mat
    radiant_ceiling_metal_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
    radiant_ceiling_metal_construction.setName('Radiant Ceiling Metal Construction')
    radiant_ceiling_metal_construction.setSourcePresentAfterLayerNumber(5)
    radiant_ceiling_metal_construction.setTemperatureCalculationRequestedAfterLayerNumber(6)
    radiant_ceiling_metal_construction.setTubeSpacing(0.1524) # 6 inches
  elsif radiant_type == 'floorwithhardwood'
    layers = []
    layers << mat_slab_insulation
    layers << mat_concrete_3_5in
    layers << wood_mat
    layers << mat_thin_carpet_tile if include_carpet
    radiant_ground_wood_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
    radiant_ground_wood_construction.setName('Radiant Ground Slab Wood Floor Construction')
    radiant_ground_wood_construction.setSourcePresentAfterLayerNumber(2)
    radiant_ground_wood_construction.setTemperatureCalculationRequestedAfterLayerNumber(3)
    radiant_ground_wood_construction.setTubeSpacing(0.2286) # 9 inches

    layers = []
    layers << mat_ext_insulation
    layers << wood_mat
    layers << mat_thin_carpet_tile if include_carpet
    radiant_exterior_wood_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
    radiant_exterior_wood_construction.setName('Radiant Exterior Wood Floor Construction')
    radiant_exterior_wood_construction.setSourcePresentAfterLayerNumber(1)
    radiant_exterior_wood_construction.setTemperatureCalculationRequestedAfterLayerNumber(2)
    radiant_exterior_wood_construction.setTubeSpacing(0.2286) # 9 inches

    layers = []
    layers << gypsum_ceiling_mat
    layers << wood_floor_insulation
    layers << wood_mat
    layers << mat_thin_carpet_tile if include_carpet
    radiant_interior_wood_floor_construction = OpenStudio::Model::ConstructionWithInternalSource.new(layers)
    radiant_interior_wood_floor_construction.setName('Radiant Interior Wooden Floor Construction')
    radiant_interior_wood_floor_construction.setSourcePresentAfterLayerNumber(2)
    radiant_interior_wood_floor_construction.setTemperatureCalculationRequestedAfterLayerNumber(3)
    radiant_interior_wood_floor_construction.setTubeSpacing(0.2286) # 9 inches
  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 = std.model_add_constant_schedule_ruleset(
    self,
    zn_radiant_htg_dsgn_temp_c,
    name = "Zone Radiant Loop Heating Threshold Temperature Schedule - #{zn_radiant_htg_dsgn_temp_f.round(0)}F")
  clg_control_temp_sch = std.model_add_constant_schedule_ruleset(
    self,
    zn_radiant_clg_dsgn_temp_c,
    name = "Zone Radiant Loop Cooling Threshold Temperature Schedule - #{zn_radiant_clg_dsgn_temp_f.round(0)}F")
  throttling_range_f = 4.0 # 2 degF on either side of control temperature
  throttling_range_c = OpenStudio.convert(throttling_range_f, 'F', 'C').get

  # 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

    # assign internal source construction to floors in zone
    srf_count = 0
    zone.spaces.each do |space|
      space.surfaces.each do |surface|
        if surface.isAirWall
          OpenStudio.logFree(OpenStudio::Info, 'openstudio.Model.Model', "Surface #{surface.name} cannot be set to a Radiant Construction as it is an AirBoundary.")
        elsif radiant_type == 'floor'
          if surface.surfaceType == 'Floor'
            srf_count += 1
            if surface.outsideBoundaryCondition == '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)
            end
          end
        elsif radiant_type == 'ceiling'
          if surface.surfaceType == 'RoofCeiling'
            srf_count += 1
            if surface.outsideBoundaryCondition == 'Outdoors'
              surface.setConstruction(radiant_ceiling_slab_construction)
            else # interior ceiling
              surface.setConstruction(radiant_interior_ceiling_slab_construction)
            end
          end
        elsif radiant_type == 'ceilingmetalpanel'
          if surface.surfaceType == 'RoofCeiling'
            srf_count += 1
            if surface.outsideBoundaryCondition == 'Outdoors'
              surface.setConstruction(radiant_ceiling_metal_construction)
            else # interior ceiling
              surface.setConstruction(radiant_interior_ceiling_metal_construction)
            end
          end
        elsif radiant_type == 'floorwithhardwood'
          if surface.surfaceType == 'Floor'
            srf_count += 1
            if surface.outsideBoundaryCondition == 'Ground'
              surface.setConstruction(radiant_ground_wood_construction)
            elsif surface.outsideBoundaryCondition == 'Outdoors'
              surface.setConstruction(radiant_exterior_wood_construction)
            else # interior floor
              surface.setConstruction(radiant_interior_wood_floor_construction)
            end
          end
        end
      end
    end

    # ignore the Zone if it has not thermally active Faces
    if srf_count == 0
      next
    end

    # create radiant coils
    if hot_water_loop
      radiant_loop_htg_coil = OpenStudio::Model::CoilHeatingLowTempRadiantVarFlow.new(self, 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(self, 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_avail_sch = self.alwaysOnDiscreteSchedule
    radiant_loop = OpenStudio::Model::ZoneHVACLowTempRadiantVarFlow.new(self,
                                                                        radiant_avail_sch,
                                                                        radiant_loop_htg_coil,
                                                                        radiant_loop_clg_coil)

    # 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')
    elsif radiant_type == 'ceilingmetalpanel'
      radiant_loop.setRadiantSurfaceType('Ceilings')
    elsif radiant_type == 'floorwithhardwood'
      radiant_loop.setRadiantSurfaceType('Floors')
    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 controls
    radiant_loop.setTemperatureControlType('MeanAirTemperature')
    radiant_loop.addToThermalZone(zone)
    radiant_loops << radiant_loop

    # rename nodes before adding EMS code
    std.rename_plant_loop_nodes(self)

    # set radiant loop controls
    if control_strategy == 'proportional_control'
      std.model_add_radiant_proportional_controls(self, zone, radiant_loop,
                                                  radiant_type: radiant_type,
                                                  model_occ_hr_start: model_occ_hr_start,
                                                  model_occ_hr_end: model_occ_hr_end,
                                                  proportional_gain: proportional_gain,
                                                  minimum_operation: minimum_operation,
                                                  weekend_temperature_reset: weekend_temperature_reset,
                                                  early_reset_out_arg: early_reset_out_arg,
                                                  switch_over_time: switch_over_time)
    end
  end

  return radiant_loops
end

#start_end_hour_from_zones_occupancy(thermal_zones, threshold: 0.1) ⇒ Object

get the start and end hour from the occupancy schedules of thermal zones



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
# File 'lib/to_openstudio/hvac/radiant.rb', line 179

def start_end_hour_from_zones_occupancy(thermal_zones, threshold: 0.1)
  # set the default start and end hour in the event there's no occupancy
  start_hour = 12
  end_hour = 12
  # loop through the occupancy schedules and get the lowest start hour; highest end hour
  thermal_zones.each do |zone|
    zone.spaces.each do |space|
      # gather all of the people objects assigned to the sapce
      peoples = []
      unless space.spaceType.empty?
        space_type = space.spaceType.get
        unless space_type.people.empty?
          space_type.people.each do |ppl|
            peoples << ppl
          end
        end
      end
      space.people.each do |ppl|
        peoples << ppl
      end
      # loop through the pople and gather all occupancy schedules
      peoples.each do |people|
        occupancy_sch_opt = people.numberofPeopleSchedule
        unless occupancy_sch_opt.empty?
          occupancy_sch = occupancy_sch_opt.get
          if occupancy_sch.to_ScheduleRuleset.is_initialized
            occupancy_sch = occupancy_sch.to_ScheduleRuleset.get
            # gather all of the day schedules across the schedule ruleset
            schedule_days, day_ids = [], []
            required_days = [
              occupancy_sch.defaultDaySchedule,
              occupancy_sch.summerDesignDaySchedule,
              occupancy_sch.winterDesignDaySchedule,
              occupancy_sch.holidaySchedule
            ]
            required_days.each do |day_sch|
              unless day_ids.include? day_sch.nameString
                schedule_days << day_sch
                day_ids << day_sch.nameString
              end
            end
            occupancy_sch.scheduleRules.each do |schedule_rule|
              day_sch = schedule_rule.daySchedule
              unless day_ids.include? day_sch.nameString
                schedule_days << day_sch
                day_ids << day_sch.nameString
              end
            end
            # loop through the day schedules and see if the start and end hours should be changed
            schedule_days.each do |day_sch|
              time_until = [1]
              day_sch.times.each do |time|
                time_until << time.hours
              end
              final_time = time_until[-2]
              day_sch.values.zip(time_until).each do |value, time|
                if value > threshold
                  if time < start_hour
                    start_hour = time
                  end
                  if time > end_hour
                    end_hour = time
                  end
                  if time == final_time
                    start_hour = 1
                    end_hour = 24
                  end
                end
              end
            end
          end
        end
      end
    end
  end

  # if no values were set, just set the system to be on all of the time
  if start_hour == 12 or start_hour == 0
    start_hour = 1
  end
  if end_hour == 12
    end_hour = 24
  end
  return start_hour, end_hour
end