-
Notifications
You must be signed in to change notification settings - Fork 12
/
hvac.rb
4750 lines (4301 loc) · 237 KB
/
hvac.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
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
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# frozen_string_literal: true
# TODO
class HVAC
AirSourceHeatRatedODB = 47.0 # degF, Rated outdoor drybulb for air-source systems, heating
AirSourceHeatRatedIDB = 70.0 # degF, Rated indoor drybulb for air-source systems, heating
AirSourceCoolRatedODB = 95.0 # degF, Rated outdoor drybulb for air-source systems, cooling
AirSourceCoolRatedIWB = 67.0 # degF, Rated indoor wetbulb for air-source systems, cooling
CrankcaseHeaterTemp = 50.0 # degF
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param runner [OpenStudio::Measure::OSRunner] OpenStudio Runner object
# @param cooling_system [TODO] TODO
# @param heating_system [TODO] TODO
# @param sequential_cool_load_fracs [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param weather_max_drybulb [TODO] TODO
# @param weather_min_drybulb [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @return [TODO] TODO
def self.apply_air_source_hvac_systems(model, runner, cooling_system, heating_system,
sequential_cool_load_fracs, sequential_heat_load_fracs,
weather_max_drybulb, weather_min_drybulb,
control_zone, hvac_unavailable_periods, schedules_file, hpxml_bldg,
hpxml_header)
is_heatpump = false
if not cooling_system.nil?
if cooling_system.is_a? HPXML::HeatPump
is_heatpump = true
if cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpAirToAir
obj_name = Constants.ObjectNameAirSourceHeatPump
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpMiniSplit
obj_name = Constants.ObjectNameMiniSplitHeatPump
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpPTHP
obj_name = Constants.ObjectNamePTHP
fan_watts_per_cfm = 0.0
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpRoom
obj_name = Constants.ObjectNameRoomHP
fan_watts_per_cfm = 0.0
else
fail "Unexpected heat pump type: #{cooling_system.heat_pump_type}."
end
elsif cooling_system.is_a? HPXML::CoolingSystem
if cooling_system.cooling_system_type == HPXML::HVACTypeCentralAirConditioner
if heating_system.nil?
obj_name = Constants.ObjectNameCentralAirConditioner
else
obj_name = Constants.ObjectNameCentralAirConditionerAndFurnace
# error checking for fan power
if (cooling_system.fan_watts_per_cfm.to_f != heating_system.fan_watts_per_cfm.to_f)
fail "Fan powers for heating system '#{heating_system.id}' and cooling system '#{cooling_system.id}' are attached to a single distribution system and therefore must be the same."
end
end
elsif [HPXML::HVACTypeRoomAirConditioner, HPXML::HVACTypePTAC].include? cooling_system.cooling_system_type
fan_watts_per_cfm = 0.0
if cooling_system.cooling_system_type == HPXML::HVACTypeRoomAirConditioner
obj_name = Constants.ObjectNameRoomAirConditioner
else
obj_name = Constants.ObjectNamePTAC
end
elsif cooling_system.cooling_system_type == HPXML::HVACTypeMiniSplitAirConditioner
obj_name = Constants.ObjectNameMiniSplitAirConditioner
else
fail "Unexpected cooling system type: #{cooling_system.cooling_system_type}."
end
end
elsif (heating_system.is_a? HPXML::HeatingSystem) && (heating_system.heating_system_type == HPXML::HVACTypeFurnace)
obj_name = Constants.ObjectNameFurnace
else
fail "Unexpected heating system type: #{heating_system.heating_system_type}, expect central air source hvac systems."
end
if fan_watts_per_cfm.nil?
if (not cooling_system.nil?) && (not cooling_system.fan_watts_per_cfm.nil?)
fan_watts_per_cfm = cooling_system.fan_watts_per_cfm
else
fan_watts_per_cfm = heating_system.fan_watts_per_cfm
end
end
# Calculate max rated cfm
max_rated_fan_cfm = -9999
if not cooling_system.nil?
clg_ap = cooling_system.additional_properties
if not cooling_system.cooling_detailed_performance_data.empty?
cooling_system.cooling_detailed_performance_data.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum }.each do |dp|
rated_fan_cfm = UnitConversions.convert(dp.capacity, 'Btu/hr', 'ton') * clg_ap.cool_rated_cfm_per_ton[-1]
max_rated_fan_cfm = rated_fan_cfm if rated_fan_cfm > max_rated_fan_cfm
end
else
rated_fan_cfm = UnitConversions.convert(cooling_system.cooling_capacity * clg_ap.cool_capacity_ratios[-1], 'Btu/hr', 'ton') * clg_ap.cool_rated_cfm_per_ton[-1]
max_rated_fan_cfm = rated_fan_cfm if rated_fan_cfm > max_rated_fan_cfm
end
end
if not heating_system.nil?
htg_ap = heating_system.additional_properties
if not heating_system.heating_detailed_performance_data.empty?
heating_system.heating_detailed_performance_data.select { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum }.each do |dp|
rated_fan_cfm = UnitConversions.convert(dp.capacity, 'Btu/hr', 'ton') * htg_ap.heat_rated_cfm_per_ton[-1]
max_rated_fan_cfm = rated_fan_cfm if rated_fan_cfm > max_rated_fan_cfm
end
elsif is_heatpump
rated_fan_cfm = UnitConversions.convert(heating_system.heating_capacity * htg_ap.heat_capacity_ratios[-1], 'Btu/hr', 'ton') * htg_ap.heat_rated_cfm_per_ton[-1]
max_rated_fan_cfm = rated_fan_cfm if rated_fan_cfm > max_rated_fan_cfm
end
end
fan_cfms = []
if not cooling_system.nil?
# Cooling Coil
clg_coil = create_dx_cooling_coil(model, obj_name, cooling_system, max_rated_fan_cfm, weather_max_drybulb)
clg_cfm = cooling_system.cooling_airflow_cfm
clg_ap.cool_fan_speed_ratios.each do |r|
fan_cfms << clg_cfm * r
end
if (cooling_system.is_a? HPXML::CoolingSystem) && cooling_system.has_integrated_heating
if cooling_system.integrated_heating_system_fuel == HPXML::FuelTypeElectricity
htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model)
htg_coil.setEfficiency(cooling_system.integrated_heating_system_efficiency_percent)
else
htg_coil = OpenStudio::Model::CoilHeatingGas.new(model)
htg_coil.setGasBurnerEfficiency(cooling_system.integrated_heating_system_efficiency_percent)
htg_coil.setOnCycleParasiticElectricLoad(0)
htg_coil.setOffCycleParasiticGasLoad(0)
htg_coil.setFuelType(EPlus.fuel_type(cooling_system.integrated_heating_system_fuel))
end
htg_coil.setNominalCapacity(UnitConversions.convert(cooling_system.integrated_heating_system_capacity, 'Btu/hr', 'W'))
htg_coil.setName(obj_name + ' htg coil')
htg_coil.additionalProperties.setFeature('HPXML_ID', cooling_system.id) # Used by reporting measure
htg_cfm = cooling_system.integrated_heating_system_airflow_cfm
fan_cfms << htg_cfm
end
end
if not heating_system.nil?
htg_cfm = heating_system.heating_airflow_cfm
if is_heatpump
supp_max_temp = htg_ap.supp_max_temp
htg_ap.heat_fan_speed_ratios.each do |r|
fan_cfms << htg_cfm * r
end
# Defrost calculations
if hpxml_header.defrost_model_type == HPXML::AdvancedResearchDefrostModelTypeAdvanced
q_dot_defrost, p_dot_defrost = calculate_heat_pump_defrost_load_power_watts(heating_system, hpxml_bldg.building_construction.number_of_units,
fan_cfms.max, htg_cfm * htg_ap.heat_fan_speed_ratios[-1],
fan_watts_per_cfm)
elsif hpxml_header.defrost_model_type != HPXML::AdvancedResearchDefrostModelTypeStandard
fail 'unknown defrost model type.'
end
# Heating Coil
htg_coil = create_dx_heating_coil(model, obj_name, heating_system, max_rated_fan_cfm, weather_min_drybulb, hpxml_header.defrost_model_type, p_dot_defrost)
# Supplemental Heating Coil
htg_supp_coil = create_supp_heating_coil(model, obj_name, heating_system)
else
# Heating Coil
fan_cfms << htg_cfm
if heating_system.heating_system_fuel == HPXML::FuelTypeElectricity
htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model)
htg_coil.setEfficiency(heating_system.heating_efficiency_afue)
else
htg_coil = OpenStudio::Model::CoilHeatingGas.new(model)
htg_coil.setGasBurnerEfficiency(heating_system.heating_efficiency_afue)
htg_coil.setOnCycleParasiticElectricLoad(0)
htg_coil.setOffCycleParasiticGasLoad(UnitConversions.convert(heating_system.pilot_light_btuh.to_f, 'Btu/hr', 'W'))
htg_coil.setFuelType(EPlus.fuel_type(heating_system.heating_system_fuel))
end
htg_coil.setNominalCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
htg_coil.setName(obj_name + ' htg coil')
htg_coil.additionalProperties.setFeature('HPXML_ID', heating_system.id) # Used by reporting measure
htg_coil.additionalProperties.setFeature('IsHeatPumpBackup', heating_system.is_heat_pump_backup_system) # Used by reporting measure
end
end
# Fan
fan = create_supply_fan(model, obj_name, fan_watts_per_cfm, fan_cfms)
if heating_system.is_a?(HPXML::HeatPump) && (not heating_system.backup_system.nil?) && (not htg_ap.hp_min_temp.nil?)
# Disable blower fan power below compressor lockout temperature if separate backup heating system
set_fan_power_ems_program(model, fan, htg_ap.hp_min_temp)
end
if (not cooling_system.nil?) && (not heating_system.nil?) && (cooling_system == heating_system)
disaggregate_fan_or_pump(model, fan, htg_coil, clg_coil, htg_supp_coil, cooling_system)
else
if not cooling_system.nil?
if cooling_system.has_integrated_heating
disaggregate_fan_or_pump(model, fan, htg_coil, clg_coil, nil, cooling_system)
else
disaggregate_fan_or_pump(model, fan, nil, clg_coil, nil, cooling_system)
end
end
if not heating_system.nil?
if heating_system.is_heat_pump_backup_system
disaggregate_fan_or_pump(model, fan, nil, nil, htg_coil, heating_system)
else
disaggregate_fan_or_pump(model, fan, htg_coil, nil, htg_supp_coil, heating_system)
end
end
end
# Unitary System
air_loop_unitary = create_air_loop_unitary_system(model, obj_name, fan, htg_coil, clg_coil, htg_supp_coil, htg_cfm, clg_cfm, supp_max_temp)
# Unitary System Performance
if (not clg_ap.nil?) && (clg_ap.cool_fan_speed_ratios.size > 1)
perf = OpenStudio::Model::UnitarySystemPerformanceMultispeed.new(model)
perf.setSingleModeOperation(false)
for speed in 1..clg_ap.cool_fan_speed_ratios.size
if is_heatpump
f = OpenStudio::Model::SupplyAirflowRatioField.new(htg_ap.heat_fan_speed_ratios[speed - 1], clg_ap.cool_fan_speed_ratios[speed - 1])
else
f = OpenStudio::Model::SupplyAirflowRatioField.fromCoolingRatio(clg_ap.cool_fan_speed_ratios[speed - 1])
end
perf.addSupplyAirflowRatioField(f)
end
air_loop_unitary.setDesignSpecificationMultispeedObject(perf)
end
# Air Loop
air_loop = create_air_loop(model, obj_name, air_loop_unitary, control_zone, sequential_heat_load_fracs, sequential_cool_load_fracs, [htg_cfm.to_f, clg_cfm.to_f].max, heating_system, hvac_unavailable_periods)
apply_installation_quality(model, heating_system, cooling_system, air_loop_unitary, htg_coil, clg_coil, control_zone)
apply_max_power_EMS(model, runner, hpxml_bldg, air_loop_unitary, control_zone, heating_system, cooling_system, htg_supp_coil, clg_coil, htg_coil, schedules_file)
if is_heatpump && hpxml_header.defrost_model_type == HPXML::AdvancedResearchDefrostModelTypeAdvanced
apply_advanced_defrost(model, htg_coil, air_loop_unitary, control_zone.spaces[0], htg_supp_coil, cooling_system, q_dot_defrost)
end
return air_loop
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param cooling_system [TODO] TODO
# @param sequential_cool_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @param unit_multiplier [Integer] Number of similar dwelling units
# @return [TODO] TODO
def self.apply_evaporative_cooler(model, cooling_system, sequential_cool_load_fracs, control_zone,
hvac_unavailable_periods, unit_multiplier)
obj_name = Constants.ObjectNameEvaporativeCooler
clg_ap = cooling_system.additional_properties
clg_cfm = cooling_system.cooling_airflow_cfm
# Evap Cooler
evap_cooler = OpenStudio::Model::EvaporativeCoolerDirectResearchSpecial.new(model, model.alwaysOnDiscreteSchedule)
evap_cooler.setName(obj_name)
evap_cooler.setCoolerEffectiveness(clg_ap.effectiveness)
evap_cooler.setEvaporativeOperationMinimumDrybulbTemperature(0) # relax limitation to open evap cooler for any potential cooling
evap_cooler.setEvaporativeOperationMaximumLimitWetbulbTemperature(50) # relax limitation to open evap cooler for any potential cooling
evap_cooler.setEvaporativeOperationMaximumLimitDrybulbTemperature(50) # relax limitation to open evap cooler for any potential cooling
evap_cooler.setPrimaryAirDesignFlowRate(UnitConversions.convert(clg_cfm, 'cfm', 'm^3/s'))
evap_cooler.additionalProperties.setFeature('HPXML_ID', cooling_system.id) # Used by reporting measure
# Air Loop
air_loop = create_air_loop(model, obj_name, evap_cooler, control_zone, [0], sequential_cool_load_fracs, clg_cfm, nil, hvac_unavailable_periods)
# Fan
fan_watts_per_cfm = [2.79 * (clg_cfm / unit_multiplier)**-0.29, 0.6].min # W/cfm; fit of efficacy to air flow from the CEC listed equipment
fan = create_supply_fan(model, obj_name, fan_watts_per_cfm, [clg_cfm])
fan.addToNode(air_loop.supplyInletNode)
disaggregate_fan_or_pump(model, fan, nil, evap_cooler, nil, cooling_system)
# Outdoor air intake system
oa_intake_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
oa_intake_controller.setName("#{air_loop.name} OA Controller")
oa_intake_controller.setMinimumLimitType('FixedMinimum')
oa_intake_controller.resetEconomizerMinimumLimitDryBulbTemperature
oa_intake_controller.setMinimumFractionofOutdoorAirSchedule(model.alwaysOnDiscreteSchedule)
oa_intake_controller.setMaximumOutdoorAirFlowRate(UnitConversions.convert(clg_cfm, 'cfm', 'm^3/s'))
oa_intake = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_intake_controller)
oa_intake.setName("#{air_loop.name} OA System")
oa_intake.addToNode(air_loop.supplyInletNode)
# air handler controls
# setpoint follows OAT WetBulb
evap_stpt_manager = OpenStudio::Model::SetpointManagerFollowOutdoorAirTemperature.new(model)
evap_stpt_manager.setName('Follow OATwb')
evap_stpt_manager.setReferenceTemperatureType('OutdoorAirWetBulb')
evap_stpt_manager.setOffsetTemperatureDifference(0.0)
evap_stpt_manager.addToNode(air_loop.supplyOutletNode)
return air_loop
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param runner [OpenStudio::Measure::OSRunner] OpenStudio Runner object
# @param weather [WeatherProcess] Weather object
# @param heat_pump [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param sequential_cool_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param ground_conductivity [TODO] TODO
# @param ground_diffusivity [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @param unit_multiplier [Integer] Number of similar dwelling units
# @return [TODO] TODO
def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
sequential_heat_load_fracs, sequential_cool_load_fracs,
control_zone, ground_conductivity, ground_diffusivity,
hvac_unavailable_periods, unit_multiplier)
if unit_multiplier > 1
# FUTURE: Figure out how to allow this. If we allow it, update docs and hpxml_translator_test.rb too.
# https://github.com/NREL/OpenStudio-HPXML/issues/1499
fail 'NumberofUnits greater than 1 is not supported for ground-to-air heat pumps.'
end
obj_name = Constants.ObjectNameGroundSourceHeatPump
geothermal_loop = heat_pump.geothermal_loop
hp_ap = heat_pump.additional_properties
htg_cfm = heat_pump.heating_airflow_cfm
clg_cfm = heat_pump.cooling_airflow_cfm
htg_cfm_rated = heat_pump.airflow_defect_ratio.nil? ? htg_cfm : (htg_cfm / (1.0 + heat_pump.airflow_defect_ratio))
clg_cfm_rated = heat_pump.airflow_defect_ratio.nil? ? clg_cfm : (clg_cfm / (1.0 + heat_pump.airflow_defect_ratio))
if hp_ap.frac_glycol == 0
hp_ap.fluid_type = Constants.FluidWater
runner.registerWarning("Specified #{hp_ap.fluid_type} fluid type and 0 fraction of glycol, so assuming #{Constants.FluidWater} fluid type.")
end
# Apply unit multiplier
geothermal_loop.loop_flow *= unit_multiplier
geothermal_loop.num_bore_holes *= unit_multiplier
# Cooling Coil
clg_total_cap_curve = create_curve_quad_linear(model, hp_ap.cool_cap_curve_spec[0], obj_name + ' clg total cap curve')
clg_sens_cap_curve = create_curve_quint_linear(model, hp_ap.cool_sh_curve_spec[0], obj_name + ' clg sens cap curve')
clg_power_curve = create_curve_quad_linear(model, hp_ap.cool_power_curve_spec[0], obj_name + ' clg power curve')
clg_coil = OpenStudio::Model::CoilCoolingWaterToAirHeatPumpEquationFit.new(model, clg_total_cap_curve, clg_sens_cap_curve, clg_power_curve)
clg_coil.setName(obj_name + ' clg coil')
clg_coil.setRatedCoolingCoefficientofPerformance(hp_ap.cool_rated_cops[0])
clg_coil.setNominalTimeforCondensateRemovaltoBegin(1000)
clg_coil.setRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity(1.5)
clg_coil.setRatedAirFlowRate(UnitConversions.convert(clg_cfm_rated, 'cfm', 'm^3/s'))
clg_coil.setRatedWaterFlowRate(UnitConversions.convert(geothermal_loop.loop_flow, 'gal/min', 'm^3/s'))
clg_coil.setRatedEnteringWaterTemperature(UnitConversions.convert(80, 'F', 'C'))
clg_coil.setRatedEnteringAirDryBulbTemperature(UnitConversions.convert(80, 'F', 'C'))
clg_coil.setRatedEnteringAirWetBulbTemperature(UnitConversions.convert(67, 'F', 'C'))
clg_coil.setRatedTotalCoolingCapacity(UnitConversions.convert(heat_pump.cooling_capacity, 'Btu/hr', 'W'))
clg_coil.setRatedSensibleCoolingCapacity(UnitConversions.convert(hp_ap.cooling_capacity_sensible, 'Btu/hr', 'W'))
clg_coil.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
# Heating Coil
htg_cap_curve = create_curve_quad_linear(model, hp_ap.heat_cap_curve_spec[0], obj_name + ' htg cap curve')
htg_power_curve = create_curve_quad_linear(model, hp_ap.heat_power_curve_spec[0], obj_name + ' htg power curve')
htg_coil = OpenStudio::Model::CoilHeatingWaterToAirHeatPumpEquationFit.new(model, htg_cap_curve, htg_power_curve)
htg_coil.setName(obj_name + ' htg coil')
htg_coil.setRatedHeatingCoefficientofPerformance(hp_ap.heat_rated_cops[0])
htg_coil.setRatedAirFlowRate(UnitConversions.convert(htg_cfm_rated, 'cfm', 'm^3/s'))
htg_coil.setRatedWaterFlowRate(UnitConversions.convert(geothermal_loop.loop_flow, 'gal/min', 'm^3/s'))
htg_coil.setRatedEnteringWaterTemperature(UnitConversions.convert(60, 'F', 'C'))
htg_coil.setRatedEnteringAirDryBulbTemperature(UnitConversions.convert(70, 'F', 'C'))
htg_coil.setRatedHeatingCapacity(UnitConversions.convert(heat_pump.heating_capacity, 'Btu/hr', 'W'))
htg_coil.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
# Supplemental Heating Coil
htg_supp_coil = create_supp_heating_coil(model, obj_name, heat_pump)
# Site Ground Temperature Undisturbed
xing = OpenStudio::Model::SiteGroundTemperatureUndisturbedXing.new(model)
xing.setSoilSurfaceTemperatureAmplitude1(UnitConversions.convert(weather.data.DeepGroundSurfTempAmp1, 'deltaf', 'deltac'))
xing.setSoilSurfaceTemperatureAmplitude2(UnitConversions.convert(weather.data.DeepGroundSurfTempAmp2, 'deltaf', 'deltac'))
xing.setPhaseShiftofTemperatureAmplitude1(weather.data.DeepGroundPhaseShiftTempAmp1)
xing.setPhaseShiftofTemperatureAmplitude2(weather.data.DeepGroundPhaseShiftTempAmp2)
# Ground Heat Exchanger
ground_heat_exch_vert = OpenStudio::Model::GroundHeatExchangerVertical.new(model, xing)
ground_heat_exch_vert.setName(obj_name + ' exchanger')
ground_heat_exch_vert.setBoreHoleRadius(UnitConversions.convert(geothermal_loop.bore_diameter / 2.0, 'in', 'm'))
ground_heat_exch_vert.setGroundThermalConductivity(UnitConversions.convert(ground_conductivity, 'Btu/(hr*ft*R)', 'W/(m*K)'))
ground_heat_exch_vert.setGroundThermalHeatCapacity(UnitConversions.convert(ground_conductivity / ground_diffusivity, 'Btu/(ft^3*F)', 'J/(m^3*K)'))
ground_heat_exch_vert.setGroundTemperature(UnitConversions.convert(weather.data.DeepGroundAnnualTemp, 'F', 'C'))
ground_heat_exch_vert.setGroutThermalConductivity(UnitConversions.convert(geothermal_loop.grout_conductivity, 'Btu/(hr*ft*R)', 'W/(m*K)'))
ground_heat_exch_vert.setPipeThermalConductivity(UnitConversions.convert(geothermal_loop.pipe_conductivity, 'Btu/(hr*ft*R)', 'W/(m*K)'))
ground_heat_exch_vert.setPipeOutDiameter(UnitConversions.convert(hp_ap.pipe_od, 'in', 'm'))
ground_heat_exch_vert.setUTubeDistance(UnitConversions.convert(geothermal_loop.shank_spacing, 'in', 'm'))
ground_heat_exch_vert.setPipeThickness(UnitConversions.convert((hp_ap.pipe_od - hp_ap.pipe_id) / 2.0, 'in', 'm'))
ground_heat_exch_vert.setMaximumLengthofSimulation(1)
ground_heat_exch_vert.setDesignFlowRate(UnitConversions.convert(geothermal_loop.loop_flow, 'gal/min', 'm^3/s'))
ground_heat_exch_vert.setNumberofBoreHoles(geothermal_loop.num_bore_holes)
ground_heat_exch_vert.setBoreHoleLength(UnitConversions.convert(geothermal_loop.bore_length, 'ft', 'm'))
ground_heat_exch_vert.setGFunctionReferenceRatio(ground_heat_exch_vert.boreHoleRadius.get / ground_heat_exch_vert.boreHoleLength.get) # ensure this ratio is consistent with rb/H so that g values will be taken as-is
ground_heat_exch_vert.removeAllGFunctions
for i in 0..(hp_ap.GSHP_G_Functions[0].size - 1)
ground_heat_exch_vert.addGFunction(hp_ap.GSHP_G_Functions[0][i], hp_ap.GSHP_G_Functions[1][i])
end
xing = ground_heat_exch_vert.undisturbedGroundTemperatureModel.to_SiteGroundTemperatureUndisturbedXing.get
xing.setSoilThermalConductivity(ground_heat_exch_vert.groundThermalConductivity.get)
xing.setSoilSpecificHeat(ground_heat_exch_vert.groundThermalHeatCapacity.get / xing.soilDensity)
xing.setAverageSoilSurfaceTemperature(ground_heat_exch_vert.groundTemperature.get)
# Plant Loop
plant_loop = OpenStudio::Model::PlantLoop.new(model)
plant_loop.setName(obj_name + ' condenser loop')
if hp_ap.fluid_type == Constants.FluidWater
plant_loop.setFluidType('Water')
else
plant_loop.setFluidType({ Constants.FluidPropyleneGlycol => 'PropyleneGlycol', Constants.FluidEthyleneGlycol => 'EthyleneGlycol' }[hp_ap.fluid_type])
plant_loop.setGlycolConcentration((hp_ap.frac_glycol * 100).to_i)
end
plant_loop.setMaximumLoopTemperature(48.88889)
plant_loop.setMinimumLoopTemperature(UnitConversions.convert(hp_ap.design_hw, 'F', 'C'))
plant_loop.setMinimumLoopFlowRate(0)
plant_loop.setLoadDistributionScheme('SequentialLoad')
plant_loop.addSupplyBranchForComponent(ground_heat_exch_vert)
plant_loop.addDemandBranchForComponent(htg_coil)
plant_loop.addDemandBranchForComponent(clg_coil)
plant_loop.setMaximumLoopFlowRate(UnitConversions.convert(geothermal_loop.loop_flow, 'gal/min', 'm^3/s'))
sizing_plant = plant_loop.sizingPlant
sizing_plant.setLoopType('Condenser')
sizing_plant.setDesignLoopExitTemperature(UnitConversions.convert(hp_ap.design_chw, 'F', 'C'))
sizing_plant.setLoopDesignTemperatureDifference(UnitConversions.convert(hp_ap.design_delta_t, 'deltaF', 'deltaC'))
setpoint_mgr_follow_ground_temp = OpenStudio::Model::SetpointManagerFollowGroundTemperature.new(model)
setpoint_mgr_follow_ground_temp.setName(obj_name + ' condenser loop temp')
setpoint_mgr_follow_ground_temp.setControlVariable('Temperature')
setpoint_mgr_follow_ground_temp.setMaximumSetpointTemperature(48.88889)
setpoint_mgr_follow_ground_temp.setMinimumSetpointTemperature(UnitConversions.convert(hp_ap.design_hw, 'F', 'C'))
setpoint_mgr_follow_ground_temp.setReferenceGroundTemperatureObjectType('Site:GroundTemperature:Deep')
setpoint_mgr_follow_ground_temp.addToNode(plant_loop.supplyOutletNode)
# Pump
pump = OpenStudio::Model::PumpVariableSpeed.new(model)
pump.setName(obj_name + ' pump')
pump.setMotorEfficiency(0.85)
pump.setRatedPumpHead(20000)
pump.setFractionofMotorInefficienciestoFluidStream(0)
pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
pump.setCoefficient2ofthePartLoadPerformanceCurve(1)
pump.setCoefficient3ofthePartLoadPerformanceCurve(0)
pump.setCoefficient4ofthePartLoadPerformanceCurve(0)
pump.setMinimumFlowRate(0)
pump.setPumpControlType('Intermittent')
pump.addToNode(plant_loop.supplyInletNode)
if heat_pump.cooling_capacity > 1.0
pump_w = heat_pump.pump_watts_per_ton * UnitConversions.convert(heat_pump.cooling_capacity, 'Btu/hr', 'ton')
else
pump_w = heat_pump.pump_watts_per_ton * UnitConversions.convert(heat_pump.heating_capacity, 'Btu/hr', 'ton')
end
pump_w = [pump_w, 1.0].max # prevent error if zero
pump.setRatedPowerConsumption(pump_w)
pump.setRatedFlowRate(calc_pump_rated_flow_rate(0.75, pump_w, pump.ratedPumpHead))
disaggregate_fan_or_pump(model, pump, htg_coil, clg_coil, htg_supp_coil, heat_pump)
# Pipes
chiller_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
plant_loop.addSupplyBranchForComponent(chiller_bypass_pipe)
coil_bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
plant_loop.addDemandBranchForComponent(coil_bypass_pipe)
supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
supply_outlet_pipe.addToNode(plant_loop.supplyOutletNode)
demand_inlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
demand_inlet_pipe.addToNode(plant_loop.demandInletNode)
demand_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
demand_outlet_pipe.addToNode(plant_loop.demandOutletNode)
# Fan
fan = create_supply_fan(model, obj_name, heat_pump.fan_watts_per_cfm, [htg_cfm, clg_cfm])
disaggregate_fan_or_pump(model, fan, htg_coil, clg_coil, htg_supp_coil, heat_pump)
# Unitary System
air_loop_unitary = create_air_loop_unitary_system(model, obj_name, fan, htg_coil, clg_coil, htg_supp_coil, htg_cfm, clg_cfm, 40.0)
set_pump_power_ems_program(model, pump_w, pump, air_loop_unitary)
if heat_pump.is_shared_system
# Shared pump power per ANSI/RESNET/ICC 301-2019 Section 4.4.5.1 (pump runs 8760)
shared_pump_w = heat_pump.shared_loop_watts / heat_pump.number_of_units_served.to_f
equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
equip_def.setName(Constants.ObjectNameGSHPSharedPump)
equip = OpenStudio::Model::ElectricEquipment.new(equip_def)
equip.setName(equip_def.name.to_s)
equip.setSpace(control_zone.spaces[0]) # no heat gain, so assign the equipment to an arbitrary space
equip_def.setDesignLevel(shared_pump_w)
equip_def.setFractionRadiant(0)
equip_def.setFractionLatent(0)
equip_def.setFractionLost(1)
equip.setSchedule(model.alwaysOnDiscreteSchedule)
equip.setEndUseSubcategory(Constants.ObjectNameGSHPSharedPump)
equip.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
end
# Air Loop
air_loop = create_air_loop(model, obj_name, air_loop_unitary, control_zone, sequential_heat_load_fracs, sequential_cool_load_fracs, [htg_cfm, clg_cfm].max, heat_pump, hvac_unavailable_periods)
# HVAC Installation Quality
apply_installation_quality(model, heat_pump, heat_pump, air_loop_unitary, htg_coil, clg_coil, control_zone)
return air_loop
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param heat_pump [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param sequential_cool_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_water_loop_to_air_heat_pump(model, heat_pump,
sequential_heat_load_fracs, sequential_cool_load_fracs,
control_zone, hvac_unavailable_periods)
if heat_pump.fraction_cool_load_served > 0
# WLHPs connected to chillers or cooling towers should have already been converted to
# central air conditioners
fail 'WLHP model should only be called for central boilers.'
end
obj_name = Constants.ObjectNameWaterLoopHeatPump
htg_cfm = heat_pump.heating_airflow_cfm
# Cooling Coil (none)
clg_coil = nil
# Heating Coil (model w/ constant efficiency)
constant_biquadratic = create_curve_biquadratic_constant(model)
constant_quadratic = create_curve_quadratic_constant(model)
htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new(model, model.alwaysOnDiscreteSchedule, constant_biquadratic, constant_quadratic, constant_biquadratic, constant_quadratic, constant_quadratic)
htg_coil.setName(obj_name + ' htg coil')
htg_coil.setRatedCOP(heat_pump.heating_efficiency_cop)
htg_coil.setDefrostTimePeriodFraction(0.00001) # Disable defrost; avoid E+ warning w/ value of zero
htg_coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-40)
htg_coil.setRatedTotalHeatingCapacity(UnitConversions.convert(heat_pump.heating_capacity, 'Btu/hr', 'W'))
htg_coil.setRatedAirFlowRate(htg_cfm)
htg_coil.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
# Supplemental Heating Coil
htg_supp_coil = create_supp_heating_coil(model, obj_name, heat_pump)
# Fan
fan_power_installed = 0.0 # Use provided net COP
fan = create_supply_fan(model, obj_name, fan_power_installed, [htg_cfm])
disaggregate_fan_or_pump(model, fan, htg_coil, clg_coil, htg_supp_coil, heat_pump)
# Unitary System
air_loop_unitary = create_air_loop_unitary_system(model, obj_name, fan, htg_coil, clg_coil, htg_supp_coil, htg_cfm, nil)
# Air Loop
air_loop = create_air_loop(model, obj_name, air_loop_unitary, control_zone, sequential_heat_load_fracs, sequential_cool_load_fracs, htg_cfm, heat_pump, hvac_unavailable_periods)
return air_loop
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param runner [OpenStudio::Measure::OSRunner] OpenStudio Runner object
# @param heating_system [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_boiler(model, runner, heating_system, sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
obj_name = Constants.ObjectNameBoiler
is_condensing = false # FUTURE: Expose as input; default based on AFUE
oat_reset_enabled = false
oat_high = nil
oat_low = nil
oat_hwst_high = nil
oat_hwst_low = nil
design_temp = 180.0 # deg-F
if oat_reset_enabled
if oat_high.nil? || oat_low.nil? || oat_hwst_low.nil? || oat_hwst_high.nil?
runner.registerWarning('Boiler outdoor air temperature (OAT) reset is enabled but no setpoints were specified so OAT reset is being disabled.')
oat_reset_enabled = false
end
end
# Plant Loop
plant_loop = OpenStudio::Model::PlantLoop.new(model)
plant_loop.setName(obj_name + ' hydronic heat loop')
plant_loop.setFluidType('Water')
plant_loop.setMaximumLoopTemperature(100)
plant_loop.setMinimumLoopTemperature(0)
plant_loop.setMinimumLoopFlowRate(0)
plant_loop.autocalculatePlantLoopVolume()
loop_sizing = plant_loop.sizingPlant
loop_sizing.setLoopType('Heating')
loop_sizing.setDesignLoopExitTemperature(UnitConversions.convert(design_temp, 'F', 'C'))
loop_sizing.setLoopDesignTemperatureDifference(UnitConversions.convert(20.0, 'deltaF', 'deltaC'))
# Pump
pump_w = heating_system.electric_auxiliary_energy / 2.08
pump_w = [pump_w, 1.0].max # prevent error if zero
pump = OpenStudio::Model::PumpVariableSpeed.new(model)
pump.setName(obj_name + ' hydronic pump')
pump.setRatedPowerConsumption(pump_w)
pump.setMotorEfficiency(0.85)
pump.setRatedPumpHead(20000)
pump.setRatedFlowRate(calc_pump_rated_flow_rate(0.75, pump_w, pump.ratedPumpHead))
pump.setFractionofMotorInefficienciestoFluidStream(0)
pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
pump.setCoefficient2ofthePartLoadPerformanceCurve(1)
pump.setCoefficient3ofthePartLoadPerformanceCurve(0)
pump.setCoefficient4ofthePartLoadPerformanceCurve(0)
pump.setPumpControlType('Intermittent')
pump.addToNode(plant_loop.supplyInletNode)
# Boiler
boiler = OpenStudio::Model::BoilerHotWater.new(model)
boiler.setName(obj_name)
boiler.setFuelType(EPlus.fuel_type(heating_system.heating_system_fuel))
if is_condensing
# Convert Rated Efficiency at 80F and 1.0PLR where the performance curves are derived from to Design condition as input
boiler_RatedHWRT = UnitConversions.convert(80.0, 'F', 'C')
plr_Rated = 1.0
plr_Design = 1.0
boiler_DesignHWRT = UnitConversions.convert(design_temp - 20.0, 'F', 'C')
# Efficiency curves are normalized using 80F return water temperature, at 0.254PLR
condBlr_TE_Coeff = [1.058343061, 0.052650153, 0.0087272, 0.001742217, 0.00000333715, 0.000513723]
boilerEff_Norm = heating_system.heating_efficiency_afue / (condBlr_TE_Coeff[0] - condBlr_TE_Coeff[1] * plr_Rated - condBlr_TE_Coeff[2] * plr_Rated**2 - condBlr_TE_Coeff[3] * boiler_RatedHWRT + condBlr_TE_Coeff[4] * boiler_RatedHWRT**2 + condBlr_TE_Coeff[5] * boiler_RatedHWRT * plr_Rated)
boilerEff_Design = boilerEff_Norm * (condBlr_TE_Coeff[0] - condBlr_TE_Coeff[1] * plr_Design - condBlr_TE_Coeff[2] * plr_Design**2 - condBlr_TE_Coeff[3] * boiler_DesignHWRT + condBlr_TE_Coeff[4] * boiler_DesignHWRT**2 + condBlr_TE_Coeff[5] * boiler_DesignHWRT * plr_Design)
boiler.setNominalThermalEfficiency(boilerEff_Design)
boiler.setEfficiencyCurveTemperatureEvaluationVariable('EnteringBoiler')
boiler_eff_curve = create_curve_biquadratic(model, [1.058343061, -0.052650153, -0.0087272, -0.001742217, 0.00000333715, 0.000513723], 'CondensingBoilerEff', 0.2, 1.0, 30.0, 85.0)
else
boiler.setNominalThermalEfficiency(heating_system.heating_efficiency_afue)
boiler.setEfficiencyCurveTemperatureEvaluationVariable('LeavingBoiler')
boiler_eff_curve = create_curve_bicubic(model, [1.111720116, 0.078614078, -0.400425756, 0.0, -0.000156783, 0.009384599, 0.234257955, 1.32927e-06, -0.004446701, -1.22498e-05], 'NonCondensingBoilerEff', 0.1, 1.0, 20.0, 80.0)
end
boiler.setNormalizedBoilerEfficiencyCurve(boiler_eff_curve)
boiler.setMinimumPartLoadRatio(0.0)
boiler.setMaximumPartLoadRatio(1.0)
boiler.setBoilerFlowMode('LeavingSetpointModulated')
boiler.setOptimumPartLoadRatio(1.0)
boiler.setWaterOutletUpperTemperatureLimit(99.9)
boiler.setOnCycleParasiticElectricLoad(0)
boiler.setNominalCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
boiler.setOffCycleParasiticFuelLoad(UnitConversions.convert(heating_system.pilot_light_btuh.to_f, 'Btu/hr', 'W'))
plant_loop.addSupplyBranchForComponent(boiler)
boiler.additionalProperties.setFeature('HPXML_ID', heating_system.id) # Used by reporting measure
boiler.additionalProperties.setFeature('IsHeatPumpBackup', heating_system.is_heat_pump_backup_system) # Used by reporting measure
set_pump_power_ems_program(model, pump_w, pump, boiler)
if is_condensing && oat_reset_enabled
setpoint_manager_oar = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
setpoint_manager_oar.setName(obj_name + ' outdoor reset')
setpoint_manager_oar.setControlVariable('Temperature')
setpoint_manager_oar.setSetpointatOutdoorLowTemperature(UnitConversions.convert(oat_hwst_low, 'F', 'C'))
setpoint_manager_oar.setOutdoorLowTemperature(UnitConversions.convert(oat_low, 'F', 'C'))
setpoint_manager_oar.setSetpointatOutdoorHighTemperature(UnitConversions.convert(oat_hwst_high, 'F', 'C'))
setpoint_manager_oar.setOutdoorHighTemperature(UnitConversions.convert(oat_high, 'F', 'C'))
setpoint_manager_oar.addToNode(plant_loop.supplyOutletNode)
end
hydronic_heat_supply_setpoint = OpenStudio::Model::ScheduleConstant.new(model)
hydronic_heat_supply_setpoint.setName(obj_name + ' hydronic heat supply setpoint')
hydronic_heat_supply_setpoint.setValue(UnitConversions.convert(design_temp, 'F', 'C'))
setpoint_manager_scheduled = OpenStudio::Model::SetpointManagerScheduled.new(model, hydronic_heat_supply_setpoint)
setpoint_manager_scheduled.setName(obj_name + ' hydronic heat loop setpoint manager')
setpoint_manager_scheduled.setControlVariable('Temperature')
setpoint_manager_scheduled.addToNode(plant_loop.supplyOutletNode)
pipe_supply_bypass = OpenStudio::Model::PipeAdiabatic.new(model)
plant_loop.addSupplyBranchForComponent(pipe_supply_bypass)
pipe_supply_outlet = OpenStudio::Model::PipeAdiabatic.new(model)
pipe_supply_outlet.addToNode(plant_loop.supplyOutletNode)
pipe_demand_bypass = OpenStudio::Model::PipeAdiabatic.new(model)
plant_loop.addDemandBranchForComponent(pipe_demand_bypass)
pipe_demand_inlet = OpenStudio::Model::PipeAdiabatic.new(model)
pipe_demand_inlet.addToNode(plant_loop.demandInletNode)
pipe_demand_outlet = OpenStudio::Model::PipeAdiabatic.new(model)
pipe_demand_outlet.addToNode(plant_loop.demandOutletNode)
bb_ua = UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W') / UnitConversions.convert(UnitConversions.convert(loop_sizing.designLoopExitTemperature, 'C', 'F') - 10.0 - 95.0, 'deltaF', 'deltaC') * 3.0 # W/K
max_water_flow = UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W') / UnitConversions.convert(20.0, 'deltaF', 'deltaC') / 4.186 / 998.2 / 1000.0 * 2.0 # m^3/s
fan_cfm = 400.0 * UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'ton') # CFM; assumes 400 cfm/ton
if heating_system.distribution_system.air_type.to_s == HPXML::AirTypeFanCoil
# Fan
fan = create_supply_fan(model, obj_name, 0.0, [fan_cfm]) # fan energy included in above pump via Electric Auxiliary Energy (EAE)
# Heating Coil
htg_coil = OpenStudio::Model::CoilHeatingWater.new(model, model.alwaysOnDiscreteSchedule)
htg_coil.setRatedCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
htg_coil.setUFactorTimesAreaValue(bb_ua)
htg_coil.setMaximumWaterFlowRate(max_water_flow)
htg_coil.setPerformanceInputMethod('NominalCapacity')
htg_coil.setName(obj_name + ' htg coil')
plant_loop.addDemandBranchForComponent(htg_coil)
# Cooling Coil (always off)
clg_coil = OpenStudio::Model::CoilCoolingWater.new(model, model.alwaysOffDiscreteSchedule)
clg_coil.setName(obj_name + ' clg coil')
clg_coil.setDesignWaterFlowRate(0.0022)
clg_coil.setDesignAirFlowRate(1.45)
clg_coil.setDesignInletWaterTemperature(6.1)
clg_coil.setDesignInletAirTemperature(25.0)
clg_coil.setDesignOutletAirTemperature(10.0)
clg_coil.setDesignInletAirHumidityRatio(0.012)
clg_coil.setDesignOutletAirHumidityRatio(0.008)
plant_loop.addDemandBranchForComponent(clg_coil)
# Fan Coil
zone_hvac = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new(model, model.alwaysOnDiscreteSchedule, fan, clg_coil, htg_coil)
zone_hvac.setCapacityControlMethod('CyclingFan')
zone_hvac.setName(obj_name + ' fan coil')
zone_hvac.setMaximumSupplyAirTemperatureInHeatingMode(UnitConversions.convert(120.0, 'F', 'C'))
zone_hvac.setHeatingConvergenceTolerance(0.001)
zone_hvac.setMinimumSupplyAirTemperatureInCoolingMode(UnitConversions.convert(55.0, 'F', 'C'))
zone_hvac.setMaximumColdWaterFlowRate(0.0)
zone_hvac.setCoolingConvergenceTolerance(0.001)
zone_hvac.setMaximumOutdoorAirFlowRate(0.0)
zone_hvac.setMaximumSupplyAirFlowRate(UnitConversions.convert(fan_cfm, 'cfm', 'm^3/s'))
zone_hvac.setMaximumHotWaterFlowRate(max_water_flow)
zone_hvac.addToThermalZone(control_zone)
disaggregate_fan_or_pump(model, pump, zone_hvac, nil, nil, heating_system)
else
# Heating Coil
htg_coil = OpenStudio::Model::CoilHeatingWaterBaseboard.new(model)
htg_coil.setName(obj_name + ' htg coil')
htg_coil.setConvergenceTolerance(0.001)
htg_coil.setHeatingDesignCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
htg_coil.setUFactorTimesAreaValue(bb_ua)
htg_coil.setMaximumWaterFlowRate(max_water_flow)
htg_coil.setHeatingDesignCapacityMethod('HeatingDesignCapacity')
plant_loop.addDemandBranchForComponent(htg_coil)
# Baseboard
zone_hvac = OpenStudio::Model::ZoneHVACBaseboardConvectiveWater.new(model, model.alwaysOnDiscreteSchedule, htg_coil)
zone_hvac.setName(obj_name + ' baseboard')
zone_hvac.addToThermalZone(control_zone)
zone_hvac.additionalProperties.setFeature('IsHeatPumpBackup', heating_system.is_heat_pump_backup_system) # Used by reporting measure
if heating_system.is_heat_pump_backup_system
disaggregate_fan_or_pump(model, pump, nil, nil, zone_hvac, heating_system)
else
disaggregate_fan_or_pump(model, pump, zone_hvac, nil, nil, heating_system)
end
end
set_sequential_load_fractions(model, control_zone, zone_hvac, sequential_heat_load_fracs, nil, hvac_unavailable_periods, heating_system)
return zone_hvac
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param heating_system [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_electric_baseboard(model, heating_system,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
obj_name = Constants.ObjectNameElectricBaseboard
# Baseboard
zone_hvac = OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric.new(model)
zone_hvac.setName(obj_name)
zone_hvac.setEfficiency(heating_system.heating_efficiency_percent)
zone_hvac.setNominalCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
zone_hvac.addToThermalZone(control_zone)
zone_hvac.additionalProperties.setFeature('HPXML_ID', heating_system.id) # Used by reporting measure
zone_hvac.additionalProperties.setFeature('IsHeatPumpBackup', heating_system.is_heat_pump_backup_system) # Used by reporting measure
set_sequential_load_fractions(model, control_zone, zone_hvac, sequential_heat_load_fracs, nil, hvac_unavailable_periods, heating_system)
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param heating_system [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_unit_heater(model, heating_system,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
obj_name = Constants.ObjectNameUnitHeater
# Heating Coil
efficiency = heating_system.heating_efficiency_afue
efficiency = heating_system.heating_efficiency_percent if efficiency.nil?
if heating_system.heating_system_fuel == HPXML::FuelTypeElectricity
htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model)
htg_coil.setEfficiency(efficiency)
else
htg_coil = OpenStudio::Model::CoilHeatingGas.new(model)
htg_coil.setGasBurnerEfficiency(efficiency)
htg_coil.setOnCycleParasiticElectricLoad(0.0)
htg_coil.setOffCycleParasiticGasLoad(UnitConversions.convert(heating_system.pilot_light_btuh.to_f, 'Btu/hr', 'W'))
htg_coil.setFuelType(EPlus.fuel_type(heating_system.heating_system_fuel))
end
htg_coil.setNominalCapacity(UnitConversions.convert(heating_system.heating_capacity, 'Btu/hr', 'W'))
htg_coil.setName(obj_name + ' htg coil')
htg_coil.additionalProperties.setFeature('HPXML_ID', heating_system.id) # Used by reporting measure
htg_coil.additionalProperties.setFeature('IsHeatPumpBackup', heating_system.is_heat_pump_backup_system) # Used by reporting measure
# Fan
htg_cfm = heating_system.heating_airflow_cfm
fan_watts_per_cfm = heating_system.fan_watts / htg_cfm
fan = create_supply_fan(model, obj_name, fan_watts_per_cfm, [htg_cfm])
disaggregate_fan_or_pump(model, fan, htg_coil, nil, nil, heating_system)
# Unitary System
unitary_system = create_air_loop_unitary_system(model, obj_name, fan, htg_coil, nil, nil, htg_cfm, nil)
unitary_system.setControllingZoneorThermostatLocation(control_zone)
unitary_system.addToThermalZone(control_zone)
set_sequential_load_fractions(model, control_zone, unitary_system, sequential_heat_load_fracs, nil, hvac_unavailable_periods, heating_system)
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param sequential_cool_load_fracs [TODO] TODO
# @param sequential_heat_load_fracs [TODO] TODO
# @param control_zone [TODO] TODO
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_ideal_air_loads(model, sequential_cool_load_fracs,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
obj_name = Constants.ObjectNameIdealAirSystem
# Ideal Air System
ideal_air = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(model)
ideal_air.setName(obj_name)
ideal_air.setMaximumHeatingSupplyAirTemperature(50)
ideal_air.setMinimumCoolingSupplyAirTemperature(10)
ideal_air.setMaximumHeatingSupplyAirHumidityRatio(0.015)
ideal_air.setMinimumCoolingSupplyAirHumidityRatio(0.01)
if sequential_heat_load_fracs.sum > 0
ideal_air.setHeatingLimit('NoLimit')
else
ideal_air.setHeatingLimit('LimitCapacity')
ideal_air.setMaximumSensibleHeatingCapacity(0)
end
if sequential_cool_load_fracs.sum > 0
ideal_air.setCoolingLimit('NoLimit')
else
ideal_air.setCoolingLimit('LimitCapacity')
ideal_air.setMaximumTotalCoolingCapacity(0)
end
ideal_air.setDehumidificationControlType('None')
ideal_air.setHumidificationControlType('None')
ideal_air.addToThermalZone(control_zone)
set_sequential_load_fractions(model, control_zone, ideal_air, sequential_heat_load_fracs, sequential_cool_load_fracs, hvac_unavailable_periods)
end
# TODO
#
# @param runner [OpenStudio::Measure::OSRunner] OpenStudio Runner object
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param dehumidifiers [TODO] TODO
# @param conditioned_space [TODO] TODO
# @param unavailable_periods [TODO] TODO
# @param unit_multiplier [Integer] Number of similar dwelling units
# @return [TODO] TODO
def self.apply_dehumidifiers(runner, model, dehumidifiers, conditioned_space, unavailable_periods, unit_multiplier)
dehumidifier_id = dehumidifiers[0].id # Syncs with the ReportSimulationOutput measure, which only looks at first dehumidifier ID
if dehumidifiers.map { |d| d.rh_setpoint }.uniq.size > 1
fail 'All dehumidifiers must have the same setpoint but multiple setpoints were specified.'
end
if unit_multiplier > 1
# FUTURE: Figure out how to allow this. If we allow it, update docs and hpxml_translator_test.rb too.
# https://github.com/NREL/OpenStudio-HPXML/issues/1499
fail 'NumberofUnits greater than 1 is not supported for dehumidifiers.'
end
# Dehumidifier coefficients
# Generic model coefficients from Winkler, Christensen, and Tomerlin (2011)
w_coeff = [-1.162525707, 0.02271469, -0.000113208, 0.021110538, -0.0000693034, 0.000378843]
ef_coeff = [-1.902154518, 0.063466565, -0.000622839, 0.039540407, -0.000125637, -0.000176722]
pl_coeff = [0.90, 0.10, 0.0]
dehumidifiers.each do |d|
next unless d.energy_factor.nil?
# shift inputs tested under IEF test conditions to those under EF test conditions with performance curves
d.energy_factor, d.capacity = apply_dehumidifier_ief_to_ef_inputs(d.type, w_coeff, ef_coeff, d.integrated_energy_factor, d.capacity)
end
# Combine HPXML dehumidifiers into a single EnergyPlus dehumidifier
total_capacity = dehumidifiers.map { |d| d.capacity }.sum
avg_energy_factor = dehumidifiers.map { |d| d.energy_factor * d.capacity }.sum / total_capacity
total_fraction_served = dehumidifiers.map { |d| d.fraction_served }.sum
# Apply unit multiplier
total_capacity *= unit_multiplier
control_zone = conditioned_space.thermalZone.get
obj_name = Constants.ObjectNameDehumidifier
rh_setpoint = dehumidifiers[0].rh_setpoint * 100.0 # (EnergyPlus uses 60 for 60% RH)
relative_humidity_setpoint_sch = OpenStudio::Model::ScheduleConstant.new(model)
relative_humidity_setpoint_sch.setName("#{obj_name} rh setpoint")
relative_humidity_setpoint_sch.setValue(rh_setpoint)
capacity_curve = create_curve_biquadratic(model, w_coeff, 'DXDH-CAP-fT', -100, 100, -100, 100)
energy_factor_curve = create_curve_biquadratic(model, ef_coeff, 'DXDH-EF-fT', -100, 100, -100, 100)
part_load_frac_curve = create_curve_quadratic(model, pl_coeff, 'DXDH-PLF-fPLR', 0, 1, 0.7, 1)
# Calculate air flow rate by assuming 2.75 cfm/pint/day (based on experimental test data)
air_flow_rate = 2.75 * total_capacity
# Humidity Setpoint
humidistat = OpenStudio::Model::ZoneControlHumidistat.new(model)
humidistat.setName(obj_name + ' humidistat')
humidistat.setHumidifyingRelativeHumiditySetpointSchedule(relative_humidity_setpoint_sch)
humidistat.setDehumidifyingRelativeHumiditySetpointSchedule(relative_humidity_setpoint_sch)
control_zone.setZoneControlHumidistat(humidistat)
# Availability Schedule
dehum_unavailable_periods = Schedule.get_unavailable_periods(runner, SchedulesFile::Columns[:Dehumidifier].name, unavailable_periods)
avail_sch = ScheduleConstant.new(model, obj_name + ' schedule', 1.0, Constants.ScheduleTypeLimitsFraction, unavailable_periods: dehum_unavailable_periods)
avail_sch = avail_sch.schedule
# Dehumidifier
zone_hvac = OpenStudio::Model::ZoneHVACDehumidifierDX.new(model, capacity_curve, energy_factor_curve, part_load_frac_curve)
zone_hvac.setName(obj_name)
zone_hvac.setAvailabilitySchedule(avail_sch)
zone_hvac.setRatedWaterRemoval(UnitConversions.convert(total_capacity, 'pint', 'L'))
zone_hvac.setRatedEnergyFactor(avg_energy_factor / total_fraction_served)
zone_hvac.setRatedAirFlowRate(UnitConversions.convert(air_flow_rate, 'cfm', 'm^3/s'))
zone_hvac.setMinimumDryBulbTemperatureforDehumidifierOperation(10)
zone_hvac.setMaximumDryBulbTemperatureforDehumidifierOperation(40)
zone_hvac.addToThermalZone(control_zone)
zone_hvac.additionalProperties.setFeature('HPXML_ID', dehumidifier_id) # Used by reporting measure
if total_fraction_served < 1.0
adjust_dehumidifier_load_EMS(total_fraction_served, zone_hvac, model, conditioned_space)
end
end
# TODO
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param runner [OpenStudio::Measure::OSRunner] OpenStudio Runner object
# @param weather [WeatherProcess] Weather object
# @param ceiling_fan [TODO] TODO
# @param conditioned_space [TODO] TODO
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @param unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_ceiling_fans(model, runner, weather, ceiling_fan, conditioned_space, schedules_file,
unavailable_periods)
obj_name = Constants.ObjectNameCeilingFan
hrs_per_day = 10.5 # From ANSI 301-2019
cfm_per_w = ceiling_fan.efficiency
label_energy_use = ceiling_fan.label_energy_use
count = ceiling_fan.count
if !label_energy_use.nil? # priority if both provided
annual_kwh = UnitConversions.convert(count * label_energy_use * hrs_per_day * 365.0, 'Wh', 'kWh')
elsif !cfm_per_w.nil?
medium_cfm = get_default_ceiling_fan_medium_cfm()
annual_kwh = UnitConversions.convert(count * medium_cfm / cfm_per_w * hrs_per_day * 365.0, 'Wh', 'kWh')
end
# Create schedule
ceiling_fan_sch = nil
ceiling_fan_col_name = SchedulesFile::Columns[:CeilingFan].name
if not schedules_file.nil?
annual_kwh *= Schedule.CeilingFanMonthlyMultipliers(weather: weather).split(',').map(&:to_f).sum(0.0) / 12.0
ceiling_fan_design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: ceiling_fan_col_name, annual_kwh: annual_kwh)
ceiling_fan_sch = schedules_file.create_schedule_file(model, col_name: ceiling_fan_col_name)
end
if ceiling_fan_sch.nil?
ceiling_fan_unavailable_periods = Schedule.get_unavailable_periods(runner, ceiling_fan_col_name, unavailable_periods)
annual_kwh *= ceiling_fan.monthly_multipliers.split(',').map(&:to_f).sum(0.0) / 12.0
weekday_sch = ceiling_fan.weekday_fractions
weekend_sch = ceiling_fan.weekend_fractions
monthly_sch = ceiling_fan.monthly_multipliers
ceiling_fan_sch_obj = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', weekday_sch, weekend_sch, monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: ceiling_fan_unavailable_periods)
ceiling_fan_design_level = ceiling_fan_sch_obj.calc_design_level_from_daily_kwh(annual_kwh / 365.0)
ceiling_fan_sch = ceiling_fan_sch_obj.schedule
else
runner.registerWarning("Both '#{ceiling_fan_col_name}' schedule file and weekday fractions provided; the latter will be ignored.") if !ceiling_fan.weekday_fractions.nil?
runner.registerWarning("Both '#{ceiling_fan_col_name}' schedule file and weekend fractions provided; the latter will be ignored.") if !ceiling_fan.weekend_fractions.nil?
runner.registerWarning("Both '#{ceiling_fan_col_name}' schedule file and monthly multipliers provided; the latter will be ignored.") if !ceiling_fan.monthly_multipliers.nil?
end