openstudio-extension 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/.rubocop.yml +9 -0
  4. data/Gemfile +3 -1
  5. data/Jenkinsfile +10 -0
  6. data/README.md +230 -12
  7. data/Rakefile +88 -3
  8. data/bin/console +3 -3
  9. data/doc_templates/LICENSE.md +27 -0
  10. data/doc_templates/README.md.erb +42 -0
  11. data/doc_templates/copyright_erb.txt +36 -0
  12. data/doc_templates/copyright_js.txt +4 -0
  13. data/doc_templates/copyright_ruby.txt +34 -0
  14. data/init_templates/README.md +37 -0
  15. data/init_templates/gemspec.txt +32 -0
  16. data/init_templates/openstudio_module.rb +50 -0
  17. data/init_templates/spec.rb +47 -0
  18. data/init_templates/spec_helper.rb +49 -0
  19. data/init_templates/template_gemfile.txt +17 -0
  20. data/init_templates/template_rakefile.txt +15 -0
  21. data/init_templates/version.rb +40 -0
  22. data/lib/files/openstudio-extension-gem-test.ddy +536 -0
  23. data/lib/files/openstudio-extension-gem-test.epw +8768 -0
  24. data/lib/files/openstudio-extension-gem-test.stat +554 -0
  25. data/lib/measures/openstudio_extension_test_measure/LICENSE.md +27 -0
  26. data/lib/measures/openstudio_extension_test_measure/README.md +26 -0
  27. data/lib/measures/openstudio_extension_test_measure/README.md.erb +42 -0
  28. data/lib/measures/openstudio_extension_test_measure/measure.rb +72 -0
  29. data/lib/measures/openstudio_extension_test_measure/measure.xml +83 -0
  30. data/lib/measures/openstudio_extension_test_measure/resources/os_lib_helper_methods.rb +399 -0
  31. data/lib/measures/openstudio_extension_test_measure/tests/OpenStudioExtensionTestMeasure_Test.rb +75 -0
  32. data/lib/openstudio/extension.rb +220 -0
  33. data/lib/openstudio/extension/core/CreateResults.rb +879 -0
  34. data/lib/openstudio/extension/core/check_air_sys_temps.rb +190 -0
  35. data/lib/openstudio/extension/core/check_calibration.rb +155 -0
  36. data/lib/openstudio/extension/core/check_cond_zns.rb +84 -0
  37. data/lib/openstudio/extension/core/check_domestic_hot_water.rb +334 -0
  38. data/lib/openstudio/extension/core/check_envelope_conductance.rb +453 -0
  39. data/lib/openstudio/extension/core/check_eui_by_end_use.rb +162 -0
  40. data/lib/openstudio/extension/core/check_eui_reasonableness.rb +135 -0
  41. data/lib/openstudio/extension/core/check_fan_pwr.rb +98 -0
  42. data/lib/openstudio/extension/core/check_internal_loads.rb +393 -0
  43. data/lib/openstudio/extension/core/check_mech_sys_capacity.rb +226 -0
  44. data/lib/openstudio/extension/core/check_mech_sys_efficiency.rb +326 -0
  45. data/lib/openstudio/extension/core/check_mech_sys_part_load_eff.rb +464 -0
  46. data/lib/openstudio/extension/core/check_mech_sys_type.rb +139 -0
  47. data/lib/openstudio/extension/core/check_part_loads.rb +451 -0
  48. data/lib/openstudio/extension/core/check_placeholder.rb +75 -0
  49. data/lib/openstudio/extension/core/check_plant_cap.rb +123 -0
  50. data/lib/openstudio/extension/core/check_plant_temps.rb +159 -0
  51. data/lib/openstudio/extension/core/check_plenum_loads.rb +87 -0
  52. data/lib/openstudio/extension/core/check_pump_pwr.rb +108 -0
  53. data/lib/openstudio/extension/core/check_sch_coord.rb +241 -0
  54. data/lib/openstudio/extension/core/check_schedules.rb +311 -0
  55. data/lib/openstudio/extension/core/check_simultaneous_heating_and_cooling.rb +158 -0
  56. data/lib/openstudio/extension/core/check_supply_air_and_thermostat_temp_difference.rb +148 -0
  57. data/lib/openstudio/extension/core/check_weather_files.rb +132 -0
  58. data/lib/openstudio/extension/core/deer_vintages.rb +311 -0
  59. data/lib/openstudio/extension/core/os_lib_aedg_measures.rb +491 -0
  60. data/lib/openstudio/extension/core/os_lib_cofee.rb +259 -0
  61. data/lib/openstudio/extension/core/os_lib_constructions.rb +378 -0
  62. data/lib/openstudio/extension/core/os_lib_geometry.rb +1022 -0
  63. data/lib/openstudio/extension/core/os_lib_helper_methods.rb +399 -0
  64. data/lib/openstudio/extension/core/os_lib_hvac.rb +2171 -0
  65. data/lib/openstudio/extension/core/os_lib_lighting_and_equipment.rb +214 -0
  66. data/lib/openstudio/extension/core/os_lib_model_generation.rb +817 -0
  67. data/lib/openstudio/extension/core/os_lib_model_simplification.rb +1049 -0
  68. data/lib/openstudio/extension/core/os_lib_outdoorair_and_infiltration.rb +165 -0
  69. data/lib/openstudio/extension/core/os_lib_reporting.rb +4652 -0
  70. data/lib/openstudio/extension/core/os_lib_reporting_qaqc.rb +200 -0
  71. data/lib/openstudio/extension/core/os_lib_schedules.rb +963 -0
  72. data/lib/openstudio/extension/rake_task.rb +149 -0
  73. data/lib/openstudio/extension/runner.rb +644 -0
  74. data/lib/openstudio/extension/version.rb +40 -0
  75. data/openstudio-extension.gemspec +20 -15
  76. metadata +150 -14
  77. data/.travis.yml +0 -7
  78. data/lib/OpenStudio/Extension/rake_task.rb +0 -84
  79. data/lib/OpenStudio/Extension/version.rb +0 -33
  80. data/lib/OpenStudio/extension.rb +0 -65
@@ -0,0 +1,139 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
27
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
28
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ module OsLib_QAQC
37
+ # include any general notes about QAQC method here
38
+
39
+ # checks the number of unmet hours in the model
40
+ def check_mech_sys_type(category, target_standard, name_only = false)
41
+ # summary of the check
42
+ check_elems = OpenStudio::AttributeVector.new
43
+ check_elems << OpenStudio::Attribute.new('name', 'Mechanical System Type')
44
+ check_elems << OpenStudio::Attribute.new('category', category)
45
+
46
+ # add ASHRAE to display of target standard if includes with 90.1
47
+ if target_standard.include?('90.1 2013')
48
+ check_elems << OpenStudio::Attribute.new('description', 'Check against ASHRAE 90.1 2013 Tables G3.1.1 A-B. Infers the baseline system type based on the equipment serving the zone and their heating/cooling fuels. Only does a high-level inference; does not look for the presence/absence of required controls, etc.')
49
+ else
50
+ check_elems << OpenStudio::Attribute.new('description', 'Check against ASHRAE 90.1. Infers the baseline system type based on the equipment serving the zone and their heating/cooling fuels. Only does a high-level inference; does not look for the presence/absence of required controls, etc.')
51
+ end
52
+
53
+ # stop here if only name is requested this is used to populate display name for arguments
54
+ if name_only == true
55
+ results = []
56
+ check_elems.each do |elem|
57
+ results << elem.valueAsString
58
+ end
59
+ return results
60
+ end
61
+
62
+ # Versions of OpenStudio greater than 2.4.0 use a modified version of
63
+ # openstudio-standards with different method calls. These methods
64
+ # require a "Standard" object instead of the standard being passed into method calls.
65
+ # This Standard object is used throughout the QAQC check.
66
+ if OpenStudio::VersionString.new(OpenStudio.openStudioVersion) < OpenStudio::VersionString.new('2.4.3')
67
+ use_old_gem_code = true
68
+ else
69
+ use_old_gem_code = false
70
+ std = Standard.build(target_standard)
71
+ end
72
+
73
+ begin
74
+ # Get the actual system type for all zones in the model
75
+ act_zone_to_sys_type = {}
76
+ @model.getThermalZones.each do |zone|
77
+ if use_old_gem_code
78
+ act_zone_to_sys_type[zone] = zone.infer_system_type
79
+ else
80
+ act_zone_to_sys_type[zone] = std.thermal_zone_infer_system_type(zone)
81
+ end
82
+ end
83
+
84
+ # Get the baseline system type for all zones in the model
85
+ if use_old_gem_code
86
+ climate_zone = @model.get_building_climate_zone_and_building_type['climate_zone']
87
+ else
88
+ climate_zone = std.model_get_building_climate_zone_and_building_type(@model)['climate_zone']
89
+ end
90
+
91
+ if use_old_gem_code
92
+ req_zone_to_sys_type = @model.get_baseline_system_type_by_zone(target_standard, climate_zone)
93
+ else
94
+ req_zone_to_sys_type = std.model_get_baseline_system_type_by_zone(@model, climate_zone)
95
+ end
96
+
97
+ # Compare the actual to the correct
98
+ @model.getThermalZones.each do |zone|
99
+ # TODO: - skip if plenum
100
+ is_plenum = false
101
+ zone.spaces.each do |space|
102
+ if use_old_gem_code
103
+ if space.plenum?
104
+ is_plenum = true
105
+ end
106
+ else
107
+ if std.space_plenum?(space)
108
+ is_plenum = true
109
+ end
110
+ end
111
+ end
112
+ next if is_plenum
113
+
114
+ req_sys_type = req_zone_to_sys_type[zone]
115
+ act_sys_type = act_zone_to_sys_type[zone]
116
+
117
+ if act_sys_type == req_sys_type
118
+ puts "#{zone.name} system type = #{act_sys_type}"
119
+ else
120
+ if req_sys_type == '' then req_sys_type = 'Unknown' end
121
+ puts "#{zone.name} baseline system type is incorrect. Supposed to be #{req_sys_type}, but was #{act_sys_type} instead."
122
+ check_elems << OpenStudio::Attribute.new('flag', "#{zone.name} baseline system type is incorrect. Supposed to be #{req_sys_type}, but was #{act_sys_type} instead.")
123
+ end
124
+ end
125
+ rescue StandardError => e
126
+ # brief description of ruby error
127
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
128
+
129
+ # backtrace of ruby error for diagnostic use
130
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
131
+ end
132
+
133
+ # add check_elms to new attribute
134
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
135
+
136
+ return check_elem
137
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
138
+ end
139
+ end
@@ -0,0 +1,451 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
27
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
28
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ module OsLib_QAQC
37
+ # Bin the hourly part load ratios into 10% bins
38
+ def bin_part_loads_by_ten_pcts(hrly_plrs)
39
+ bins = Array.new(10, 0)
40
+ op_hrs = 0.0
41
+ hrly_plrs.each do |plr|
42
+ op_hrs += 1.0 if plr > 0
43
+ if plr <= 0.1 # add below-zero % PLRs to final bin
44
+ bins[0] += 1
45
+ elsif plr > 0.1 && plr <= 0.2
46
+ bins[1] += 1
47
+ elsif plr > 0.2 && plr <= 0.3
48
+ bins[2] += 1
49
+ elsif plr > 0.3 && plr <= 0.4
50
+ bins[3] += 1
51
+ elsif plr > 0.4 && plr <= 0.5
52
+ bins[4] += 1
53
+ elsif plr > 0.5 && plr <= 0.6
54
+ bins[5] += 1
55
+ elsif plr > 0.6 && plr <= 0.7
56
+ bins[6] += 1
57
+ elsif plr > 0.7 && plr <= 0.8
58
+ bins[7] += 1
59
+ elsif plr > 0.8 && plr <= 0.9
60
+ bins[8] += 1
61
+ elsif plr > 0.9 # add over-100% PLRs to final bin
62
+ bins[9] += 1
63
+ end
64
+ end
65
+
66
+ # Convert bins from hour counts to % of operating hours.
67
+ bins.each_with_index do |bin, i|
68
+ bins[i] = bins[i] / op_hrs
69
+ end
70
+
71
+ return bins
72
+ end
73
+
74
+ # Check primary heating and cooling equipment part load ratios
75
+ # to find equipment that is significantly oversized or undersized.
76
+ def check_part_loads(category, target_standard, max_pct_delta = 0.1, name_only = false)
77
+ # summary of the check
78
+ check_elems = OpenStudio::AttributeVector.new
79
+ check_elems << OpenStudio::Attribute.new('name', 'Part Load')
80
+ check_elems << OpenStudio::Attribute.new('category', category)
81
+ check_elems << OpenStudio::Attribute.new('description', 'Check that equipment operates at reasonable part load ranges.')
82
+
83
+ # stop here if only name is requested this is used to populate display name for arguments
84
+ if name_only == true
85
+ results = []
86
+ check_elems.each do |elem|
87
+ results << elem.valueAsString
88
+ end
89
+ return results
90
+ end
91
+
92
+ std = Standard.build(target_standard)
93
+
94
+ begin
95
+ # Establish limits for % of operating hrs expected above 90% part load
96
+ expected_pct_hrs_above_90 = 0.1
97
+
98
+ # get the weather file run period (as opposed to design day run period)
99
+ ann_env_pd = nil
100
+ @sql.availableEnvPeriods.each do |env_pd|
101
+ env_type = @sql.environmentType(env_pd)
102
+ if env_type.is_initialized
103
+ if env_type.get == OpenStudio::EnvironmentType.new('WeatherRunPeriod')
104
+ ann_env_pd = env_pd
105
+ break
106
+ end
107
+ end
108
+ end
109
+
110
+ # only try to get the annual timeseries if an annual simulation was run
111
+ if ann_env_pd.nil?
112
+ check_elems << OpenStudio::Attribute.new('flag', 'Cannot find the annual simulation run period, cannot check equipment part load ratios.')
113
+ return check_elem
114
+ end
115
+
116
+ # Boilers
117
+ @model.getBoilerHotWaters.each do |equip|
118
+ # Get the timeseries part load ratio data
119
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
120
+ time_step = 'Hourly'
121
+ variable_name = 'Boiler Part Load Ratio'
122
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
123
+ if ts.empty?
124
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
125
+ next
126
+ end
127
+
128
+ # Convert to array
129
+ ts = ts.get.values
130
+ plrs = []
131
+ for i in 0..(ts.size - 1)
132
+ plrs << ts[i]
133
+ end
134
+
135
+ # Bin part load ratios
136
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
137
+
138
+ # Check top-end part load ratio bins
139
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
140
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
141
+ end
142
+ end
143
+
144
+ # Chillers
145
+ @model.getChillerElectricEIRs.each do |equip|
146
+ # Get the timeseries part load ratio data
147
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
148
+ time_step = 'Hourly'
149
+ variable_name = 'Chiller Part Load Ratio'
150
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
151
+ if ts.empty?
152
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
153
+ next
154
+ end
155
+
156
+ # Convert to array
157
+ ts = ts.get.values
158
+ plrs = []
159
+ for i in 0..(ts.size - 1)
160
+ plrs << ts[i]
161
+ end
162
+
163
+ # Bin part load ratios
164
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
165
+
166
+ # Check top-end part load ratio bins
167
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
168
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
169
+ end
170
+ end
171
+
172
+ # Cooling Towers (Single Speed)
173
+ @model.getCoolingTowerSingleSpeeds.each do |equip|
174
+ # Get the design fan power
175
+ if equip.fanPoweratDesignAirFlowRate.is_initialized
176
+ dsn_pwr = equip.fanPoweratDesignAirFlowRate.get
177
+ elsif equip.autosizedFanPoweratDesignAirFlowRate.is_initialized
178
+ dsn_pwr = equip.autosizedFanPoweratDesignAirFlowRate.get
179
+ else
180
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine peak power for #{equip.name}, cannot check part load ratios.")
181
+ next
182
+ end
183
+
184
+ # Get the timeseries fan power
185
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
186
+ time_step = 'Hourly'
187
+ variable_name = 'Cooling Tower Fan Electric Power'
188
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
189
+ if ts.empty?
190
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
191
+ next
192
+ end
193
+
194
+ # Convert to array
195
+ ts = ts.get.values
196
+ plrs = []
197
+ for i in 0..(ts.size - 1)
198
+ plrs << ts[i] / dsn_pwr.to_f
199
+ end
200
+
201
+ # Bin part load ratios
202
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
203
+
204
+ # Check top-end part load ratio bins
205
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
206
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
207
+ end
208
+ end
209
+
210
+ # Cooling Towers (Two Speed)
211
+ @model.getCoolingTowerTwoSpeeds.each do |equip|
212
+ # Get the design fan power
213
+ if equip.highFanSpeedFanPower.is_initialized
214
+ dsn_pwr = equip.highFanSpeedFanPower.get
215
+ elsif equip.autosizedHighFanSpeedFanPower.is_initialized
216
+ dsn_pwr = equip.autosizedHighFanSpeedFanPower.get
217
+ else
218
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine peak power for #{equip.name}, cannot check part load ratios.")
219
+ next
220
+ end
221
+
222
+ # Get the timeseries fan power
223
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
224
+ time_step = 'Hourly'
225
+ variable_name = 'Cooling Tower Fan Electric Power'
226
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
227
+ if ts.empty?
228
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
229
+ next
230
+ end
231
+
232
+ # Convert to array
233
+ ts = ts.get.values
234
+ plrs = []
235
+ for i in 0..(ts.size - 1)
236
+ plrs << ts[i] / dsn_pwr.to_f
237
+ end
238
+
239
+ # Bin part load ratios
240
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
241
+
242
+ # Check top-end part load ratio bins
243
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
244
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
245
+ end
246
+ end
247
+
248
+ # Cooling Towers (Variable Speed)
249
+ @model.getCoolingTowerVariableSpeeds.each do |equip|
250
+ # Get the design fan power
251
+ if equip.designFanPower.is_initialized
252
+ dsn_pwr = equip.designFanPower.get
253
+ elsif equip.autosizedDesignFanPower.is_initialized
254
+ dsn_pwr = equip.autosizedDesignFanPower.get
255
+ else
256
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine peak power for #{equip.name}, cannot check part load ratios.")
257
+ next
258
+ end
259
+
260
+ # Get the timeseries fan power
261
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
262
+ time_step = 'Hourly'
263
+ variable_name = 'Cooling Tower Fan Electric Power'
264
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
265
+ if ts.empty?
266
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
267
+ next
268
+ end
269
+
270
+ # Convert to array
271
+ ts = ts.get.values
272
+ plrs = []
273
+ for i in 0..(ts.size - 1)
274
+ plrs << ts[i] / dsn_pwr.to_f
275
+ end
276
+
277
+ # Bin part load ratios
278
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
279
+
280
+ # Check top-end part load ratio bins
281
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
282
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
283
+ end
284
+ end
285
+
286
+ # DX Cooling Coils (Single Speed)
287
+ @model.getCoilCoolingDXSingleSpeeds.each do |equip|
288
+ # Get the design coil capacity
289
+ if equip.ratedTotalCoolingCapacity.is_initialized
290
+ dsn_pwr = equip.ratedTotalCoolingCapacity.get
291
+ elsif equip.autosizedRatedTotalCoolingCapacity.is_initialized
292
+ dsn_pwr = equip.autosizedRatedTotalCoolingCapacity.get
293
+ else
294
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine capacity for #{equip.name}, cannot check part load ratios.")
295
+ next
296
+ end
297
+
298
+ # Get the timeseries coil capacity
299
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
300
+ time_step = 'Hourly'
301
+ variable_name = 'Cooling Coil Total Cooling Rate'
302
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
303
+ if ts.empty?
304
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
305
+ next
306
+ end
307
+
308
+ # Convert to array
309
+ ts = ts.get.values
310
+ plrs = []
311
+ for i in 0..(ts.size - 1)
312
+ plrs << ts[i] / dsn_pwr.to_f
313
+ end
314
+
315
+ # Bin part load ratios
316
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
317
+
318
+ # Check top-end part load ratio bins
319
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
320
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
321
+ end
322
+ end
323
+
324
+ # DX Cooling Coils (Two Speed)
325
+ @model.getCoilCoolingDXTwoSpeeds.each do |equip|
326
+ # Get the design coil capacity
327
+ if equip.ratedHighSpeedTotalCoolingCapacity.is_initialized
328
+ dsn_pwr = equip.ratedHighSpeedTotalCoolingCapacity.get
329
+ elsif equip.autosizedRatedHighSpeedTotalCoolingCapacity.is_initialized
330
+ dsn_pwr = equip.autosizedRatedHighSpeedTotalCoolingCapacity.get
331
+ else
332
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine capacity for #{equip.name}, cannot check part load ratios.")
333
+ next
334
+ end
335
+
336
+ # Get the timeseries coil capacity
337
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
338
+ time_step = 'Hourly'
339
+ variable_name = 'Cooling Coil Total Cooling Rate'
340
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
341
+ if ts.empty?
342
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
343
+ next
344
+ end
345
+
346
+ # Convert to array
347
+ ts = ts.get.values
348
+ plrs = []
349
+ for i in 0..(ts.size - 1)
350
+ plrs << ts[i] / dsn_pwr.to_f
351
+ end
352
+
353
+ # Bin part load ratios
354
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
355
+
356
+ # Check top-end part load ratio bins
357
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
358
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
359
+ end
360
+ end
361
+
362
+ # DX Cooling Coils (Variable Speed)
363
+ @model.getCoilCoolingDXVariableSpeeds.each do |equip|
364
+ # Get the design coil capacity
365
+ if equip.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
366
+ dsn_pwr = equip.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.get
367
+ elsif equip.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
368
+ dsn_pwr = equip.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.get
369
+ else
370
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine capacity for #{equip.name}, cannot check part load ratios.")
371
+ next
372
+ end
373
+
374
+ # Get the timeseries coil capacity
375
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
376
+ time_step = 'Hourly'
377
+ variable_name = 'Cooling Coil Total Cooling Rate'
378
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
379
+ if ts.empty?
380
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
381
+ next
382
+ end
383
+
384
+ # Convert to array
385
+ ts = ts.get.values
386
+ plrs = []
387
+ for i in 0..(ts.size - 1)
388
+ plrs << ts[i] / dsn_pwr.to_f
389
+ end
390
+
391
+ # Bin part load ratios
392
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
393
+
394
+ # Check top-end part load ratio bins
395
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
396
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
397
+ end
398
+ end
399
+
400
+ # Gas Heating Coils
401
+ @model.getCoilHeatingGass.each do |equip|
402
+ # Get the design coil capacity
403
+ if equip.nominalCapacity.is_initialized
404
+ dsn_pwr = equip.nominalCapacity.get
405
+ elsif equip.autosizedNominalCapacity.is_initialized
406
+ dsn_pwr = equip.autosizedNominalCapacity.get
407
+ else
408
+ check_elems << OpenStudio::Attribute.new('flag', "Could not determine capacity for #{equip.name}, cannot check part load ratios.")
409
+ next
410
+ end
411
+
412
+ # Get the timeseries coil capacity
413
+ key_value = equip.name.get.to_s.upcase # must be in all caps.
414
+ time_step = 'Hourly'
415
+ variable_name = 'Heating Coil Air Heating Rate'
416
+ ts = @sql.timeSeries(ann_env_pd, time_step, variable_name, key_value)
417
+ if ts.empty?
418
+ check_elems << OpenStudio::Attribute.new('flag', "#{variable_name} Timeseries not found for #{key_value}.")
419
+ next
420
+ end
421
+
422
+ # Convert to array
423
+ ts = ts.get.values
424
+ plrs = []
425
+ for i in 0..(ts.size - 1)
426
+ plrs << ts[i] / dsn_pwr.to_f
427
+ end
428
+
429
+ # Bin part load ratios
430
+ pct_hrs_above_90 = bin_part_loads_by_ten_pcts(plrs)[9]
431
+
432
+ # Check top-end part load ratio bins
433
+ if ((pct_hrs_above_90 - expected_pct_hrs_above_90) / pct_hrs_above_90).abs > max_pct_delta
434
+ check_elems << OpenStudio::Attribute.new('flag', "For #{equip.name}, the actual hrs above 90% part load of #{(pct_hrs_above_90 * 100).round(2)}% is more than #{(max_pct_delta * 100.0).round(2)}% different from the expected #{(expected_pct_hrs_above_90 * 100).round(2)}% of hrs above 90% part load. This could indicate significantly oversized or undersized equipment.")
435
+ end
436
+ end
437
+ rescue StandardError => e
438
+ # brief description of ruby error
439
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
440
+
441
+ # backtrace of ruby error for diagnostic use
442
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
443
+ end
444
+
445
+ # add check_elms to new attribute
446
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
447
+
448
+ return check_elem
449
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
450
+ end
451
+ end