Class: OpenStudio::Model::SubSurface
- Inherits:
-
Object
- Object
- OpenStudio::Model::SubSurface
- Defined in:
- lib/openstudio-standards/standards/Standards.SubSurface.rb
Overview
open the class to add methods to apply HVAC efficiency standards
Instance Method Summary collapse
-
#component_infiltration_rate(type) ⇒ Double
Determine the component infiltration rate for this surface.
-
#reduce_area_by_percent_by_raising_sill(percent_reduction) ⇒ Object
Reduce the area of the subsurface by raising the sill height.
-
#reduce_area_by_percent_by_shrinking_toward_centroid(percent_reduction) ⇒ Object
Reduce the area of the subsurface by shrinking it toward the centroid.
-
#vertical_rectangle? ⇒ Boolean
Determine if the sub surface is a vertical rectangle, meaning a rectangle where the bottom is parallel to the ground.
Instance Method Details
#component_infiltration_rate(type) ⇒ Double
Determine the component infiltration rate for this surface
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/openstudio-standards/standards/Standards.SubSurface.rb', line 9 def component_infiltration_rate(type) comp_infil_rate_m3_per_s = 0.0 # Define the envelope component infiltration rates component_infil_rates_cfm_per_ft2 = { 'baseline' => { 'opaque_door' => 0.40, 'loading_dock_door' => 0.40, 'swinging_or_revolving_glass_door' => 1.0, 'vestibule' => 1.0, 'sliding_glass_door' => 0.40, 'window' => 0.40, 'skylight' => 0.40 }, 'advanced' => { 'opaque_door' => 0.20, 'loading_dock_door' => 0.20, 'swinging_or_revolving_glass_door' => 1.0, 'vestibule' => 1.0, 'sliding_glass_door' => 0.20, 'window' => 0.20, 'skylight' => 0.20 } } boundary_condition = outsideBoundaryCondition # Skip non-outdoor surfaces return comp_infil_rate_m3_per_s unless outsideBoundaryCondition == 'Outdoors' || outsideBoundaryCondition == 'Ground' # Per area infiltration rate for this surface surface_type = subSurfaceType infil_rate_cfm_per_ft2 = nil case boundary_condition when 'Outdoors' case surface_type when 'Door' infil_rate_cfm_per_ft2 = component_infil_rates_cfm_per_ft2[type]['opaque_door'] when 'OverheadDoor' infil_rate_cfm_per_ft2 = component_infil_rates_cfm_per_ft2[type]['loading_dock_door'] when 'GlassDoor' OpenStudio.logFree(OpenStudio::Info, 'openstudio.Standards.Model', "For #{name}, assuming swinging_or_revolving_glass_door for infiltration calculation.") infil_rate_cfm_per_ft2 = component_infil_rates_cfm_per_ft2[type]['swinging_or_revolving_glass_door'] when 'FixedWindow', 'OperableWindow' infil_rate_cfm_per_ft2 = component_infil_rates_cfm_per_ft2[type]['window'] when 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser' infil_rate_cfm_per_ft2 = component_infil_rates_cfm_per_ft2[type]['skylight'] end end if infil_rate_cfm_per_ft2.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Standards.Model', "For #{name}, could not determine surface type for infiltration, will not be included in calculation.") return comp_infil_rate_m3_per_s end # Area of the surface area_m2 = netArea area_ft2 = OpenStudio.convert(area_m2, 'm^2', 'ft^2').get # Rate for this surface comp_infil_rate_cfm = area_ft2 * infil_rate_cfm_per_ft2 comp_infil_rate_m3_per_s = OpenStudio.convert(comp_infil_rate_cfm, 'cfm', 'm^3/s').get # OpenStudio::logFree(OpenStudio::Debug, "openstudio.Standards.Model", "......#{self.name}, infil = #{comp_infil_rate_cfm.round(2)} cfm @ rate = #{infil_rate_cfm_per_ft2} cfm/ft2, area = #{area_ft2.round} ft2.") return comp_infil_rate_m3_per_s end |
#reduce_area_by_percent_by_raising_sill(percent_reduction) ⇒ Object
Reduce the area of the subsurface by raising the sill height.
to reduce the area.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/openstudio-standards/standards/Standards.SubSurface.rb', line 116 def reduce_area_by_percent_by_raising_sill(percent_reduction) mult = 1 - percent_reduction # Calculate the original area area_original = netArea # Find the min and max z values min_z_val = 99999 max_z_val = -99999 vertices.each do |vertex| # Min z value if vertex.z < min_z_val min_z_val = vertex.z end # Max z value if vertex.z > max_z_val max_z_val = vertex.z end end # Calculate the window height height = max_z_val - min_z_val # Calculate the new sill height new_sill_z = max_z_val - (height * mult) # Reset the z value of the lowest points new_vertices = [] vertices.each do |vertex| new_x = vertex.x new_y = vertex.y new_z = vertex.z if new_z == min_z_val new_z = new_sill_z end new_vertices << OpenStudio::Point3d.new(new_x, new_y, new_z) end # Reset the vertices setVertices(new_vertices) return true end |
#reduce_area_by_percent_by_shrinking_toward_centroid(percent_reduction) ⇒ Object
Reduce the area of the subsurface by shrinking it toward the centroid. to reduce the area.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/openstudio-standards/standards/Standards.SubSurface.rb', line 82 def reduce_area_by_percent_by_shrinking_toward_centroid(percent_reduction) mult = 1 - percent_reduction scale_factor = mult**0.5 # Get the centroid (Point3d) g = centroid # Create an array to collect the new vertices new_vertices = [] # Loop on vertices (Point3ds) vertices.each do |vertex| # Point3d - Point3d = Vector3d # Vector from centroid to vertex (GA, GB, GC, etc) centroid_vector = vertex - g # Resize the vector (done in place) according to scale_factor centroid_vector.setLength(centroid_vector.length * scale_factor) # Move the vertex toward the centroid vertex = g + centroid_vector new_vertices << vertex end # Assign the new vertices to the self setVertices(new_vertices) end |
#vertical_rectangle? ⇒ Boolean
Determine if the sub surface is a vertical rectangle, meaning a rectangle where the bottom is parallel to the ground.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/openstudio-standards/standards/Standards.SubSurface.rb', line 163 def vertical_rectangle? # Get the vertices once verts = vertices # Check for 4 vertices return false unless verts.size == 4 # Check if the 2 lowest z-values # are the same z_vals = [] verts.each do |vertex| z_vals << vertex.z end z_vals = z_vals.sort return false unless z_vals[0] = z_vals[1] # Check if the diagonals are equal length diag_a = verts[0] - verts[2] diag_b = verts[1] - verts[3] return false unless diag_a.length == diag_b.length # If here, we have a rectangle return true end |