openstudio-extension 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +29 -26
  3. data/.rspec +3 -3
  4. data/.rubocop.yml +10 -9
  5. data/CHANGELOG.md +16 -0
  6. data/Gemfile +6 -6
  7. data/Jenkinsfile +10 -10
  8. data/README.md +251 -250
  9. data/Rakefile +119 -119
  10. data/bin/console +14 -14
  11. data/bin/setup +8 -8
  12. data/doc_templates/LICENSE.md +26 -26
  13. data/doc_templates/README.md.erb +41 -41
  14. data/doc_templates/copyright_erb.txt +35 -35
  15. data/doc_templates/copyright_js.txt +3 -3
  16. data/doc_templates/copyright_ruby.txt +33 -33
  17. data/init_templates/README.md +37 -37
  18. data/init_templates/gemspec.txt +32 -32
  19. data/init_templates/openstudio_module.rb +50 -50
  20. data/init_templates/spec.rb +47 -47
  21. data/init_templates/spec_helper.rb +49 -49
  22. data/init_templates/template_gemfile.txt +17 -17
  23. data/init_templates/template_rakefile.txt +15 -15
  24. data/init_templates/version.rb +40 -40
  25. data/lib/files/openstudio-extension-gem-test.ddy +536 -536
  26. data/lib/files/openstudio-extension-gem-test.epw +8768 -8768
  27. data/lib/files/openstudio-extension-gem-test.stat +554 -554
  28. data/lib/measures/openstudio_extension_test_measure/LICENSE.md +26 -26
  29. data/lib/measures/openstudio_extension_test_measure/README.md +26 -26
  30. data/lib/measures/openstudio_extension_test_measure/README.md.erb +41 -41
  31. data/lib/measures/openstudio_extension_test_measure/measure.rb +72 -72
  32. data/lib/measures/openstudio_extension_test_measure/measure.xml +83 -83
  33. data/lib/measures/openstudio_extension_test_measure/resources/os_lib_helper_methods.rb +399 -399
  34. data/lib/measures/openstudio_extension_test_measure/tests/{OpenStudioExtensionTestMeasure_Test.rb → openstudio_extension_test_measure_test.rb} +74 -75
  35. data/lib/openstudio-extension.rb +1 -1
  36. data/lib/openstudio/extension.rb +234 -229
  37. data/lib/openstudio/extension/core/CreateResults.rb +886 -886
  38. data/lib/openstudio/extension/core/check_air_sys_temps.rb +190 -190
  39. data/lib/openstudio/extension/core/check_calibration.rb +155 -155
  40. data/lib/openstudio/extension/core/check_cond_zns.rb +84 -84
  41. data/lib/openstudio/extension/core/check_domestic_hot_water.rb +334 -334
  42. data/lib/openstudio/extension/core/check_envelope_conductance.rb +453 -453
  43. data/lib/openstudio/extension/core/check_eui_by_end_use.rb +162 -162
  44. data/lib/openstudio/extension/core/check_eui_reasonableness.rb +135 -135
  45. data/lib/openstudio/extension/core/check_fan_pwr.rb +98 -98
  46. data/lib/openstudio/extension/core/check_internal_loads.rb +393 -393
  47. data/lib/openstudio/extension/core/check_mech_sys_capacity.rb +226 -226
  48. data/lib/openstudio/extension/core/check_mech_sys_efficiency.rb +326 -326
  49. data/lib/openstudio/extension/core/check_mech_sys_part_load_eff.rb +464 -464
  50. data/lib/openstudio/extension/core/check_mech_sys_type.rb +139 -139
  51. data/lib/openstudio/extension/core/check_part_loads.rb +451 -451
  52. data/lib/openstudio/extension/core/check_placeholder.rb +75 -75
  53. data/lib/openstudio/extension/core/check_plant_cap.rb +123 -123
  54. data/lib/openstudio/extension/core/check_plant_temps.rb +159 -159
  55. data/lib/openstudio/extension/core/check_plenum_loads.rb +87 -87
  56. data/lib/openstudio/extension/core/check_pump_pwr.rb +108 -108
  57. data/lib/openstudio/extension/core/check_sch_coord.rb +241 -241
  58. data/lib/openstudio/extension/core/check_schedules.rb +311 -311
  59. data/lib/openstudio/extension/core/check_simultaneous_heating_and_cooling.rb +158 -158
  60. data/lib/openstudio/extension/core/check_supply_air_and_thermostat_temp_difference.rb +148 -148
  61. data/lib/openstudio/extension/core/check_weather_files.rb +132 -132
  62. data/lib/openstudio/extension/core/deer_vintages.rb +311 -311
  63. data/lib/openstudio/extension/core/os_lib_aedg_measures.rb +491 -491
  64. data/lib/openstudio/extension/core/os_lib_cofee.rb +258 -258
  65. data/lib/openstudio/extension/core/os_lib_constructions.rb +378 -378
  66. data/lib/openstudio/extension/core/os_lib_geometry.rb +1022 -1022
  67. data/lib/openstudio/extension/core/os_lib_helper_methods.rb +399 -399
  68. data/lib/openstudio/extension/core/os_lib_hvac.rb +2171 -2171
  69. data/lib/openstudio/extension/core/os_lib_lighting_and_equipment.rb +214 -214
  70. data/lib/openstudio/extension/core/os_lib_model_generation.rb +817 -817
  71. data/lib/openstudio/extension/core/os_lib_model_simplification.rb +1049 -1049
  72. data/lib/openstudio/extension/core/os_lib_outdoorair_and_infiltration.rb +165 -165
  73. data/lib/openstudio/extension/core/os_lib_reporting.rb +4651 -4651
  74. data/lib/openstudio/extension/core/os_lib_reporting_qaqc.rb +200 -200
  75. data/lib/openstudio/extension/core/os_lib_schedules.rb +963 -963
  76. data/lib/openstudio/extension/rake_task.rb +159 -149
  77. data/lib/openstudio/extension/runner.rb +667 -644
  78. data/lib/openstudio/extension/runner_config.rb +114 -0
  79. data/lib/openstudio/extension/version.rb +40 -40
  80. data/openstudio-extension.gemspec +34 -33
  81. metadata +39 -37
@@ -1,84 +1,84 @@
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
- # Check that all zones with people are conditioned (have a thermostat with setpoints)
38
- def check_cond_zns(category, target_standard, name_only = false)
39
- # summary of the check
40
- check_elems = OpenStudio::AttributeVector.new
41
- check_elems << OpenStudio::Attribute.new('name', 'Conditioned Zones')
42
- check_elems << OpenStudio::Attribute.new('category', category)
43
- check_elems << OpenStudio::Attribute.new('description', 'Check that all zones with people have thermostats.')
44
-
45
- # stop here if only name is requested this is used to populate display name for arguments
46
- if name_only == true
47
- results = []
48
- check_elems.each do |elem|
49
- results << elem.valueAsString
50
- end
51
- return results
52
- end
53
-
54
- std = Standard.build(target_standard)
55
-
56
- begin
57
- @model.getThermalZones.each do |zone|
58
- # Only check zones that have people
59
- num_ppl = zone.numberOfPeople
60
- next unless zone.numberOfPeople > 0
61
-
62
- # Check that the zone is heated (at a minimum)
63
- # by checking that the heating setpoint is at least 41F.
64
- # Sometimes people include thermostats but set the setpoints
65
- # such that the system never comes on. This check attempts to catch that.
66
- unless std.thermal_zone_heated?(zone)
67
- check_elems << OpenStudio::Attribute.new('flag', "#{zone.name} has #{num_ppl} people but is not heated. Zones containing people are expected to be conditioned, heated-only at a minimum. Heating setpoint must be at least 41F to be considered heated.")
68
- end
69
- end
70
- rescue StandardError => e
71
- # brief description of ruby error
72
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
73
-
74
- # backtrace of ruby error for diagnostic use
75
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
76
- end
77
-
78
- # add check_elms to new attribute
79
- check_elem = OpenStudio::Attribute.new('check', check_elems)
80
-
81
- return check_elem
82
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
83
- end
84
- end
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
+ # Check that all zones with people are conditioned (have a thermostat with setpoints)
38
+ def check_cond_zns(category, target_standard, name_only = false)
39
+ # summary of the check
40
+ check_elems = OpenStudio::AttributeVector.new
41
+ check_elems << OpenStudio::Attribute.new('name', 'Conditioned Zones')
42
+ check_elems << OpenStudio::Attribute.new('category', category)
43
+ check_elems << OpenStudio::Attribute.new('description', 'Check that all zones with people have thermostats.')
44
+
45
+ # stop here if only name is requested this is used to populate display name for arguments
46
+ if name_only == true
47
+ results = []
48
+ check_elems.each do |elem|
49
+ results << elem.valueAsString
50
+ end
51
+ return results
52
+ end
53
+
54
+ std = Standard.build(target_standard)
55
+
56
+ begin
57
+ @model.getThermalZones.each do |zone|
58
+ # Only check zones that have people
59
+ num_ppl = zone.numberOfPeople
60
+ next unless zone.numberOfPeople > 0
61
+
62
+ # Check that the zone is heated (at a minimum)
63
+ # by checking that the heating setpoint is at least 41F.
64
+ # Sometimes people include thermostats but set the setpoints
65
+ # such that the system never comes on. This check attempts to catch that.
66
+ unless std.thermal_zone_heated?(zone)
67
+ check_elems << OpenStudio::Attribute.new('flag', "#{zone.name} has #{num_ppl} people but is not heated. Zones containing people are expected to be conditioned, heated-only at a minimum. Heating setpoint must be at least 41F to be considered heated.")
68
+ end
69
+ end
70
+ rescue StandardError => e
71
+ # brief description of ruby error
72
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
73
+
74
+ # backtrace of ruby error for diagnostic use
75
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
76
+ end
77
+
78
+ # add check_elms to new attribute
79
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
80
+
81
+ return check_elem
82
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
83
+ end
84
+ end
@@ -1,334 +1,334 @@
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_domestic_hot_water(category, target_standard, min_pass, max_pass, name_only = false)
41
- # TODO: - could expose meal turnover and people per unit for res and hotel into arguments
42
-
43
- # summary of the check
44
- check_elems = OpenStudio::AttributeVector.new
45
- check_elems << OpenStudio::Attribute.new('name', 'Domestic Hot Water')
46
- check_elems << OpenStudio::Attribute.new('category', category)
47
- if target_standard == 'ICC IECC 2015'
48
- check_elems << OpenStudio::Attribute.new('description', 'Check service water heating consumption against Table R405.5.2(1) in ICC IECC 2015 Residential Provisions.')
49
- else
50
- check_elems << OpenStudio::Attribute.new('description', 'Check against the 2011 ASHRAE Handbook - HVAC Applications, Table 7 section 50.14.')
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
- # loop through water_use_equipment
75
- service_water_consumption_daily_avg_gal = 0.0
76
- @model.getWaterUseEquipments.each do |water_use_equipment|
77
- # get peak flow rate from def
78
- peak_flow_rate_si = water_use_equipment.waterUseEquipmentDefinition.peakFlowRate
79
- source_units = 'm^3/s'
80
- target_units = 'gal/min'
81
- peak_flow_rate_ip = OpenStudio.convert(peak_flow_rate_si, source_units, target_units).get
82
-
83
- # get value from flow rate schedule
84
- if water_use_equipment.flowRateFractionSchedule.is_initialized
85
- # get annual equiv for model schedule
86
- schedule_inst = water_use_equipment.flowRateFractionSchedule.get
87
- if schedule_inst.to_ScheduleRuleset.is_initialized
88
- if use_old_gem_code
89
- annual_equiv_flow_rate = schedule_inst.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
90
- else
91
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleRuleset.get)
92
- end
93
- elsif schedule_inst.to_ScheduleConstant.is_initialized
94
- if use_old_gem_code
95
- annual_equiv_flow_rate = schedule_inst.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
96
- else
97
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleConstant.get)
98
- end
99
- else
100
- check_elems << OpenStudio::Attribute.new('flag', "#{schedule_inst.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
101
- next
102
- end
103
- else
104
- # issue flag
105
- check_elems << OpenStudio::Attribute.new('flag', "#{water_use_equipment.name} doesn't have a schedule. Can't identify hot water consumption.")
106
- next
107
- end
108
-
109
- # add to global service water consumpiton value
110
- service_water_consumption_daily_avg_gal += 60.0 * peak_flow_rate_ip * annual_equiv_flow_rate / 365.0
111
- end
112
-
113
- if target_standard == 'ICC IECC 2015'
114
-
115
- num_people = 0.0
116
- @model.getSpaceTypes.each do |space_type|
117
- next if !space_type.standardsSpaceType.is_initialized
118
- next if space_type.standardsSpaceType.get != 'Apartment' # currently only supports midrise apt space type
119
- space_type_floor_area = space_type.floorArea
120
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
121
- num_people += space_type_num_people
122
- end
123
-
124
- # lookup target gal/day for the building
125
- bedrooms_per_unit = 2.0 # assumption
126
- num_units = num_people / 2.5 # Avg 2.5 units per person.
127
- if use_old_gem_code
128
- target_consumption = @model.find_icc_iecc_2015_hot_water_demand(num_units, bedrooms_per_unit)
129
- else
130
- target_consumption = std.model_find_icc_iecc_2015_hot_water_demand(@model, num_units, bedrooms_per_unit)
131
- end
132
-
133
- else # only other path for now is 90.1-2013
134
-
135
- # get building type
136
- building_type = ''
137
- if @model.getBuilding.standardsBuildingType.is_initialized
138
- building_type = @model.getBuilding.standardsBuildingType.get
139
- end
140
-
141
- # lookup data from standards
142
- if use_old_gem_code
143
- ashrae_hot_water_demand = @model.find_ashrae_hot_water_demand
144
- else
145
- ashrae_hot_water_demand = std.model_find_ashrae_hot_water_demand(@model)
146
- end
147
-
148
- # building type specific logic for water consumption
149
- # todo - update test to exercise various building types
150
- if !ashrae_hot_water_demand.empty?
151
-
152
- if building_type == 'FullServiceRestaurant'
153
- num_people_hours = 0.0
154
- @model.getSpaceTypes.each do |space_type|
155
- next if !space_type.standardsSpaceType.is_initialized
156
- next if space_type.standardsSpaceType.get != 'Dining'
157
- space_type_floor_area = space_type.floorArea
158
-
159
- space_type_num_people_hours = 0.0
160
- # loop through peole instances
161
- space_type.peoples.each do |inst|
162
- inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
163
- inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
164
-
165
- if inst_schedule.to_ScheduleRuleset.is_initialized
166
- if use_old_gem_code
167
- annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
168
- else
169
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
170
- end
171
- elsif inst_schedule.to_ScheduleConstant.is_initialized
172
- if use_old_gem_code
173
- annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
174
- else
175
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
176
- end
177
- else
178
- check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
179
- annual_equiv_flow_rate = 0.0
180
- end
181
-
182
- inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
183
- space_type_num_people_hours += inst_num_people_horus
184
- end
185
-
186
- num_people_hours += space_type_num_people_hours
187
- end
188
- num_meals = num_people_hours / 365.0 * 1.5 # 90 minute meal
189
- target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
190
-
191
- elsif ['LargeHotel', 'SmallHotel'].include? building_type
192
- num_people = 0.0
193
- @model.getSpaceTypes.each do |space_type|
194
- next if !space_type.standardsSpaceType.is_initialized
195
- next if space_type.standardsSpaceType.get != 'GuestRoom'
196
- space_type_floor_area = space_type.floorArea
197
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
198
- num_people += space_type_num_people
199
- end
200
-
201
- # find best fit from returned results
202
- num_units = num_people / 2.0 # 2 people per room design load, not typical occupancy
203
- avg_day_unit = nil
204
- fit = nil
205
- ashrae_hot_water_demand.each do |block|
206
- if fit.nil?
207
- avg_day_unit = block[:avg_day_unit]
208
- fit = (avg_day_unit - block[:block]).abs
209
- elsif (avg_day_unit - block[:block]).abs - fit
210
- avg_day_unit = block[:avg_day_unit]
211
- fit = (avg_day_unit - block[:block]).abs
212
- end
213
- end
214
- target_consumption = num_units * avg_day_unit
215
-
216
- elsif building_type == 'MidriseApartment'
217
- num_people = 0.0
218
- @model.getSpaceTypes.each do |space_type|
219
- next if !space_type.standardsSpaceType.is_initialized
220
- next if space_type.standardsSpaceType.get != 'Apartment'
221
- space_type_floor_area = space_type.floorArea
222
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
223
- num_people += space_type_num_people
224
- end
225
-
226
- # find best fit from returned results
227
- num_units = num_people / 2.5 # Avg 2.5 units per person.
228
- avg_day_unit = nil
229
- fit = nil
230
- ashrae_hot_water_demand.each do |block|
231
- if fit.nil?
232
- avg_day_unit = block[:avg_day_unit]
233
- fit = (avg_day_unit - block[:block]).abs
234
- elsif (avg_day_unit - block[:block]).abs - fit
235
- avg_day_unit = block[:avg_day_unit]
236
- fit = (avg_day_unit - block[:block]).abs
237
- end
238
- end
239
- target_consumption = num_units * avg_day_unit
240
-
241
- elsif ['Office', 'LargeOffice', 'MediumOffice', 'SmallOffice'].include? building_type
242
- num_people = @model.getBuilding.numberOfPeople
243
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
244
- elsif building_type == 'PrimarySchool'
245
- num_people = 0.0
246
- @model.getSpaceTypes.each do |space_type|
247
- next if !space_type.standardsSpaceType.is_initialized
248
- next if space_type.standardsSpaceType.get != 'Classroom'
249
- space_type_floor_area = space_type.floorArea
250
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
251
- num_people += space_type_num_people
252
- end
253
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
254
- elsif building_type == 'QuickServiceRestaurant'
255
- num_people_hours = 0.0
256
- @model.getSpaceTypes.each do |space_type|
257
- next if !space_type.standardsSpaceType.is_initialized
258
- next if space_type.standardsSpaceType.get != 'Dining'
259
- space_type_floor_area = space_type.floorArea
260
-
261
- space_type_num_people_hours = 0.0
262
- # loop through peole instances
263
- space_type.peoples.each do |inst|
264
- inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
265
- inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
266
-
267
- if inst_schedule.to_ScheduleRuleset.is_initialized
268
- if use_old_gem_code
269
- annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
270
- else
271
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
272
- end
273
- elsif inst_schedule.to_ScheduleConstant.is_initialized
274
- if use_old_gem_code
275
- annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
276
- else
277
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
278
- end
279
- else
280
- check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
281
- annual_equiv_flow_rate = 0.0
282
- end
283
-
284
- inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
285
- space_type_num_people_hours += inst_num_people_horus
286
- end
287
-
288
- num_people_hours += space_type_num_people_hours
289
- end
290
- num_meals = num_people_hours / 365.0 * 0.5 # 30 minute leal
291
- # todo - add logic to address drive through traffic
292
- target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
293
-
294
- elsif building_type == 'SecondarySchool'
295
- num_people = 0.0
296
- @model.getSpaceTypes.each do |space_type|
297
- next if !space_type.standardsSpaceType.is_initialized
298
- next if space_type.standardsSpaceType.get != 'Classroom'
299
- space_type_floor_area = space_type.floorArea
300
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
301
- num_people += space_type_num_people
302
- end
303
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
304
- else
305
- check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
306
- end
307
-
308
- else
309
- check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
310
- end
311
-
312
- end
313
-
314
- # check actual against target
315
- if service_water_consumption_daily_avg_gal < target_consumption * (1.0 - min_pass)
316
- check_elems << OpenStudio::Attribute.new('flag', "Annual average of #{service_water_consumption_daily_avg_gal.round} gallons per day of hot water is more than #{min_pass * 100} % below the expected value of #{target_consumption.round} gallons per day.")
317
- elsif service_water_consumption_daily_avg_gal > target_consumption * (1.0 + max_pass)
318
- check_elems << OpenStudio::Attribute.new('flag', "Annual average of #{service_water_consumption_daily_avg_gal.round} gallons per day of hot water is more than #{max_pass * 100} % above the expected value of #{target_consumption.round} gallons per day.")
319
- end
320
- rescue StandardError => e
321
- # brief description of ruby error
322
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
323
-
324
- # backtrace of ruby error for diagnostic use
325
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
326
- end
327
-
328
- # add check_elms to new attribute
329
- check_elem = OpenStudio::Attribute.new('check', check_elems)
330
-
331
- return check_elem
332
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
333
- end
334
- end
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_domestic_hot_water(category, target_standard, min_pass, max_pass, name_only = false)
41
+ # TODO: - could expose meal turnover and people per unit for res and hotel into arguments
42
+
43
+ # summary of the check
44
+ check_elems = OpenStudio::AttributeVector.new
45
+ check_elems << OpenStudio::Attribute.new('name', 'Domestic Hot Water')
46
+ check_elems << OpenStudio::Attribute.new('category', category)
47
+ if target_standard == 'ICC IECC 2015'
48
+ check_elems << OpenStudio::Attribute.new('description', 'Check service water heating consumption against Table R405.5.2(1) in ICC IECC 2015 Residential Provisions.')
49
+ else
50
+ check_elems << OpenStudio::Attribute.new('description', 'Check against the 2011 ASHRAE Handbook - HVAC Applications, Table 7 section 50.14.')
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
+ # loop through water_use_equipment
75
+ service_water_consumption_daily_avg_gal = 0.0
76
+ @model.getWaterUseEquipments.each do |water_use_equipment|
77
+ # get peak flow rate from def
78
+ peak_flow_rate_si = water_use_equipment.waterUseEquipmentDefinition.peakFlowRate
79
+ source_units = 'm^3/s'
80
+ target_units = 'gal/min'
81
+ peak_flow_rate_ip = OpenStudio.convert(peak_flow_rate_si, source_units, target_units).get
82
+
83
+ # get value from flow rate schedule
84
+ if water_use_equipment.flowRateFractionSchedule.is_initialized
85
+ # get annual equiv for model schedule
86
+ schedule_inst = water_use_equipment.flowRateFractionSchedule.get
87
+ if schedule_inst.to_ScheduleRuleset.is_initialized
88
+ if use_old_gem_code
89
+ annual_equiv_flow_rate = schedule_inst.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
90
+ else
91
+ annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleRuleset.get)
92
+ end
93
+ elsif schedule_inst.to_ScheduleConstant.is_initialized
94
+ if use_old_gem_code
95
+ annual_equiv_flow_rate = schedule_inst.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
96
+ else
97
+ annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleConstant.get)
98
+ end
99
+ else
100
+ check_elems << OpenStudio::Attribute.new('flag', "#{schedule_inst.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
101
+ next
102
+ end
103
+ else
104
+ # issue flag
105
+ check_elems << OpenStudio::Attribute.new('flag', "#{water_use_equipment.name} doesn't have a schedule. Can't identify hot water consumption.")
106
+ next
107
+ end
108
+
109
+ # add to global service water consumpiton value
110
+ service_water_consumption_daily_avg_gal += 60.0 * peak_flow_rate_ip * annual_equiv_flow_rate / 365.0
111
+ end
112
+
113
+ if target_standard == 'ICC IECC 2015'
114
+
115
+ num_people = 0.0
116
+ @model.getSpaceTypes.each do |space_type|
117
+ next if !space_type.standardsSpaceType.is_initialized
118
+ next if space_type.standardsSpaceType.get != 'Apartment' # currently only supports midrise apt space type
119
+ space_type_floor_area = space_type.floorArea
120
+ space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
121
+ num_people += space_type_num_people
122
+ end
123
+
124
+ # lookup target gal/day for the building
125
+ bedrooms_per_unit = 2.0 # assumption
126
+ num_units = num_people / 2.5 # Avg 2.5 units per person.
127
+ if use_old_gem_code
128
+ target_consumption = @model.find_icc_iecc_2015_hot_water_demand(num_units, bedrooms_per_unit)
129
+ else
130
+ target_consumption = std.model_find_icc_iecc_2015_hot_water_demand(@model, num_units, bedrooms_per_unit)
131
+ end
132
+
133
+ else # only other path for now is 90.1-2013
134
+
135
+ # get building type
136
+ building_type = ''
137
+ if @model.getBuilding.standardsBuildingType.is_initialized
138
+ building_type = @model.getBuilding.standardsBuildingType.get
139
+ end
140
+
141
+ # lookup data from standards
142
+ if use_old_gem_code
143
+ ashrae_hot_water_demand = @model.find_ashrae_hot_water_demand
144
+ else
145
+ ashrae_hot_water_demand = std.model_find_ashrae_hot_water_demand(@model)
146
+ end
147
+
148
+ # building type specific logic for water consumption
149
+ # todo - update test to exercise various building types
150
+ if !ashrae_hot_water_demand.empty?
151
+
152
+ if building_type == 'FullServiceRestaurant'
153
+ num_people_hours = 0.0
154
+ @model.getSpaceTypes.each do |space_type|
155
+ next if !space_type.standardsSpaceType.is_initialized
156
+ next if space_type.standardsSpaceType.get != 'Dining'
157
+ space_type_floor_area = space_type.floorArea
158
+
159
+ space_type_num_people_hours = 0.0
160
+ # loop through peole instances
161
+ space_type.peoples.each do |inst|
162
+ inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
163
+ inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
164
+
165
+ if inst_schedule.to_ScheduleRuleset.is_initialized
166
+ if use_old_gem_code
167
+ annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
168
+ else
169
+ annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
170
+ end
171
+ elsif inst_schedule.to_ScheduleConstant.is_initialized
172
+ if use_old_gem_code
173
+ annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
174
+ else
175
+ annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
176
+ end
177
+ else
178
+ check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
179
+ annual_equiv_flow_rate = 0.0
180
+ end
181
+
182
+ inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
183
+ space_type_num_people_hours += inst_num_people_horus
184
+ end
185
+
186
+ num_people_hours += space_type_num_people_hours
187
+ end
188
+ num_meals = num_people_hours / 365.0 * 1.5 # 90 minute meal
189
+ target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
190
+
191
+ elsif ['LargeHotel', 'SmallHotel'].include? building_type
192
+ num_people = 0.0
193
+ @model.getSpaceTypes.each do |space_type|
194
+ next if !space_type.standardsSpaceType.is_initialized
195
+ next if space_type.standardsSpaceType.get != 'GuestRoom'
196
+ space_type_floor_area = space_type.floorArea
197
+ space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
198
+ num_people += space_type_num_people
199
+ end
200
+
201
+ # find best fit from returned results
202
+ num_units = num_people / 2.0 # 2 people per room design load, not typical occupancy
203
+ avg_day_unit = nil
204
+ fit = nil
205
+ ashrae_hot_water_demand.each do |block|
206
+ if fit.nil?
207
+ avg_day_unit = block[:avg_day_unit]
208
+ fit = (avg_day_unit - block[:block]).abs
209
+ elsif (avg_day_unit - block[:block]).abs - fit
210
+ avg_day_unit = block[:avg_day_unit]
211
+ fit = (avg_day_unit - block[:block]).abs
212
+ end
213
+ end
214
+ target_consumption = num_units * avg_day_unit
215
+
216
+ elsif building_type == 'MidriseApartment'
217
+ num_people = 0.0
218
+ @model.getSpaceTypes.each do |space_type|
219
+ next if !space_type.standardsSpaceType.is_initialized
220
+ next if space_type.standardsSpaceType.get != 'Apartment'
221
+ space_type_floor_area = space_type.floorArea
222
+ space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
223
+ num_people += space_type_num_people
224
+ end
225
+
226
+ # find best fit from returned results
227
+ num_units = num_people / 2.5 # Avg 2.5 units per person.
228
+ avg_day_unit = nil
229
+ fit = nil
230
+ ashrae_hot_water_demand.each do |block|
231
+ if fit.nil?
232
+ avg_day_unit = block[:avg_day_unit]
233
+ fit = (avg_day_unit - block[:block]).abs
234
+ elsif (avg_day_unit - block[:block]).abs - fit
235
+ avg_day_unit = block[:avg_day_unit]
236
+ fit = (avg_day_unit - block[:block]).abs
237
+ end
238
+ end
239
+ target_consumption = num_units * avg_day_unit
240
+
241
+ elsif ['Office', 'LargeOffice', 'MediumOffice', 'SmallOffice'].include? building_type
242
+ num_people = @model.getBuilding.numberOfPeople
243
+ target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
244
+ elsif building_type == 'PrimarySchool'
245
+ num_people = 0.0
246
+ @model.getSpaceTypes.each do |space_type|
247
+ next if !space_type.standardsSpaceType.is_initialized
248
+ next if space_type.standardsSpaceType.get != 'Classroom'
249
+ space_type_floor_area = space_type.floorArea
250
+ space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
251
+ num_people += space_type_num_people
252
+ end
253
+ target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
254
+ elsif building_type == 'QuickServiceRestaurant'
255
+ num_people_hours = 0.0
256
+ @model.getSpaceTypes.each do |space_type|
257
+ next if !space_type.standardsSpaceType.is_initialized
258
+ next if space_type.standardsSpaceType.get != 'Dining'
259
+ space_type_floor_area = space_type.floorArea
260
+
261
+ space_type_num_people_hours = 0.0
262
+ # loop through peole instances
263
+ space_type.peoples.each do |inst|
264
+ inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
265
+ inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
266
+
267
+ if inst_schedule.to_ScheduleRuleset.is_initialized
268
+ if use_old_gem_code
269
+ annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
270
+ else
271
+ annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
272
+ end
273
+ elsif inst_schedule.to_ScheduleConstant.is_initialized
274
+ if use_old_gem_code
275
+ annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
276
+ else
277
+ annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
278
+ end
279
+ else
280
+ check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
281
+ annual_equiv_flow_rate = 0.0
282
+ end
283
+
284
+ inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
285
+ space_type_num_people_hours += inst_num_people_horus
286
+ end
287
+
288
+ num_people_hours += space_type_num_people_hours
289
+ end
290
+ num_meals = num_people_hours / 365.0 * 0.5 # 30 minute leal
291
+ # todo - add logic to address drive through traffic
292
+ target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
293
+
294
+ elsif building_type == 'SecondarySchool'
295
+ num_people = 0.0
296
+ @model.getSpaceTypes.each do |space_type|
297
+ next if !space_type.standardsSpaceType.is_initialized
298
+ next if space_type.standardsSpaceType.get != 'Classroom'
299
+ space_type_floor_area = space_type.floorArea
300
+ space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
301
+ num_people += space_type_num_people
302
+ end
303
+ target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
304
+ else
305
+ check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
306
+ end
307
+
308
+ else
309
+ check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
310
+ end
311
+
312
+ end
313
+
314
+ # check actual against target
315
+ if service_water_consumption_daily_avg_gal < target_consumption * (1.0 - min_pass)
316
+ check_elems << OpenStudio::Attribute.new('flag', "Annual average of #{service_water_consumption_daily_avg_gal.round} gallons per day of hot water is more than #{min_pass * 100} % below the expected value of #{target_consumption.round} gallons per day.")
317
+ elsif service_water_consumption_daily_avg_gal > target_consumption * (1.0 + max_pass)
318
+ check_elems << OpenStudio::Attribute.new('flag', "Annual average of #{service_water_consumption_daily_avg_gal.round} gallons per day of hot water is more than #{max_pass * 100} % above the expected value of #{target_consumption.round} gallons per day.")
319
+ end
320
+ rescue StandardError => e
321
+ # brief description of ruby error
322
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
323
+
324
+ # backtrace of ruby error for diagnostic use
325
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
326
+ end
327
+
328
+ # add check_elms to new attribute
329
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
330
+
331
+ return check_elem
332
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
333
+ end
334
+ end