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,190 +1,190 @@
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 the air loop and zone operational vs. sizing temperatures
38
- # and make sure everything is coordinated. This identifies problems
39
- # caused by sizing to one set of conditions and operating at a different set.
40
- def check_air_sys_temps(category, target_standard, max_sizing_temp_delta = 0.1, name_only = false)
41
- # summary of the check
42
- check_elems = OpenStudio::AttributeVector.new
43
- check_elems << OpenStudio::Attribute.new('name', 'Air System Temperatures')
44
- check_elems << OpenStudio::Attribute.new('category', category)
45
- check_elems << OpenStudio::Attribute.new('description', 'Check that air system sizing and operation temperatures are coordinated.')
46
-
47
- # stop here if only name is requested this is used to populate display name for arguments
48
- if name_only == true
49
- results = []
50
- check_elems.each do |elem|
51
- results << elem.valueAsString
52
- end
53
- return results
54
- end
55
-
56
- std = Standard.build(target_standard)
57
-
58
- begin
59
- # Check each air loop in the model
60
- @model.getAirLoopHVACs.sort.each do |airloop|
61
- loop_name = airloop.name.to_s
62
-
63
- # Get the central heating and cooling SAT for sizing
64
- sizing_system = airloop.sizingSystem
65
- loop_siz_htg_f = OpenStudio.convert(sizing_system.centralHeatingDesignSupplyAirTemperature, 'C', 'F').get
66
- loop_siz_clg_f = OpenStudio.convert(sizing_system.centralCoolingDesignSupplyAirTemperature, 'C', 'F').get
67
-
68
- # Compare air loop to zone sizing temperatures
69
- airloop.thermalZones.each do |zone|
70
- # If this zone has a reheat terminal, get the reheat temp for comparison
71
- reheat_op_f = nil
72
- reheat_zone = false
73
- zone.equipment.each do |equip|
74
- obj_type = equip.iddObjectType.valueName.to_s
75
- case obj_type
76
- when 'OS_AirTerminal_SingleDuct_ConstantVolume_Reheat'
77
- term = equip.to_AirTerminalSingleDuctConstantVolumeReheat.get
78
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
79
- reheat_zone = true
80
- when 'OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat'
81
- term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
82
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
83
- reheat_zone = true
84
- when 'OS_AirTerminal_SingleDuct_VAV_Reheat'
85
- term = equip.to_AirTerminalSingleDuctVAVReheat.get
86
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
87
- reheat_zone = true
88
- when 'OS_AirTerminal_SingleDuct_ParallelPIU_Reheat'
89
- term = equip.to_AirTerminalSingleDuctParallelPIUReheat.get
90
- # reheat_op_f = # Not an OpenStudio input
91
- reheat_zone = true
92
- when 'OS_AirTerminal_SingleDuct_SeriesPIU_Reheat'
93
- term = equip.to_AirTerminalSingleDuctSeriesPIUReheat.get
94
- # reheat_op_f = # Not an OpenStudio input
95
- reheat_zone = true
96
- end
97
- end
98
-
99
- # Get the zone heating and cooling SAT for sizing
100
- sizing_zone = zone.sizingZone
101
- zone_siz_htg_f = OpenStudio.convert(sizing_zone.zoneHeatingDesignSupplyAirTemperature, 'C', 'F').get
102
- zone_siz_clg_f = OpenStudio.convert(sizing_zone.zoneCoolingDesignSupplyAirTemperature, 'C', 'F').get
103
-
104
- # Check cooling temperatures
105
- if ((loop_siz_clg_f - zone_siz_clg_f) / loop_siz_clg_f).abs > max_sizing_temp_delta
106
- check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the sizing for the air loop is done with a cooling supply air temp of #{loop_siz_clg_f.round(2)}F, but the sizing for the zone is done with a cooling supply air temp of #{zone_siz_clg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
107
- end
108
-
109
- # Check heating temperatures
110
- if reheat_zone && reheat_op_f
111
- if ((reheat_op_f - zone_siz_htg_f) / reheat_op_f).abs > max_sizing_temp_delta
112
- check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the reheat air temp is set to #{reheat_op_f.round(2)}F, but the sizing for the zone is done with a heating supply air temp of #{zone_siz_htg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
113
- end
114
- elsif reheat_zone && !reheat_op_f
115
- # Don't perform the check if it is a reheat zone but the reheat temperature
116
- # is not available from the model inputs
117
- else
118
- if ((loop_siz_htg_f - zone_siz_htg_f) / loop_siz_htg_f).abs > max_sizing_temp_delta
119
- check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the sizing for the air loop is done with a heating supply air temp of #{loop_siz_htg_f.round(2)}F, but the sizing for the zone is done with a heating supply air temp of #{zone_siz_htg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
120
- end
121
- end
122
- end
123
-
124
- # Determine the min and max operational temperatures
125
- loop_op_min_f = nil
126
- loop_op_max_f = nil
127
- airloop.supplyOutletNode.setpointManagers.each do |spm|
128
- obj_type = spm.iddObjectType.valueName.to_s
129
- case obj_type
130
- when 'OS_SetpointManager_Scheduled'
131
- sch = spm.to_SetpointManagerScheduled.get.schedule
132
- if sch.to_ScheduleRuleset.is_initialized
133
- min_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['min']
134
- max_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['max']
135
- elsif sch.to_ScheduleConstant.is_initialized
136
- min_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['min']
137
- max_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['max']
138
- else
139
- next
140
- end
141
- loop_op_min_f = OpenStudio.convert(min_c, 'C', 'F').get
142
- loop_op_max_f = OpenStudio.convert(max_c, 'C', 'F').get
143
- when 'OS_SetpointManager_SingleZoneReheat'
144
- spm = spm.to_SetpointManagerSingleZoneReheat.get
145
- loop_op_min_f = OpenStudio.convert(spm.minimumSupplyAirTemperature, 'C', 'F').get
146
- loop_op_max_f = OpenStudio.convert(spm.maximumSupplyAirTemperature, 'C', 'F').get
147
- when 'OS_SetpointManager_Warmest'
148
- spm = spm.to_SetpointManagerSingleZoneReheat.get
149
- loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
150
- loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
151
- when 'OS_SetpointManager_WarmestTemperatureFlow'
152
- spm = spm.to_SetpointManagerSingleZoneReheat.get
153
- loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
154
- loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
155
- else
156
- next # Only check the commonly used setpoint managers
157
- end
158
- end
159
-
160
- # Compare air loop sizing temperatures to operational temperatures
161
-
162
- # Cooling
163
- if loop_op_min_f
164
- if ((loop_op_min_f - loop_siz_clg_f) / loop_op_min_f).abs > max_sizing_temp_delta
165
- check_elems << OpenStudio::Attribute.new('flag', "For #{airloop.name}, the sizing is done with a cooling supply air temp of #{loop_siz_clg_f.round(2)}F, but the setpoint manager controlling the loop operates down to #{loop_op_min_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
166
- end
167
- end
168
-
169
- # Heating
170
- if loop_op_max_f
171
- if ((loop_op_max_f - loop_siz_htg_f) / loop_op_max_f).abs > max_sizing_temp_delta
172
- check_elems << OpenStudio::Attribute.new('flag', "For #{airloop.name}, the sizing is done with a heating supply air temp of #{loop_siz_htg_f.round(2)}F, but the setpoint manager controlling the loop operates up to #{loop_op_max_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
173
- end
174
- end
175
- end
176
- rescue StandardError => e
177
- # brief description of ruby error
178
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
179
-
180
- # backtrace of ruby error for diagnostic use
181
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
182
- end
183
-
184
- # add check_elms to new attribute
185
- check_elem = OpenStudio::Attribute.new('check', check_elems)
186
-
187
- return check_elem
188
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
189
- end
190
- 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 the air loop and zone operational vs. sizing temperatures
38
+ # and make sure everything is coordinated. This identifies problems
39
+ # caused by sizing to one set of conditions and operating at a different set.
40
+ def check_air_sys_temps(category, target_standard, max_sizing_temp_delta = 0.1, name_only = false)
41
+ # summary of the check
42
+ check_elems = OpenStudio::AttributeVector.new
43
+ check_elems << OpenStudio::Attribute.new('name', 'Air System Temperatures')
44
+ check_elems << OpenStudio::Attribute.new('category', category)
45
+ check_elems << OpenStudio::Attribute.new('description', 'Check that air system sizing and operation temperatures are coordinated.')
46
+
47
+ # stop here if only name is requested this is used to populate display name for arguments
48
+ if name_only == true
49
+ results = []
50
+ check_elems.each do |elem|
51
+ results << elem.valueAsString
52
+ end
53
+ return results
54
+ end
55
+
56
+ std = Standard.build(target_standard)
57
+
58
+ begin
59
+ # Check each air loop in the model
60
+ @model.getAirLoopHVACs.sort.each do |airloop|
61
+ loop_name = airloop.name.to_s
62
+
63
+ # Get the central heating and cooling SAT for sizing
64
+ sizing_system = airloop.sizingSystem
65
+ loop_siz_htg_f = OpenStudio.convert(sizing_system.centralHeatingDesignSupplyAirTemperature, 'C', 'F').get
66
+ loop_siz_clg_f = OpenStudio.convert(sizing_system.centralCoolingDesignSupplyAirTemperature, 'C', 'F').get
67
+
68
+ # Compare air loop to zone sizing temperatures
69
+ airloop.thermalZones.each do |zone|
70
+ # If this zone has a reheat terminal, get the reheat temp for comparison
71
+ reheat_op_f = nil
72
+ reheat_zone = false
73
+ zone.equipment.each do |equip|
74
+ obj_type = equip.iddObjectType.valueName.to_s
75
+ case obj_type
76
+ when 'OS_AirTerminal_SingleDuct_ConstantVolume_Reheat'
77
+ term = equip.to_AirTerminalSingleDuctConstantVolumeReheat.get
78
+ reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
79
+ reheat_zone = true
80
+ when 'OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat'
81
+ term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
82
+ reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
83
+ reheat_zone = true
84
+ when 'OS_AirTerminal_SingleDuct_VAV_Reheat'
85
+ term = equip.to_AirTerminalSingleDuctVAVReheat.get
86
+ reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
87
+ reheat_zone = true
88
+ when 'OS_AirTerminal_SingleDuct_ParallelPIU_Reheat'
89
+ term = equip.to_AirTerminalSingleDuctParallelPIUReheat.get
90
+ # reheat_op_f = # Not an OpenStudio input
91
+ reheat_zone = true
92
+ when 'OS_AirTerminal_SingleDuct_SeriesPIU_Reheat'
93
+ term = equip.to_AirTerminalSingleDuctSeriesPIUReheat.get
94
+ # reheat_op_f = # Not an OpenStudio input
95
+ reheat_zone = true
96
+ end
97
+ end
98
+
99
+ # Get the zone heating and cooling SAT for sizing
100
+ sizing_zone = zone.sizingZone
101
+ zone_siz_htg_f = OpenStudio.convert(sizing_zone.zoneHeatingDesignSupplyAirTemperature, 'C', 'F').get
102
+ zone_siz_clg_f = OpenStudio.convert(sizing_zone.zoneCoolingDesignSupplyAirTemperature, 'C', 'F').get
103
+
104
+ # Check cooling temperatures
105
+ if ((loop_siz_clg_f - zone_siz_clg_f) / loop_siz_clg_f).abs > max_sizing_temp_delta
106
+ check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the sizing for the air loop is done with a cooling supply air temp of #{loop_siz_clg_f.round(2)}F, but the sizing for the zone is done with a cooling supply air temp of #{zone_siz_clg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
107
+ end
108
+
109
+ # Check heating temperatures
110
+ if reheat_zone && reheat_op_f
111
+ if ((reheat_op_f - zone_siz_htg_f) / reheat_op_f).abs > max_sizing_temp_delta
112
+ check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the reheat air temp is set to #{reheat_op_f.round(2)}F, but the sizing for the zone is done with a heating supply air temp of #{zone_siz_htg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
113
+ end
114
+ elsif reheat_zone && !reheat_op_f
115
+ # Don't perform the check if it is a reheat zone but the reheat temperature
116
+ # is not available from the model inputs
117
+ else
118
+ if ((loop_siz_htg_f - zone_siz_htg_f) / loop_siz_htg_f).abs > max_sizing_temp_delta
119
+ check_elems << OpenStudio::Attribute.new('flag', "For #{zone.name}, the sizing for the air loop is done with a heating supply air temp of #{loop_siz_htg_f.round(2)}F, but the sizing for the zone is done with a heating supply air temp of #{zone_siz_htg_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
120
+ end
121
+ end
122
+ end
123
+
124
+ # Determine the min and max operational temperatures
125
+ loop_op_min_f = nil
126
+ loop_op_max_f = nil
127
+ airloop.supplyOutletNode.setpointManagers.each do |spm|
128
+ obj_type = spm.iddObjectType.valueName.to_s
129
+ case obj_type
130
+ when 'OS_SetpointManager_Scheduled'
131
+ sch = spm.to_SetpointManagerScheduled.get.schedule
132
+ if sch.to_ScheduleRuleset.is_initialized
133
+ min_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['min']
134
+ max_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['max']
135
+ elsif sch.to_ScheduleConstant.is_initialized
136
+ min_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['min']
137
+ max_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['max']
138
+ else
139
+ next
140
+ end
141
+ loop_op_min_f = OpenStudio.convert(min_c, 'C', 'F').get
142
+ loop_op_max_f = OpenStudio.convert(max_c, 'C', 'F').get
143
+ when 'OS_SetpointManager_SingleZoneReheat'
144
+ spm = spm.to_SetpointManagerSingleZoneReheat.get
145
+ loop_op_min_f = OpenStudio.convert(spm.minimumSupplyAirTemperature, 'C', 'F').get
146
+ loop_op_max_f = OpenStudio.convert(spm.maximumSupplyAirTemperature, 'C', 'F').get
147
+ when 'OS_SetpointManager_Warmest'
148
+ spm = spm.to_SetpointManagerSingleZoneReheat.get
149
+ loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
150
+ loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
151
+ when 'OS_SetpointManager_WarmestTemperatureFlow'
152
+ spm = spm.to_SetpointManagerSingleZoneReheat.get
153
+ loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
154
+ loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
155
+ else
156
+ next # Only check the commonly used setpoint managers
157
+ end
158
+ end
159
+
160
+ # Compare air loop sizing temperatures to operational temperatures
161
+
162
+ # Cooling
163
+ if loop_op_min_f
164
+ if ((loop_op_min_f - loop_siz_clg_f) / loop_op_min_f).abs > max_sizing_temp_delta
165
+ check_elems << OpenStudio::Attribute.new('flag', "For #{airloop.name}, the sizing is done with a cooling supply air temp of #{loop_siz_clg_f.round(2)}F, but the setpoint manager controlling the loop operates down to #{loop_op_min_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
166
+ end
167
+ end
168
+
169
+ # Heating
170
+ if loop_op_max_f
171
+ if ((loop_op_max_f - loop_siz_htg_f) / loop_op_max_f).abs > max_sizing_temp_delta
172
+ check_elems << OpenStudio::Attribute.new('flag', "For #{airloop.name}, the sizing is done with a heating supply air temp of #{loop_siz_htg_f.round(2)}F, but the setpoint manager controlling the loop operates up to #{loop_op_max_f.round(2)}F. These are farther apart than the acceptable #{(max_sizing_temp_delta * 100.0).round(2)}% difference.")
173
+ end
174
+ end
175
+ end
176
+ rescue StandardError => e
177
+ # brief description of ruby error
178
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
179
+
180
+ # backtrace of ruby error for diagnostic use
181
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
182
+ end
183
+
184
+ # add check_elms to new attribute
185
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
186
+
187
+ return check_elem
188
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
189
+ end
190
+ end
@@ -1,155 +1,155 @@
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 the calibration against utility bills.
38
- def check_calibration(category, target_standard, max_nmbe, max_cvrmse, name_only = false)
39
- # summary of the check
40
- check_elems = OpenStudio::AttributeVector.new
41
- check_elems << OpenStudio::Attribute.new('name', 'Calibration')
42
- check_elems << OpenStudio::Attribute.new('category', category)
43
- check_elems << OpenStudio::Attribute.new('description', 'Check that the model is calibrated to the utility bills.')
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
- # Check that there are utility bills in the model
58
- if @model.getUtilityBills.empty?
59
- check_elems << OpenStudio::Attribute.new('flag', 'Model contains no utility bills, cannot check calibration.')
60
- end
61
-
62
- # Check the calibration for each utility bill
63
- @model.getUtilityBills.each do |bill|
64
- bill_name = bill.name.get
65
- fuel = bill.fuelType.valueDescription
66
-
67
- # Consumption
68
-
69
- # NMBE
70
- if bill.NMBE.is_initialized
71
- nmbe = bill.NMBE.get
72
- if nmbe > max_nmbe || nmbe < -1.0 * max_nmbe
73
- check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the consumption NMBE of #{nmbe.round(1)}% is outside the limit of +/- #{max_nmbe}%, so the model is not calibrated.")
74
- end
75
- end
76
-
77
- # CVRMSE
78
- if bill.CVRMSE.is_initialized
79
- cvrmse = bill.CVRMSE.get
80
- if cvrmse > max_cvrmse
81
- check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the consumption CVRMSE of #{cvrmse.round(1)}% is above the limit of #{max_cvrmse}%, so the model is not calibrated.")
82
- end
83
- end
84
-
85
- # Peak Demand (for some fuels)
86
- if bill.peakDemandUnitConversionFactor.is_initialized
87
- peak_conversion = bill.peakDemandUnitConversionFactor.get
88
-
89
- # Get modeled and actual values
90
- actual_vals = []
91
- modeled_vals = []
92
- bill.billingPeriods.each do |billing_period|
93
- actual_peak = billing_period.peakDemand
94
- if actual_peak.is_initialized
95
- actual_vals << actual_peak.get
96
- end
97
-
98
- modeled_peak = billing_period.modelPeakDemand
99
- if modeled_peak.is_initialized
100
- modeled_vals << modeled_peak.get
101
- end
102
- end
103
-
104
- # Check that both arrays are the same size
105
- unless actual_vals.size == modeled_vals.size
106
- check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, cannot get the same number of modeled and actual peak demand values, cannot check peak demand calibration.")
107
- end
108
-
109
- # NMBE and CMRMSE
110
- ysum = 0
111
- sum_err = 0
112
- squared_err = 0
113
- n = actual_vals.size
114
-
115
- actual_vals.each_with_index do |actual, i|
116
- modeled = modeled_vals[i]
117
- actual *= peak_conversion # Convert actual demand to model units
118
- ysum += actual
119
- sum_err += (actual - modeled)
120
- squared_err += (actual - modeled)**2
121
- end
122
-
123
- if n > 1
124
- ybar = ysum / n
125
-
126
- # NMBE
127
- demand_nmbe = 100.0 * (sum_err / (n - 1)) / ybar
128
- if demand_nmbe > max_nmbe || demand_nmbe < -1.0 * max_nmbe
129
- check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the peak demand NMBE of #{demand_nmbe.round(1)}% is outside the limit of +/- #{max_nmbe}%, so the model is not calibrated.")
130
- end
131
-
132
- # CVRMSE
133
- demand_cvrmse = 100.0 * (squared_err / (n - 1))**0.5 / ybar
134
- if demand_cvrmse > max_cvrmse
135
- check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the peak demand CVRMSE of #{demand_cvrmse.round(1)}% is above the limit of #{max_cvrmse}%, so the model is not calibrated.")
136
- end
137
- end
138
-
139
- end
140
- end
141
- rescue StandardError => e
142
- # brief description of ruby error
143
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
144
-
145
- # backtrace of ruby error for diagnostic use
146
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
147
- end
148
-
149
- # add check_elms to new attribute
150
- check_elem = OpenStudio::Attribute.new('check', check_elems)
151
-
152
- return check_elem
153
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
154
- end
155
- 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 the calibration against utility bills.
38
+ def check_calibration(category, target_standard, max_nmbe, max_cvrmse, name_only = false)
39
+ # summary of the check
40
+ check_elems = OpenStudio::AttributeVector.new
41
+ check_elems << OpenStudio::Attribute.new('name', 'Calibration')
42
+ check_elems << OpenStudio::Attribute.new('category', category)
43
+ check_elems << OpenStudio::Attribute.new('description', 'Check that the model is calibrated to the utility bills.')
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
+ # Check that there are utility bills in the model
58
+ if @model.getUtilityBills.empty?
59
+ check_elems << OpenStudio::Attribute.new('flag', 'Model contains no utility bills, cannot check calibration.')
60
+ end
61
+
62
+ # Check the calibration for each utility bill
63
+ @model.getUtilityBills.each do |bill|
64
+ bill_name = bill.name.get
65
+ fuel = bill.fuelType.valueDescription
66
+
67
+ # Consumption
68
+
69
+ # NMBE
70
+ if bill.NMBE.is_initialized
71
+ nmbe = bill.NMBE.get
72
+ if nmbe > max_nmbe || nmbe < -1.0 * max_nmbe
73
+ check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the consumption NMBE of #{nmbe.round(1)}% is outside the limit of +/- #{max_nmbe}%, so the model is not calibrated.")
74
+ end
75
+ end
76
+
77
+ # CVRMSE
78
+ if bill.CVRMSE.is_initialized
79
+ cvrmse = bill.CVRMSE.get
80
+ if cvrmse > max_cvrmse
81
+ check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the consumption CVRMSE of #{cvrmse.round(1)}% is above the limit of #{max_cvrmse}%, so the model is not calibrated.")
82
+ end
83
+ end
84
+
85
+ # Peak Demand (for some fuels)
86
+ if bill.peakDemandUnitConversionFactor.is_initialized
87
+ peak_conversion = bill.peakDemandUnitConversionFactor.get
88
+
89
+ # Get modeled and actual values
90
+ actual_vals = []
91
+ modeled_vals = []
92
+ bill.billingPeriods.each do |billing_period|
93
+ actual_peak = billing_period.peakDemand
94
+ if actual_peak.is_initialized
95
+ actual_vals << actual_peak.get
96
+ end
97
+
98
+ modeled_peak = billing_period.modelPeakDemand
99
+ if modeled_peak.is_initialized
100
+ modeled_vals << modeled_peak.get
101
+ end
102
+ end
103
+
104
+ # Check that both arrays are the same size
105
+ unless actual_vals.size == modeled_vals.size
106
+ check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, cannot get the same number of modeled and actual peak demand values, cannot check peak demand calibration.")
107
+ end
108
+
109
+ # NMBE and CMRMSE
110
+ ysum = 0
111
+ sum_err = 0
112
+ squared_err = 0
113
+ n = actual_vals.size
114
+
115
+ actual_vals.each_with_index do |actual, i|
116
+ modeled = modeled_vals[i]
117
+ actual *= peak_conversion # Convert actual demand to model units
118
+ ysum += actual
119
+ sum_err += (actual - modeled)
120
+ squared_err += (actual - modeled)**2
121
+ end
122
+
123
+ if n > 1
124
+ ybar = ysum / n
125
+
126
+ # NMBE
127
+ demand_nmbe = 100.0 * (sum_err / (n - 1)) / ybar
128
+ if demand_nmbe > max_nmbe || demand_nmbe < -1.0 * max_nmbe
129
+ check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the peak demand NMBE of #{demand_nmbe.round(1)}% is outside the limit of +/- #{max_nmbe}%, so the model is not calibrated.")
130
+ end
131
+
132
+ # CVRMSE
133
+ demand_cvrmse = 100.0 * (squared_err / (n - 1))**0.5 / ybar
134
+ if demand_cvrmse > max_cvrmse
135
+ check_elems << OpenStudio::Attribute.new('flag', "For the #{fuel} bill called #{bill_name}, the peak demand CVRMSE of #{demand_cvrmse.round(1)}% is above the limit of #{max_cvrmse}%, so the model is not calibrated.")
136
+ end
137
+ end
138
+
139
+ end
140
+ end
141
+ rescue StandardError => e
142
+ # brief description of ruby error
143
+ check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
144
+
145
+ # backtrace of ruby error for diagnostic use
146
+ if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
147
+ end
148
+
149
+ # add check_elms to new attribute
150
+ check_elem = OpenStudio::Attribute.new('check', check_elems)
151
+
152
+ return check_elem
153
+ # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
154
+ end
155
+ end