Skip to content

Commit 699d8aa

Browse files
committed
Tweaks space width/height methods/tests
1 parent a1a8612 commit 699d8aa

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

lib/osut/utils.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4565,8 +4565,8 @@ def alignedHeight(pts = nil, force = false)
45654565
def spaceHeight(space = nil)
45664566
return 0 unless space.is_a?(OpenStudio::Model::Space)
45674567

4568-
minZ = 1000
4569-
maxZ = 0
4568+
minZ = 10000
4569+
maxZ = -10000
45704570

45714571
space.surfaces.each do |surface|
45724572
minZ = [surface.vertices.min_by(&:z).z, minZ].min
@@ -4599,6 +4599,7 @@ def spaceWidth(space = nil)
45994599
# - retain only other floor surfaces sharing same 3D plane
46004600
# - recover potential union between floor surfaces
46014601
# - fall back to largest floor surface if invalid union
4602+
# - return width of largest bounded box
46024603
floors = floors.sort_by(&:grossArea).reverse
46034604
floor = floors.first
46044605
plane = floor.plane
@@ -4622,6 +4623,7 @@ def spaceWidth(space = nil)
46224623
res = realignedFace(polyg.to_a.reverse)
46234624
return 0 if res[:box].nil?
46244625

4626+
# A bounded box's 'height', at its narrowest, is its 'width'.
46254627
height(res[:box])
46264628
end
46274629

spec/osut_tests_spec.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5743,7 +5743,7 @@ module M
57435743

57445744
# The Fine Storage space has 2 floors, at different Z-axis levels:
57455745
# - main ground floor (slab on grade), Z=0.00m
5746-
# - a mezzanine floor, adjacent to the office space ceiling below, Z=4.27m
5746+
# - mezzanine floor, adjacent to the office space ceiling below, Z=4.27m
57475747
expect(mod1.facets(fine, "all", "floor").size).to eq(2)
57485748
groundfloor = model.getSurfaceByName("Fine Storage Floor")
57495749
mezzanine = model.getSurfaceByName("Office Roof Reversed")
@@ -5755,10 +5755,10 @@ module M
57555755
# The ground floor is L-shaped, floor surfaces have differenet Z=axis
57565756
# levels, etc. In the context of codes/standards like ASHRAE 90.1 or the
57575757
# Canadian NECB, determining what constitutes a space's 'height' and/or
5758-
# 'width' can matter, namely with regards to geometry-based LPD rules (e.g.
5759-
# adjustments per corridor 'width'). Not stating here what the definitive
5760-
# answers should be in all cases. There are however a few OSut functions
5761-
# that may be useful.
5758+
# 'width' matters, namely with regards to geometry-based LPD rules (e.g.
5759+
# adjustments based on corridor 'width'). Not stating here what the
5760+
# definitive answers should be in all cases. There are however a few OSut
5761+
# functions that may be helpful.
57625762
#
57635763
# OSut's 'aligned' height and width functions were initially developed for
57645764
# non-flat surfaces, like walls and sloped roofs - particularly useful when
@@ -5778,11 +5778,13 @@ module M
57785778

57795779
# OSut's 'spaceHeight' and 'spaceWidth' are more suitable for height- or
57805780
# width-based LPD adjustement calculations. OSut sets a space's width as
5781-
# the widest edge of the largest bounded box it can fit within a collection
5782-
# of neighbouring floor surfaces. This is considered reasonable for a long
5783-
# corridor, with a varying width along its full length. Achtung! The
5784-
# function can be time consuming for very convoluted spaces (e.g. long
5785-
# corridors with multiple concavities).
5781+
# the length of the narrowest edge of the largest bounded box that fits
5782+
# within a collection of neighbouring floor surfaces. This is considered
5783+
# reasonable for a long corridor, with varying widths along its full
5784+
# length (e.g. occasional alcoves).
5785+
#
5786+
# Achtung! The function can be time consuming (multiple iterations) for
5787+
# very convoluted spaces (e.g. long corridors with multiple concavities).
57865788
expect(mod1.spaceHeight(fine)).to be_within(TOL).of(8.53)
57875789
expect(mod1.spaceWidth(fine)).to be_within(TOL).of(21.33)
57885790

0 commit comments

Comments
 (0)