openstudio-model-articulation 0.8.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +12 -5
  4. data/Jenkinsfile +1 -1
  5. data/README.md +2 -0
  6. data/lib/measures/SimplifyGeometryToSlicedBar/measure.rb +32 -37
  7. data/lib/measures/SimplifyGeometryToSlicedBar/measure.xml +34 -80
  8. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_cofee.rb +10 -9
  9. data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.rb +10 -13
  10. data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.xml +28 -28
  11. data/lib/measures/blended_space_type_from_floor_area_ratios/measure.rb +31 -14
  12. data/lib/measures/blended_space_type_from_floor_area_ratios/measure.xml +36 -36
  13. data/lib/measures/blended_space_type_from_model/measure.rb +12 -5
  14. data/lib/measures/blended_space_type_from_model/measure.xml +47 -47
  15. data/lib/measures/create_DOE_prototype_building/measure.rb +1 -1
  16. data/lib/measures/create_DOE_prototype_building/measure.xml +19 -875
  17. data/lib/measures/create_bar_from_building_type_ratios/README.md +2 -13
  18. data/lib/measures/create_bar_from_building_type_ratios/measure.rb +122 -30
  19. data/lib/measures/create_bar_from_building_type_ratios/measure.xml +108 -349
  20. data/lib/measures/create_bar_from_deer_building_type_ratios/README.md +21 -1
  21. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.rb +120 -18
  22. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.xml +94 -32
  23. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.rb +127 -18
  24. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.xml +48 -26
  25. data/lib/measures/create_bar_from_model/measure.rb +17 -18
  26. data/lib/measures/create_bar_from_model/measure.xml +41 -41
  27. data/lib/measures/create_bar_from_space_type_ratios/README.md +1 -1
  28. data/lib/measures/create_bar_from_space_type_ratios/measure.rb +94 -14
  29. data/lib/measures/create_bar_from_space_type_ratios/measure.xml +104 -63
  30. data/lib/measures/create_baseline_building/measure.xml +33 -33
  31. data/lib/measures/create_deer_prototype_building/measure.xml +15 -15
  32. data/lib/measures/create_parametric_schedules/measure.rb +17 -20
  33. data/lib/measures/create_parametric_schedules/measure.xml +15 -15
  34. data/lib/measures/create_typical_building_from_model/README.md +16 -16
  35. data/lib/measures/create_typical_building_from_model/measure.rb +84 -18
  36. data/lib/measures/create_typical_building_from_model/measure.xml +159 -211
  37. data/lib/measures/create_typical_deer_building_from_model/README.md +38 -5
  38. data/lib/measures/create_typical_deer_building_from_model/measure.rb +84 -12
  39. data/lib/measures/create_typical_deer_building_from_model/measure.xml +165 -65
  40. data/lib/measures/create_typical_doe_building_from_model/README.md +17 -4
  41. data/lib/measures/create_typical_doe_building_from_model/measure.rb +84 -12
  42. data/lib/measures/create_typical_doe_building_from_model/measure.xml +125 -65
  43. data/lib/measures/deer_space_type_and_construction_set_wizard/measure.rb +13 -16
  44. data/lib/measures/deer_space_type_and_construction_set_wizard/measure.xml +72 -29
  45. data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.rb +4 -4
  46. data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.xml +21 -21
  47. data/lib/measures/merge_spaces_from_external_file/measure.rb +4 -4
  48. data/lib/measures/merge_spaces_from_external_file/measure.xml +34 -34
  49. data/lib/measures/radiant_slab_with_doas/README.md +0 -8
  50. data/lib/measures/radiant_slab_with_doas/measure.rb +2 -11
  51. data/lib/measures/radiant_slab_with_doas/measure.xml +31 -40
  52. data/lib/measures/replace_geometry_by_story/measure.rb +6 -10
  53. data/lib/measures/replace_geometry_by_story/measure.xml +19 -19
  54. data/lib/measures/set_nist_infiltration_correlations/measure.rb +34 -25
  55. data/lib/measures/set_nist_infiltration_correlations/measure.xml +38 -38
  56. data/lib/openstudio/model_articulation/version.rb +1 -1
  57. data/openstudio-model-articulation.gemspec +11 -4
  58. metadata +69 -16
  59. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_geometry.rb +0 -1174
  60. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_helper_methods.rb +0 -367
  61. data/lib/measures/create_typical_building_from_model/resources/Model.hvac.rb +0 -608
@@ -8,20 +8,8 @@
8
8
 
9
9
  require 'openstudio-standards'
10
10
 
11
- # load OpenStudio measure libraries from openstudio-extension gem
12
- require 'openstudio-extension'
13
- require 'openstudio/extension/core/os_lib_helper_methods'
14
- require 'openstudio/extension/core/os_lib_geometry'
15
- require 'openstudio/extension/core/os_lib_model_generation'
16
- require 'openstudio/extension/core/os_lib_model_simplification'
17
-
18
11
  # start the measure
19
12
  class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
20
- # resource file modules
21
- include OsLib_HelperMethods
22
- include OsLib_Geometry
23
- include OsLib_ModelGeneration
24
- include OsLib_ModelSimplification
25
13
 
26
14
  # human readable name
27
15
  def name
@@ -43,18 +31,88 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
43
31
  return 'Envelope.Form'
44
32
  end
45
33
 
34
+ # remove existing non resource objects from the model
35
+ # technically thermostats and building stories are resources but still want to remove them.
36
+ def remove_non_resource_objects(runner, model, options = nil)
37
+ if options.nil?
38
+ options = {}
39
+ options[:remove_building_stories] = true
40
+ options[:remove_thermostats] = true
41
+ options[:remove_air_loops] = true
42
+ options[:remove_non_swh_plant_loops] = true
43
+
44
+ # leave these in by default unless requsted when method called
45
+ options[:remove_swh_plant_loops] = false
46
+ options[:remove_exterior_lights] = false
47
+ options[:remove_site_shading] = false
48
+ end
49
+
50
+ num_model_objects = model.objects.size
51
+
52
+ # remove non-resource objects not removed by removing the building
53
+ if options[:remove_building_stories] then model.getBuildingStorys.each(&:remove) end
54
+ if options[:remove_thermostats] then model.getThermostats.each(&:remove) end
55
+ if options[:remove_air_loops] then model.getAirLoopHVACs.each(&:remove) end
56
+ if options[:remove_exterior_lights] then model.getFacility.exteriorLights.each(&:remove) end
57
+ if options[:remove_site_shading] then model.getSite.shadingSurfaceGroups.each(&:remove) end
58
+
59
+ # see if plant loop is swh or not and take proper action (booter loop doesn't have water use equipment)
60
+ model.getPlantLoops.each do |plant_loop|
61
+ is_swh_loop = false
62
+ plant_loop.supplyComponents.each do |component|
63
+ if component.to_WaterHeaterMixed.is_initialized
64
+ is_swh_loop = true
65
+ next
66
+ end
67
+ end
68
+
69
+ if is_swh_loop
70
+ if options[:remove_swh_plant_loops] then plant_loop.remove end
71
+ else
72
+ if options[:remove_non_swh_plant_loops] then plant_loop.remove end
73
+ end
74
+ end
75
+
76
+ # remove water use connections (may be removed when loop is removed)
77
+ if options[:remove_swh_plant_loops] then model.getWaterConnectionss.each(&:remove) end
78
+ if options[:remove_swh_plant_loops] then model.getWaterUseEquipments.each(&:remove) end
79
+
80
+ # remove building but reset fields on new building object.
81
+ building_fields = []
82
+ building = model.getBuilding
83
+ num_fields = building.numFields
84
+ num_fields.times.each do |i|
85
+ building_fields << building.getString(i).get
86
+ end
87
+ # removes spaces, space's child objects, thermal zones, zone equipment, non site surfaces, building stories and water use connections.
88
+ model.getBuilding.remove
89
+ building = model.getBuilding
90
+ num_fields.times.each do |i|
91
+ next if i == 0 # don't try and set handle
92
+ building_fields << building.setString(i, building_fields[i])
93
+ end
94
+
95
+ # other than optionally site shading and exterior lights not messing with site characteristics
96
+
97
+ if num_model_objects - model.objects.size > 0
98
+ runner.registerInfo("Removed #{num_model_objects - model.objects.size} non resource objects from the model.")
99
+ end
100
+
101
+ return true
102
+ end
103
+
46
104
  # define the arguments that the user will input
47
105
  def arguments(model)
48
106
  args = OpenStudio::Measure::OSArgumentVector.new
49
107
 
50
108
  # Make an argument for the bldg_type_a
51
- bldg_type_a = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_a', get_doe_building_types, true)
109
+ bldg_type_a = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_a', OpenstudioStandards::CreateTypical.get_doe_building_types, true)
52
110
  bldg_type_a.setDisplayName('Primary Building Type')
53
111
  bldg_type_a.setDefaultValue('SmallOffice')
54
112
  args << bldg_type_a
55
113
 
56
114
  # Make an argument for the bldg_type_b
57
- bldg_type_b = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_b', get_doe_building_types, true)
115
+ bldg_type_b = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_b', OpenstudioStandards::CreateTypical.get_doe_building_types, true)
58
116
  bldg_type_b.setDisplayName('Building Type B')
59
117
  bldg_type_b.setDefaultValue('SmallOffice')
60
118
  args << bldg_type_b
@@ -63,10 +121,12 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
63
121
  bldg_type_b_fract_bldg_area = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_b_fract_bldg_area', true)
64
122
  bldg_type_b_fract_bldg_area.setDisplayName('Building Type B Fraction of Building Floor Area')
65
123
  bldg_type_b_fract_bldg_area.setDefaultValue(0.0)
124
+ bldg_type_b_fract_bldg_area.setMinValue(0.0)
125
+ bldg_type_b_fract_bldg_area.setMaxValue(1.0)
66
126
  args << bldg_type_b_fract_bldg_area
67
127
 
68
128
  # Make an argument for the bldg_type_c
69
- bldg_type_c = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_c', get_doe_building_types, true)
129
+ bldg_type_c = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_c', OpenstudioStandards::CreateTypical.get_doe_building_types, true)
70
130
  bldg_type_c.setDisplayName('Building Type C')
71
131
  bldg_type_c.setDefaultValue('SmallOffice')
72
132
  args << bldg_type_c
@@ -75,10 +135,12 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
75
135
  bldg_type_c_fract_bldg_area = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_c_fract_bldg_area', true)
76
136
  bldg_type_c_fract_bldg_area.setDisplayName('Building Type C Fraction of Building Floor Area')
77
137
  bldg_type_c_fract_bldg_area.setDefaultValue(0.0)
138
+ bldg_type_c_fract_bldg_area.setMinValue(0.0)
139
+ bldg_type_c_fract_bldg_area.setMaxValue(1.0)
78
140
  args << bldg_type_c_fract_bldg_area
79
141
 
80
142
  # Make an argument for the bldg_type_d
81
- bldg_type_d = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_d', get_doe_building_types, true)
143
+ bldg_type_d = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_d', OpenstudioStandards::CreateTypical.get_doe_building_types, true)
82
144
  bldg_type_d.setDisplayName('Building Type D')
83
145
  bldg_type_d.setDefaultValue('SmallOffice')
84
146
  args << bldg_type_d
@@ -87,6 +149,8 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
87
149
  bldg_type_d_fract_bldg_area = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_d_fract_bldg_area', true)
88
150
  bldg_type_d_fract_bldg_area.setDisplayName('Building Type D Fraction of Building Floor Area')
89
151
  bldg_type_d_fract_bldg_area.setDefaultValue(0.0)
152
+ bldg_type_d_fract_bldg_area.setMinValue(0.0)
153
+ bldg_type_d_fract_bldg_area.setMaxValue(1.0)
90
154
  args << bldg_type_d_fract_bldg_area
91
155
 
92
156
  # Make argument for total_bldg_floor_area
@@ -94,6 +158,8 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
94
158
  total_bldg_floor_area.setDisplayName('Total Building Floor Area')
95
159
  total_bldg_floor_area.setUnits('ft^2')
96
160
  total_bldg_floor_area.setDefaultValue(10000.0)
161
+ total_bldg_floor_area.setMinValue(0.0)
162
+ total_bldg_floor_area.setMinValue(0.0)
97
163
  args << total_bldg_floor_area
98
164
 
99
165
  # Make argument for single_floor_area
@@ -102,6 +168,8 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
102
168
  single_floor_area.setDescription('Non-zero value will fix the single floor area, overriding a user entry for Total Building Floor Area')
103
169
  single_floor_area.setUnits('ft^2')
104
170
  single_floor_area.setDefaultValue(0.0)
171
+ single_floor_area.setMinValue(0.0)
172
+ single_floor_area.setMinValue(0.0)
105
173
  args << single_floor_area
106
174
 
107
175
  # Make argument for floor_height
@@ -110,6 +178,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
110
178
  floor_height.setDescription('Selecting a typical floor height of 0 will trigger a smart building type default.')
111
179
  floor_height.setUnits('ft')
112
180
  floor_height.setDefaultValue(0.0)
181
+ floor_height.setMinValue(0.0)
113
182
  args << floor_height
114
183
 
115
184
  # add argument to enable/disable multi custom space height bar
@@ -123,12 +192,14 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
123
192
  num_stories_above_grade = OpenStudio::Measure::OSArgument.makeDoubleArgument('num_stories_above_grade', true)
124
193
  num_stories_above_grade.setDisplayName('Number of Stories Above Grade')
125
194
  num_stories_above_grade.setDefaultValue(1.0)
195
+ num_stories_above_grade.setMinValue(1.0)
126
196
  args << num_stories_above_grade
127
197
 
128
198
  # Make argument for num_stories_below_grade
129
199
  num_stories_below_grade = OpenStudio::Measure::OSArgument.makeIntegerArgument('num_stories_below_grade', true)
130
200
  num_stories_below_grade.setDisplayName('Number of Stories Below Grade')
131
201
  num_stories_below_grade.setDefaultValue(0)
202
+ num_stories_below_grade.setMinValue(0)
132
203
  args << num_stories_below_grade
133
204
 
134
205
  # Make argument for building_rotation
@@ -140,7 +211,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
140
211
  args << building_rotation
141
212
 
142
213
  # Make argument for template
143
- template = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(false), true)
214
+ template = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', OpenstudioStandards::CreateTypical.get_doe_templates(false), true)
144
215
  template.setDisplayName('Target Standard')
145
216
  template.setDefaultValue('90.1-2004')
146
217
  args << template
@@ -150,6 +221,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
150
221
  ns_to_ew_ratio.setDisplayName('Ratio of North/South Facade Length Relative to East/West Facade Length')
151
222
  ns_to_ew_ratio.setDescription('Selecting an aspect ratio of 0 will trigger a smart building type default. Aspect ratios less than one are not recommended for sliced bar geometry, instead rotate building and use a greater than 1 aspect ratio.')
152
223
  ns_to_ew_ratio.setDefaultValue(0.0)
224
+ ns_to_ew_ratio.setMinValue(0.0)
153
225
  args << ns_to_ew_ratio
154
226
 
155
227
  # Make argument for perim_mult
@@ -157,6 +229,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
157
229
  perim_mult.setDisplayName('Perimeter Multiplier')
158
230
  perim_mult.setDescription('Selecting a value of 0 will trigger a smart building type default. This represents a multiplier for the building perimeter relative to the perimeter of a rectangular building that meets the area and aspect ratio inputs. Other than the smart default of 0.0 this argument should have a value of 1.0 or higher and is only applicable Multiple Space Types - Individual Stories Sliced division method.')
159
231
  perim_mult.setDefaultValue(0.0)
232
+ perim_mult.setMinValue(0.0)
160
233
  args << perim_mult
161
234
 
162
235
  # Make argument for bar_width
@@ -165,6 +238,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
165
238
  bar_width.setDescription('Non-zero value will fix the building width, overriding user entry for Perimeter Multiplier. NS/EW Aspect Ratio may be limited based on target width.')
166
239
  bar_width.setUnits('ft')
167
240
  bar_width.setDefaultValue(0.0)
241
+ bar_width.setMinValue(0.0)
168
242
  args << bar_width
169
243
 
170
244
  # Make argument for bar_sep_dist_mult
@@ -179,6 +253,8 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
179
253
  wwr.setDisplayName('Window to Wall Ratio')
180
254
  wwr.setDescription('Selecting a window to wall ratio of 0 will trigger a smart building type default.')
181
255
  wwr.setDefaultValue(0.0)
256
+ wwr.setMinValue(0.0)
257
+ wwr.setMaxValue(1.0)
182
258
  args << wwr
183
259
 
184
260
  # Make argument for party_wall_fraction
@@ -186,6 +262,8 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
186
262
  party_wall_fraction.setDisplayName('Fraction of Exterior Wall Area with Adjacent Structure')
187
263
  party_wall_fraction.setDescription('This will impact how many above grade exterior walls are modeled with adiabatic boundary condition.')
188
264
  party_wall_fraction.setDefaultValue(0.0)
265
+ party_wall_fraction.setMinValue(0.0)
266
+ party_wall_fraction.setMaxValue(1.0)
189
267
  args << party_wall_fraction
190
268
 
191
269
  # party_wall_fraction was used where we wanted to represent some party walls but didn't know where they are, it ends up using methods to make whole surfaces adiabiatc by story and orientaiton to try to come close to requested fraction
@@ -195,6 +273,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
195
273
  party_wall_stories_north.setDisplayName('Number of North facing stories with party wall')
196
274
  party_wall_stories_north.setDescription('This will impact how many above grade exterior north walls are modeled with adiabatic boundary condition. If this is less than the number of above grade stoes, upper flor will reamin exterior')
197
275
  party_wall_stories_north.setDefaultValue(0)
276
+ party_wall_stories_north.setMinValue(0)
198
277
  args << party_wall_stories_north
199
278
 
200
279
  # Make argument for party_wall_stories_south
@@ -202,6 +281,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
202
281
  party_wall_stories_south.setDisplayName('Number of South facing stories with party wall')
203
282
  party_wall_stories_south.setDescription('This will impact how many above grade exterior south walls are modeled with adiabatic boundary condition. If this is less than the number of above grade stoes, upper flor will reamin exterior')
204
283
  party_wall_stories_south.setDefaultValue(0)
284
+ party_wall_stories_south.setMinValue(0)
205
285
  args << party_wall_stories_south
206
286
 
207
287
  # Make argument for party_wall_stories_east
@@ -209,6 +289,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
209
289
  party_wall_stories_east.setDisplayName('Number of East facing stories with party wall')
210
290
  party_wall_stories_east.setDescription('This will impact how many above grade exterior east walls are modeled with adiabatic boundary condition. If this is less than the number of above grade stoes, upper flor will reamin exterior')
211
291
  party_wall_stories_east.setDefaultValue(0)
292
+ party_wall_stories_east.setMinValue(0)
212
293
  args << party_wall_stories_east
213
294
 
214
295
  # Make argument for party_wall_stories_west
@@ -216,6 +297,7 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
216
297
  party_wall_stories_west.setDisplayName('Number of West facing stories with party wall')
217
298
  party_wall_stories_west.setDescription('This will impact how many above grade exterior west walls are modeled with adiabatic boundary condition. If this is less than the number of above grade stoes, upper flor will reamin exterior')
218
299
  party_wall_stories_west.setDefaultValue(0)
300
+ party_wall_stories_west.setMinValue(0)
219
301
  args << party_wall_stories_west
220
302
 
221
303
  # make an argument for bottom_story_ground_exposed_floor
@@ -299,10 +381,37 @@ class CreateBarFromDOEBuildingTypeRatios < OpenStudio::Measure::ModelMeasure
299
381
  def run(model, runner, user_arguments)
300
382
  super(model, runner, user_arguments)
301
383
 
384
+ # use the built-in error checking
385
+ if !runner.validateUserArguments(arguments(model), user_arguments)
386
+ return false
387
+ end
388
+
389
+ # assign the user inputs to variables
390
+ args = runner.getArgumentValues(arguments(model), user_arguments)
391
+ args = Hash[args.collect{ |k, v| [k.to_sym, v] }]
392
+ if !args then return false end
393
+
394
+ # todo - need to make use of this before pass to standards
395
+ use_upstream_args = args['use_upstream_args']
396
+
397
+ # open channel to log messages
398
+ reset_log
399
+
400
+ # Turn debugging output on/off
401
+ debug = false
402
+
403
+ # remove_non_resource_objects (this was not moved to standards, so added method in measure for now)
404
+ remove_non_resource_objects(runner, model)
405
+
302
406
  # method run from os_lib_model_generation.rb
303
- result = bar_from_building_type_ratios(model, runner, user_arguments)
407
+ result = OpenstudioStandards::Geometry.create_bar_from_building_type_ratios(model, args)
408
+
409
+ # gather log
410
+ log_messages_to_runner(runner, debug)
411
+ reset_log
304
412
 
305
413
  if result == false
414
+ runner.registerError("Measure did not complete successfully")
306
415
  return false
307
416
  else
308
417
  return true
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0"?>
2
2
  <measure>
3
- <schema_version>3.0</schema_version>
3
+ <schema_version>3.1</schema_version>
4
4
  <name>create_bar_from_doe_building_type_ratios</name>
5
5
  <uid>0de3cff9-c805-42c4-964e-18cb43a22c63</uid>
6
- <version_id>3e2454d3-911f-429e-9e9a-5d0503f70728</version_id>
7
- <version_modified>20230602T160046Z</version_modified>
6
+ <version_id>26190672-6d0c-473a-bb0f-2824642ff02f</version_id>
7
+ <version_modified>2024-07-09T16:03:28Z</version_modified>
8
8
  <xml_checksum>5F523097</xml_checksum>
9
9
  <class_name>CreateBarFromDOEBuildingTypeRatios</class_name>
10
10
  <display_name>Create Bar From DOE Building Type Ratios</display_name>
@@ -230,6 +230,8 @@
230
230
  <required>true</required>
231
231
  <model_dependent>false</model_dependent>
232
232
  <default_value>0</default_value>
233
+ <min_value>0.000000</min_value>
234
+ <max_value>1.000000</max_value>
233
235
  </argument>
234
236
  <argument>
235
237
  <name>bldg_type_c</name>
@@ -344,6 +346,8 @@
344
346
  <required>true</required>
345
347
  <model_dependent>false</model_dependent>
346
348
  <default_value>0</default_value>
349
+ <min_value>0.000000</min_value>
350
+ <max_value>1.000000</max_value>
347
351
  </argument>
348
352
  <argument>
349
353
  <name>bldg_type_d</name>
@@ -458,6 +462,8 @@
458
462
  <required>true</required>
459
463
  <model_dependent>false</model_dependent>
460
464
  <default_value>0</default_value>
465
+ <min_value>0.000000</min_value>
466
+ <max_value>1.000000</max_value>
461
467
  </argument>
462
468
  <argument>
463
469
  <name>total_bldg_floor_area</name>
@@ -467,6 +473,7 @@
467
473
  <required>true</required>
468
474
  <model_dependent>false</model_dependent>
469
475
  <default_value>10000</default_value>
476
+ <min_value>0.000000</min_value>
470
477
  </argument>
471
478
  <argument>
472
479
  <name>single_floor_area</name>
@@ -477,6 +484,7 @@
477
484
  <required>true</required>
478
485
  <model_dependent>false</model_dependent>
479
486
  <default_value>0</default_value>
487
+ <min_value>0.000000</min_value>
480
488
  </argument>
481
489
  <argument>
482
490
  <name>floor_height</name>
@@ -487,6 +495,7 @@
487
495
  <required>true</required>
488
496
  <model_dependent>false</model_dependent>
489
497
  <default_value>0</default_value>
498
+ <min_value>0.000000</min_value>
490
499
  </argument>
491
500
  <argument>
492
501
  <name>custom_height_bar</name>
@@ -514,6 +523,7 @@
514
523
  <required>true</required>
515
524
  <model_dependent>false</model_dependent>
516
525
  <default_value>1</default_value>
526
+ <min_value>1.000000</min_value>
517
527
  </argument>
518
528
  <argument>
519
529
  <name>num_stories_below_grade</name>
@@ -522,6 +532,7 @@
522
532
  <required>true</required>
523
533
  <model_dependent>false</model_dependent>
524
534
  <default_value>0</default_value>
535
+ <min_value>0</min_value>
525
536
  </argument>
526
537
  <argument>
527
538
  <name>building_rotation</name>
@@ -615,6 +626,7 @@
615
626
  <required>true</required>
616
627
  <model_dependent>false</model_dependent>
617
628
  <default_value>0</default_value>
629
+ <min_value>0.000000</min_value>
618
630
  </argument>
619
631
  <argument>
620
632
  <name>perim_mult</name>
@@ -624,6 +636,7 @@
624
636
  <required>true</required>
625
637
  <model_dependent>false</model_dependent>
626
638
  <default_value>0</default_value>
639
+ <min_value>0.000000</min_value>
627
640
  </argument>
628
641
  <argument>
629
642
  <name>bar_width</name>
@@ -634,6 +647,7 @@
634
647
  <required>true</required>
635
648
  <model_dependent>false</model_dependent>
636
649
  <default_value>0</default_value>
650
+ <min_value>0.000000</min_value>
637
651
  </argument>
638
652
  <argument>
639
653
  <name>bar_sep_dist_mult</name>
@@ -652,6 +666,8 @@
652
666
  <required>true</required>
653
667
  <model_dependent>false</model_dependent>
654
668
  <default_value>0</default_value>
669
+ <min_value>0.000000</min_value>
670
+ <max_value>1.000000</max_value>
655
671
  </argument>
656
672
  <argument>
657
673
  <name>party_wall_fraction</name>
@@ -661,6 +677,8 @@
661
677
  <required>true</required>
662
678
  <model_dependent>false</model_dependent>
663
679
  <default_value>0</default_value>
680
+ <min_value>0.000000</min_value>
681
+ <max_value>1.000000</max_value>
664
682
  </argument>
665
683
  <argument>
666
684
  <name>party_wall_stories_north</name>
@@ -670,6 +688,7 @@
670
688
  <required>true</required>
671
689
  <model_dependent>false</model_dependent>
672
690
  <default_value>0</default_value>
691
+ <min_value>0</min_value>
673
692
  </argument>
674
693
  <argument>
675
694
  <name>party_wall_stories_south</name>
@@ -679,6 +698,7 @@
679
698
  <required>true</required>
680
699
  <model_dependent>false</model_dependent>
681
700
  <default_value>0</default_value>
701
+ <min_value>0</min_value>
682
702
  </argument>
683
703
  <argument>
684
704
  <name>party_wall_stories_east</name>
@@ -688,6 +708,7 @@
688
708
  <required>true</required>
689
709
  <model_dependent>false</model_dependent>
690
710
  <default_value>0</default_value>
711
+ <min_value>0</min_value>
691
712
  </argument>
692
713
  <argument>
693
714
  <name>party_wall_stories_west</name>
@@ -697,6 +718,7 @@
697
718
  <required>true</required>
698
719
  <model_dependent>false</model_dependent>
699
720
  <default_value>0</default_value>
721
+ <min_value>0</min_value>
700
722
  </argument>
701
723
  <argument>
702
724
  <name>bottom_story_ground_exposed_floor</name>
@@ -897,10 +919,22 @@
897
919
  </attributes>
898
920
  <files>
899
921
  <file>
900
- <filename>example_model.osm</filename>
901
- <filetype>osm</filetype>
902
- <usage_type>test</usage_type>
903
- <checksum>032BCDC9</checksum>
922
+ <filename>LICENSE.md</filename>
923
+ <filetype>md</filetype>
924
+ <usage_type>license</usage_type>
925
+ <checksum>BFFB1AA6</checksum>
926
+ </file>
927
+ <file>
928
+ <filename>README.md</filename>
929
+ <filetype>md</filetype>
930
+ <usage_type>readme</usage_type>
931
+ <checksum>B96F2633</checksum>
932
+ </file>
933
+ <file>
934
+ <filename>README.md.erb</filename>
935
+ <filetype>erb</filetype>
936
+ <usage_type>readmeerb</usage_type>
937
+ <checksum>764EC4D9</checksum>
904
938
  </file>
905
939
  <file>
906
940
  <filename>ar_05.png</filename>
@@ -1028,40 +1062,28 @@
1028
1062
  <usage_type>doc</usage_type>
1029
1063
  <checksum>D1E7B644</checksum>
1030
1064
  </file>
1031
- <file>
1032
- <filename>README.md.erb</filename>
1033
- <filetype>erb</filetype>
1034
- <usage_type>readmeerb</usage_type>
1035
- <checksum>764EC4D9</checksum>
1036
- </file>
1037
- <file>
1038
- <filename>LICENSE.md</filename>
1039
- <filetype>md</filetype>
1040
- <usage_type>license</usage_type>
1041
- <checksum>BFFB1AA6</checksum>
1042
- </file>
1043
1065
  <file>
1044
1066
  <version>
1045
1067
  <software_program>OpenStudio</software_program>
1046
1068
  <identifier>2.0.0</identifier>
1047
- <min_compatible>3.0.0</min_compatible>
1069
+ <min_compatible>3.8.0</min_compatible>
1048
1070
  </version>
1049
1071
  <filename>measure.rb</filename>
1050
1072
  <filetype>rb</filetype>
1051
1073
  <usage_type>script</usage_type>
1052
- <checksum>02329948</checksum>
1074
+ <checksum>AF357BC7</checksum>
1053
1075
  </file>
1054
1076
  <file>
1055
1077
  <filename>create_bar_from_doe_building_type_ratios_test.rb</filename>
1056
1078
  <filetype>rb</filetype>
1057
1079
  <usage_type>test</usage_type>
1058
- <checksum>436246F7</checksum>
1080
+ <checksum>7286FEA7</checksum>
1059
1081
  </file>
1060
1082
  <file>
1061
- <filename>README.md</filename>
1062
- <filetype>md</filetype>
1063
- <usage_type>readme</usage_type>
1064
- <checksum>B96F2633</checksum>
1083
+ <filename>example_model.osm</filename>
1084
+ <filetype>osm</filetype>
1085
+ <usage_type>test</usage_type>
1086
+ <checksum>032BCDC9</checksum>
1065
1087
  </file>
1066
1088
  </files>
1067
1089
  </measure>
@@ -6,20 +6,11 @@
6
6
  # see the URL below for information on how to write OpenStudio measures
7
7
  # http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/
8
8
 
9
- # load OpenStudio measure libraries from openstudio-extension gem
10
- require 'openstudio-extension'
11
- require 'openstudio/extension/core/os_lib_helper_methods'
12
- require 'openstudio/extension/core/os_lib_geometry'
13
- require 'openstudio/extension/core/os_lib_model_generation'
14
- require 'openstudio/extension/core/os_lib_model_simplification'
9
+ # load openstudio-standards gem
10
+ require 'openstudio-standards'
15
11
 
16
12
  # start the measure
17
13
  class CreateBarFromModel < OpenStudio::Measure::ModelMeasure
18
- # resource file modules
19
- include OsLib_HelperMethods
20
- include OsLib_Geometry
21
- include OsLib_ModelGeneration
22
- include OsLib_ModelSimplification
23
14
 
24
15
  # human readable name
25
16
  def name
@@ -90,7 +81,7 @@ class CreateBarFromModel < OpenStudio::Measure::ModelMeasure
90
81
  runner.registerInitialCondition("The building started with #{model.getSpaces.size} spaces.")
91
82
 
92
83
  # gather_envelope_data
93
- envelope_data_hash = gather_envelope_data(runner, model)
84
+ envelope_data_hash = OpenstudioStandards::Geometry.model_envelope_data(model)
94
85
 
95
86
  # report summary of initial geometry
96
87
  runner.registerValue('rotation', envelope_data_hash[:north_axis], 'degrees')
@@ -274,11 +265,11 @@ class CreateBarFromModel < OpenStudio::Measure::ModelMeasure
274
265
  # define length and with of bar
275
266
  case bar_calc_method
276
267
  when 'Bar - Reduced Bounding Box'
277
- bar_calc = calc_bar_reduced_bounding_box(envelope_data_hash)
268
+ bar_calc = OpenstudioStandards::Geometry.bar_reduced_bounding_box(envelope_data_hash)
278
269
  when 'Bar - Reduced Width'
279
- bar_calc = calc_bar_reduced_width(envelope_data_hash)
270
+ bar_calc = OpenstudioStandards::Geometry.bar_reduced_width(envelope_data_hash)
280
271
  when 'Bar - Stretched'
281
- bar_calc = calc_bar_stretched(envelope_data_hash)
272
+ bar_calc = OpenstudioStandards::Geometry.bar_stretched(envelope_data_hash)
282
273
  end
283
274
 
284
275
  # populate bar_hash and create envelope with data from envelope_data_hash and user arguments
@@ -306,11 +297,11 @@ class CreateBarFromModel < OpenStudio::Measure::ModelMeasure
306
297
  # when using create_typical_model with this measure choose None for exhaust makeup air so don't have any dummy exhaust objects
307
298
  model.getFanZoneExhausts.each(&:removeFromThermalZone)
308
299
 
309
- # remove non-resource objects
310
- remove_non_resource_objects(runner, model)
300
+ # remove non-resource objects (this wasn't added to standards which explains some other measure test failures)
301
+ # remove_non_resource_objects(runner, model)
311
302
 
312
303
  # create bar
313
- create_bar(runner, model, bar_hash)
304
+ OpenstudioStandards::Geometry.create_bar(model, bar_hash)
314
305
 
315
306
  # move exhaust from temp zone to large zone in new model
316
307
  zone_hash = {} # key is zone value is floor area. It excludes zones with non 1 multiplier
@@ -343,9 +334,17 @@ class CreateBarFromModel < OpenStudio::Measure::ModelMeasure
343
334
 
344
335
  # restore thermostats for space type saved from old geometry
345
336
  model.getThermalZones.each do |thermal_zone|
337
+
338
+ # todo - figure out why this is happening some times
339
+ if thermal_zone.spaces.size == 0
340
+ runner.registerInfo("Not altering thermostat because thermal zone #{thermal_zone.name} doesn't have any spaces.")
341
+ next
342
+ end
346
343
  next if !thermal_zone.spaces.first.spaceType.is_initialized
347
344
 
348
345
  space_type = thermal_zone.spaces.first.spaceType.get
346
+ next if htg_setpoints[space_type].nil?
347
+ next if clg_setpoints[space_type].nil?
349
348
  new_thermostat = OpenStudio::Model::ThermostatSetpointDualSetpoint.new(model)
350
349
  new_thermostat.setHeatingSetpointTemperatureSchedule(htg_setpoints[space_type])
351
350
  new_thermostat.setCoolingSetpointTemperatureSchedule(clg_setpoints[space_type])