openstudio-extension 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +14 -0
  4. data/LICENSE.md +1 -1
  5. data/README.md +2 -0
  6. data/lib/openstudio/extension/runner.rb +12 -8
  7. data/lib/openstudio/extension/runner_config.rb +33 -6
  8. data/lib/openstudio/extension/version.rb +1 -1
  9. data/openstudio-extension.gemspec +6 -6
  10. metadata +15 -66
  11. data/lib/openstudio/extension/core/CreateResults.rb +0 -1033
  12. data/lib/openstudio/extension/core/check_air_sys_temps.rb +0 -160
  13. data/lib/openstudio/extension/core/check_calibration.rb +0 -125
  14. data/lib/openstudio/extension/core/check_cond_zns.rb +0 -54
  15. data/lib/openstudio/extension/core/check_domestic_hot_water.rb +0 -304
  16. data/lib/openstudio/extension/core/check_envelope_conductance.rb +0 -423
  17. data/lib/openstudio/extension/core/check_eui_by_end_use.rb +0 -132
  18. data/lib/openstudio/extension/core/check_eui_reasonableness.rb +0 -105
  19. data/lib/openstudio/extension/core/check_fan_pwr.rb +0 -68
  20. data/lib/openstudio/extension/core/check_internal_loads.rb +0 -363
  21. data/lib/openstudio/extension/core/check_mech_sys_capacity.rb +0 -196
  22. data/lib/openstudio/extension/core/check_mech_sys_efficiency.rb +0 -296
  23. data/lib/openstudio/extension/core/check_mech_sys_part_load_eff.rb +0 -434
  24. data/lib/openstudio/extension/core/check_mech_sys_type.rb +0 -109
  25. data/lib/openstudio/extension/core/check_part_loads.rb +0 -421
  26. data/lib/openstudio/extension/core/check_placeholder.rb +0 -45
  27. data/lib/openstudio/extension/core/check_plant_cap.rb +0 -93
  28. data/lib/openstudio/extension/core/check_plant_temps.rb +0 -129
  29. data/lib/openstudio/extension/core/check_plenum_loads.rb +0 -57
  30. data/lib/openstudio/extension/core/check_pump_pwr.rb +0 -78
  31. data/lib/openstudio/extension/core/check_sch_coord.rb +0 -211
  32. data/lib/openstudio/extension/core/check_schedules.rb +0 -281
  33. data/lib/openstudio/extension/core/check_simultaneous_heating_and_cooling.rb +0 -128
  34. data/lib/openstudio/extension/core/check_supply_air_and_thermostat_temp_difference.rb +0 -118
  35. data/lib/openstudio/extension/core/check_weather_files.rb +0 -102
  36. data/lib/openstudio/extension/core/deer_vintages.rb +0 -281
  37. data/lib/openstudio/extension/core/os_lib_aedg_measures.rb +0 -461
  38. data/lib/openstudio/extension/core/os_lib_constructions.rb +0 -353
  39. data/lib/openstudio/extension/core/os_lib_geometry.rb +0 -1169
  40. data/lib/openstudio/extension/core/os_lib_helper_methods.rb +0 -383
  41. data/lib/openstudio/extension/core/os_lib_hvac.rb +0 -2163
  42. data/lib/openstudio/extension/core/os_lib_lighting_and_equipment.rb +0 -184
  43. data/lib/openstudio/extension/core/os_lib_model_generation.rb +0 -3584
  44. data/lib/openstudio/extension/core/os_lib_model_simplification.rb +0 -1019
  45. data/lib/openstudio/extension/core/os_lib_outdoorair_and_infiltration.rb +0 -135
  46. data/lib/openstudio/extension/core/os_lib_reporting_qaqc.rb +0 -170
  47. data/lib/openstudio/extension/core/os_lib_schedules.rb +0 -933
@@ -1,105 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
3
- # See also https://openstudio.net/license
4
- # *******************************************************************************
5
-
6
- module OsLib_QAQC
7
- # include any general notes about QAQC method here
8
-
9
- # checks the number of unmet hours in the model
10
- def check_eui_reasonableness(category, target_standard, min_pass, max_pass, name_only = false)
11
- # summary of the check
12
- check_elems = OpenStudio::AttributeVector.new
13
- check_elems << OpenStudio::Attribute.new('name', 'EUI Reasonableness')
14
- check_elems << OpenStudio::Attribute.new('category', category)
15
- check_elems << OpenStudio::Attribute.new('description', "Check EUI for model against #{target_standard} DOE prototype buildings.")
16
-
17
- # stop here if only name is requested this is used to populate display name for arguments
18
- if name_only == true
19
- results = []
20
- check_elems.each do |elem|
21
- results << elem.valueAsString
22
- end
23
- return results
24
- end
25
-
26
- # Versions of OpenStudio greater than 2.4.0 use a modified version of
27
- # openstudio-standards with different method calls. These methods
28
- # require a "Standard" object instead of the standard being passed into method calls.
29
- # This Standard object is used throughout the QAQC check.
30
- if OpenStudio::VersionString.new(OpenStudio.openStudioVersion) < OpenStudio::VersionString.new('2.4.3')
31
- use_old_gem_code = true
32
- else
33
- use_old_gem_code = false
34
- std = Standard.build(target_standard)
35
- end
36
-
37
- begin
38
- # total building area
39
- query = 'SELECT Value FROM tabulardatawithstrings WHERE '
40
- query << "ReportName='AnnualBuildingUtilityPerformanceSummary' and "
41
- query << "ReportForString='Entire Facility' and "
42
- query << "TableName='Building Area' and "
43
- query << "RowName='Total Building Area' and "
44
- query << "ColumnName='Area' and "
45
- query << "Units='m2';"
46
- query_results = @sql.execAndReturnFirstDouble(query)
47
- if query_results.empty?
48
- check_elems << OpenStudio::Attribute.new('flag', "Can't calculate EUI, SQL query for building area failed.")
49
- return OpenStudio::Attribute.new('check', check_elems)
50
- else
51
- energy_plus_area = query_results.get
52
- end
53
-
54
- # temp code to check OS vs. E+ area
55
- open_studio_area = @model.getBuilding.floorArea
56
- if (energy_plus_area - open_studio_area).abs >= 0.1
57
- check_elems << OpenStudio::Attribute.new('flag', "EnergyPlus reported area is #{energy_plus_area} (m^2). OpenStudio reported area is #{@model.getBuilding.floorArea} (m^2).")
58
- end
59
-
60
- # EUI
61
- source_units = 'GJ/m^2'
62
- target_units = 'kBtu/ft^2'
63
- if energy_plus_area > 0.0 # don't calculate EUI if building doesn't have any area
64
- # todo - netSiteEnergy deducts for renewable. May want to update this to show gross consumption vs. net consumption
65
- eui = @sql.netSiteEnergy.get / energy_plus_area
66
- else
67
- check_elems << OpenStudio::Attribute.new('flag', "Can't calculate model EUI, building doesn't have any floor area.")
68
- return OpenStudio::Attribute.new('check', check_elems)
69
- end
70
-
71
- # test using new method
72
- if use_old_gem_code
73
- target_eui = @model.find_target_eui(target_standard)
74
- else
75
- std = Standard.build(target_standard)
76
- target_eui = std.model_find_target_eui(@model)
77
- end
78
-
79
- # check model vs. target for user specified tolerance.
80
- if !target_eui.nil?
81
- eui_ip_neat = OpenStudio.toNeatString(OpenStudio.convert(eui, source_units, target_units).get, 1, true)
82
- target_eui_ip_neat = OpenStudio.toNeatString(OpenStudio.convert(target_eui, source_units, target_units).get, 1, true)
83
- if eui < target_eui * (1.0 - min_pass)
84
- check_elems << OpenStudio::Attribute.new('flag', "Model EUI of #{eui_ip_neat} (#{target_units}) is less than #{min_pass * 100} % below the expected EUI of #{target_eui_ip_neat} (#{target_units}) for #{target_standard}.")
85
- elsif eui > target_eui * (1.0 + max_pass)
86
- check_elems << OpenStudio::Attribute.new('flag', "Model EUI of #{eui_ip_neat} (#{target_units}) is more than #{max_pass * 100} % above the expected EUI of #{target_eui_ip_neat} (#{target_units}) for #{target_standard}.")
87
- end
88
- else
89
- check_elems << OpenStudio::Attribute.new('flag', "Can't calculate target EUI. Make sure model has expected climate zone and building type.")
90
- end
91
- rescue StandardError => e
92
- # brief description of ruby error
93
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
94
-
95
- # backtrace of ruby error for diagnostic use
96
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
97
- end
98
-
99
- # add check_elms to new attribute
100
- check_elem = OpenStudio::Attribute.new('check', check_elems)
101
-
102
- return check_elem
103
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
104
- end
105
- end
@@ -1,68 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
3
- # See also https://openstudio.net/license
4
- # *******************************************************************************
5
-
6
- module OsLib_QAQC
7
- # Check the fan power (W/cfm) for each air loop fan in the model to identify
8
- # unrealistically sized fans.
9
- def check_fan_pwr(category, target_standard, max_pwr_delta = 0.1, name_only = false)
10
- # summary of the check
11
- check_elems = OpenStudio::AttributeVector.new
12
- check_elems << OpenStudio::Attribute.new('name', 'Fan Power')
13
- check_elems << OpenStudio::Attribute.new('category', category)
14
- check_elems << OpenStudio::Attribute.new('description', 'Check that fan power vs flow makes sense.')
15
-
16
- # stop here if only name is requested this is used to populate display name for arguments
17
- if name_only == true
18
- results = []
19
- check_elems.each do |elem|
20
- results << elem.valueAsString
21
- end
22
- return results
23
- end
24
-
25
- std = Standard.build(target_standard)
26
-
27
- begin
28
- # Check each air loop
29
- @model.getAirLoopHVACs.each do |plant_loop|
30
- # Set the expected W/cfm
31
- expected_w_per_cfm = 1.1
32
-
33
- # Check the W/cfm for each fan on each air loop
34
- plant_loop.supplyComponents.each do |sc|
35
- # Get the W/cfm for the fan
36
- obj_type = sc.iddObjectType.valueName.to_s
37
- case obj_type
38
- when 'OS_Fan_ConstantVolume'
39
- actual_w_per_cfm = std.fan_rated_w_per_cfm(sc.to_FanConstantVolume.get)
40
- when 'OS_Fan_OnOff'
41
- actual_w_per_cfm = std.fan_rated_w_per_cfm(sc.to_FanOnOff.get)
42
- when 'OS_Fan_VariableVolume'
43
- actual_w_per_cfm = std.fan_rated_w_per_cfm(sc.to_FanVariableVolume.get)
44
- else
45
- next # Skip non-fan objects
46
- end
47
-
48
- # Compare W/cfm to expected/typical values
49
- if ((expected_w_per_cfm - actual_w_per_cfm) / actual_w_per_cfm).abs > max_pwr_delta
50
- check_elems << OpenStudio::Attribute.new('flag', "For #{sc.name} on #{plant_loop.name}, the actual fan power of #{actual_w_per_cfm.round(1)} W/cfm is more than #{(max_pwr_delta * 100.0).round(2)}% different from the expected #{expected_w_per_cfm} W/cfm.")
51
- end
52
- end
53
- end
54
- rescue StandardError => e
55
- # brief description of ruby error
56
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
57
-
58
- # backtrace of ruby error for diagnostic use
59
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
60
- end
61
-
62
- # add check_elms to new attribute
63
- check_elem = OpenStudio::Attribute.new('check', check_elems)
64
-
65
- return check_elem
66
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
67
- end
68
- end
@@ -1,363 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
3
- # See also https://openstudio.net/license
4
- # *******************************************************************************
5
-
6
- module OsLib_QAQC
7
- # include any general notes about QAQC method here
8
-
9
- # checks the number of unmet hours in the model
10
- def check_internal_loads(category, target_standard, min_pass, max_pass, name_only = false)
11
- # summary of the check
12
- check_elems = OpenStudio::AttributeVector.new
13
- check_elems << OpenStudio::Attribute.new('name', 'Internal Loads')
14
- check_elems << OpenStudio::Attribute.new('category', category)
15
- if target_standard == 'ICC IECC 2015'
16
- check_elems << OpenStudio::Attribute.new('description', 'Check internal loads against Table R405.5.2(1) in ICC IECC 2015 Residential Provisions.')
17
- else
18
- if target_standard.include?('90.1')
19
- display_standard = "ASHRAE #{target_standard}"
20
- else
21
- display_standard = target_standard
22
- end
23
- check_elems << OpenStudio::Attribute.new('description', "Check LPD, ventilation rates, occupant density, plug loads, and equipment loads against #{display_standard} and DOE Prototype buildings.")
24
- end
25
-
26
- # stop here if only name is requested this is used to populate display name for arguments
27
- if name_only == true
28
- results = []
29
- check_elems.each do |elem|
30
- results << elem.valueAsString
31
- end
32
- return results
33
- end
34
-
35
- # Versions of OpenStudio greater than 2.4.0 use a modified version of
36
- # openstudio-standards with different method calls. These methods
37
- # require a "Standard" object instead of the standard being passed into method calls.
38
- # This Standard object is used throughout the QAQC check.
39
- if OpenStudio::VersionString.new(OpenStudio.openStudioVersion) < OpenStudio::VersionString.new('2.4.3')
40
- use_old_gem_code = true
41
- else
42
- use_old_gem_code = false
43
- std = Standard.build(target_standard)
44
- end
45
-
46
- begin
47
- if target_standard == 'ICC IECC 2015'
48
-
49
- num_people = 0.0
50
- @model.getSpaceTypes.each do |space_type|
51
- next if !space_type.standardsSpaceType.is_initialized
52
- next if space_type.standardsSpaceType.get != 'Apartment' # currently only supports midrise apt space type
53
- space_type_floor_area = space_type.floorArea
54
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
55
- num_people += space_type_num_people
56
- end
57
-
58
- # lookup iecc internal loads for the building
59
- bedrooms_per_unit = 2.0 # assumption
60
- num_units = num_people / 2.5 # Avg 2.5 units per person.
61
- if use_old_gem_code
62
- target_loads_hash = @model.find_icc_iecc_2015_internal_loads(num_units, bedrooms_per_unit)
63
- else
64
- target_loads_hash = std.model_find_icc_iecc_2015_internal_loads(@model, num_units, bedrooms_per_unit)
65
- end
66
-
67
- # get model internal gains for lights, elec equipment, and gas equipment
68
- model_internal_gains_si = 0.0
69
- query_eleint_lights = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= 'Interior Lighting' and ColumnName= 'Electricity'"
70
- query_elec_equip = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= 'Interior Equipment' and ColumnName= 'Electricity'"
71
- query_gas_equip = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= 'Interior Equipment' and ColumnName= 'Natural Gas'"
72
- model_internal_gains_si += results_elec = @sql.execAndReturnFirstDouble(query_eleint_lights).get
73
- model_internal_gains_si += results_elec = @sql.execAndReturnFirstDouble(query_elec_equip).get
74
- model_internal_gains_si += results_elec = @sql.execAndReturnFirstDouble(query_gas_equip).get
75
- model_internal_gains_si_kbtu_per_day = OpenStudio.convert(model_internal_gains_si, 'GJ', 'kBtu').get / 365.0 # assumes annual run
76
-
77
- # get target internal loads
78
- target_igain_btu_per_day = target_loads_hash['igain_btu_per_day']
79
- target_igain_kbtu_per_day = OpenStudio.convert(target_igain_btu_per_day, 'Btu', 'kBtu').get
80
-
81
- # check internal loads
82
- if model_internal_gains_si_kbtu_per_day < target_igain_kbtu_per_day * (1.0 - min_pass)
83
- check_elems << OpenStudio::Attribute.new('flag', "The model average of #{OpenStudio.toNeatString(model_internal_gains_si_kbtu_per_day, 2, true)} (kBtu/day) is more than #{min_pass * 100} % below the expected value of #{OpenStudio.toNeatString(target_igain_kbtu_per_day, 2, true)} (kBtu/day) for #{target_standard}.")
84
- elsif model_internal_gains_si_kbtu_per_day > target_igain_kbtu_per_day * (1.0 + max_pass)
85
- check_elems << OpenStudio::Attribute.new('flag', "The model average of #{OpenStudio.toNeatString(model_internal_gains_si_kbtu_per_day, 2, true)} (kBtu/day) is more than #{max_pass * 100} % above the expected value of #{OpenStudio.toNeatString(target_igain_kbtu_per_day, 2, true)} k(Btu/day) for #{target_standard}.")
86
- end
87
-
88
- # get target mech vent
89
- target_mech_vent_cfm = target_loads_hash['mech_vent_cfm']
90
-
91
- # get model mech vent
92
- model_mech_vent_si = 0
93
- @model.getSpaceTypes.each do |space_type|
94
- next if space_type.floorArea <= 0
95
-
96
- # get necessary space type information
97
- floor_area = space_type.floorArea
98
- num_people = space_type.getNumberOfPeople(floor_area)
99
-
100
- # get volume for space type for use with ventilation and infiltration
101
- space_type_volume = 0.0
102
- space_type_exterior_area = 0.0
103
- space_type_exterior_wall_area = 0.0
104
- space_type.spaces.each do |space|
105
- space_type_volume += space.volume * space.multiplier
106
- space_type_exterior_area = space.exteriorArea * space.multiplier
107
- space_type_exterior_wall_area = space.exteriorWallArea * space.multiplier
108
- end
109
-
110
- # get design spec OA object
111
- if space_type.designSpecificationOutdoorAir.is_initialized
112
- oa = space_type.designSpecificationOutdoorAir.get
113
- oa_method = oa.outdoorAirMethod
114
- oa_per_person = oa.outdoorAirFlowperPerson * num_people
115
- oa_ach = oa.outdoorAirFlowAirChangesperHour * space_type_volume
116
- oa_per_area = oa.outdoorAirFlowperFloorArea * floor_area
117
- oa_flow_rate = oa.outdoorAirFlowRate
118
- oa_space_type_total = oa_per_person + oa_ach + oa_per_area + oa_flow_rate
119
-
120
- value_count = 0
121
- if oa_per_person > 0 then value_count += 1 end
122
- if oa_ach > 0 then value_count += 1 end
123
- if oa_per_area > 0 then value_count += 1 end
124
- if oa_flow_rate > 0 then value_count += 1 end
125
- if (oa_method != 'Sum') && (value_count > 1)
126
- check_elems << OpenStudio::Attribute.new('flag', "Outdoor Air Method for #{space_type.name} was #{oa_method}. Expected value was Sum.")
127
- end
128
- else
129
- oa_space_type_total = 0.0
130
- end
131
- # add to building total oa
132
- model_mech_vent_si += oa_space_type_total
133
- end
134
-
135
- # check oa
136
- model_mech_vent_cfm = OpenStudio.convert(model_mech_vent_si, 'm^3/s', 'cfm').get
137
- if model_mech_vent_cfm < target_mech_vent_cfm * (1.0 - min_pass)
138
- check_elems << OpenStudio::Attribute.new('flag', "The model mechanical ventilation of #{OpenStudio.toNeatString(model_mech_vent_cfm, 2, true)} cfm is more than #{min_pass * 100} % below the expected value of #{OpenStudio.toNeatString(target_mech_vent_cfm, 2, true)} cfm for #{target_standard}.")
139
- elsif model_mech_vent_cfm > target_mech_vent_cfm * (1.0 + max_pass)
140
- check_elems << OpenStudio::Attribute.new('flag', "The model mechanical ventilation of #{OpenStudio.toNeatString(model_mech_vent_cfm, 2, true)} cfm is more than #{max_pass * 100} % above the expected value of #{OpenStudio.toNeatString(target_mech_vent_cfm, 2, true)} cfm for #{target_standard}.")
141
- end
142
-
143
- else
144
-
145
- # loop through all space types used in the model
146
- @model.getSpaceTypes.each do |space_type|
147
- next if space_type.floorArea <= 0
148
-
149
- # get necessary space type information
150
- floor_area = space_type.floorArea
151
- num_people = space_type.getNumberOfPeople(floor_area)
152
-
153
- # load in standard info for this space type
154
- if use_old_gem_code
155
- data = space_type.get_standards_data(target_standard)
156
- else
157
- data = std.space_type_get_standards_data(space_type)
158
- end
159
-
160
- if data.nil? || data.empty?
161
-
162
- # skip if all spaces using this space type are plenums
163
- all_spaces_plenums = true
164
- space_type.spaces.each do |space|
165
- if use_old_gem_code
166
- if !space.plenum?
167
- all_spaces_plenums = false
168
- next
169
- end
170
- else
171
- if !std.space_plenum?(space)
172
- all_spaces_plenums = false
173
- next
174
- end
175
- end
176
- end
177
-
178
- if !all_spaces_plenums
179
- check_elems << OpenStudio::Attribute.new('flag', "Unexpected standards type for #{space_type.name}, can't validate internal loads.")
180
- end
181
-
182
- next
183
- end
184
-
185
- # check lpd for space type
186
- model_lights_si = space_type.getLightingPowerPerFloorArea(floor_area, num_people)
187
- data['lighting_per_area'].nil? ? (target_lights_ip = 0.0) : (target_lights_ip = data['lighting_per_area'])
188
- source_units = 'W/m^2'
189
- target_units = 'W/ft^2'
190
- load_type = 'Lighting Power Density'
191
- model_ip = OpenStudio.convert(model_lights_si, source_units, target_units).get
192
- target_ip = target_lights_ip.to_f
193
- model_ip_neat = OpenStudio.toNeatString(model_ip, 2, true)
194
- target_ip_neat = OpenStudio.toNeatString(target_ip, 2, true)
195
- if model_ip < target_ip * (1.0 - min_pass)
196
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
197
- elsif model_ip > target_ip * (1.0 + max_pass)
198
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
199
- end
200
-
201
- # check electric equipment
202
- model_elec_si = space_type.getElectricEquipmentPowerPerFloorArea(floor_area, num_people)
203
- data['electric_equipment_per_area'].nil? ? (target_elec_ip = 0.0) : (target_elec_ip = data['electric_equipment_per_area'])
204
- source_units = 'W/m^2'
205
- target_units = 'W/ft^2'
206
- load_type = 'Electric Power Density'
207
- model_ip = OpenStudio.convert(model_elec_si, source_units, target_units).get
208
- target_ip = target_elec_ip.to_f
209
- model_ip_neat = OpenStudio.toNeatString(model_ip, 2, true)
210
- target_ip_neat = OpenStudio.toNeatString(target_ip, 2, true)
211
- if model_ip < target_ip * (1.0 - min_pass)
212
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
213
- elsif model_ip > target_ip * (1.0 + max_pass)
214
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
215
- end
216
-
217
- # check gas equipment
218
- model_gas_si = space_type.getGasEquipmentPowerPerFloorArea(floor_area, num_people)
219
- data['gas_equipment_per_area'].nil? ? (target_gas_ip = 0.0) : (target_gas_ip = data['gas_equipment_per_area'])
220
- source_units = 'W/m^2'
221
- target_units = 'Btu/hr*ft^2'
222
- load_type = 'Gas Power Density'
223
- model_ip = OpenStudio.convert(model_gas_si, source_units, target_units).get
224
- target_ip = target_gas_ip.to_f
225
- model_ip_neat = OpenStudio.toNeatString(model_ip, 2, true)
226
- target_ip_neat = OpenStudio.toNeatString(target_ip, 2, true)
227
- if model_ip < target_ip * (1.0 - min_pass)
228
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
229
- elsif model_ip > target_ip * (1.0 + max_pass)
230
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
231
- end
232
-
233
- # check people
234
- model_occ_si = space_type.getPeoplePerFloorArea(floor_area)
235
- data['occupancy_per_area'].nil? ? (target_occ_ip = 0.0) : (target_occ_ip = data['occupancy_per_area'])
236
- source_units = '1/m^2' # people/m^2
237
- target_units = '1/ft^2' # people per ft^2 (can't add *1000) to the bottom, need to do later
238
- load_type = 'Occupancy per Area'
239
- model_ip = OpenStudio.convert(model_occ_si, source_units, target_units).get * 1000.0
240
- target_ip = target_occ_ip.to_f
241
- model_ip_neat = OpenStudio.toNeatString(model_ip, 2, true)
242
- target_ip_neat = OpenStudio.toNeatString(target_ip, 2, true)
243
- # for people need to update target units just for display. Can't be used for converstion.
244
- target_units = 'People/1000 ft^2'
245
- if model_ip < target_ip * (1.0 - min_pass)
246
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
247
- elsif model_ip > target_ip * (1.0 + max_pass)
248
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
249
- end
250
-
251
- # get volume for space type for use with ventilation and infiltration
252
- space_type_volume = 0.0
253
- space_type_exterior_area = 0.0
254
- space_type_exterior_wall_area = 0.0
255
- space_type.spaces.each do |space|
256
- space_type_volume += space.volume * space.multiplier
257
- space_type_exterior_area = space.exteriorArea * space.multiplier
258
- space_type_exterior_wall_area = space.exteriorWallArea * space.multiplier
259
- end
260
-
261
- # get design spec OA object
262
- if space_type.designSpecificationOutdoorAir.is_initialized
263
- oa = space_type.designSpecificationOutdoorAir.get
264
- oa_method = oa.outdoorAirMethod
265
- oa_per_person = oa.outdoorAirFlowperPerson
266
- oa_other = 0.0
267
- oa_ach = oa.outdoorAirFlowAirChangesperHour * space_type_volume
268
- oa_per_area = oa.outdoorAirFlowperFloorArea * floor_area
269
- oa_flow_rate = oa.outdoorAirFlowRate
270
- oa_total = oa_ach + oa_per_area + oa_flow_rate
271
-
272
- value_count = 0
273
- if oa_per_person > 0 then value_count += 1 end
274
- if oa_ach > 0 then value_count += 1 end
275
- if oa_per_area > 0 then value_count += 1 end
276
- if oa_flow_rate > 0 then value_count += 1 end
277
- if (oa_method != 'Sum') && (value_count > 1)
278
- check_elems << OpenStudio::Attribute.new('flag', "Outdoor Air Method for #{space_type.name} was #{oa_method}. Expected value was Sum.")
279
- end
280
- else
281
- oa_per_person = 0.0
282
- oa_other_total = 0.0
283
- end
284
-
285
- # get target values for OA
286
- target_oa_per_person_ip = data['ventilation_per_person'].to_f # ft^3/min*person
287
- target_oa_ach_ip = data['ventilation_air_changes'].to_f # ach
288
- target_oa_per_area_ip = data['ventilation_per_area'].to_f # ft^3/min*ft^2
289
- if target_oa_per_person_ip.nil?
290
- target_oa_per_person_si = 0.0
291
- else
292
- target_oa_per_person_si = OpenStudio.convert(target_oa_per_person_ip, 'cfm', 'm^3/s').get
293
- end
294
- if target_oa_ach_ip.nil?
295
- target_oa_ach_si = 0.0
296
- else
297
- target_oa_ach_si = target_oa_ach_ip * space_type_volume
298
- end
299
- if target_oa_per_area_ip.nil?
300
- target_oa_per_area_si = 0.0
301
- else
302
- target_oa_per_area_si = OpenStudio.convert(target_oa_per_area_ip, 'cfm/ft^2', 'm^3/s*m^2').get * floor_area
303
- end
304
- target_oa_total = target_oa_ach_si + target_oa_per_area_si
305
-
306
- # check oa per person
307
- source_units = 'm^3/s'
308
- target_units = 'cfm'
309
- load_type = 'Outdoor Air Per Person'
310
- model_ip_neat = OpenStudio.toNeatString(OpenStudio.convert(oa_per_person, source_units, target_units).get, 2, true)
311
- target_ip_neat = OpenStudio.toNeatString(target_oa_per_person_ip, 2, true)
312
- if oa_per_person < target_oa_per_person_si * (1.0 - min_pass)
313
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
314
- elsif oa_per_person > target_oa_per_person_si * (1.0 + max_pass)
315
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
316
- end
317
-
318
- # check other oa
319
- source_units = 'm^3/s'
320
- target_units = 'cfm'
321
- load_type = 'Outdoor Air (Excluding per Person Value)'
322
- model_ip_neat = OpenStudio.toNeatString(OpenStudio.convert(oa_total, source_units, target_units).get, 2, true)
323
- target_ip_neat = OpenStudio.toNeatString(OpenStudio.convert(target_oa_total, source_units, target_units).get, 2, true)
324
- if oa_total < target_oa_total * (1.0 - min_pass)
325
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{min_pass * 100} % below the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
326
- elsif oa_total > target_oa_total * (1.0 + max_pass)
327
- check_elems << OpenStudio::Attribute.new('flag', "#{load_type} of #{model_ip_neat} (#{target_units}) for #{space_type.name} is more than #{max_pass * 100} % above the expected value of #{target_ip_neat} (#{target_units}) for #{display_standard}.")
328
- end
329
- end
330
-
331
- # warn if there are spaces in model that don't use space type unless they appear to be plenums
332
- @model.getSpaces.each do |space|
333
- if use_old_gem_code
334
- next if space.plenum?
335
- else
336
- next if std.space_plenum?(space)
337
- end
338
-
339
- if !space.spaceType.is_initialized
340
- check_elems << OpenStudio::Attribute.new('flag', "#{space.name} doesn't have a space type assigned, can't validate internal loads.")
341
- end
342
- end
343
-
344
- # TODO: - need to address internal loads where fuel is variable like cooking and laundry
345
- # todo - For now we are not going to loop through spaces looking for loads beyond what comes from space type
346
- # todo - space infiltration
347
-
348
- end
349
- rescue StandardError => e
350
- # brief description of ruby error
351
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
352
-
353
- # backtrace of ruby error for diagnostic use
354
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
355
- end
356
-
357
- # add check_elms to new attribute
358
- check_elem = OpenStudio::Attribute.new('check', check_elems)
359
-
360
- return check_elem
361
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
362
- end
363
- end