openstudio-model-articulation 0.4.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -1
  3. data/CHANGELOG.md +24 -0
  4. data/Gemfile +2 -2
  5. data/README.md +22 -3
  6. data/lib/measures/AssignConstructionSetToBuilding/measure.xml +10 -10
  7. data/lib/measures/AssignSpaceTypeBySpaceName/measure.xml +27 -9
  8. data/lib/measures/AssignSpaceTypeToBuilding/measure.xml +10 -10
  9. data/lib/measures/AssignSpacesToStories/measure.rb +2 -4
  10. data/lib/measures/AssignSpacesToStories/measure.xml +10 -10
  11. data/lib/measures/BarAspectRatioStudy/measure.rb +2 -1
  12. data/lib/measures/BarAspectRatioStudy/measure.xml +4 -4
  13. data/lib/measures/CleanupSpaceOrigins/measure.rb +3 -0
  14. data/lib/measures/CleanupSpaceOrigins/measure.xml +10 -10
  15. data/lib/measures/FindAndReplaceObjectNames/measure.xml +8 -8
  16. data/lib/measures/InjectOsmGeometryIntoAnExternalIdf/measure.rb +2 -2
  17. data/lib/measures/InjectOsmGeometryIntoAnExternalIdf/measure.xml +22 -4
  18. data/lib/measures/RemoveHardAssignedConstructions/measure.xml +8 -8
  19. data/lib/measures/RenameSpaceSurfacesBasedonParentSpaceandOrientation/measure.xml +37 -7
  20. data/lib/measures/RotateBuilding/measure.xml +8 -8
  21. data/lib/measures/SetExtWallToGroundBoundaryConditionByStory/measure.xml +13 -7
  22. data/lib/measures/SetInteriorWallsAndFloorsToAdiabatic/measure.rb +1 -1
  23. data/lib/measures/SetInteriorWallsAndFloorsToAdiabatic/measure.xml +10 -10
  24. data/lib/measures/SetInteriorWallsToSelectedConstruction/measure.rb +1 -1
  25. data/lib/measures/SetInteriorWallsToSelectedConstruction/measure.xml +10 -10
  26. data/lib/measures/SetWindowToWallRatioByFacade/README.md +11 -0
  27. data/lib/measures/SetWindowToWallRatioByFacade/measure.rb +90 -142
  28. data/lib/measures/SetWindowToWallRatioByFacade/measure.xml +32 -11
  29. data/lib/measures/SetWindowToWallRatioByFacade/resources/functions.rb +176 -0
  30. data/lib/measures/SimplifyGeometryToSlicedBar/measure.rb +8 -4
  31. data/lib/measures/SimplifyGeometryToSlicedBar/measure.xml +31 -13
  32. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_cofee.rb +6 -4
  33. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_geometry.rb +13 -8
  34. data/lib/measures/SimplifyGeometryToSlicedBar/resources/os_lib_helper_methods.rb +2 -4
  35. data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.rb +1 -1
  36. data/lib/measures/SpaceTypeAndConstructionSetWizard/measure.xml +4 -4
  37. data/lib/measures/SurfaceMatching/measure.rb +1 -0
  38. data/lib/measures/SurfaceMatching/measure.xml +10 -10
  39. data/lib/measures/add_empd_material_properties/LICENSE.md +27 -0
  40. data/lib/measures/add_empd_material_properties/README.md +116 -0
  41. data/lib/measures/add_empd_material_properties/README.md.erb +42 -0
  42. data/lib/measures/add_empd_material_properties/docs/.gitkeep +0 -0
  43. data/lib/measures/add_empd_material_properties/measure.rb +247 -0
  44. data/lib/measures/add_empd_material_properties/measure.xml +201 -0
  45. data/lib/measures/blended_space_type_from_floor_area_ratios/measure.rb +4 -3
  46. data/lib/measures/blended_space_type_from_floor_area_ratios/measure.xml +4 -4
  47. data/lib/measures/blended_space_type_from_model/{resources → docs}/replace_occupied_spaces_with_blended_space_type_design_doc.txt +0 -0
  48. data/lib/measures/blended_space_type_from_model/measure.rb +11 -3
  49. data/lib/measures/blended_space_type_from_model/measure.xml +15 -21
  50. data/lib/measures/clone_building_from_external_model/measure.xml +3 -3
  51. data/lib/measures/create_DOE_prototype_building/measure.rb +2 -2
  52. data/lib/measures/create_DOE_prototype_building/measure.xml +442 -438
  53. data/lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.xml +3 -3
  54. data/lib/measures/create_bar_from_building_type_ratios/README.md +109 -35
  55. data/lib/measures/create_bar_from_building_type_ratios/README.md.erb +54 -35
  56. data/lib/measures/create_bar_from_building_type_ratios/measure.rb +8 -3
  57. data/lib/measures/create_bar_from_building_type_ratios/measure.xml +12 -12
  58. data/lib/measures/create_bar_from_deer_building_type_ratios/README.md +301 -79
  59. data/lib/measures/create_bar_from_deer_building_type_ratios/README.md.erb +62 -79
  60. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.rb +9 -4
  61. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.xml +15 -59
  62. data/lib/measures/create_bar_from_doe_building_type_ratios/README.md +298 -57
  63. data/lib/measures/create_bar_from_doe_building_type_ratios/README.md.erb +54 -57
  64. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.rb +9 -4
  65. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.xml +12 -16
  66. data/lib/measures/create_bar_from_model/measure.rb +10 -6
  67. data/lib/measures/create_bar_from_model/measure.xml +4 -4
  68. data/lib/measures/create_bar_from_space_type_ratios/README.md +94 -42
  69. data/lib/measures/create_bar_from_space_type_ratios/README.md.erb +60 -42
  70. data/lib/measures/create_bar_from_space_type_ratios/measure.rb +8 -3
  71. data/lib/measures/create_bar_from_space_type_ratios/measure.xml +15 -15
  72. data/lib/measures/create_baseline_building/measure.rb +3 -2
  73. data/lib/measures/create_baseline_building/measure.xml +4 -4
  74. data/lib/measures/create_deer_prototype_building/measure.xml +3 -3
  75. data/lib/measures/create_parametric_schedules/measure.rb +15 -10
  76. data/lib/measures/create_parametric_schedules/measure.xml +4 -4
  77. data/lib/measures/create_typical_building_from_model/README.md +81 -16
  78. data/lib/measures/create_typical_building_from_model/README.md.erb +36 -16
  79. data/lib/measures/create_typical_building_from_model/measure.rb +6 -1
  80. data/lib/measures/create_typical_building_from_model/measure.xml +19 -19
  81. data/lib/measures/create_typical_deer_building_from_model/README.md +173 -53
  82. data/lib/measures/create_typical_deer_building_from_model/README.md.erb +57 -53
  83. data/lib/measures/create_typical_deer_building_from_model/measure.rb +7 -2
  84. data/lib/measures/create_typical_deer_building_from_model/measure.xml +26 -26
  85. data/lib/measures/create_typical_doe_building_from_model/README.md +182 -44
  86. data/lib/measures/create_typical_doe_building_from_model/README.md.erb +58 -44
  87. data/lib/measures/create_typical_doe_building_from_model/measure.rb +7 -2
  88. data/lib/measures/create_typical_doe_building_from_model/measure.xml +26 -26
  89. data/lib/measures/deer_space_type_and_construction_set_wizard/measure.rb +1 -1
  90. data/lib/measures/deer_space_type_and_construction_set_wizard/measure.xml +4 -4
  91. data/lib/measures/find_and_replace_in_all_thermal_zone_names/measure.xml +3 -3
  92. data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.rb +2 -0
  93. data/lib/measures/make_shading_surfaces_based_on_zone_multipliers/measure.xml +4 -4
  94. data/lib/measures/merge_floorspace_js_with_model/measure.rb +4 -1
  95. data/lib/measures/merge_floorspace_js_with_model/measure.xml +4 -4
  96. data/lib/measures/merge_spaces_from_external_file/measure.xml +3 -3
  97. data/lib/measures/radiance_measure/measure.rb +62 -56
  98. data/lib/measures/radiance_measure/measure.xml +4 -4
  99. data/lib/measures/radiant_slab_with_doas/measure.rb +8 -1
  100. data/lib/measures/radiant_slab_with_doas/measure.xml +9 -9
  101. data/lib/measures/replace_geometry_by_story/measure.rb +4 -0
  102. data/lib/measures/replace_geometry_by_story/measure.xml +4 -4
  103. data/lib/measures/scale_geometry/measure.xml +3 -3
  104. data/lib/openstudio/model_articulation/version.rb +1 -1
  105. data/openstudio-model-articulation.gemspec +2 -2
  106. metadata +15 -9
  107. data/lib/measures/blended_space_type_from_model/resources/os_lib_model_simplification.rb +0 -1049
@@ -0,0 +1,176 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
27
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
28
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ require 'openstudio'
37
+
38
+ module Functions
39
+ # return an array of surfaces or subsurfaces from a specific facade.
40
+ def self.get_surfaces_or_subsurfaces_by_facade(surfaces_or_subsurfaces, facade)
41
+ surfaces_or_subsurfaces_by_facade = []
42
+
43
+ surfaces_or_subsurfaces.each do |surface_or_subsurface|
44
+ case surface_or_subsurface.class.to_s.gsub('OpenStudio::Model::', '')
45
+ when 'Surface'
46
+ next if surface_or_subsurface.surfaceType != 'Wall'
47
+ next if surface_or_subsurface.outsideBoundaryCondition != 'Outdoors'
48
+
49
+ if surface_or_subsurface.space.empty?
50
+ runner.registerWarning("#{surface_or_subsurface.name} doesn't have a parent space and won't be included in the measure reporting or modifications.")
51
+ next
52
+ end
53
+ direction_of_relative_north = surface_or_subsurface.space.get.directionofRelativeNorth
54
+ when 'SubSurface'
55
+ next if surface_or_subsurface.subSurfaceType == 'Door' || surface_or_subsurface.subSurfaceType == 'OverheadDoor'
56
+
57
+ direction_of_relative_north = surface_or_subsurface.surface.get.space.get.directionofRelativeNorth
58
+ end
59
+
60
+ # get the absoluteAzimuth for the surface so we can categorize it
61
+ absoluteAzimuth = OpenStudio.convert(surface_or_subsurface.azimuth, 'rad', 'deg').get + direction_of_relative_north + surface_or_subsurface.model.getBuilding.northAxis
62
+ absoluteAzimuth -= 360.0 until absoluteAzimuth < 360.0
63
+
64
+ case facade
65
+ when 'North'
66
+ next if !((absoluteAzimuth >= 315.0) || (absoluteAzimuth < 45.0))
67
+ when 'East'
68
+ next if !((absoluteAzimuth >= 45.0) && (absoluteAzimuth < 135.0))
69
+ when 'South'
70
+ next if !((absoluteAzimuth >= 135.0) && (absoluteAzimuth < 225.0))
71
+ when 'West'
72
+ next if !((absoluteAzimuth >= 225.0) && (absoluteAzimuth < 315.0))
73
+ when 'All'
74
+ # no next needed
75
+ else
76
+ runner.registerError("Unexpected value of facade: #{facade}.")
77
+ return false
78
+ end
79
+
80
+ surfaces_or_subsurfaces_by_facade << surface_or_subsurface
81
+ end
82
+
83
+ return surfaces_or_subsurfaces_by_facade
84
+ end
85
+
86
+ # return a hash of subsurface constructions.
87
+ def self.get_orig_sub_surf_const_for_target(subsurfaces)
88
+ orig_sub_surf_const_for_target = {}
89
+
90
+ subsurfaces.each do |subsurface|
91
+ next if subsurface.subSurfaceType == 'Door' || subsurface.subSurfaceType == 'OverheadDoor'
92
+
93
+ if subsurface.construction.is_initialized
94
+ if orig_sub_surf_const_for_target.key?(subsurface.construction.get)
95
+ orig_sub_surf_const_for_target[subsurface.construction.get] += 1
96
+ else
97
+ orig_sub_surf_const_for_target[subsurface.construction.get] = 1
98
+ end
99
+ end
100
+ end
101
+
102
+ return orig_sub_surf_const_for_target
103
+ end
104
+
105
+ # see if surface is rectangular (only checking non rotated on vertical wall)
106
+ # todo - add in more robust rectangle check that can look for rotate and tilted rectangles
107
+ def self.rectangle?(surface)
108
+ x_vals = []
109
+ y_vals = []
110
+ z_vals = []
111
+ vertices = surface.vertices
112
+ vertices.each do |vertex|
113
+ # initialize new vertex to old vertex
114
+ # rounding values to address tolerance issue 10 digits digits in
115
+ x_vals << vertex.x.round(4)
116
+ y_vals << vertex.y.round(4)
117
+ z_vals << vertex.z.round(4)
118
+ end
119
+ if x_vals.uniq.size <= 2 && y_vals.uniq.size <= 2 && z_vals.uniq.size <= 2
120
+ return true
121
+ else
122
+ return false
123
+ end
124
+ end
125
+
126
+ # return true if the requested window-to-wall area exceeds the maximum allowed area, false if not.
127
+ # implements the following part of the applyViewAndDaylightingGlassRatios method, which is what setWindowToWallRatio uses.
128
+ # https://github.com/NREL/OpenStudio/blob/760613c7ac9c2093f7dbd65f947a6853356c558d/src/utilities/geometry/Geometry.cpp#L605-L695
129
+ def self.requested_window_area_greater_than_max?(surface, viewGlassToWallRatio)
130
+ daylightingGlassToWallRatio = 0
131
+ totalWWR = viewGlassToWallRatio + daylightingGlassToWallRatio
132
+
133
+ vertices = surface.vertices
134
+ transformation = OpenStudio::Transformation.alignFace(vertices)
135
+ faceVertices = transformation.inverse * vertices
136
+
137
+ # // new coordinate system has z' in direction of outward normal, y' is up
138
+ xmin = 0
139
+ xmax = 0
140
+ ymin = 0
141
+ ymax = 0
142
+ faceVertices.each do |faceVertex|
143
+ xmin = [xmin, faceVertex.x].min
144
+ xmax = [xmax, faceVertex.x].max
145
+ ymin = [ymin, faceVertex.y].min
146
+ ymax = [ymax, faceVertex.y].max
147
+ end
148
+
149
+ oneInch = 0.0254 # meters
150
+
151
+ # // DLM: preserve a 1" gap between window and edge to keep SketchUp happy
152
+ minGlassToEdgeDistance = oneInch
153
+ minViewToDaylightDistance = 0
154
+
155
+ # // wall parameters
156
+ wallWidth = xmax - xmin
157
+ wallHeight = ymax - ymin
158
+ wallArea = wallWidth * wallHeight
159
+
160
+ # return false if wallWidth < 2 * minGlassToEdgeDistance
161
+
162
+ # return false if wallHeight < 2 * minGlassToEdgeDistance + minViewToDaylightDistance
163
+
164
+ maxWindowArea = wallArea - 2 * wallHeight * minGlassToEdgeDistance
165
+ - (wallWidth - 2 * minGlassToEdgeDistance) * (2 * minGlassToEdgeDistance + minViewToDaylightDistance)
166
+ requestedViewArea = viewGlassToWallRatio * wallArea
167
+ requestedDaylightingArea = daylightingGlassToWallRatio * wallArea
168
+ requestedTotalWindowArea = totalWWR * wallArea
169
+
170
+ if requestedTotalWindowArea > maxWindowArea
171
+ return true
172
+ else
173
+ return false
174
+ end
175
+ end
176
+ end
@@ -45,7 +45,7 @@
45
45
  # load OpenStudio measure libraries from openstudio-extension gem
46
46
  require 'openstudio-extension'
47
47
  require 'openstudio/extension/core/os_lib_helper_methods'
48
- require 'openstudio/extension/core/os_lib_geometry.rb'
48
+ require 'openstudio/extension/core/os_lib_geometry'
49
49
 
50
50
  # load OpenStudio measure libraries
51
51
  require "#{File.dirname(__FILE__)}/resources/os_lib_cofee"
@@ -137,6 +137,7 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
137
137
  spaceTypes = model.getSpaceTypes
138
138
  spaceTypes.each do |spaceType|
139
139
  next if spaceType.spaces.empty?
140
+
140
141
  result = OsLib_HelperMethods.getAreaOfSpacesInArray(model, spaceType.spaces, areaType = 'floorArea')
141
142
  spaceTypeHash[spaceType] = result['totalArea']
142
143
  totalSpaceTypeArea += result['totalArea']
@@ -144,7 +145,7 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
144
145
 
145
146
  runner.registerInfo("Initial Space Type Total Floor Area is #{OsLib_HelperMethods.neatConvertWithUnitDisplay(totalSpaceTypeArea, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)}.")
146
147
 
147
- spaceTypeHash.sort_by { |key, value| value }.reverse.each do |k, v|
148
+ spaceTypeHash.sort_by { |key, value| value }.reverse_each do |k, v|
148
149
  runner.registerInfo("Floor Area for #{k.name} is #{OsLib_HelperMethods.neatConvertWithUnitDisplay(v, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)}.")
149
150
  end
150
151
 
@@ -194,7 +195,8 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
194
195
  runner.registerInfo("Bounding box area is #{areaBounding_display}. #{lengthX_display} by #{lengthY_display}.")
195
196
 
196
197
  # get target footprint size
197
- if logic == 'Maintain Bounding Box Aspect Ratio'
198
+ case logic
199
+ when 'Maintain Bounding Box Aspect Ratio'
198
200
  areaTarget = totalFloorArea / numStories
199
201
  areaMultiplier = areaTarget / areaBounding
200
202
  edgeMultiplier = Math.sqrt(areaMultiplier)
@@ -204,7 +206,7 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
204
206
  # run def to create bar
205
207
  bar_AspectRatio = OsLib_Cofee.createBar(model, spaceTypeHash, lengthXTarget, lengthYTarget, totalFloorArea, numStories, midFloorMultiplier, xmin, ymin, lengthX, lengthY, zmin, zmax, true)
206
208
 
207
- elsif logic == 'Maintain Total Exterior Wall Area'
209
+ when 'Maintain Total Exterior Wall Area'
208
210
  areaTarget = totalFloorArea / numStories
209
211
  perim = exteriorArea_si / (zmax - zmin)
210
212
  lengthYTarget = 0.25 * perim - 0.25 * Math.sqrt(perim**2 - 16 * areaTarget)
@@ -229,6 +231,7 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
229
231
  relativeAzimuth = OpenStudio.convert(surface.azimuth, 'rad', 'deg').get
230
232
  next if surface.outsideBoundaryCondition != 'Outdoors'
231
233
  next if surface.surfaceType != 'Wall'
234
+
232
235
  if (relativeAzimuth.round == 90) || (relativeAzimuth.round == 270)
233
236
  construction = surface.construction # TODO: - this isn't really the construction I want since it wasn't an interior one, but will work for now
234
237
  surface.setOutsideBoundaryCondition('Adiabatic')
@@ -257,6 +260,7 @@ class SimplifyGeometryToSlicedBar < OpenStudio::Measure::ModelMeasure
257
260
  relativeAzimuth = OpenStudio.convert(surface.azimuth, 'rad', 'deg').get
258
261
  next if surface.outsideBoundaryCondition != 'Outdoors'
259
262
  next if surface.surfaceType != 'Wall'
263
+
260
264
  if (relativeAzimuth.round == 90) || (relativeAzimuth.round == 270)
261
265
  construction = surface.construction # TODO: - this isn't really the construction I want since it wasn't an interior one, but will work for now
262
266
  surface.setOutsideBoundaryCondition('Adiabatic')
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>simplify_geometry_to_sliced_bar</name>
5
5
  <uid>eb218516-5fa5-47fe-948d-274777c7d592</uid>
6
- <version_id>43464352-edbd-46d3-9feb-65ad84e6797d</version_id>
7
- <version_modified>20210423T142517Z</version_modified>
6
+ <version_id>13960111-65c1-476c-a206-591ca7423b94</version_id>
7
+ <version_modified>20220505T182931Z</version_modified>
8
8
  <xml_checksum>45097B60</xml_checksum>
9
9
  <class_name>SimplifyGeometryToSlicedBar</class_name>
10
10
  <display_name>SimplifyGeometryToSlicedBar</display_name>
@@ -106,23 +106,23 @@ In a future version I may try to identify similar spaces types and blend them to
106
106
  <usage_type>readmeerb</usage_type>
107
107
  <checksum>703C9964</checksum>
108
108
  </file>
109
+ <file>
110
+ <filename>LICENSE.md</filename>
111
+ <filetype>md</filetype>
112
+ <usage_type>license</usage_type>
113
+ <checksum>A21A3ED2</checksum>
114
+ </file>
109
115
  <file>
110
116
  <filename>os_lib_helper_methods.rb</filename>
111
117
  <filetype>rb</filetype>
112
118
  <usage_type>resource</usage_type>
113
- <checksum>B91D04D5</checksum>
119
+ <checksum>37A1A07C</checksum>
114
120
  </file>
115
121
  <file>
116
122
  <filename>os_lib_cofee.rb</filename>
117
123
  <filetype>rb</filetype>
118
124
  <usage_type>resource</usage_type>
119
- <checksum>BA716A1A</checksum>
120
- </file>
121
- <file>
122
- <filename>LICENSE.md</filename>
123
- <filetype>md</filetype>
124
- <usage_type>license</usage_type>
125
- <checksum>A21A3ED2</checksum>
125
+ <checksum>031AC395</checksum>
126
126
  </file>
127
127
  <file>
128
128
  <version>
@@ -133,19 +133,37 @@ In a future version I may try to identify similar spaces types and blend them to
133
133
  <filename>measure.rb</filename>
134
134
  <filetype>rb</filetype>
135
135
  <usage_type>script</usage_type>
136
- <checksum>6147FE1F</checksum>
136
+ <checksum>46B1D452</checksum>
137
137
  </file>
138
138
  <file>
139
139
  <filename>os_lib_geometry.rb</filename>
140
140
  <filetype>rb</filetype>
141
141
  <usage_type>resource</usage_type>
142
- <checksum>F25DC7F1</checksum>
142
+ <checksum>53B30D3C</checksum>
143
143
  </file>
144
144
  <file>
145
145
  <filename>SimplifyGeometryToSlicedBar_Test.rb</filename>
146
146
  <filetype>rb</filetype>
147
147
  <usage_type>test</usage_type>
148
- <checksum>6BEA0A0C</checksum>
148
+ <checksum>A931C588</checksum>
149
+ </file>
150
+ <file>
151
+ <filename>UShapedHotelExample/run.db</filename>
152
+ <filetype>db</filetype>
153
+ <usage_type>test</usage_type>
154
+ <checksum>9230B5CD</checksum>
155
+ </file>
156
+ <file>
157
+ <filename>UShapedHotelExample/files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw</filename>
158
+ <filetype>epw</filetype>
159
+ <usage_type>test</usage_type>
160
+ <checksum>C254B53F</checksum>
161
+ </file>
162
+ <file>
163
+ <filename>UShapedHotelExample/project.osp</filename>
164
+ <filetype>osp</filetype>
165
+ <usage_type>test</usage_type>
166
+ <checksum>EE6FAF90</checksum>
149
167
  </file>
150
168
  </files>
151
169
  </measure>
@@ -46,8 +46,9 @@ module OsLib_Cofee
46
46
  # create an array to control sort order of spaces in bar
47
47
  customSpaceTypeBar = []
48
48
  counter = 0
49
- spaceTypeHash.sort_by { |key, value| value }.reverse.each do |k, v|
49
+ spaceTypeHash.sort_by { |key, value| value }.reverse_each do |k, v|
50
50
  next if v == 0 # this line adds support for fractional values of 0
51
+
51
52
  if counter == 1
52
53
  if (lengthXTarget * (v / totalFloorArea) > perimeterDepth * perimeterBufferFactor) && endZones
53
54
  customSpaceTypeBar << [k, totalFloorArea * (perimeterDepth / lengthXTarget)]
@@ -63,7 +64,7 @@ module OsLib_Cofee
63
64
 
64
65
  # add the largest space type to the end
65
66
  counter = 0
66
- spaceTypeHash.sort_by { |key, value| value }.reverse.each do |k, v|
67
+ spaceTypeHash.sort_by { |key, value| value }.reverse_each do |k, v|
67
68
  if counter == 0
68
69
  # if width is greater than 1.5x perimeter depth then split in half
69
70
  if (lengthXTarget * (v / totalFloorArea) > perimeterDepth * perimeterBufferFactor) && endZones
@@ -201,9 +202,10 @@ module OsLib_Cofee
201
202
  else
202
203
  z += floor_to_floor_height * midFloorMultiplier - floor_to_floor_height
203
204
 
204
- if storyCounter == 0
205
+ case storyCounter
206
+ when 0
205
207
  ceilingAdiabatic = true
206
- elsif storyCounter == 1
208
+ when 1
207
209
  floorAdiabatic = true
208
210
  ceilingAdiabatic = true
209
211
  else
@@ -63,7 +63,7 @@ module OsLib_Geometry
63
63
  end
64
64
 
65
65
  # set vertices to new vertices
66
- surface.setVertices(newVertices) # todo check if this was made, and issue warning if it was not. Could happen if resulting surface not planer.
66
+ surface.setVertices(newVertices) # TODO: check if this was made, and issue warning if it was not. Could happen if resulting surface not planer.
67
67
 
68
68
  if flag then counter += 1 end
69
69
  end
@@ -95,6 +95,7 @@ module OsLib_Geometry
95
95
  floors = []
96
96
  space.surfaces.each do |surface|
97
97
  next if surface.surfaceType != 'Floor'
98
+
98
99
  floors << surface
99
100
  end
100
101
 
@@ -407,6 +408,7 @@ module OsLib_Geometry
407
408
  # adjustments running counter for space type being removed from this story
408
409
  space_types_running_count.each do |k2, v2|
409
410
  next if k2 != first_space[0]
411
+
410
412
  v2[:floor_area] += first_space[1][:floor_area] * v[:multiplier]
411
413
  end
412
414
 
@@ -504,10 +506,8 @@ module OsLib_Geometry
504
506
  re_apply_largest_space_type_at_end = true
505
507
  end
506
508
  end
507
- if space_type == space_types.last[0]
508
- if [length, width].max * space_type_hash[:floor_area] / total_floor_area > max_bar_end_multiplier * perimeter_zone_depth
509
- end_perimeter_width_deduction = perimeter_zone_depth
510
- end
509
+ if space_type == space_types.last[0] && ([length, width].max * space_type_hash[:floor_area] / total_floor_area > max_bar_end_multiplier * perimeter_zone_depth)
510
+ end_perimeter_width_deduction = perimeter_zone_depth
511
511
  end
512
512
  non_end_adjusted_width = ([length, width].max * space_type_hash[:floor_area] / total_floor_area) - start_perimeter_width_deduction - end_perimeter_width_deduction
513
513
 
@@ -772,7 +772,7 @@ module OsLib_Geometry
772
772
  if story.nil?
773
773
  story = OpenStudio::Model::BuildingStory.new(model)
774
774
  story.setNominalFloortoFloorHeight(story_data[:space_height]) # not used for anything
775
- story.setNominalZCoordinate (story_data[:space_origin_z]) # not used for anything
775
+ story.setNominalZCoordinate(story_data[:space_origin_z]) # not used for anything
776
776
  story.setName("Story #{story_name}")
777
777
  end
778
778
 
@@ -780,11 +780,12 @@ module OsLib_Geometry
780
780
  multiplier_story_above = 1
781
781
  multiplier_story_below = 1
782
782
 
783
- if index == 0 # bottom floor, only check above
783
+ case index
784
+ when 0 # bottom floor, only check above
784
785
  if story_hash.size > 1
785
786
  multiplier_story_above = story_hash.values[index + 1][:multiplier]
786
787
  end
787
- elsif index == story_hash.size - 1 # top floor, check only below
788
+ when story_hash.size - 1 # top floor, check only below
788
789
  multiplier_story_below = story_hash.values[index + -1][:multiplier]
789
790
  else # mid floor, check above and below
790
791
  multiplier_story_above = story_hash.values[index + 1][:multiplier]
@@ -997,9 +998,11 @@ module OsLib_Geometry
997
998
  perim_story.spaces.each do |space|
998
999
  space.surfaces.each do |surface|
999
1000
  next if (surface.outsideBoundaryCondition != 'Outdoors') || (surface.surfaceType != 'Wall')
1001
+
1000
1002
  area = surface.grossArea
1001
1003
  z_value_array = OsLib_Geometry.getSurfaceZValues([surface])
1002
1004
  next if z_value_array.max == z_value_array.min # shouldn't see this unless wall is horizontal
1005
+
1003
1006
  perimeter += area / (z_value_array.max - z_value_array.min)
1004
1007
  end
1005
1008
  end
@@ -1044,6 +1047,7 @@ module OsLib_Geometry
1044
1047
  edge_hash.each do |k1, v1|
1045
1048
  # apply to any floor boundary condition. This supports used in floors above basements
1046
1049
  next if v1[4] != 'Floor'
1050
+
1047
1051
  edge_hash.each do |k2, v2|
1048
1052
  test_boundary_cond = false
1049
1053
  next if !tested_wall_boundary_condition.include?(v2[3]) # method arg takes multiple conditions
@@ -1161,6 +1165,7 @@ module OsLib_Geometry
1161
1165
  edge_hash.each do |k1, v1|
1162
1166
  next if v1[3] != 'Ground' # skip if not ground exposed floor
1163
1167
  next if v1[4] != 'Floor'
1168
+
1164
1169
  edge_hash.each do |k2, v2|
1165
1170
  next if v2[3] != 'Outdoors' # skip if not exterior exposed wall (todo - update to handle basement)
1166
1171
  next if v2[4] != 'Wall'
@@ -353,10 +353,8 @@ module OsLib_HelperMethods
353
353
  objectArray.each do |object|
354
354
  object_LCCs = object.lifeCycleCosts
355
355
  object_LCCs.each do |object_LCC|
356
- if object_LCC.category == category
357
- if onlyYearFromStartZero == false || object_LCC.yearsFromStart == 0
358
- counter += object_LCC.totalCost
359
- end
356
+ if object_LCC.category == category && (onlyYearFromStartZero == false || object_LCC.yearsFromStart == 0)
357
+ counter += object_LCC.totalCost
360
358
  end
361
359
  end
362
360
  end
@@ -49,7 +49,7 @@ class SpaceTypeAndConstructionSetWizard < OpenStudio::Measure::ModelMeasure
49
49
  # load OpenStudio measure libraries from openstudio-extension gem
50
50
  require 'openstudio-extension'
51
51
  require 'openstudio/extension/core/os_lib_helper_methods'
52
- require 'openstudio/extension/core/os_lib_model_generation.rb'
52
+ require 'openstudio/extension/core/os_lib_model_generation'
53
53
 
54
54
  # resource files used by measure
55
55
  include OsLib_HelperMethods
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>space_type_and_construction_set_wizard</name>
5
5
  <uid>7c65af63-4316-47c9-b7a5-68d7a019e533</uid>
6
- <version_id>a0577cf6-a844-4d90-a7c6-2a3f54e65bfd</version_id>
7
- <version_modified>20210423T142525Z</version_modified>
6
+ <version_id>c10f0999-8ad9-46fa-8caa-953db92a07e6</version_id>
7
+ <version_modified>20220505T182932Z</version_modified>
8
8
  <xml_checksum>057E8D9D</xml_checksum>
9
9
  <class_name>SpaceTypeAndConstructionSetWizard</class_name>
10
10
  <display_name>Space Type and Construction Set Wizard</display_name>
@@ -372,7 +372,7 @@
372
372
  <filename>SpaceTypeAndConstructionSetWizard_Test.rb</filename>
373
373
  <filetype>rb</filetype>
374
374
  <usage_type>test</usage_type>
375
- <checksum>A33BC44E</checksum>
375
+ <checksum>6904B5F3</checksum>
376
376
  </file>
377
377
  <file>
378
378
  <version>
@@ -383,7 +383,7 @@
383
383
  <filename>measure.rb</filename>
384
384
  <filetype>rb</filetype>
385
385
  <usage_type>script</usage_type>
386
- <checksum>ECB1C32A</checksum>
386
+ <checksum>729BA750</checksum>
387
387
  </file>
388
388
  </files>
389
389
  </measure>
@@ -81,6 +81,7 @@ class SurfaceMatching < OpenStudio::Measure::ModelMeasure
81
81
  surfaces.each do |surface|
82
82
  if surface.outsideBoundaryCondition == 'Surface'
83
83
  next if !surface.adjacentSurface.is_initialized # don't count as matched if boundary condition is right but no matched object
84
+
84
85
  initialMatchedSurfaceCounter += 1
85
86
  end
86
87
  end
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>surface_matching</name>
5
5
  <uid>e9c69c36-bf33-4ac4-b695-41dee26ee880</uid>
6
- <version_id>1b01d623-5de5-4dbf-a775-82119cbc16f4</version_id>
7
- <version_modified>20210423T142525Z</version_modified>
6
+ <version_id>35935b9b-4dc3-4f1b-a680-050c6b356365</version_id>
7
+ <version_modified>20220505T182930Z</version_modified>
8
8
  <xml_checksum>45097B60</xml_checksum>
9
9
  <class_name>SurfaceMatching</class_name>
10
10
  <display_name>SurfaceMatching</display_name>
@@ -66,6 +66,12 @@
66
66
  <usage_type>readme</usage_type>
67
67
  <checksum>FBF56DB2</checksum>
68
68
  </file>
69
+ <file>
70
+ <filename>LICENSE.md</filename>
71
+ <filetype>md</filetype>
72
+ <usage_type>license</usage_type>
73
+ <checksum>A21A3ED2</checksum>
74
+ </file>
69
75
  <file>
70
76
  <version>
71
77
  <software_program>OpenStudio</software_program>
@@ -75,19 +81,13 @@
75
81
  <filename>measure.rb</filename>
76
82
  <filetype>rb</filetype>
77
83
  <usage_type>script</usage_type>
78
- <checksum>2C1EB547</checksum>
84
+ <checksum>BE5B9A0D</checksum>
79
85
  </file>
80
86
  <file>
81
87
  <filename>SurfaceMatching_Test.rb</filename>
82
88
  <filetype>rb</filetype>
83
89
  <usage_type>test</usage_type>
84
- <checksum>C729BC9F</checksum>
85
- </file>
86
- <file>
87
- <filename>LICENSE.md</filename>
88
- <filetype>md</filetype>
89
- <usage_type>license</usage_type>
90
- <checksum>A21A3ED2</checksum>
90
+ <checksum>726F8146</checksum>
91
91
  </file>
92
92
  </files>
93
93
  </measure>
@@ -0,0 +1,27 @@
1
+ OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted
4
+ provided that the following conditions are met:
5
+
6
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions
7
+ and the following disclaimer.
8
+
9
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
13
+ or promote products derived from this software without specific prior written permission from the
14
+ respective party.
15
+
16
+ (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
17
+ derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
18
+ designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
21
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
23
+ OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.