openstudio-model-articulation 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.md +7 -21
- data/README.md +4 -3
- data/Rakefile +2 -32
- data/doc_templates/LICENSE.md +7 -21
- data/doc_templates/copyright_erb.txt +2 -32
- data/doc_templates/copyright_js.txt +2 -2
- data/doc_templates/copyright_ruby.txt +3 -33
- data/lib/measures/AssignConstructionSetToBuilding/LICENSE.md +7 -21
- data/lib/measures/AssignConstructionSetToBuilding/measure.rb +2 -32
- data/lib/measures/AssignConstructionSetToBuilding/measure.xml +7 -7
- data/lib/measures/AssignSpaceTypeBySpaceName/LICENSE.md +7 -21
- data/lib/measures/AssignSpaceTypeBySpaceName/measure.rb +2 -32
- data/lib/measures/AssignSpaceTypeBySpaceName/measure.xml +25 -25
- data/lib/measures/AssignSpaceTypeToBuilding/LICENSE.md +7 -21
- data/lib/measures/AssignSpaceTypeToBuilding/measure.rb +2 -32
- data/lib/measures/AssignSpaceTypeToBuilding/measure.xml +7 -7
- data/lib/measures/AssignSpacesToStories/LICENSE.md +7 -21
- data/lib/measures/AssignSpacesToStories/measure.rb +2 -32
- data/lib/measures/AssignSpacesToStories/measure.xml +5 -5
- data/lib/measures/BarAspectRatioStudy/LICENSE.md +7 -21
- data/lib/measures/BarAspectRatioStudy/measure.rb +2 -32
- data/lib/measures/BarAspectRatioStudy/measure.xml +5 -5
- data/lib/measures/CleanupSpaceOrigins/LICENSE.md +7 -21
- data/lib/measures/CleanupSpaceOrigins/measure.rb +2 -32
- data/lib/measures/CleanupSpaceOrigins/measure.xml +5 -5
- data/lib/measures/FindAndReplaceObjectNames/LICENSE.md +7 -21
- data/lib/measures/FindAndReplaceObjectNames/measure.rb +2 -32
- data/lib/measures/FindAndReplaceObjectNames/measure.xml +5 -5
- data/lib/measures/InjectOsmGeometryIntoAnExternalIdf/LICENSE.md +7 -21
- data/lib/measures/InjectOsmGeometryIntoAnExternalIdf/measure.rb +2 -32
- data/lib/measures/InjectOsmGeometryIntoAnExternalIdf/measure.xml +23 -23
- data/lib/measures/RemoveHardAssignedConstructions/LICENSE.md +7 -21
- data/lib/measures/RemoveHardAssignedConstructions/measure.rb +2 -32
- data/lib/measures/RemoveHardAssignedConstructions/measure.xml +5 -5
- data/lib/measures/RenameSpaceSurfacesBasedonParentSpaceandOrientation/LICENSE.md +7 -21
- data/lib/measures/RenameSpaceSurfacesBasedonParentSpaceandOrientation/measure.rb +2 -32
- data/lib/measures/RenameSpaceSurfacesBasedonParentSpaceandOrientation/measure.xml +25 -25
- data/lib/measures/RotateBuilding/LICENSE.md +7 -21
- data/lib/measures/RotateBuilding/measure.rb +2 -32
- data/lib/measures/RotateBuilding/measure.xml +5 -5
- data/lib/measures/SetExtWallToGroundBoundaryConditionByStory/LICENSE.md +7 -21
- data/lib/measures/SetExtWallToGroundBoundaryConditionByStory/measure.rb +2 -32
- data/lib/measures/SetExtWallToGroundBoundaryConditionByStory/measure.xml +11 -11
- data/lib/measures/SetInteriorWallsAndFloorsToAdiabatic/LICENSE.md +7 -21
- data/lib/measures/SetInteriorWallsAndFloorsToAdiabatic/measure.rb +2 -32
- data/lib/measures/SetInteriorWallsAndFloorsToAdiabatic/measure.xml +5 -5
- data/lib/measures/SetInteriorWallsToSelectedConstruction/LICENSE.md +7 -21
- data/lib/measures/SetInteriorWallsToSelectedConstruction/measure.rb +2 -32
- data/lib/measures/SetInteriorWallsToSelectedConstruction/measure.xml +5 -5
- data/lib/measures/SetWindowToWallRatioByFacade/LICENSE.md +7 -21
- data/lib/measures/SetWindowToWallRatioByFacade/measure.rb +2 -32
- data/lib/measures/SetWindowToWallRatioByFacade/measure.xml +11 -11
- data/lib/measures/SetWindowToWallRatioByFacade/resources/functions.rb +2 -32
- data/lib/measures/SimplifyGeometryToSlicedBar/LICENSE.md +7 -21
- data/lib/measures/SimplifyGeometryToSlicedBar/measure.rb +2 -32
- data/lib/measures/SimplifyGeometryToSlicedBar/measure.xml +26 -26
- data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_cofee.rb +2 -32
- data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_geometry.rb +2 -32
- data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_helper_methods.rb +2 -32
- data/lib/measures/SpaceTypeAndConstructionSetWizard/LICENSE.md +7 -21
- data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.rb +2 -32
- data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.xml +21 -5
- data/lib/measures/SurfaceMatching/LICENSE.md +7 -21
- data/lib/measures/SurfaceMatching/measure.rb +2 -32
- data/lib/measures/SurfaceMatching/measure.xml +5 -5
- data/lib/measures/add_empd_material_properties/LICENSE.md +7 -21
- data/lib/measures/add_empd_material_properties/measure.rb +2 -32
- data/lib/measures/add_empd_material_properties/measure.xml +10 -10
- data/lib/measures/blended_space_type_from_floor_area_ratios/LICENSE.md +7 -21
- data/lib/measures/blended_space_type_from_floor_area_ratios/measure.rb +2 -32
- data/lib/measures/blended_space_type_from_floor_area_ratios/measure.xml +5 -5
- data/lib/measures/blended_space_type_from_model/LICENSE.md +7 -21
- data/lib/measures/blended_space_type_from_model/measure.rb +2 -32
- data/lib/measures/blended_space_type_from_model/measure.xml +10 -10
- data/lib/measures/clone_building_from_external_model/LICENSE.md +7 -21
- data/lib/measures/clone_building_from_external_model/measure.rb +2 -32
- data/lib/measures/clone_building_from_external_model/measure.xml +5 -5
- data/lib/measures/create_DOE_prototype_building/LICENSE.md +7 -21
- data/lib/measures/create_DOE_prototype_building/measure.rb +2 -32
- data/lib/measures/create_DOE_prototype_building/measure.xml +603 -235
- data/lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/LICENSE.md +7 -21
- data/lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb +2 -32
- data/lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.xml +5 -5
- data/lib/measures/create_bar_from_building_type_ratios/LICENSE.md +7 -21
- data/lib/measures/create_bar_from_building_type_ratios/README.md +5 -5
- data/lib/measures/create_bar_from_building_type_ratios/measure.rb +2 -32
- data/lib/measures/create_bar_from_building_type_ratios/measure.xml +53 -13
- data/lib/measures/create_bar_from_deer_building_type_ratios/LICENSE.md +7 -21
- data/lib/measures/create_bar_from_deer_building_type_ratios/measure.rb +2 -32
- data/lib/measures/create_bar_from_deer_building_type_ratios/measure.xml +10 -10
- data/lib/measures/create_bar_from_doe_building_type_ratios/LICENSE.md +7 -21
- data/lib/measures/create_bar_from_doe_building_type_ratios/README.md +13 -5
- data/lib/measures/create_bar_from_doe_building_type_ratios/measure.rb +2 -32
- data/lib/measures/create_bar_from_doe_building_type_ratios/measure.xml +53 -13
- data/lib/measures/create_bar_from_model/LICENSE.md +7 -21
- data/lib/measures/create_bar_from_model/measure.rb +2 -32
- data/lib/measures/create_bar_from_model/measure.xml +5 -5
- data/lib/measures/create_bar_from_space_type_ratios/LICENSE.md +7 -21
- data/lib/measures/create_bar_from_space_type_ratios/README.md +1 -1
- data/lib/measures/create_bar_from_space_type_ratios/measure.rb +2 -32
- data/lib/measures/create_bar_from_space_type_ratios/measure.xml +21 -13
- data/lib/measures/create_baseline_building/LICENSE.md +7 -21
- data/lib/measures/create_baseline_building/measure.rb +2 -32
- data/lib/measures/create_baseline_building/measure.xml +5 -5
- data/lib/measures/create_deer_prototype_building/LICENSE.md +7 -21
- data/lib/measures/create_deer_prototype_building/measure.rb +2 -32
- data/lib/measures/create_deer_prototype_building/measure.xml +6 -6
- data/lib/measures/create_deer_prototype_building/resources/deer_building_types.rb +2 -32
- data/lib/measures/create_parametric_schedules/LICENSE.md +7 -21
- data/lib/measures/create_parametric_schedules/measure.rb +2 -32
- data/lib/measures/create_parametric_schedules/measure.xml +5 -5
- data/lib/measures/create_typical_building_from_model/LICENSE.md +7 -21
- data/lib/measures/create_typical_building_from_model/README.md +1 -1
- data/lib/measures/create_typical_building_from_model/measure.rb +2 -32
- data/lib/measures/create_typical_building_from_model/measure.xml +27 -19
- data/lib/measures/create_typical_building_from_model/resources/Model.hvac.rb +2 -32
- data/lib/measures/create_typical_deer_building_from_model/LICENSE.md +7 -21
- data/lib/measures/create_typical_deer_building_from_model/measure.rb +2 -32
- data/lib/measures/create_typical_deer_building_from_model/measure.xml +17 -17
- data/lib/measures/create_typical_deer_building_from_model/resources/Model.hvac.rb +2 -32
- data/lib/measures/create_typical_doe_building_from_model/LICENSE.md +7 -21
- data/lib/measures/create_typical_doe_building_from_model/README.md +5 -1
- data/lib/measures/create_typical_doe_building_from_model/measure.rb +2 -32
- data/lib/measures/create_typical_doe_building_from_model/measure.xml +27 -19
- data/lib/measures/create_typical_doe_building_from_model/resources/Model.hvac.rb +2 -32
- data/lib/measures/deer_space_type_and_construction_set_wizard/LICENSE.md +7 -21
- data/lib/measures/deer_space_type_and_construction_set_wizard/measure.rb +2 -32
- data/lib/measures/deer_space_type_and_construction_set_wizard/measure.xml +5 -5
- data/lib/measures/find_and_replace_in_all_thermal_zone_names/LICENSE.md +7 -21
- data/lib/measures/find_and_replace_in_all_thermal_zone_names/measure.rb +2 -32
- data/lib/measures/find_and_replace_in_all_thermal_zone_names/measure.xml +5 -5
- data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/LICENSE.md +7 -21
- data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.rb +2 -32
- data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.xml +5 -5
- data/lib/measures/merge_floorspace_js_with_model/LICENSE.md +7 -21
- data/lib/measures/merge_floorspace_js_with_model/measure.rb +2 -32
- data/lib/measures/merge_floorspace_js_with_model/measure.xml +11 -5
- data/lib/measures/merge_spaces_from_external_file/LICENSE.md +7 -21
- data/lib/measures/merge_spaces_from_external_file/measure.rb +2 -32
- data/lib/measures/merge_spaces_from_external_file/measure.xml +6 -6
- data/lib/measures/merge_spaces_from_external_file/resources/ScheduleTranslator.rb +2 -32
- data/lib/measures/radiance_measure/LICENSE.md +7 -21
- data/lib/measures/radiance_measure/measure.rb +2 -32
- data/lib/measures/radiance_measure/measure.xml +5 -5
- data/lib/measures/radiant_slab_with_doas/LICENSE.md +7 -21
- data/lib/measures/radiant_slab_with_doas/measure.rb +2 -32
- data/lib/measures/radiant_slab_with_doas/measure.xml +5 -5
- data/lib/measures/replace_geometry_by_story/LICENSE.md +7 -21
- data/lib/measures/replace_geometry_by_story/measure.rb +2 -32
- data/lib/measures/replace_geometry_by_story/measure.xml +5 -5
- data/lib/measures/scale_geometry/LICENSE.md +7 -21
- data/lib/measures/scale_geometry/measure.rb +2 -32
- data/lib/measures/scale_geometry/measure.xml +5 -5
- data/lib/measures/set_nist_infiltration_correlations/LICENSE.md +13 -0
- data/lib/measures/set_nist_infiltration_correlations/README.md +94 -0
- data/lib/measures/set_nist_infiltration_correlations/README.md.erb +45 -0
- data/lib/measures/set_nist_infiltration_correlations/docs/Data-NISTInfiltrationCorrelations.xlsx +0 -0
- data/lib/measures/set_nist_infiltration_correlations/docs/NIST.TN.2221.pdf +0 -0
- data/lib/measures/set_nist_infiltration_correlations/measure.rb +613 -0
- data/lib/measures/set_nist_infiltration_correlations/measure.xml +373 -0
- data/lib/measures/set_nist_infiltration_correlations/resources/Data-NISTInfiltrationCorrelations.csv +353 -0
- data/lib/openstudio/model_articulation/extension.rb +2 -32
- data/lib/openstudio/model_articulation/version.rb +3 -33
- data/lib/openstudio/model_articulation.rb +2 -32
- data/lib/openstudio-model-articulation.rb +2 -32
- data/openstudio-model-articulation.gemspec +2 -2
- metadata +15 -7
@@ -0,0 +1,613 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
4
|
+
# *******************************************************************************
|
5
|
+
|
6
|
+
require 'csv'
|
7
|
+
|
8
|
+
# start the measure
|
9
|
+
class SetNISTInfiltrationCorrelations < OpenStudio::Measure::ModelMeasure
|
10
|
+
# human readable name
|
11
|
+
def name
|
12
|
+
# Measure name should be the title case of the class name.
|
13
|
+
return 'SetNISTInfiltrationCorrelations'
|
14
|
+
end
|
15
|
+
|
16
|
+
# human readable description
|
17
|
+
def description
|
18
|
+
return "This measure incorporates infiltration that varies with weather and HVAC operation, and takes into account building geometry (height, above-ground exterior surface area, and volume). It is based on work published by Ng et al. (2018) <a href='https://doi.org/10.1016/j.buildenv.2017.10.029'>'Weather correlations to calculate infiltration rates for U.S. commercial building energy models'</a> and Ng et al. (2021) <a href='https://doi.org/10.1016/j.buildenv.2021.107783'>'Evaluating potential benefits of air barriers in commercial buildings using NIST infiltration correlations in EnergyPlus'</a>. This method of calculating infiltration was developed using eleven of the DOE commercial prototype building models (<a href='https://www.energycodes.gov/development/commercial/prototype_models'>Goel et al. 2014</a>) and TMY3 weather files for eight climate zones (CZ). Guidance on implementing the infiltration correlations are explained in the NIST technical report <a href='https://doi.org/10.6028/NIST.TN.2221'>'Implementing NIST Infiltration Correlations'</a>. Ng et al. (2018) shows that when analyzing the benefits of building envelope airtightening, greater HVAC energy savings were predicted using the infiltration inputs included in this Measure compared with using the default inputs that are included in the prototype building models. Brian Polidoro (NIST) first developed this Measure in 2015 and updated it in 2018 and 2019. Matthew Dahlhausen (NREL) updated the 2019 Measure and published this current version in 2023. To provide feedback on the NIST infiltration correlations, please email infiltration@list.nist.gov or lisa.ng@nist.gov. For measure implementation questions or issues, contact matthew.dahlhausen@nrel.gov."
|
19
|
+
end
|
20
|
+
|
21
|
+
# human readable description of modeling approach
|
22
|
+
def modeler_description
|
23
|
+
return "This measure will remove any existing infiltration objects (OS:SpaceInfiltration:DesignFlowRate and OS:SpaceInfiltration:EffectiveLeakageArea). Every zone will then get two OS:SpaceInfiltration:DesignFlowRate objects that add infiltration using the 'Flow per Exterior Surface Area' input option, one infiltration object when the HVAC system is on and one object when the HVAC system is off. The method assumes that HVAC operation is set by a schedule, though it may not reflect actual simulation/operation when fan operation may depend on internal loads and temperature setpoints. By default, interior zones will receive no infiltration. The user may enter a design building envelope airtightness at a specific design pressure, and whether the design value represents a 4-sided, 5-sided, or 6-sided normalization. By default, the measure assumes an airtightness design value of 13.8 (m^3/h-m^2) at 75 Pa. The measure assumes that infiltration is evenly distributed across the entire building envelope, including the roof. The user may select the HVAC system operating schedule in the model, or infer it based on the availability schedule of the air loop that serves the largest amount of floor area. The measure will make a copy of the HVAC operating schedule, 'Infiltration HVAC On Schedule', which is used with the HVAC on infiltration correlations. The measure will also make an 'Infiltration HVAC Off Schedule' with inverse operation, used with the HVAC off infiltration correlations. OS:SpaceInfiltration:DesignFlowRate object coefficients (A, B, C, and D) come from Ng et al. (2018). The user may select the Building Type and Climate Zone, or the measure will infer them from the model."
|
24
|
+
end
|
25
|
+
|
26
|
+
# DOE prototype buildings for which there are NIST infiltration coefficients
|
27
|
+
def nist_building_types
|
28
|
+
building_types = OpenStudio::StringVector.new
|
29
|
+
building_types << 'SecondarySchool'
|
30
|
+
building_types << 'PrimarySchool'
|
31
|
+
building_types << 'SmallOffice'
|
32
|
+
building_types << 'MediumOffice'
|
33
|
+
building_types << 'SmallHotel'
|
34
|
+
building_types << 'LargeHotel'
|
35
|
+
building_types << 'RetailStandalone'
|
36
|
+
building_types << 'RetailStripmall'
|
37
|
+
building_types << 'Hospital'
|
38
|
+
building_types << 'MidriseApartment'
|
39
|
+
building_types << 'HighriseApartment'
|
40
|
+
|
41
|
+
return building_types
|
42
|
+
end
|
43
|
+
|
44
|
+
def infer_nist_building_type(model)
|
45
|
+
if model.getBuilding.standardsBuildingType.is_initialized
|
46
|
+
model_building_type = model.getBuilding.standardsBuildingType.get
|
47
|
+
else
|
48
|
+
model_building_type = ''
|
49
|
+
end
|
50
|
+
|
51
|
+
case model_building_type
|
52
|
+
when 'Office'
|
53
|
+
# map office building type to small medium or large
|
54
|
+
floor_area = model.getBuilding.floorArea
|
55
|
+
if floor_area < 2750.0
|
56
|
+
nist_building_type = 'SmallOffice'
|
57
|
+
else
|
58
|
+
nist_building_type = 'MediumOffice'
|
59
|
+
end
|
60
|
+
when 'LargeOffice'
|
61
|
+
nist_building_type = 'MediumOffice'
|
62
|
+
when 'Retail'
|
63
|
+
# map retal building type to RetailStripmall or RetailStandalone based on building name
|
64
|
+
building_name = model.getBuilding.name.get
|
65
|
+
if building_name.include? 'RetailStandalone'
|
66
|
+
nist_building_type = 'RetailStandalone'
|
67
|
+
else
|
68
|
+
nist_building_type = 'RetailStripmall'
|
69
|
+
end
|
70
|
+
when 'StripMall'
|
71
|
+
nist_building_type = 'RetailStripmall'
|
72
|
+
when 'Warehouse'
|
73
|
+
nist_building_type = 'RetailStripmall'
|
74
|
+
when 'QuickServiceRestaurant'
|
75
|
+
nist_building_type = 'RetailStripmall'
|
76
|
+
when 'FullServiceRestaurant'
|
77
|
+
nist_building_type = 'RetailStripmall'
|
78
|
+
when 'Outpatient'
|
79
|
+
nist_building_type = 'MediumOffice'
|
80
|
+
when 'SuperMarket'
|
81
|
+
nist_building_type = 'RetailStandalone'
|
82
|
+
when 'EPr'
|
83
|
+
nist_building_type = 'PrimarySchool'
|
84
|
+
when 'ESe'
|
85
|
+
nist_building_type = 'SecondarySchool'
|
86
|
+
when 'RtL'
|
87
|
+
nist_building_type = 'RetailStandalone'
|
88
|
+
when 'RtS'
|
89
|
+
nist_building_type = 'RetailStripmall'
|
90
|
+
when 'RSD'
|
91
|
+
nist_building_type = 'RetailStripmall'
|
92
|
+
when 'RFF'
|
93
|
+
nist_building_type = 'RetailStripmall'
|
94
|
+
when 'Mtl'
|
95
|
+
nist_building_type = 'SmallHotel'
|
96
|
+
when 'Htl'
|
97
|
+
nist_building_type = 'LargeHotel'
|
98
|
+
when 'Hsp'
|
99
|
+
nist_building_type = 'Hospital'
|
100
|
+
when 'OfS'
|
101
|
+
nist_building_type = 'SmallOffice'
|
102
|
+
when 'OfL'
|
103
|
+
nist_building_type = 'MediumOffice'
|
104
|
+
when 'SCn'
|
105
|
+
nist_building_type = 'RetailStripmall'
|
106
|
+
else
|
107
|
+
nist_building_type = model_building_type
|
108
|
+
end
|
109
|
+
|
110
|
+
results = {}
|
111
|
+
results['model_building_type'] = model_building_type
|
112
|
+
results['nist_building_type'] = nist_building_type
|
113
|
+
|
114
|
+
return results
|
115
|
+
end
|
116
|
+
|
117
|
+
# method to invert a schedule ruleset
|
118
|
+
def invert_schedule_ruleset(schedule_ruleset, new_schedule_name)
|
119
|
+
model = schedule_ruleset.model
|
120
|
+
new_schedule = OpenStudio::Model::ScheduleRuleset.new(model, 0.0)
|
121
|
+
new_schedule.setName(new_schedule_name)
|
122
|
+
|
123
|
+
# change the default day values
|
124
|
+
default_day_schedule = schedule_ruleset.defaultDaySchedule
|
125
|
+
new_default_day_schedule = new_schedule.defaultDaySchedule
|
126
|
+
new_default_day_schedule.setName("#{new_schedule_name} Default Day Schedule")
|
127
|
+
for index in 0..default_day_schedule.times.size-1
|
128
|
+
old_value = default_day_schedule.values[index]
|
129
|
+
if old_value == 0
|
130
|
+
new_value = 1
|
131
|
+
else
|
132
|
+
new_value = 0
|
133
|
+
end
|
134
|
+
new_default_day_schedule.addValue(default_day_schedule.times[index], new_value)
|
135
|
+
end
|
136
|
+
|
137
|
+
# change for schedule rules
|
138
|
+
schedule_ruleset.scheduleRules.each_with_index do |rule, i|
|
139
|
+
old_day_schedule = rule.daySchedule
|
140
|
+
new_day_schedule = OpenStudio::Model::ScheduleDay.new(model)
|
141
|
+
new_day_schedule.setName("#{new_schedule_name} Schedule Day #{i}")
|
142
|
+
index = 0
|
143
|
+
for index in 0..old_day_schedule.times.size-1
|
144
|
+
old_value = old_day_schedule.values[index]
|
145
|
+
if old_value == 0
|
146
|
+
new_value = 1
|
147
|
+
else
|
148
|
+
new_value = 0
|
149
|
+
end
|
150
|
+
new_day_schedule.addValue(old_day_schedule.times[index], new_value)
|
151
|
+
end
|
152
|
+
|
153
|
+
new_rule = OpenStudio::Model::ScheduleRule.new(new_schedule, new_day_schedule)
|
154
|
+
new_rule.setName("#{new_day_schedule.name} Rule")
|
155
|
+
new_rule.setApplySunday(rule.applySunday)
|
156
|
+
new_rule.setApplyMonday(rule.applyMonday)
|
157
|
+
new_rule.setApplyTuesday(rule.applyTuesday)
|
158
|
+
new_rule.setApplyWednesday(rule.applyWednesday)
|
159
|
+
new_rule.setApplyThursday(rule.applyThursday)
|
160
|
+
new_rule.setApplyFriday(rule.applyFriday)
|
161
|
+
new_rule.setApplySaturday(rule.applySaturday)
|
162
|
+
end
|
163
|
+
return new_schedule
|
164
|
+
end
|
165
|
+
|
166
|
+
# define the arguments that the user will input
|
167
|
+
def arguments(model)
|
168
|
+
args = OpenStudio::Measure::OSArgumentVector.new
|
169
|
+
|
170
|
+
# airtightness value
|
171
|
+
airtightness_value = OpenStudio::Measure::OSArgument::makeDoubleArgument('airtightness_value', false)
|
172
|
+
airtightness_value.setDefaultValue(13.8)
|
173
|
+
airtightness_value.setDisplayName('Airtightness design value (m^3/h-m^2)')
|
174
|
+
airtightness_value.setDescription('The airtightness design value from a building pressurization test. Use 5.0 (m^3/h-m^2) as a default for buildings with air barriers. Convert (cfm/ft^2) to (m^3/h-m^2) by multiplying by 18.288 (m-min/ft-hr). (0.3048 m/ft)*(60 min/hr) = 18.288 (m-min/ft-hr).')
|
175
|
+
args << airtightness_value
|
176
|
+
|
177
|
+
# airtightness pressure
|
178
|
+
airtightness_pressure = OpenStudio::Measure::OSArgument::makeDoubleArgument('airtightness_pressure', false)
|
179
|
+
airtightness_pressure.setDefaultValue(75.0)
|
180
|
+
airtightness_pressure.setDisplayName('Airtightness design pressure (Pa)')
|
181
|
+
airtightness_pressure.setDescription('The corresponding pressure for the airtightness design value, typically 75 Pa for commercial buildings and 50 Pa for residential buildings.')
|
182
|
+
args << airtightness_pressure
|
183
|
+
|
184
|
+
# choices for air-tightness scope
|
185
|
+
airtightness_choices = OpenStudio::StringVector.new
|
186
|
+
airtightness_choices << '4-sided'
|
187
|
+
airtightness_choices << '5-sided'
|
188
|
+
airtightness_choices << '6-sided'
|
189
|
+
|
190
|
+
# airtightness area
|
191
|
+
airtightness_area = OpenStudio::Measure::OSArgument.makeChoiceArgument('airtightness_area', airtightness_choices, false)
|
192
|
+
airtightness_area.setDefaultValue('5-sided')
|
193
|
+
airtightness_area.setDisplayName('Airtightness exterior surface area scope')
|
194
|
+
airtightness_area.setDescription('Airtightness measurements are weighted by exterior surface area. 4-sided values divide infiltration by exterior wall area. 5-sided values additionally include roof area. 6-sided values additionally include floor and ground area.')
|
195
|
+
args << airtightness_area
|
196
|
+
|
197
|
+
# air barrier
|
198
|
+
air_barrier = OpenStudio::Measure::OSArgument::makeBoolArgument('air_barrier', false)
|
199
|
+
air_barrier.setDefaultValue(false)
|
200
|
+
air_barrier.setDisplayName('Does the building have an air barrier?')
|
201
|
+
air_barrier.setDescription('Buildings with air barriers use a different set of coefficients.')
|
202
|
+
args << air_barrier
|
203
|
+
|
204
|
+
# populate choice argument for schedules in the model
|
205
|
+
sch_handles = OpenStudio::StringVector.new
|
206
|
+
sch_display_names = OpenStudio::StringVector.new
|
207
|
+
|
208
|
+
# populate choice argument for schedules that are applied to surfaces in the model
|
209
|
+
schedule_handles = OpenStudio::StringVector.new
|
210
|
+
schedule_display_names = OpenStudio::StringVector.new
|
211
|
+
|
212
|
+
# putting space types and names into hash
|
213
|
+
schedule_names = []
|
214
|
+
schedule_names << 'Lookup From Model'
|
215
|
+
model.getScheduleRulesets.each { |sch| schedule_names << sch.name.to_s }
|
216
|
+
model.getScheduleConstants.each { |sch| schedule_names << sch.name.to_s }
|
217
|
+
|
218
|
+
# hvac operation schedule
|
219
|
+
hvac_schedule = OpenStudio::Measure::OSArgument::makeChoiceArgument('hvac_schedule', schedule_names, false, true)
|
220
|
+
hvac_schedule.setDefaultValue('Lookup From Model')
|
221
|
+
hvac_schedule.setDisplayName('HVAC Operating Schedule')
|
222
|
+
hvac_schedule.setDescription('Choose the HVAC Operating Schedule for the building. The schedule must be a Schedule Constant or Schedule Ruleset object. Lookup From Model will use the operating schedule from the largest airloop by floor area served. If the largest airloop serves less than 5% of the building, the measure will attempt to use the Building Hours of Operation schedule instead.')
|
223
|
+
args << hvac_schedule
|
224
|
+
|
225
|
+
# climate zone options
|
226
|
+
cz_choices = OpenStudio::StringVector.new
|
227
|
+
cz_choices << '1A'
|
228
|
+
cz_choices << '1B'
|
229
|
+
cz_choices << '2A'
|
230
|
+
cz_choices << '2B'
|
231
|
+
cz_choices << '3A'
|
232
|
+
cz_choices << '3B'
|
233
|
+
cz_choices << '3C'
|
234
|
+
cz_choices << '4A'
|
235
|
+
cz_choices << '4B'
|
236
|
+
cz_choices << '4C'
|
237
|
+
cz_choices << '5A'
|
238
|
+
cz_choices << '5B'
|
239
|
+
cz_choices << '5C'
|
240
|
+
cz_choices << '6A'
|
241
|
+
cz_choices << '6B'
|
242
|
+
cz_choices << '7A'
|
243
|
+
cz_choices << '8A'
|
244
|
+
cz_choices << 'Lookup From Model'
|
245
|
+
|
246
|
+
# climate zone
|
247
|
+
climate_zone = OpenStudio::Measure::OSArgument.makeChoiceArgument('climate_zone', cz_choices, false)
|
248
|
+
climate_zone.setDefaultValue('Lookup From Model')
|
249
|
+
climate_zone.setDisplayName('Climate Zone')
|
250
|
+
climate_zone.setDescription('Specify the ASHRAE climate zone. CEC climate zones are not supported.')
|
251
|
+
args << climate_zone
|
252
|
+
|
253
|
+
# building type options
|
254
|
+
building_types = nist_building_types
|
255
|
+
building_types << 'Lookup From Model'
|
256
|
+
|
257
|
+
# building type
|
258
|
+
building_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('building_type', building_types, false)
|
259
|
+
building_type.setDefaultValue('Lookup From Model')
|
260
|
+
building_type.setDisplayName('Building Type')
|
261
|
+
building_type.setDescription('If the building type is not available, pick the one with the most similar geometry and exhaust fan flow rates.')
|
262
|
+
args << building_type
|
263
|
+
|
264
|
+
return args
|
265
|
+
end
|
266
|
+
|
267
|
+
# define what happens when the measure is run
|
268
|
+
def run(model, runner, user_arguments)
|
269
|
+
super(model, runner, user_arguments)
|
270
|
+
|
271
|
+
# use the built-in error checking
|
272
|
+
if !runner.validateUserArguments(arguments(model), user_arguments)
|
273
|
+
return false
|
274
|
+
end
|
275
|
+
|
276
|
+
# assign the user inputs to variables
|
277
|
+
airtightness_value = runner.getDoubleArgumentValue('airtightness_value', user_arguments)
|
278
|
+
airtightness_pressure = runner.getDoubleArgumentValue('airtightness_pressure', user_arguments)
|
279
|
+
airtightness_area = runner.getStringArgumentValue('airtightness_area', user_arguments)
|
280
|
+
air_barrier = runner.getBoolArgumentValue('air_barrier', user_arguments)
|
281
|
+
hvac_schedule = runner.getStringArgumentValue('hvac_schedule', user_arguments)
|
282
|
+
climate_zone = runner.getStringArgumentValue('climate_zone', user_arguments)
|
283
|
+
building_type = runner.getStringArgumentValue('building_type', user_arguments)
|
284
|
+
|
285
|
+
# validate airtightness value and pressure
|
286
|
+
if airtightness_value < 0.0
|
287
|
+
runner.registerError('Airtightness value must be postive.')
|
288
|
+
return false
|
289
|
+
end
|
290
|
+
|
291
|
+
if airtightness_pressure < 0.0
|
292
|
+
runner.registerError('Airtightness pressure must be postive.')
|
293
|
+
return false
|
294
|
+
end
|
295
|
+
|
296
|
+
# calculate infiltration design value at 4 Pa
|
297
|
+
airtightness_value_4pa_per_hr = airtightness_value * ((4.0 / airtightness_pressure)**0.65)
|
298
|
+
runner.registerInfo("User-inputed airtightness design value #{airtightness_value} (m^3/h-m^2) at #{airtightness_pressure} Pa converts to #{airtightness_value_4pa_per_hr.round(7)} (m^3/h-m^2) at 4 Pa")
|
299
|
+
|
300
|
+
# convert to m^3/s-m^2
|
301
|
+
airtightness_value_4pa_per_s = airtightness_value_4pa_per_hr / 3600.0
|
302
|
+
|
303
|
+
# get 4-sided, 5-sided, and 6-sided areas
|
304
|
+
exterior_wall_area = 0.0
|
305
|
+
exterior_roof_area = 0.0
|
306
|
+
exterior_floor_area = 0.0
|
307
|
+
ground_wall_area = 0.0
|
308
|
+
ground_roof_area = 0.0
|
309
|
+
ground_floor_area = 0.0
|
310
|
+
model.getSurfaces.each do |surface|
|
311
|
+
bc = surface.outsideBoundaryCondition
|
312
|
+
type = surface.surfaceType
|
313
|
+
area = surface.grossArea
|
314
|
+
exterior_wall_area += area if bc == 'Outdoors' && type == 'Wall'
|
315
|
+
exterior_roof_area += area if bc == 'Outdoors' && type == 'RoofCeiling'
|
316
|
+
exterior_floor_area += area if bc == 'Outdoors' && type == 'Floor'
|
317
|
+
ground_wall_area += area if bc == 'Ground' && type == 'Wall'
|
318
|
+
ground_roof_area += area if bc == 'Ground' && type == 'RoofCeiling'
|
319
|
+
ground_floor_area += area if bc == 'Ground' && type == 'Floor'
|
320
|
+
end
|
321
|
+
four_sided_area = exterior_wall_area + ground_wall_area
|
322
|
+
five_sided_area = exterior_wall_area + ground_wall_area + exterior_roof_area + ground_roof_area
|
323
|
+
six_sided_area = exterior_wall_area + ground_wall_area + exterior_roof_area + ground_roof_area + exterior_floor_area + ground_floor_area
|
324
|
+
energy_plus_area = exterior_wall_area + exterior_roof_area
|
325
|
+
runner.registerInfo("4-sided area = #{four_sided_area.round(2)} m^2, 5-sided area = #{five_sided_area.round(2)} m^2, 6-sided area = #{six_sided_area.round(2)} m^2.")
|
326
|
+
|
327
|
+
# The SpaceInfiltrationDesignFlowRate object FlowperExteriorSurfaceArea method only counts surfaces with the 'Outdoors' boundary conditions towards exterior surface area, not surfaces with the 'Ground' boundary conditions. That means all values need to be normalized to exterior wall and roof area.
|
328
|
+
case airtightness_area
|
329
|
+
when '4-sided'
|
330
|
+
design_infiltration_4pa = airtightness_value_4pa_per_s * (four_sided_area / energy_plus_area)
|
331
|
+
runner.registerInfo("#{airtightness_area} infiltration design value #{airtightness_value_4pa_per_s.round(7)} (m^3/s-m^2) converted to #{design_infiltration_4pa.round(7)} (m^3/s-m^2) based on 4-sided area #{four_sided_area.round(2)} m^2 and 5-sided area #{energy_plus_area.round(2)} m^2 excluding ground boundary surfaces for energyplus.")
|
332
|
+
when '5-sided'
|
333
|
+
design_infiltration_4pa = airtightness_value_4pa_per_s * (five_sided_area / energy_plus_area)
|
334
|
+
runner.registerInfo("#{airtightness_area} infiltration design value #{airtightness_value_4pa_per_s.round(7)} (m^3/s-m^2) converted to #{design_infiltration_4pa.round(7)} (m^3/s-m^2) based on 5-sided area #{five_sided_area.round(2)} m^2 and 5-sided area #{energy_plus_area.round(2)} m^2 excluding ground boundary surfaces for energyplus.")
|
335
|
+
when '6-sided'
|
336
|
+
design_infiltration_4pa = airtightness_value_4pa_per_s * (six_sided_area / energy_plus_area)
|
337
|
+
runner.registerInfo("#{airtightness_area} infiltration design value #{airtightness_value_4pa_per_s.round(7)} (m^3/s-m^2) converted to #{design_infiltration_4pa.round(7)} (m^3/s-m^2) based on 6-sided area #{six_sided_area.round(2)} m^2 and 5-sided area #{energy_plus_area.round(2)} m^2 excluding ground boundary surfaces for energyplus.")
|
338
|
+
end
|
339
|
+
runner.registerValue('design_infiltration_4pa', design_infiltration_4pa, 'm/s')
|
340
|
+
|
341
|
+
# validate hvac schedule
|
342
|
+
if hvac_schedule == 'Lookup From Model'
|
343
|
+
# lookup from model, using largest air loop
|
344
|
+
# check multiple kinds of systems, including unitary systems
|
345
|
+
hvac_schedule = nil
|
346
|
+
largest_area = 0.0
|
347
|
+
|
348
|
+
model.getAirLoopHVACs.each do |air_loop|
|
349
|
+
air_loop_area = 0.0
|
350
|
+
air_loop.thermalZones.each { |tz| air_loop_area += tz.floorArea }
|
351
|
+
if air_loop_area > largest_area
|
352
|
+
hvac_schedule = air_loop.availabilitySchedule
|
353
|
+
largest_area = air_loop_area
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
model.getAirLoopHVACUnitarySystems.each do |unitary|
|
358
|
+
next unless unitary.thermalZone.is_initialized
|
359
|
+
air_loop_area = unitary.thermalZone.get.floorArea
|
360
|
+
if air_loop_area > largest_area
|
361
|
+
if unitary.availabilitySchedule.is_initialized
|
362
|
+
hvac_schedule = unitary.availabilitySchedule.get
|
363
|
+
else
|
364
|
+
hvac_schedule = model.alwaysOnDiscreteSchedule
|
365
|
+
end
|
366
|
+
largest_area = air_loop_area
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
model.getAirLoopHVACUnitaryHeatPumpAirToAirs.each do |unitary|
|
371
|
+
next unless unitary.controllingZone.is_initialized
|
372
|
+
air_loop_area = unitary.controllingZone.get.floorArea
|
373
|
+
if air_loop_area > largest_area
|
374
|
+
hvac_schedule = unitary.availabilitySchedule.get
|
375
|
+
largest_area = air_loop_area
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
model.getAirLoopHVACUnitaryHeatPumpAirToAirMultiSpeeds.each do |unitary|
|
380
|
+
next unless unitary.controllingZoneorThermostatLocation.is_initialized
|
381
|
+
air_loop_area = unitary.controllingZoneorThermostatLocation.get.floorArea
|
382
|
+
if air_loop_area > largest_area
|
383
|
+
if unitary.availabilitySchedule.is_initialized
|
384
|
+
hvac_schedule = unitary.availabilitySchedule.get
|
385
|
+
else
|
386
|
+
hvac_schedule = model.alwaysOnDiscreteSchedule
|
387
|
+
end
|
388
|
+
largest_area = air_loop_area
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
model.getFanZoneExhausts.each do |fan|
|
393
|
+
next unless fan.thermalZone.is_initialized
|
394
|
+
air_loop_area = fan.thermalZone.get.floorArea
|
395
|
+
if air_loop_area > largest_area
|
396
|
+
if fan.availabilitySchedule.is_initialized
|
397
|
+
hvac_schedule = fan.availabilitySchedule.get
|
398
|
+
else
|
399
|
+
hvac_schedule = model.alwaysOnDiscreteSchedule
|
400
|
+
end
|
401
|
+
largest_area = air_loop_area
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
building_area = model.getBuilding.floorArea
|
406
|
+
if largest_area < 0.05*building_area
|
407
|
+
runner.registerWarning("The largest airloop or HVAC system serves #{largest_area.round(1)} m^2, which is less than 5% of the building area #{building_area.round(1)} m^2. Attempting to use building hours of operation schedule instead.")
|
408
|
+
default_schedule_set = model.getBuilding.defaultScheduleSet
|
409
|
+
if default_schedule_set.is_initialized
|
410
|
+
default_schedule_set = default_schedule_set.get
|
411
|
+
hoo = default_schedule_set.hoursofOperationSchedule
|
412
|
+
if hoo.is_initialized
|
413
|
+
hvac_schedule = hoo.get
|
414
|
+
largest_area = building_area
|
415
|
+
else
|
416
|
+
runner.registerWarning("Unable to determine building hours of operation schedule. Treating the building as if there is no HVAC system schedule.")
|
417
|
+
hvac_schedule = nil
|
418
|
+
end
|
419
|
+
else
|
420
|
+
runner.registerWarning("Unable to determine building hours of operation schedule. Treating the building as if there is no HVAC system schedule.")
|
421
|
+
hvac_schedule = nil
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
unless hvac_schedule.nil?
|
426
|
+
area_fraction = 100.0 * largest_area / building_area
|
427
|
+
runner.registerInfo("Using schedule #{hvac_schedule.name} serving area #{largest_area.round(1)} m^2, #{area_fraction.round(0)}% of building area #{building_area.round(1)} m^2 to determine infiltration on/off schedule.")
|
428
|
+
end
|
429
|
+
else
|
430
|
+
hvac_schedule = model.getScheduleByName(hvac_schedule)
|
431
|
+
unless schedule_object.is_initialized
|
432
|
+
runner.registerError("HVAC schedule argument #{hvac_schedule} not found in the model. IT may have been removed by another measure.")
|
433
|
+
return false
|
434
|
+
end
|
435
|
+
hvac_schedule = hvac_schedule.get
|
436
|
+
if hvac_schedule.get.to_ScheduleRuleset.is_initialized
|
437
|
+
hvac_schedule = hvac_schedule.get.to_ScheduleRuleset.get
|
438
|
+
elsif hvac_schedule.get.to_ScheduleConstant.is_initialized
|
439
|
+
hvac_schedule = hvac_schedule.get.to_ScheduleConstant.get
|
440
|
+
else
|
441
|
+
runner.registerError("HVAC schedule argument #{hvac_schedule} is not a Schedule Constant or Schedule Ruleset object.")
|
442
|
+
return false
|
443
|
+
end
|
444
|
+
|
445
|
+
runner.registerInfo("Using HVAC schedule #{hvac_schedule.name} from user arguments to determine infiltration on/off schedule.")
|
446
|
+
end
|
447
|
+
|
448
|
+
# creating infiltration schedules based on hvac schedule
|
449
|
+
if hvac_schedule.nil?
|
450
|
+
runner.registerWarning('Unable to determine the HVAC schedule. Treating the building as if there is no HVAC system with outdoor air. If this is not the case, input a schedule argument, or assign one to an air loop in the model.')
|
451
|
+
on_schedule = OpenStudio::Model::ScheduleConstant.new(model)
|
452
|
+
on_schedule.setName("Infiltration HVAC On Schedule")
|
453
|
+
on_schedule.setValue(0.0)
|
454
|
+
off_schedule = OpenStudio::Model::ScheduleConstant.new(model)
|
455
|
+
off_schedule.setName("Infiltration HVAC Off Schedule")
|
456
|
+
off_schedule.setValue(1.0)
|
457
|
+
elsif hvac_schedule.to_ScheduleConstant.is_initialized
|
458
|
+
hvac_schedule = hvac_schedule.to_ScheduleConstant.get
|
459
|
+
on_schedule = OpenStudio::Model::ScheduleConstant.new(model)
|
460
|
+
on_schedule.setName("Infiltration HVAC On Schedule")
|
461
|
+
on_schedule.setValue(hvac_schedule.value)
|
462
|
+
off_schedule = OpenStudio::Model::ScheduleConstant.new(model)
|
463
|
+
off_schedule.setName("Infiltration HVAC Off Schedule")
|
464
|
+
if hvac_schedule.value > 0
|
465
|
+
off_schedule.setValue(0.0)
|
466
|
+
else
|
467
|
+
off_schedule.setValue(1.0)
|
468
|
+
end
|
469
|
+
elsif hvac_schedule.to_ScheduleRuleset.is_initialized
|
470
|
+
hvac_schedule = hvac_schedule.to_ScheduleRuleset.get
|
471
|
+
on_schedule = hvac_schedule.clone.to_ScheduleRuleset.get
|
472
|
+
on_schedule.setName("Infiltration HVAC On Schedule")
|
473
|
+
off_schedule = invert_schedule_ruleset(hvac_schedule, 'Infiltration HVAC Off Schedule')
|
474
|
+
end
|
475
|
+
|
476
|
+
# validate climate zone
|
477
|
+
if climate_zone == 'Lookup From Model'
|
478
|
+
climate_zone = ''
|
479
|
+
model.getClimateZones.climateZones.each do |cz|
|
480
|
+
next if cz.value == ''
|
481
|
+
cz_institution = cz.institution
|
482
|
+
if cz_institution == 'ASHRAE'
|
483
|
+
climate_zone = cz.value
|
484
|
+
climate_zone = climate_zone.gsub('ASHRAE 169-2006-','')
|
485
|
+
climate_zone = climate_zone.gsub('ASHRAE 169-2013-','')
|
486
|
+
climate_zone = climate_zone.gsub('ASHRAE 169-2020-','')
|
487
|
+
climate_zone = climate_zone.gsub('ASHRAE 169-2021-','')
|
488
|
+
elsif cz_institution == 'CEC'
|
489
|
+
california_cz = cz.value.gsub('CEC','')
|
490
|
+
case california_cz
|
491
|
+
when '1'
|
492
|
+
climate_zone = '4B'
|
493
|
+
when '2','3','4','5','6'
|
494
|
+
climate_zone = '3C'
|
495
|
+
when '7','8','9','10','11','12','13','14'
|
496
|
+
climate_zone = '3B'
|
497
|
+
when '15'
|
498
|
+
climate_zone = '2B'
|
499
|
+
when '16'
|
500
|
+
climate_zone = '5B'
|
501
|
+
end
|
502
|
+
runner.registerWarning("Using ASHRAE climate zone #{climate_zone} for California climate zone #{california_cz}.")
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
if climate_zone == ''
|
507
|
+
runner.registerError('Unable to determine an ASHRAE climate zone for the model. An ASHRAE climate zone value is necessary to lookup the coefficients.')
|
508
|
+
return false
|
509
|
+
end
|
510
|
+
|
511
|
+
runner.registerInfo("Using climate zone #{climate_zone} from model.")
|
512
|
+
else
|
513
|
+
runner.registerInfo("Using climate zone #{climate_zone} from user arguments.")
|
514
|
+
end
|
515
|
+
|
516
|
+
# get climate zone number
|
517
|
+
climate_zone_number = climate_zone.delete('^0-9').to_i
|
518
|
+
|
519
|
+
# validate building type
|
520
|
+
if building_type == 'Lookup From Model'
|
521
|
+
|
522
|
+
# get building type from the model
|
523
|
+
building_type_data = infer_nist_building_type(model)
|
524
|
+
model_building_type = building_type_data['model_building_type']
|
525
|
+
nist_building_type = building_type_data['nist_building_type']
|
526
|
+
building_type = nist_building_type
|
527
|
+
|
528
|
+
# check that model building type is supported
|
529
|
+
unless nist_building_types.include? nist_building_type
|
530
|
+
runner.registerError("NIST coefficients are not available for model building type #{nist_building_type}.")
|
531
|
+
return false
|
532
|
+
end
|
533
|
+
|
534
|
+
# warn the user if the model building type is different from support nist building types
|
535
|
+
unless model_building_type == nist_building_type
|
536
|
+
runner.registerWarning("Using building type #{building_type} for model building type #{model_building_type}.")
|
537
|
+
else
|
538
|
+
runner.registerInfo("Using building type #{building_type} from model.")
|
539
|
+
end
|
540
|
+
else
|
541
|
+
runner.registerInfo("Using building type #{building_type} from user arguments.")
|
542
|
+
end
|
543
|
+
|
544
|
+
# remove existing infiltration objects
|
545
|
+
runner.registerInitialCondition("The modeled started with #{model.getSpaceInfiltrationDesignFlowRates.size} infiltration objects and #{model.getSpaceInfiltrationEffectiveLeakageAreas.size} effective leakage area objects.")
|
546
|
+
model.getSpaceInfiltrationDesignFlowRates.each(&:remove)
|
547
|
+
model.getSpaceInfiltrationEffectiveLeakageAreas.each(&:remove)
|
548
|
+
|
549
|
+
# load NIST infiltration correlations file and convert to hash table
|
550
|
+
nist_infiltration_correlations_csv = "#{File.dirname(__FILE__)}/resources/Data-NISTInfiltrationCorrelations.csv"
|
551
|
+
if not File.file?(nist_infiltration_correlations_csv)
|
552
|
+
runner.registerError("Unable to find file: #{nist_infiltration_correlations_csv}")
|
553
|
+
return nil
|
554
|
+
end
|
555
|
+
coefficients_tbl = CSV.table(nist_infiltration_correlations_csv)
|
556
|
+
coefficients_hsh = coefficients_tbl.map { |row| row.to_hash }
|
557
|
+
|
558
|
+
# select down to building type and climate zone
|
559
|
+
coefficients = coefficients_hsh.select { |r| (r[:building_type] == building_type) && (r[:climate_zone] == climate_zone_number) }
|
560
|
+
|
561
|
+
# filter by air barrier
|
562
|
+
if air_barrier
|
563
|
+
coefficients = coefficients.select { |r| r[:air_barrier] == 'yes'}
|
564
|
+
else
|
565
|
+
coefficients = coefficients.select { |r| r[:air_barrier] == 'no'}
|
566
|
+
end
|
567
|
+
|
568
|
+
# determine coefficients
|
569
|
+
# if no off coefficients are defined, use 0 for a and the on coefficients for b and d
|
570
|
+
on_coefficients = coefficients.select { |r| r[:hvac_status] == 'on'}
|
571
|
+
off_coefficients = coefficients.select { |r| r[:hvac_status] == 'off'}
|
572
|
+
a_on = on_coefficients[0][:a]
|
573
|
+
b_on = on_coefficients[0][:b]
|
574
|
+
d_on = on_coefficients[0][:d]
|
575
|
+
a_off = off_coefficients[0][:a].nil? ? on_coefficients[0][:a] : off_coefficients[0][:a]
|
576
|
+
b_off = off_coefficients[0][:b].nil? ? on_coefficients[0][:b] : off_coefficients[0][:b]
|
577
|
+
d_off = off_coefficients[0][:d].nil? ? on_coefficients[0][:d] : off_coefficients[0][:d]
|
578
|
+
|
579
|
+
# add new infiltration objects
|
580
|
+
# define infiltration as flow per exterior area
|
581
|
+
model.getSpaces.each do |space|
|
582
|
+
next unless space.exteriorArea > 0.0
|
583
|
+
|
584
|
+
hvac_on_infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
|
585
|
+
hvac_on_infiltration.setName("#{space.name.get} HVAC On Infiltration")
|
586
|
+
hvac_on_infiltration.setFlowperExteriorSurfaceArea(design_infiltration_4pa)
|
587
|
+
hvac_on_infiltration.setConstantTermCoefficient(a_on)
|
588
|
+
hvac_on_infiltration.setTemperatureTermCoefficient(b_on)
|
589
|
+
hvac_on_infiltration.setVelocityTermCoefficient(0.0)
|
590
|
+
hvac_on_infiltration.setVelocitySquaredTermCoefficient(d_on)
|
591
|
+
hvac_on_infiltration.setSpace(space)
|
592
|
+
hvac_on_infiltration.setSchedule(on_schedule)
|
593
|
+
|
594
|
+
hvac_off_infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
|
595
|
+
hvac_off_infiltration.setName("#{space.name.get} HVAC Off Infiltration")
|
596
|
+
hvac_off_infiltration.setFlowperExteriorSurfaceArea(design_infiltration_4pa)
|
597
|
+
hvac_off_infiltration.setConstantTermCoefficient(a_off)
|
598
|
+
hvac_off_infiltration.setTemperatureTermCoefficient(b_off)
|
599
|
+
hvac_off_infiltration.setVelocityTermCoefficient(0.0)
|
600
|
+
hvac_off_infiltration.setVelocitySquaredTermCoefficient(d_off)
|
601
|
+
hvac_off_infiltration.setSpace(space)
|
602
|
+
hvac_off_infiltration.setSchedule(off_schedule)
|
603
|
+
|
604
|
+
end
|
605
|
+
|
606
|
+
runner.registerFinalCondition("The modeled finished with #{model.getSpaceInfiltrationDesignFlowRates.size} infiltration objects.")
|
607
|
+
|
608
|
+
return true
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
# register the measure to be used by the application
|
613
|
+
SetNISTInfiltrationCorrelations.new.registerWithApplication
|