openstudio-ee 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Rakefile +2 -0
- data/lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.rb +333 -0
- data/lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.xml +150 -0
- data/lib/measures/ReplaceFanTotalEfficiency/measure.rb +330 -0
- data/lib/measures/ReplaceFanTotalEfficiency/measure.xml +150 -0
- data/lib/measures/add_apszhp_to_each_zone/measure.rb +607 -0
- data/lib/measures/add_apszhp_to_each_zone/measure.xml +184 -0
- data/lib/measures/add_energy_recovery_ventilator/measure.rb +354 -0
- data/lib/measures/add_energy_recovery_ventilator/measure.xml +78 -0
- data/lib/measures/improve_simple_glazing_by_percentage/measure.rb +81 -0
- data/lib/measures/improve_simple_glazing_by_percentage/measure.xml +70 -0
- data/lib/measures/reduce_water_use_by_percentage/measure.rb +61 -0
- data/lib/measures/reduce_water_use_by_percentage/measure.xml +62 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/measure.rb +511 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/measure.xml +375 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_AedgMeasures.rb +454 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Constructions.rb +221 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Geometry.rb +41 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HVAC.rb +1682 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HelperMethods.rb +114 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_LightingAndEquipment.rb +99 -0
- data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Schedules.rb +142 -0
- data/lib/measures/replace_simple_glazing/measure.rb +86 -0
- data/lib/measures/replace_simple_glazing/measure.xml +78 -0
- data/lib/measures/set_boiler_thermal_efficiency/measure.rb +520 -0
- data/lib/measures/set_boiler_thermal_efficiency/measure.xml +78 -0
- data/lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.rb +207 -0
- data/lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.xml +78 -0
- data/lib/measures/tenant_star_internal_loads/measure.rb +134 -0
- data/lib/measures/tenant_star_internal_loads/measure.xml +67 -0
- data/lib/measures/tenant_star_internal_loads/resources/os_lib_helper_methods.rb +401 -0
- data/lib/measures/vr_fwith_doas/measure.rb +468 -0
- data/lib/measures/vr_fwith_doas/measure.xml +298 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_AedgMeasures.rb +454 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_Constructions.rb +221 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_Geometry.rb +41 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_HVAC.rb +1516 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_HelperMethods.rb +114 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_LightingAndEquipment.rb +99 -0
- data/lib/measures/vr_fwith_doas/resources/OsLib_Schedules.rb +142 -0
- data/lib/openstudio/ee_measures/version.rb +1 -1
- data/openstudio-ee.gemspec +7 -5
- metadata +48 -9
@@ -0,0 +1,520 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# see the URL below for information on how to write OpenStudio measures
|
4
|
+
# http://openstudio.nrel.gov/openstudio-measure-writing-guide
|
5
|
+
|
6
|
+
# see the URL below for access to C++ documentation on model objects (click on "model" in the main window to view model objects)
|
7
|
+
# http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html
|
8
|
+
|
9
|
+
# start the measure
|
10
|
+
class SetBoilerThermalEfficiency < OpenStudio::Ruleset::ModelUserScript
|
11
|
+
# define the name that a user will see, this method may be deprecated as
|
12
|
+
# the display name in PAT comes from the name field in measure.xml
|
13
|
+
def name
|
14
|
+
return 'SetBoilerThermalEfficiency'
|
15
|
+
end
|
16
|
+
|
17
|
+
# define the arguments that the user will input
|
18
|
+
def arguments(model)
|
19
|
+
args = OpenStudio::Ruleset::OSArgumentVector.new
|
20
|
+
|
21
|
+
# Determine how many boilers in model
|
22
|
+
boiler_handles = OpenStudio::StringVector.new
|
23
|
+
boiler_display_names = OpenStudio::StringVector.new
|
24
|
+
|
25
|
+
# Get/show all boiler units from current loaded model.
|
26
|
+
boiler_handles << '0'
|
27
|
+
boiler_display_names << '*All boilers*'
|
28
|
+
|
29
|
+
i_boiler = 1
|
30
|
+
model.getBoilerHotWaters.each do |boiler_water|
|
31
|
+
if !boiler_water.to_BoilerHotWater.empty?
|
32
|
+
water_unit = boiler_water.to_BoilerHotWater.get
|
33
|
+
boiler_handles << i_boiler.to_s
|
34
|
+
boiler_display_names << water_unit.name.to_s
|
35
|
+
|
36
|
+
i_boiler += 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
model.getBoilerSteams.each do |boiler_steam|
|
40
|
+
if !boiler_steam.to_BoilerSteam.empty?
|
41
|
+
steam_unit = boiler_water.to_BoilerSteam.get
|
42
|
+
boiler_handles << i_boiler.to_s
|
43
|
+
boiler_display_names << steam_unit.name.to_s
|
44
|
+
i_boiler += 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if i_boiler == 1
|
49
|
+
info_widget = OpenStudio::Ruleset::OSArgument.makeBoolArgument('info_widget', true)
|
50
|
+
info_widget.setDisplayName('!!!!*** This Measure is not Applicable to loaded Model. Read the description and choose an appropriate baseline model. ***!!!!')
|
51
|
+
info_widget.setDefaultValue(true)
|
52
|
+
args << info_widget
|
53
|
+
return args
|
54
|
+
end
|
55
|
+
|
56
|
+
boiler_widget = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('boiler_widget', boiler_handles, boiler_display_names, true)
|
57
|
+
boiler_widget.setDisplayName('Apply the measure to ')
|
58
|
+
boiler_widget.setDefaultValue(boiler_display_names[0])
|
59
|
+
args << boiler_widget
|
60
|
+
|
61
|
+
# Add a check box for specify thermal efficiency manually
|
62
|
+
input_option_manual = OpenStudio::Ruleset::OSArgument.makeBoolArgument('input_option_manual', false)
|
63
|
+
input_option_manual.setDisplayName('Option 1, set boiler nominal thermal efficiency to a user defined value')
|
64
|
+
input_option_manual.setDefaultValue(false)
|
65
|
+
args << input_option_manual
|
66
|
+
|
67
|
+
# Boiler Thermal Efficiency (default of 0.8)
|
68
|
+
boiler_thermal_efficiency = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('boiler_thermal_efficiency')
|
69
|
+
boiler_thermal_efficiency.setDisplayName('Boiler nominal thermal efficiency (between 0 and 1)')
|
70
|
+
boiler_thermal_efficiency.setDefaultValue(0.8)
|
71
|
+
args << boiler_thermal_efficiency
|
72
|
+
|
73
|
+
input_option_standard = OpenStudio::Ruleset::OSArgument.makeBoolArgument('input_option_standard', false)
|
74
|
+
input_option_standard.setDisplayName('Option 2, set boiler nominal thermal efficiency based on ASHRAE Standard 90.1 requirement')
|
75
|
+
input_option_standard.setDefaultValue(false)
|
76
|
+
args << input_option_standard
|
77
|
+
|
78
|
+
# Nominal Capacity [W] (default of blank)
|
79
|
+
nominal_capacity = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('nominal_capacity', false)
|
80
|
+
nominal_capacity.setDisplayName('Boiler nominal capacity [W] ')
|
81
|
+
args << nominal_capacity
|
82
|
+
|
83
|
+
# Show fuel type selection
|
84
|
+
fuel_type_handles = OpenStudio::StringVector.new
|
85
|
+
fuel_type_display_names = OpenStudio::StringVector.new
|
86
|
+
|
87
|
+
fuel_type_handles << '0'
|
88
|
+
fuel_type_display_names << 'NaturalGas'
|
89
|
+
fuel_type_handles << '1'
|
90
|
+
fuel_type_display_names << 'FuelOil#1'
|
91
|
+
fuel_type_handles << '2'
|
92
|
+
fuel_type_display_names << 'FuelOil#2'
|
93
|
+
|
94
|
+
# Make a choice argument for Boiler Fuel Type (default of NaturalGas)
|
95
|
+
fuel_type_widget = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('fuel_type_widget', fuel_type_handles, fuel_type_display_names, false)
|
96
|
+
fuel_type_widget.setDisplayName('Fuel type')
|
97
|
+
fuel_type_widget.setDefaultValue(fuel_type_display_names[0])
|
98
|
+
args << fuel_type_widget
|
99
|
+
|
100
|
+
# Show ASHRAE standards
|
101
|
+
standards_handles = OpenStudio::StringVector.new
|
102
|
+
standards_display_names = OpenStudio::StringVector.new
|
103
|
+
|
104
|
+
standards_handles << '0'
|
105
|
+
standards_handles << '1'
|
106
|
+
standards_handles << '2'
|
107
|
+
standards_handles << '3'
|
108
|
+
standards_handles << '4'
|
109
|
+
|
110
|
+
standards_display_names << ''
|
111
|
+
standards_display_names << 'ASHRAE 90.1-2004'
|
112
|
+
standards_display_names << 'ASHRAE 90.1-2007'
|
113
|
+
standards_display_names << 'ASHRAE 90.1-2010'
|
114
|
+
standards_display_names << 'ASHRAE 90.1-2013'
|
115
|
+
|
116
|
+
standards_widget = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('standards_widget', standards_handles, standards_display_names, false)
|
117
|
+
standards_widget.setDisplayName('ASHRAE Standards 90.1')
|
118
|
+
standards_widget.setDefaultValue(standards_display_names[0])
|
119
|
+
args << standards_widget
|
120
|
+
|
121
|
+
return args
|
122
|
+
end # end the arguments method
|
123
|
+
|
124
|
+
def getMinEfficiencyWaterBoiler(standard, capacity, heating_type)
|
125
|
+
min_efficiency = 0
|
126
|
+
standard_list = ['ASHRAE 90.1-2004', 'ASHRAE 90.1-2007', 'ASHRAE 90.1-2010', 'ASHRAE 90.1-2013']
|
127
|
+
heating_type_list = ['Gas', 'Oil']
|
128
|
+
if (!standard_list.include? standard) || (!heating_type_list.include? heating_type)
|
129
|
+
return nil
|
130
|
+
end
|
131
|
+
|
132
|
+
if standard == standard_list[0]
|
133
|
+
if heating_type == heating_type_list[0]
|
134
|
+
if capacity < 87862
|
135
|
+
min_efficiency = 0.8
|
136
|
+
elsif capacity < 732188
|
137
|
+
min_efficiency = 0.75
|
138
|
+
else
|
139
|
+
min_efficiency = 0.85
|
140
|
+
end
|
141
|
+
else
|
142
|
+
if capacity < 87862
|
143
|
+
min_efficiency = 0.8
|
144
|
+
elsif capacity < 732188
|
145
|
+
min_efficiency = 0.75
|
146
|
+
else
|
147
|
+
min_efficiency = 0.7925
|
148
|
+
end
|
149
|
+
end
|
150
|
+
elsif standard == standard_list[1]
|
151
|
+
if heating_type == heating_type_list[0]
|
152
|
+
if capacity < 87862
|
153
|
+
min_efficiency = 0.8
|
154
|
+
elsif capacity < 732188
|
155
|
+
min_efficiency = 0.8
|
156
|
+
else
|
157
|
+
min_efficiency = 0.8125
|
158
|
+
end
|
159
|
+
else
|
160
|
+
if capacity < 87862
|
161
|
+
min_efficiency = 0.8
|
162
|
+
elsif capacity < 732188
|
163
|
+
min_efficiency = 0.82
|
164
|
+
else
|
165
|
+
min_efficiency = 0.8325
|
166
|
+
end
|
167
|
+
end
|
168
|
+
elsif standard == standard_list[3]
|
169
|
+
if heating_type == heating_type_list[0]
|
170
|
+
if capacity < 87862
|
171
|
+
min_efficiency = 0.8
|
172
|
+
elsif capacity < 732188
|
173
|
+
min_efficiency = 0.8
|
174
|
+
else
|
175
|
+
min_efficiency = 0.8125
|
176
|
+
end
|
177
|
+
else
|
178
|
+
if capacity < 87862
|
179
|
+
min_efficiency = 0.8
|
180
|
+
elsif capacity < 732188
|
181
|
+
min_efficiency = 0.82
|
182
|
+
else
|
183
|
+
min_efficiency = 0.8325
|
184
|
+
end
|
185
|
+
end
|
186
|
+
elsif standard == standard_list[4]
|
187
|
+
if heating_type == heating_type_list[0]
|
188
|
+
if capacity < 87862
|
189
|
+
min_efficiency = 0.82
|
190
|
+
elsif capacity < 732188
|
191
|
+
min_efficiency = 0.8
|
192
|
+
else
|
193
|
+
min_efficiency = 0.8125
|
194
|
+
end
|
195
|
+
else
|
196
|
+
if capacity < 87862
|
197
|
+
min_efficiency = 0.84
|
198
|
+
elsif capacity < 732188
|
199
|
+
min_efficiency = 0.82
|
200
|
+
else
|
201
|
+
min_efficiency = 0.8325
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
return min_efficiency
|
207
|
+
end
|
208
|
+
|
209
|
+
def getMinEfficiencySteamBoiler(standard, capacity, heating_type)
|
210
|
+
min_efficiency = 0
|
211
|
+
standard_list = ['ASHRAE 90.1-2004', 'ASHRAE 90.1-2007', 'ASHRAE 90.1-2010', 'ASHRAE 90.1-2013']
|
212
|
+
heating_type_list = ['Gas', 'Oil']
|
213
|
+
if (!standard_list.include? standard) || (!heating_type_list.include? heating_type)
|
214
|
+
return nil
|
215
|
+
end
|
216
|
+
|
217
|
+
if standard == standard_list[0]
|
218
|
+
if heating_type == heating_type_list[0]
|
219
|
+
if capacity < 87862
|
220
|
+
min_efficiency = 0.75
|
221
|
+
elsif capacity < 732188
|
222
|
+
min_efficiency = 0.75
|
223
|
+
else
|
224
|
+
min_efficiency = 0.7925
|
225
|
+
end
|
226
|
+
else
|
227
|
+
if capacity < 87862
|
228
|
+
min_efficiency = 0.8
|
229
|
+
elsif capacity < 732188
|
230
|
+
min_efficiency = 0.75
|
231
|
+
else
|
232
|
+
min_efficiency = 0.7925
|
233
|
+
end
|
234
|
+
end
|
235
|
+
elsif standard == standard_list[1]
|
236
|
+
if heating_type == heating_type_list[0]
|
237
|
+
if capacity < 87862
|
238
|
+
min_efficiency = 0.75
|
239
|
+
elsif capacity < 732188
|
240
|
+
min_efficiency = 0.79
|
241
|
+
else
|
242
|
+
min_efficiency = 0.79
|
243
|
+
end
|
244
|
+
else
|
245
|
+
if capacity < 87862
|
246
|
+
min_efficiency = 0.8
|
247
|
+
elsif capacity < 732188
|
248
|
+
min_efficiency = 0.81
|
249
|
+
else
|
250
|
+
min_efficiency = 0.81
|
251
|
+
end
|
252
|
+
end
|
253
|
+
elsif standard == standard_list[3]
|
254
|
+
if heating_type == heating_type_list[0]
|
255
|
+
if capacity < 87862
|
256
|
+
min_efficiency = 0.75
|
257
|
+
elsif capacity < 732188
|
258
|
+
min_efficiency = 0.79
|
259
|
+
else
|
260
|
+
min_efficiency = 0.79
|
261
|
+
end
|
262
|
+
else
|
263
|
+
if capacity < 87862
|
264
|
+
min_efficiency = 0.8
|
265
|
+
elsif capacity < 732188
|
266
|
+
min_efficiency = 0.81
|
267
|
+
else
|
268
|
+
min_efficiency = 0.81
|
269
|
+
end
|
270
|
+
end
|
271
|
+
else standard == standard_list[4]
|
272
|
+
if heating_type == heating_type_list[0]
|
273
|
+
if capacity < 87862
|
274
|
+
min_efficiency = 0.8
|
275
|
+
elsif capacity < 732188
|
276
|
+
min_efficiency = 0.79
|
277
|
+
else
|
278
|
+
min_efficiency = 0.79
|
279
|
+
end
|
280
|
+
else
|
281
|
+
if capacity < 87862
|
282
|
+
min_efficiency = 0.82
|
283
|
+
elsif capacity < 732188
|
284
|
+
min_efficiency = 0.81
|
285
|
+
else
|
286
|
+
min_efficiency = 0.81
|
287
|
+
min_efficiency = 0.81
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
return min_efficiency
|
293
|
+
end
|
294
|
+
|
295
|
+
def changeThermalEfficiency(model, boiler_index, efficiency_value_new, runner)
|
296
|
+
i_boiler = 0
|
297
|
+
# loop through to find water boiler
|
298
|
+
model.getBoilerHotWaters.each do |boiler_water|
|
299
|
+
if !boiler_water.to_BoilerHotWater.empty?
|
300
|
+
i_boiler += 1
|
301
|
+
if (boiler_index != 0) && (boiler_index != i_boiler)
|
302
|
+
next
|
303
|
+
end
|
304
|
+
|
305
|
+
water_unit = boiler_water.to_BoilerHotWater.get
|
306
|
+
unit_name = water_unit.name
|
307
|
+
|
308
|
+
# check capacity, fuel type, and thermal efficiency
|
309
|
+
thermal_efficiency_old = water_unit.nominalThermalEfficiency
|
310
|
+
|
311
|
+
# if thermal_efficiency_old.nil?
|
312
|
+
if !thermal_efficiency_old.is_a? Numeric
|
313
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
314
|
+
else
|
315
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
316
|
+
end
|
317
|
+
|
318
|
+
water_unit.setNominalThermalEfficiency(efficiency_value_new)
|
319
|
+
runner.registerInfo("Final: The Thermal Efficiency for '#{unit_name}' was #{efficiency_value_new}")
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
# loop through to find steam boiler
|
324
|
+
model.getBoilerSteams.each do |boiler_steam|
|
325
|
+
if !boiler_steam.to_BoilerSteam.empty?
|
326
|
+
i_boiler += 1
|
327
|
+
if (boiler_index != 0) && (boiler_index != i_boiler)
|
328
|
+
next
|
329
|
+
end
|
330
|
+
|
331
|
+
steam_unit = boiler.to_BoilerSteam.get
|
332
|
+
steam_unit_fueltype = steam_unit.fuelType
|
333
|
+
unit_name = steam_unit.name
|
334
|
+
|
335
|
+
thermal_efficiency_old = steam_unit.theoreticalEfficiency
|
336
|
+
|
337
|
+
if !thermal_efficiency_old.is_a? Numeric
|
338
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
339
|
+
else
|
340
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was #{efficiency_value_new}.")
|
341
|
+
end
|
342
|
+
|
343
|
+
steam_unit.setNominalThermalEfficiency(efficiency_value_new)
|
344
|
+
runner.registerInfo("Final: The Thermal Efficiency for '#{unit_name}' was #{efficiency_value_new}")
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
def changeThermalEfficiencyByStandard(model, boiler_index, efficiency_value_water, efficiency_value_steam, nominal_capacity, fuel_type, runner)
|
350
|
+
i_boiler = 0
|
351
|
+
# loop through to find water boiler
|
352
|
+
model.getBoilerHotWaters.each do |boiler_water|
|
353
|
+
if !boiler_water.to_BoilerHotWater.empty?
|
354
|
+
i_boiler += 1
|
355
|
+
if (boiler_index != 0) && (boiler_index != i_boiler)
|
356
|
+
next
|
357
|
+
end
|
358
|
+
|
359
|
+
water_unit = boiler_water.to_BoilerHotWater.get
|
360
|
+
unit_name = water_unit.name
|
361
|
+
|
362
|
+
# check capacity, fuel type, and thermal efficiency
|
363
|
+
thermal_efficiency_old = water_unit.nominalThermalEfficiency
|
364
|
+
|
365
|
+
# if thermal_efficiency_old.nil?
|
366
|
+
if !thermal_efficiency_old.is_a? Numeric
|
367
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
368
|
+
else
|
369
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
370
|
+
end
|
371
|
+
|
372
|
+
water_unit.setNominalThermalEfficiency(efficiency_value_water)
|
373
|
+
runner.registerInfo("Final: The Thermal Efficiency for '#{unit_name}' was #{efficiency_value_water}")
|
374
|
+
|
375
|
+
# In case there is information about capacity and fuel_type
|
376
|
+
if !nominal_capacity.nil?
|
377
|
+
water_unit.setFuelType(fuel_type)
|
378
|
+
|
379
|
+
nominal_capacity_old = water_unit.nominalCapacity
|
380
|
+
if !nominal_capacity_old.is_a? Numeric
|
381
|
+
runner.registerInfo("Initial: The Nominal Capacity for '#{unit_name}' was not set.")
|
382
|
+
else
|
383
|
+
runner.registerInfo("Initial: The Nominal Capacity for '#{unit_name}' was #{nominal_capacity_old}.")
|
384
|
+
end
|
385
|
+
water_unit.setNominalCapacity(nominal_capacity)
|
386
|
+
runner.registerInfo("Final: The Nominal Capacity for '#{unit_name}' was #{nominal_capacity}")
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
# loop through to find steam boiler
|
392
|
+
model.getBoilerSteams.each do |boiler_steam|
|
393
|
+
if !boiler_steam.to_BoilerSteam.empty?
|
394
|
+
i_boiler += 1
|
395
|
+
if (boiler_index != 0) && (boiler_index != i_boiler)
|
396
|
+
next
|
397
|
+
end
|
398
|
+
|
399
|
+
steam_unit = boiler.to_BoilerSteam.get
|
400
|
+
steam_unit_fueltype = steam_unit.fuelType
|
401
|
+
unit_name = steam_unit.name
|
402
|
+
|
403
|
+
thermal_efficiency_old = steam_unit.theoreticalEfficiency
|
404
|
+
|
405
|
+
if !thermal_efficiency_old.is_a? Numeric
|
406
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was not set.")
|
407
|
+
else
|
408
|
+
runner.registerInfo("Initial: The Thermal Efficiency for '#{unit_name}' was #{thermal_efficiency_old}.")
|
409
|
+
end
|
410
|
+
|
411
|
+
steam_unit.setNominalThermalEfficiency(efficiency_value_steam)
|
412
|
+
runner.registerInfo("Final: The Thermal Efficiency for '#{unit_name}' was #{efficiency_value_steam}")
|
413
|
+
|
414
|
+
# In case there is information about capacity and fuel_type
|
415
|
+
if !nominal_capacity.nil?
|
416
|
+
steam_unit.setFuelType(fuel)
|
417
|
+
|
418
|
+
nominal_capacity_old = steam_unit.nominalCapacity
|
419
|
+
if !nominal_capacity_old.is_a? Numeric
|
420
|
+
runner.registerInfo("Initial: The Nominal Capacity for '#{unit_name}' was not set.")
|
421
|
+
else
|
422
|
+
runner.registerInfo("Initial: The Nominal Capacity for '#{unit_name}' was #{nominal_capacity_old}.")
|
423
|
+
end
|
424
|
+
steam_unit.setNominalCapacity(nominal_capacity)
|
425
|
+
runner.registerInfo("Final: The Nominal Capacity for '#{unit_name}' was #{nominal_capacity}")
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
# define what happens when the measure is run
|
432
|
+
def run(model, runner, user_arguments)
|
433
|
+
super(model, runner, user_arguments)
|
434
|
+
|
435
|
+
# use the built-in error checking
|
436
|
+
if !runner.validateUserArguments(arguments(model), user_arguments)
|
437
|
+
return false
|
438
|
+
end
|
439
|
+
|
440
|
+
# Determine if the measure is applicable to the model, if not just return and no changes are made.
|
441
|
+
info_widget = runner.getOptionalWorkspaceObjectChoiceValue('info_widget', user_arguments, model)
|
442
|
+
if !(info_widget.nil? || info_widget.empty?)
|
443
|
+
runner.registerInfo('This measure is not applicable.')
|
444
|
+
return true
|
445
|
+
end
|
446
|
+
|
447
|
+
# assign the user inputs to variables
|
448
|
+
boiler_widget = runner.getOptionalWorkspaceObjectChoiceValue('boiler_widget', user_arguments, model)
|
449
|
+
standards_widget = runner.getOptionalWorkspaceObjectChoiceValue('standards_widget', user_arguments, model)
|
450
|
+
nominal_capacity_method_widget = runner.getOptionalWorkspaceObjectChoiceValue('nominal_capacity_method_widget', user_arguments, model)
|
451
|
+
fuel_type_widget = runner.getOptionalWorkspaceObjectChoiceValue('fuel_type_widget', user_arguments, model)
|
452
|
+
|
453
|
+
handle = runner.getStringArgumentValue('boiler_widget', user_arguments)
|
454
|
+
boiler_index = handle.to_i
|
455
|
+
|
456
|
+
# check which method is used, if both are checked used the first one
|
457
|
+
is_option_manual = runner.getBoolArgumentValue('input_option_manual', user_arguments)
|
458
|
+
is_option_standard = runner.getBoolArgumentValue('input_option_standard', user_arguments)
|
459
|
+
|
460
|
+
if is_option_manual
|
461
|
+
boiler_thermal_efficiency = runner.getDoubleArgumentValue('boiler_thermal_efficiency', user_arguments)
|
462
|
+
|
463
|
+
# Check if input is valid
|
464
|
+
if (boiler_thermal_efficiency < 0) || (boiler_thermal_efficiency > 1)
|
465
|
+
runner.registerError('Boiler Thermal Efficiency must be between 0 and 1.')
|
466
|
+
return false
|
467
|
+
end
|
468
|
+
|
469
|
+
changeThermalEfficiency(model, boiler_index, boiler_thermal_efficiency, runner)
|
470
|
+
elsif is_option_standard
|
471
|
+
handle = runner.getStringArgumentValue('standards_widget', user_arguments)
|
472
|
+
standards_index = handle.to_i
|
473
|
+
|
474
|
+
handle = runner.getStringArgumentValue('fuel_type_widget', user_arguments)
|
475
|
+
fuel_type_index = handle.to_i
|
476
|
+
|
477
|
+
standard_table = ['', 'ASHRAE 90.1-2004', 'ASHRAE 90.1-2007', 'ASHRAE 90.1-2010', 'ASHRAE 90.1-2013']
|
478
|
+
fuel_table = ['Gas', 'Oil', 'Oil']
|
479
|
+
fuel_formal_name = ['NaturalGas', 'FuelOil#1', 'FuelOil#2']
|
480
|
+
fuel_type = fuel_formal_name[fuel_type_index]
|
481
|
+
|
482
|
+
nominal_capacity = runner.getOptionalDoubleArgumentValue('nominal_capacity', user_arguments)
|
483
|
+
if nominal_capacity.empty?
|
484
|
+
runner.registerError('Nominal capacity is not specified.')
|
485
|
+
return false
|
486
|
+
else
|
487
|
+
nominal_capacity = runner.getDoubleArgumentValue('nominal_capacity', user_arguments)
|
488
|
+
end
|
489
|
+
# Check if the required inputs
|
490
|
+
if !nominal_capacity.is_a? Numeric
|
491
|
+
runner.registerError("'Nominal Capacity' is not specified but required for ASHRAE Standards.")
|
492
|
+
elsif nominal_capacity < 0
|
493
|
+
runner.registerError("'Nominal Capacity' can not be negative.")
|
494
|
+
# elsif (nominal_capacity < 87862) or (nominal_capacity > 732188) then
|
495
|
+
# runner.registerError("'Nominal Capacity' should be between 87.862kW and 732.188kW.")
|
496
|
+
end
|
497
|
+
|
498
|
+
if standards_index <= 0
|
499
|
+
runner.registerError('ASHRAE 90.1 standard is not specified.')
|
500
|
+
return false
|
501
|
+
else
|
502
|
+
runner.registerInfo("Final: ASHRAE Standards #{standard_table[standards_index]} is selected.")
|
503
|
+
end
|
504
|
+
|
505
|
+
water_unit_min_efficiency = getMinEfficiencyWaterBoiler(standard_table[standards_index], nominal_capacity, fuel_table[fuel_type_index])
|
506
|
+
steam_unit_min_efficiency = getMinEfficiencySteamBoiler(standard_table[standards_index], nominal_capacity, fuel_table[fuel_type_index])
|
507
|
+
|
508
|
+
changeThermalEfficiencyByStandard(model, boiler_index, water_unit_min_efficiency, steam_unit_min_efficiency, nominal_capacity, fuel_type, runner)
|
509
|
+
|
510
|
+
else
|
511
|
+
runner.registerError('You have to specify using either Option 1 or Option 2.')
|
512
|
+
return false
|
513
|
+
end
|
514
|
+
|
515
|
+
return true
|
516
|
+
end # end the run method
|
517
|
+
end # end the measure
|
518
|
+
|
519
|
+
# this allows the measure to be use by the application
|
520
|
+
SetBoilerThermalEfficiency.new.registerWithApplication
|