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,160 +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 air loop and zone operational vs. sizing temperatures
8
- # and make sure everything is coordinated. This identifies problems
9
- # caused by sizing to one set of conditions and operating at a different set.
10
- def check_air_sys_temps(category, target_standard, max_sizing_temp_delta = 0.1, name_only = false)
11
- # summary of the check
12
- check_elems = OpenStudio::AttributeVector.new
13
- check_elems << OpenStudio::Attribute.new('name', 'Air System Temperatures')
14
- check_elems << OpenStudio::Attribute.new('category', category)
15
- check_elems << OpenStudio::Attribute.new('description', 'Check that air system sizing and operation temperatures are coordinated.')
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
- std = Standard.build(target_standard)
27
-
28
- begin
29
- # Check each air loop in the model
30
- @model.getAirLoopHVACs.sort.each do |airloop|
31
- loop_name = airloop.name.to_s
32
-
33
- # Get the central heating and cooling SAT for sizing
34
- sizing_system = airloop.sizingSystem
35
- loop_siz_htg_f = OpenStudio.convert(sizing_system.centralHeatingDesignSupplyAirTemperature, 'C', 'F').get
36
- loop_siz_clg_f = OpenStudio.convert(sizing_system.centralCoolingDesignSupplyAirTemperature, 'C', 'F').get
37
-
38
- # Compare air loop to zone sizing temperatures
39
- airloop.thermalZones.each do |zone|
40
- # If this zone has a reheat terminal, get the reheat temp for comparison
41
- reheat_op_f = nil
42
- reheat_zone = false
43
- zone.equipment.each do |equip|
44
- obj_type = equip.iddObjectType.valueName.to_s
45
- case obj_type
46
- when 'OS_AirTerminal_SingleDuct_ConstantVolume_Reheat'
47
- term = equip.to_AirTerminalSingleDuctConstantVolumeReheat.get
48
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
49
- reheat_zone = true
50
- when 'OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat'
51
- term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get
52
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
53
- reheat_zone = true
54
- when 'OS_AirTerminal_SingleDuct_VAV_Reheat'
55
- term = equip.to_AirTerminalSingleDuctVAVReheat.get
56
- reheat_op_f = OpenStudio.convert(term.maximumReheatAirTemperature, 'C', 'F').get
57
- reheat_zone = true
58
- when 'OS_AirTerminal_SingleDuct_ParallelPIU_Reheat'
59
- term = equip.to_AirTerminalSingleDuctParallelPIUReheat.get
60
- # reheat_op_f = # Not an OpenStudio input
61
- reheat_zone = true
62
- when 'OS_AirTerminal_SingleDuct_SeriesPIU_Reheat'
63
- term = equip.to_AirTerminalSingleDuctSeriesPIUReheat.get
64
- # reheat_op_f = # Not an OpenStudio input
65
- reheat_zone = true
66
- end
67
- end
68
-
69
- # Get the zone heating and cooling SAT for sizing
70
- sizing_zone = zone.sizingZone
71
- zone_siz_htg_f = OpenStudio.convert(sizing_zone.zoneHeatingDesignSupplyAirTemperature, 'C', 'F').get
72
- zone_siz_clg_f = OpenStudio.convert(sizing_zone.zoneCoolingDesignSupplyAirTemperature, 'C', 'F').get
73
-
74
- # Check cooling temperatures
75
- if ((loop_siz_clg_f - zone_siz_clg_f) / loop_siz_clg_f).abs > max_sizing_temp_delta
76
- 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.")
77
- end
78
-
79
- # Check heating temperatures
80
- if reheat_zone && reheat_op_f
81
- if ((reheat_op_f - zone_siz_htg_f) / reheat_op_f).abs > max_sizing_temp_delta
82
- 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.")
83
- end
84
- elsif reheat_zone && !reheat_op_f
85
- # Don't perform the check if it is a reheat zone but the reheat temperature
86
- # is not available from the model inputs
87
- else
88
- if ((loop_siz_htg_f - zone_siz_htg_f) / loop_siz_htg_f).abs > max_sizing_temp_delta
89
- 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.")
90
- end
91
- end
92
- end
93
-
94
- # Determine the min and max operational temperatures
95
- loop_op_min_f = nil
96
- loop_op_max_f = nil
97
- airloop.supplyOutletNode.setpointManagers.each do |spm|
98
- obj_type = spm.iddObjectType.valueName.to_s
99
- case obj_type
100
- when 'OS_SetpointManager_Scheduled'
101
- sch = spm.to_SetpointManagerScheduled.get.schedule
102
- if sch.to_ScheduleRuleset.is_initialized
103
- min_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['min']
104
- max_c = std.schedule_ruleset_annual_min_max_value(sch.to_ScheduleRuleset.get)['max']
105
- elsif sch.to_ScheduleConstant.is_initialized
106
- min_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['min']
107
- max_c = std.schedule_constant_annual_min_max_value(sch.to_ScheduleConstant.get)['max']
108
- else
109
- next
110
- end
111
- loop_op_min_f = OpenStudio.convert(min_c, 'C', 'F').get
112
- loop_op_max_f = OpenStudio.convert(max_c, 'C', 'F').get
113
- when 'OS_SetpointManager_SingleZoneReheat'
114
- spm = spm.to_SetpointManagerSingleZoneReheat.get
115
- loop_op_min_f = OpenStudio.convert(spm.minimumSupplyAirTemperature, 'C', 'F').get
116
- loop_op_max_f = OpenStudio.convert(spm.maximumSupplyAirTemperature, 'C', 'F').get
117
- when 'OS_SetpointManager_Warmest'
118
- spm = spm.to_SetpointManagerSingleZoneReheat.get
119
- loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
120
- loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
121
- when 'OS_SetpointManager_WarmestTemperatureFlow'
122
- spm = spm.to_SetpointManagerSingleZoneReheat.get
123
- loop_op_min_f = OpenStudio.convert(spm.minimumSetpointTemperature, 'C', 'F').get
124
- loop_op_max_f = OpenStudio.convert(spm.maximumSetpointTemperature, 'C', 'F').get
125
- else
126
- next # Only check the commonly used setpoint managers
127
- end
128
- end
129
-
130
- # Compare air loop sizing temperatures to operational temperatures
131
-
132
- # Cooling
133
- if loop_op_min_f
134
- if ((loop_op_min_f - loop_siz_clg_f) / loop_op_min_f).abs > max_sizing_temp_delta
135
- 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.")
136
- end
137
- end
138
-
139
- # Heating
140
- if loop_op_max_f
141
- if ((loop_op_max_f - loop_siz_htg_f) / loop_op_max_f).abs > max_sizing_temp_delta
142
- 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.")
143
- end
144
- end
145
- end
146
- rescue StandardError => e
147
- # brief description of ruby error
148
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
149
-
150
- # backtrace of ruby error for diagnostic use
151
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
152
- end
153
-
154
- # add check_elms to new attribute
155
- check_elem = OpenStudio::Attribute.new('check', check_elems)
156
-
157
- return check_elem
158
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
159
- end
160
- end
@@ -1,125 +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 calibration against utility bills.
8
- def check_calibration(category, target_standard, max_nmbe, max_cvrmse, name_only = false)
9
- # summary of the check
10
- check_elems = OpenStudio::AttributeVector.new
11
- check_elems << OpenStudio::Attribute.new('name', 'Calibration')
12
- check_elems << OpenStudio::Attribute.new('category', category)
13
- check_elems << OpenStudio::Attribute.new('description', 'Check that the model is calibrated to the utility bills.')
14
-
15
- # stop here if only name is requested this is used to populate display name for arguments
16
- if name_only == true
17
- results = []
18
- check_elems.each do |elem|
19
- results << elem.valueAsString
20
- end
21
- return results
22
- end
23
-
24
- std = Standard.build(target_standard)
25
-
26
- begin
27
- # Check that there are utility bills in the model
28
- if @model.getUtilityBills.empty?
29
- check_elems << OpenStudio::Attribute.new('flag', 'Model contains no utility bills, cannot check calibration.')
30
- end
31
-
32
- # Check the calibration for each utility bill
33
- @model.getUtilityBills.each do |bill|
34
- bill_name = bill.name.get
35
- fuel = bill.fuelType.valueDescription
36
-
37
- # Consumption
38
-
39
- # NMBE
40
- if bill.NMBE.is_initialized
41
- nmbe = bill.NMBE.get
42
- if nmbe > max_nmbe || nmbe < -1.0 * max_nmbe
43
- 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.")
44
- end
45
- end
46
-
47
- # CVRMSE
48
- if bill.CVRMSE.is_initialized
49
- cvrmse = bill.CVRMSE.get
50
- if cvrmse > max_cvrmse
51
- 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.")
52
- end
53
- end
54
-
55
- # Peak Demand (for some fuels)
56
- if bill.peakDemandUnitConversionFactor.is_initialized
57
- peak_conversion = bill.peakDemandUnitConversionFactor.get
58
-
59
- # Get modeled and actual values
60
- actual_vals = []
61
- modeled_vals = []
62
- bill.billingPeriods.each do |billing_period|
63
- actual_peak = billing_period.peakDemand
64
- if actual_peak.is_initialized
65
- actual_vals << actual_peak.get
66
- end
67
-
68
- modeled_peak = billing_period.modelPeakDemand
69
- if modeled_peak.is_initialized
70
- modeled_vals << modeled_peak.get
71
- end
72
- end
73
-
74
- # Check that both arrays are the same size
75
- unless actual_vals.size == modeled_vals.size
76
- 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.")
77
- end
78
-
79
- # NMBE and CMRMSE
80
- ysum = 0
81
- sum_err = 0
82
- squared_err = 0
83
- n = actual_vals.size
84
-
85
- actual_vals.each_with_index do |actual, i|
86
- modeled = modeled_vals[i]
87
- actual *= peak_conversion # Convert actual demand to model units
88
- ysum += actual
89
- sum_err += (actual - modeled)
90
- squared_err += (actual - modeled)**2
91
- end
92
-
93
- if n > 1
94
- ybar = ysum / n
95
-
96
- # NMBE
97
- demand_nmbe = 100.0 * (sum_err / (n - 1)) / ybar
98
- if demand_nmbe > max_nmbe || demand_nmbe < -1.0 * max_nmbe
99
- 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.")
100
- end
101
-
102
- # CVRMSE
103
- demand_cvrmse = 100.0 * (squared_err / (n - 1))**0.5 / ybar
104
- if demand_cvrmse > max_cvrmse
105
- 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.")
106
- end
107
- end
108
-
109
- end
110
- end
111
- rescue StandardError => e
112
- # brief description of ruby error
113
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
114
-
115
- # backtrace of ruby error for diagnostic use
116
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
117
- end
118
-
119
- # add check_elms to new attribute
120
- check_elem = OpenStudio::Attribute.new('check', check_elems)
121
-
122
- return check_elem
123
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
124
- end
125
- end
@@ -1,54 +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 that all zones with people are conditioned (have a thermostat with setpoints)
8
- def check_cond_zns(category, target_standard, name_only = false)
9
- # summary of the check
10
- check_elems = OpenStudio::AttributeVector.new
11
- check_elems << OpenStudio::Attribute.new('name', 'Conditioned Zones')
12
- check_elems << OpenStudio::Attribute.new('category', category)
13
- check_elems << OpenStudio::Attribute.new('description', 'Check that all zones with people have thermostats.')
14
-
15
- # stop here if only name is requested this is used to populate display name for arguments
16
- if name_only == true
17
- results = []
18
- check_elems.each do |elem|
19
- results << elem.valueAsString
20
- end
21
- return results
22
- end
23
-
24
- std = Standard.build(target_standard)
25
-
26
- begin
27
- @model.getThermalZones.each do |zone|
28
- # Only check zones that have people
29
- num_ppl = zone.numberOfPeople
30
- next unless zone.numberOfPeople > 0
31
-
32
- # Check that the zone is heated (at a minimum)
33
- # by checking that the heating setpoint is at least 41F.
34
- # Sometimes people include thermostats but set the setpoints
35
- # such that the system never comes on. This check attempts to catch that.
36
- unless std.thermal_zone_heated?(zone)
37
- 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.")
38
- end
39
- end
40
- rescue StandardError => e
41
- # brief description of ruby error
42
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
43
-
44
- # backtrace of ruby error for diagnostic use
45
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
46
- end
47
-
48
- # add check_elms to new attribute
49
- check_elem = OpenStudio::Attribute.new('check', check_elems)
50
-
51
- return check_elem
52
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
53
- end
54
- end
@@ -1,304 +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_domestic_hot_water(category, target_standard, min_pass, max_pass, name_only = false)
11
- # TODO: - could expose meal turnover and people per unit for res and hotel into arguments
12
-
13
- # summary of the check
14
- check_elems = OpenStudio::AttributeVector.new
15
- check_elems << OpenStudio::Attribute.new('name', 'Domestic Hot Water')
16
- check_elems << OpenStudio::Attribute.new('category', category)
17
- if target_standard == 'ICC IECC 2015'
18
- check_elems << OpenStudio::Attribute.new('description', 'Check service water heating consumption against Table R405.5.2(1) in ICC IECC 2015 Residential Provisions.')
19
- else
20
- check_elems << OpenStudio::Attribute.new('description', 'Check against the 2011 ASHRAE Handbook - HVAC Applications, Table 7 section 50.14.')
21
- end
22
-
23
- # stop here if only name is requested this is used to populate display name for arguments
24
- if name_only == true
25
- results = []
26
- check_elems.each do |elem|
27
- results << elem.valueAsString
28
- end
29
- return results
30
- end
31
-
32
- # Versions of OpenStudio greater than 2.4.0 use a modified version of
33
- # openstudio-standards with different method calls. These methods
34
- # require a "Standard" object instead of the standard being passed into method calls.
35
- # This Standard object is used throughout the QAQC check.
36
- if OpenStudio::VersionString.new(OpenStudio.openStudioVersion) < OpenStudio::VersionString.new('2.4.3')
37
- use_old_gem_code = true
38
- else
39
- use_old_gem_code = false
40
- std = Standard.build(target_standard)
41
- end
42
-
43
- begin
44
- # loop through water_use_equipment
45
- service_water_consumption_daily_avg_gal = 0.0
46
- @model.getWaterUseEquipments.each do |water_use_equipment|
47
- # get peak flow rate from def
48
- peak_flow_rate_si = water_use_equipment.waterUseEquipmentDefinition.peakFlowRate
49
- source_units = 'm^3/s'
50
- target_units = 'gal/min'
51
- peak_flow_rate_ip = OpenStudio.convert(peak_flow_rate_si, source_units, target_units).get
52
-
53
- # get value from flow rate schedule
54
- if water_use_equipment.flowRateFractionSchedule.is_initialized
55
- # get annual equiv for model schedule
56
- schedule_inst = water_use_equipment.flowRateFractionSchedule.get
57
- if schedule_inst.to_ScheduleRuleset.is_initialized
58
- if use_old_gem_code
59
- annual_equiv_flow_rate = schedule_inst.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
60
- else
61
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleRuleset.get)
62
- end
63
- elsif schedule_inst.to_ScheduleConstant.is_initialized
64
- if use_old_gem_code
65
- annual_equiv_flow_rate = schedule_inst.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
66
- else
67
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(schedule_inst.to_ScheduleConstant.get)
68
- end
69
- else
70
- check_elems << OpenStudio::Attribute.new('flag', "#{schedule_inst.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
71
- next
72
- end
73
- else
74
- # issue flag
75
- check_elems << OpenStudio::Attribute.new('flag', "#{water_use_equipment.name} doesn't have a schedule. Can't identify hot water consumption.")
76
- next
77
- end
78
-
79
- # add to global service water consumpiton value
80
- service_water_consumption_daily_avg_gal += 60.0 * peak_flow_rate_ip * annual_equiv_flow_rate / 365.0
81
- end
82
-
83
- if target_standard == 'ICC IECC 2015'
84
-
85
- num_people = 0.0
86
- @model.getSpaceTypes.each do |space_type|
87
- next if !space_type.standardsSpaceType.is_initialized
88
- next if space_type.standardsSpaceType.get != 'Apartment' # currently only supports midrise apt space type
89
- space_type_floor_area = space_type.floorArea
90
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
91
- num_people += space_type_num_people
92
- end
93
-
94
- # lookup target gal/day for the building
95
- bedrooms_per_unit = 2.0 # assumption
96
- num_units = num_people / 2.5 # Avg 2.5 units per person.
97
- if use_old_gem_code
98
- target_consumption = @model.find_icc_iecc_2015_hot_water_demand(num_units, bedrooms_per_unit)
99
- else
100
- target_consumption = std.model_find_icc_iecc_2015_hot_water_demand(@model, num_units, bedrooms_per_unit)
101
- end
102
-
103
- else # only other path for now is 90.1-2013
104
-
105
- # get building type
106
- building_type = ''
107
- if @model.getBuilding.standardsBuildingType.is_initialized
108
- building_type = @model.getBuilding.standardsBuildingType.get
109
- end
110
-
111
- # lookup data from standards
112
- if use_old_gem_code
113
- ashrae_hot_water_demand = @model.find_ashrae_hot_water_demand
114
- else
115
- ashrae_hot_water_demand = std.model_find_ashrae_hot_water_demand(@model)
116
- end
117
-
118
- # building type specific logic for water consumption
119
- # todo - update test to exercise various building types
120
- if !ashrae_hot_water_demand.empty?
121
-
122
- if building_type == 'FullServiceRestaurant'
123
- num_people_hours = 0.0
124
- @model.getSpaceTypes.each do |space_type|
125
- next if !space_type.standardsSpaceType.is_initialized
126
- next if space_type.standardsSpaceType.get != 'Dining'
127
- space_type_floor_area = space_type.floorArea
128
-
129
- space_type_num_people_hours = 0.0
130
- # loop through peole instances
131
- space_type.peoples.each do |inst|
132
- inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
133
- inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
134
-
135
- if inst_schedule.to_ScheduleRuleset.is_initialized
136
- if use_old_gem_code
137
- annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
138
- else
139
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
140
- end
141
- elsif inst_schedule.to_ScheduleConstant.is_initialized
142
- if use_old_gem_code
143
- annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
144
- else
145
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
146
- end
147
- else
148
- check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
149
- annual_equiv_flow_rate = 0.0
150
- end
151
-
152
- inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
153
- space_type_num_people_hours += inst_num_people_horus
154
- end
155
-
156
- num_people_hours += space_type_num_people_hours
157
- end
158
- num_meals = num_people_hours / 365.0 * 1.5 # 90 minute meal
159
- target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
160
-
161
- elsif ['LargeHotel', 'SmallHotel'].include? building_type
162
- num_people = 0.0
163
- @model.getSpaceTypes.each do |space_type|
164
- next if !space_type.standardsSpaceType.is_initialized
165
- next if space_type.standardsSpaceType.get != 'GuestRoom'
166
- space_type_floor_area = space_type.floorArea
167
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
168
- num_people += space_type_num_people
169
- end
170
-
171
- # find best fit from returned results
172
- num_units = num_people / 2.0 # 2 people per room design load, not typical occupancy
173
- avg_day_unit = nil
174
- fit = nil
175
- ashrae_hot_water_demand.each do |block|
176
- if fit.nil?
177
- avg_day_unit = block[:avg_day_unit]
178
- fit = (avg_day_unit - block[:block]).abs
179
- elsif (avg_day_unit - block[:block]).abs - fit
180
- avg_day_unit = block[:avg_day_unit]
181
- fit = (avg_day_unit - block[:block]).abs
182
- end
183
- end
184
- target_consumption = num_units * avg_day_unit
185
-
186
- elsif building_type == 'MidriseApartment'
187
- num_people = 0.0
188
- @model.getSpaceTypes.each do |space_type|
189
- next if !space_type.standardsSpaceType.is_initialized
190
- next if space_type.standardsSpaceType.get != 'Apartment'
191
- space_type_floor_area = space_type.floorArea
192
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
193
- num_people += space_type_num_people
194
- end
195
-
196
- # find best fit from returned results
197
- num_units = num_people / 2.5 # Avg 2.5 units per person.
198
- avg_day_unit = nil
199
- fit = nil
200
- ashrae_hot_water_demand.each do |block|
201
- if fit.nil?
202
- avg_day_unit = block[:avg_day_unit]
203
- fit = (avg_day_unit - block[:block]).abs
204
- elsif (avg_day_unit - block[:block]).abs - fit
205
- avg_day_unit = block[:avg_day_unit]
206
- fit = (avg_day_unit - block[:block]).abs
207
- end
208
- end
209
- target_consumption = num_units * avg_day_unit
210
-
211
- elsif ['Office', 'LargeOffice', 'MediumOffice', 'SmallOffice'].include? building_type
212
- num_people = @model.getBuilding.numberOfPeople
213
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
214
- elsif building_type == 'PrimarySchool'
215
- num_people = 0.0
216
- @model.getSpaceTypes.each do |space_type|
217
- next if !space_type.standardsSpaceType.is_initialized
218
- next if space_type.standardsSpaceType.get != 'Classroom'
219
- space_type_floor_area = space_type.floorArea
220
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
221
- num_people += space_type_num_people
222
- end
223
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
224
- elsif building_type == 'QuickServiceRestaurant'
225
- num_people_hours = 0.0
226
- @model.getSpaceTypes.each do |space_type|
227
- next if !space_type.standardsSpaceType.is_initialized
228
- next if space_type.standardsSpaceType.get != 'Dining'
229
- space_type_floor_area = space_type.floorArea
230
-
231
- space_type_num_people_hours = 0.0
232
- # loop through peole instances
233
- space_type.peoples.each do |inst|
234
- inst_num_people = inst.getNumberOfPeople(space_type_floor_area)
235
- inst_schedule = inst.numberofPeopleSchedule.get # sim will fail prior to this if doesn't have it
236
-
237
- if inst_schedule.to_ScheduleRuleset.is_initialized
238
- if use_old_gem_code
239
- annual_equiv_flow_rate = inst_schedule.to_ScheduleRuleset.get.annual_equivalent_full_load_hrs
240
- else
241
- annual_equiv_flow_rate = std.schedule_ruleset_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleRuleset.get)
242
- end
243
- elsif inst_schedule.to_ScheduleConstant.is_initialized
244
- if use_old_gem_code
245
- annual_equiv_flow_rate = inst_schedule.to_ScheduleConstant.get.annual_equivalent_full_load_hrs
246
- else
247
- annual_equiv_flow_rate = std.schedule_constant_annual_equivalent_full_load_hrs(inst_schedule.to_ScheduleConstant.get)
248
- end
249
- else
250
- check_elems << OpenStudio::Attribute.new('flag', "#{inst_schedule.name} isn't a Ruleset or Constant schedule. Can't calculate annual equivalent full load hours.")
251
- annual_equiv_flow_rate = 0.0
252
- end
253
-
254
- inst_num_people_horus = annual_equiv_flow_rate * inst_num_people
255
- space_type_num_people_hours += inst_num_people_horus
256
- end
257
-
258
- num_people_hours += space_type_num_people_hours
259
- end
260
- num_meals = num_people_hours / 365.0 * 0.5 # 30 minute leal
261
- # todo - add logic to address drive through traffic
262
- target_consumption = num_meals * ashrae_hot_water_demand.first[:avg_day_unit]
263
-
264
- elsif building_type == 'SecondarySchool'
265
- num_people = 0.0
266
- @model.getSpaceTypes.each do |space_type|
267
- next if !space_type.standardsSpaceType.is_initialized
268
- next if space_type.standardsSpaceType.get != 'Classroom'
269
- space_type_floor_area = space_type.floorArea
270
- space_type_num_people = space_type.getNumberOfPeople(space_type_floor_area)
271
- num_people += space_type_num_people
272
- end
273
- target_consumption = num_people * ashrae_hot_water_demand.first[:avg_day_unit]
274
- else
275
- check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
276
- end
277
-
278
- else
279
- check_elems << OpenStudio::Attribute.new('flag', "No rule of thumb values exist for #{building_type}. Hot water consumption was not checked.")
280
- end
281
-
282
- end
283
-
284
- # check actual against target
285
- if service_water_consumption_daily_avg_gal < target_consumption * (1.0 - min_pass)
286
- 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.")
287
- elsif service_water_consumption_daily_avg_gal > target_consumption * (1.0 + max_pass)
288
- 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.")
289
- end
290
- rescue StandardError => e
291
- # brief description of ruby error
292
- check_elems << OpenStudio::Attribute.new('flag', "Error prevented QAQC check from running (#{e}).")
293
-
294
- # backtrace of ruby error for diagnostic use
295
- if @error_backtrace then check_elems << OpenStudio::Attribute.new('flag', e.backtrace.join("\n").to_s) end
296
- end
297
-
298
- # add check_elms to new attribute
299
- check_elem = OpenStudio::Attribute.new('check', check_elems)
300
-
301
- return check_elem
302
- # note: registerWarning and registerValue will be added for checks downstream using os_lib_reporting_qaqc.rb
303
- end
304
- end