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
|
# File 'lib/to_openstudio/load/service_hot_water.rb', line 55
def add_hot_water_plants(openstudio_model, shw_hashes)
shw_hashes.each do |shw_hash|
unless @@shw_rates[shw_hash[:identifier]].nil?
hot_water_plant = OpenStudio::Model::PlantLoop.new(openstudio_model)
hot_water_plant.setName('SHW Loop ' + shw_hash[:identifier])
hot_water_plant.setMaximumLoopTemperature(@@max_target_temp)
hot_water_plant.setMinimumLoopTemperature(10)
loop_sizing = hot_water_plant.sizingPlant()
loop_sizing.setLoopType('Heating')
loop_sizing.setDesignLoopExitTemperature(@@max_target_temp)
loop_sizing.setLoopDesignTemperatureDifference(5)
hot_sch = @@max_temp_schedule
if @@max_temp_schedule.nil?
hot_sch_name = @@max_target_temp.to_s + 'C Hot Water'
hot_sch = create_constant_schedule(openstudio_model, hot_sch_name, @@max_target_temp)
end
sp_manager = OpenStudio::Model::SetpointManagerScheduled.new(openstudio_model, hot_sch)
sp_manager.addToNode(hot_water_plant.supplyOutletNode())
hot_water_pump = OpenStudio::Model::PumpConstantSpeed.new(openstudio_model)
hot_water_pump.setName('SHW Pump' + @@sys_count.to_s)
hot_water_pump.setRatedPumpHead(29891)
hot_water_pump.setMotorEfficiency(0.9)
hot_water_pump.addToNode(hot_water_plant.supplyInletNode())
eq_type = shw_hash[:equipment_type]
if eq_type == 'Default_District_SHW'
district_hw = OpenStudio::Model::WaterHeaterMixed.new(openstudio_model)
district_hw.setName('Ideal Service Hot Water Heater')
district_hw.setHeaterFuelType('DistrictHeating')
district_hw.setOffCycleParasiticFuelType('DistrictHeating')
district_hw.setOnCycleParasiticFuelType('DistrictHeating')
district_hw.setHeaterThermalEfficiency(1.0)
district_hw.setHeaterMaximumCapacity(1000000)
district_hw.setTankVolume(0)
district_hw.setHeaterControlType('Modulate')
target_sch_name = '22C Ambient Condition'
target_sch = create_constant_schedule(openstudio_model, target_sch_name, 22)
district_hw.setAmbientTemperatureSchedule(target_sch)
district_hw.setOffCycleLossCoefficienttoAmbientTemperature(0)
district_hw.setOnCycleLossCoefficienttoAmbientTemperature(0)
hot_water_plant.addSupplyBranchForComponent(district_hw)
hot_water_pump.setEndUseSubcategory('Water Systems')
hot_water_pump.setMotorEfficiency(0.9)
else
heater = OpenStudio::Model::WaterHeaterMixed.new(openstudio_model)
if eq_type == 'Electric_WaterHeater' || eq_type == 'HeatPump_WaterHeater' || eq_type == 'Electric_TanklessHeater'
heater.setHeaterFuelType('Electricity')
heater.setOffCycleParasiticFuelType('Electricity')
heater.setOnCycleParasiticFuelType('Electricity')
end
if eq_type == 'HeatPump_WaterHeater'
heater.setHeaterThermalEfficiency(1.0)
elsif shw_hash[:heater_efficiency].nil?
if eq_type == 'Electric_WaterHeater' || eq_type == 'Electric_TanklessHeater'
heater.setHeaterThermalEfficiency(1.0)
else
heater.setHeaterThermalEfficiency(0.8)
end
else
heater.setHeaterThermalEfficiency(shw_hash[:heater_efficiency])
end
to_thermal_zone = false
unless shw_hash[:ambient_condition].nil?
if shw_hash[:ambient_condition].is_a? Numeric
target_sch_name = shw_hash[:ambient_condition].to_s + 'C Ambient Condition'
target_sch = create_constant_schedule(
openstudio_model, target_sch_name, shw_hash[:ambient_condition])
heater.setAmbientTemperatureSchedule(target_sch)
else
source_zone_ref = openstudio_model.getThermalZoneByName(shw_hash[:ambient_condition])
unless source_zone_ref.empty?
source_zone = source_zone_ref.get
heater.setAmbientTemperatureThermalZone(source_zone)
end
heater.setAmbientTemperatureIndicator('ThermalZone')
to_thermal_zone = true
end
else
target_sch_name = '22C Ambient Condition'
target_sch = create_constant_schedule(openstudio_model, target_sch_name, 22)
heater.setAmbientTemperatureSchedule(target_sch)
end
if to_thermal_zone
unless shw_hash[:ambient_loss_coefficient].nil?
heater.setOffCycleLossFractiontoThermalZone(
shw_hash[:ambient_loss_coefficient])
heater.setOnCycleLossFractiontoThermalZone(
shw_hash[:ambient_loss_coefficient])
else
heater.setOffCycleLossFractiontoThermalZone(6)
heater.setOnCycleLossFractiontoThermalZone(6)
end
else
unless shw_hash[:ambient_loss_coefficient].nil?
heater.setOffCycleLossCoefficienttoAmbientTemperature(
shw_hash[:ambient_loss_coefficient])
heater.setOnCycleLossCoefficienttoAmbientTemperature(
shw_hash[:ambient_loss_coefficient])
else
heater.setOffCycleLossCoefficienttoAmbientTemperature(6)
heater.setOnCycleLossCoefficienttoAmbientTemperature(6)
end
end
heater.setHeaterMaximumCapacity(1000000)
if eq_type == 'Gas_TanklessHeater' || eq_type == 'Electric_TanklessHeater'
heater.setName('SHW Tankless WaterHeater' + @@sys_count.to_s)
heater.setTankVolume(0)
heater.setHeaterControlType('Modulate')
heater.setOffCycleLossCoefficienttoAmbientTemperature(0)
heater.setOnCycleLossCoefficienttoAmbientTemperature(0)
else
heater.setName('SHW WaterHeater' + @@sys_count.to_s)
heater.setTankVolume(@@shw_rates[shw_hash[:identifier]])
end
hot_water_plant.addSupplyBranchForComponent(heater)
if eq_type == 'HeatPump_WaterHeater'
heat_pump = OpenStudio::Model::CoilWaterHeatingAirToWaterHeatPump.new(openstudio_model)
heat_pump.setName('SHW HPWH DX Coil' + @@sys_count.to_s)
if shw_hash[:heater_efficiency].nil?
heat_pump.setRatedCOP(3.5)
else
heat_pump.setRatedCOP(shw_hash[:heater_efficiency])
end
fan = OpenStudio::Model::FanOnOff.new(openstudio_model)
fan.setName('HPWH Fan' + @@sys_count.to_s)
fan.setEndUseSubcategory('Water Systems')
setpt_sch = create_constant_schedule(
openstudio_model, 'HPWH Setpoint' + @@sys_count.to_s, @@max_target_temp + (@@hp_deadband * 2))
inlet_sch = create_constant_schedule(
openstudio_model, 'Inlet Air Mixer Fraction' + @@sys_count.to_s, 0.2)
heat_sys = OpenStudio::Model::WaterHeaterHeatPump.new(
openstudio_model, heat_pump, heater, fan, setpt_sch, inlet_sch)
heat_sys.setDeadBandTemperatureDifference(@@hp_deadband)
source_zone_ref = openstudio_model.getThermalZoneByName(shw_hash[:ambient_condition])
unless source_zone_ref.empty?
source_zone = source_zone_ref.get
heat_sys.addToThermalZone(source_zone)
end
heat_sys.setName('SHW WaterHeater HeatPump' + @@sys_count.to_s)
end
end
@@shw_connections[shw_hash[:identifier]].each do |shw_conn|
hot_water_plant.addDemandBranchForComponent(shw_conn)
end
@@sys_count = @@sys_count + 1
end
end
end
|