Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a3e8b7c
Adds geometry-related functions & tests
brgix Jul 8, 2025
aad82a5
Implements basic 3DVector functions (untested)
brgix Jul 8, 2025
c77bcf1
Fixes is_same ('0' as valid list index)
brgix Jul 8, 2025
e842406
Implements width/height functions, tests triangulation
brgix Jul 9, 2025
0ba39ac
Adds (yet untested) line segment functions
brgix Jul 9, 2025
8d82211
Rehauls vestibule, plenum conditional checks (tested)
brgix Jul 10, 2025
d4e0bd0
Reinstates previous tests
brgix Jul 10, 2025
394a4e5
Completes (tested) ULC & BLC
brgix Jul 11, 2025
8266f63
Fixes & tests collinearity methods
brgix Jul 12, 2025
aae7307
Fixes & tests point-line intersection methods
brgix Jul 12, 2025
5ba1ace
Adds a handful of boolean functions
brgix Jul 13, 2025
9f41e35
First try at 'overlaps' - buggy for now
brgix Jul 14, 2025
838fb59
Fixes overlap method - initial tests only
brgix Jul 14, 2025
34ad038
Minor cleanup - post overlap fix
brgix Jul 14, 2025
1f8df35
Partial refactor of 'overlap' (tested)
brgix Jul 16, 2025
8ea89c7
Adds (yet untested) 'offset' & 'outline' methods
brgix Jul 16, 2025
82028fb
Initial tests of 'bounded boxes' methods
brgix Jul 16, 2025
d36561c
Tweaks 'overlap' (more testing needed)
brgix Jul 17, 2025
623ebbb
Completes 'fits' & 'overlap' method testing
brgix Jul 17, 2025
33600d1
Completes segments, triads and orientation tests
brgix Jul 17, 2025
9d44c8a
Initial implementation of 'realignedFace' (untested)
brgix Jul 17, 2025
9a4c20e
Completes 'poly' attributes testing
brgix Jul 18, 2025
c88bea5
Completes model transformation tests
brgix Jul 18, 2025
2f8ab94
Adds (getter) 'roofs' (tested)
brgix Jul 18, 2025
d49f52a
Adds 'isDaylit' (untested)
brgix Jul 18, 2025
8f27186
Minor cleanup
brgix Jul 18, 2025
89ba373
Partial implementation of convexity tests
brgix Jul 18, 2025
635adfd
Implements 'addSubs' (initial testing, more to come ...)
brgix Jul 19, 2025
4fba8e3
Merge branch 'geo' of https://github.com/rd2/pyOSut into geo
brgix Jul 19, 2025
1e4a90a
Updates pyproject.toml
brgix Jul 19, 2025
a0bf359
Adds numpy (dependency) in GH Actions pull_request.yml
brgix Jul 19, 2025
f838db4
Further testing of 'addSubs' (control case)
brgix Jul 19, 2025
4f57555
Completes 1st round of 'addSubs' testing
brgix Jul 21, 2025
b331905
Completes aligned width/height tests
brgix Jul 21, 2025
3f8ec9a
Completes 'WWR insertion' tests
brgix Jul 21, 2025
765d328
Completes 'genShade' fixes/tests
brgix Jul 21, 2025
fd3c2d4
Adds 'grossRoofArea' and 'getHorizontalRidges' (untested)
brgix Jul 22, 2025
e57e6b6
Adds 'toToplit' - yet untested
brgix Jul 23, 2025
45e1cbd
Adds 'genAnchors' - untested
brgix Jul 24, 2025
7108439
Adds 'genextendedvertices' - untested
brgix Jul 25, 2025
11397bb
Sets up 'addSkylights', fixes 'overlap'
brgix Jul 28, 2025
ef390a8
First draft of 'addSkylights': inoperable/inactive for now ...
brgix Aug 1, 2025
bfc9440
Purges 'set' variables (conflict with built-in)
brgix Aug 1, 2025
fb86a4b
First 'addSkylights' test 'green' (more to come)
brgix Aug 2, 2025
0d99847
Fixes (inter alia) ceiling leader lines (skylights)
brgix Aug 3, 2025
52dc079
Fixes roof leader line issues
brgix Aug 3, 2025
a6bca1b
Completes 'SmallOffice' skylight unittests
brgix Aug 3, 2025
60f9f6f
Completes 'SEB' addSkylights unittest
brgix Aug 3, 2025
62ec271
Completes 'Warehouse' addSkylights unittest
brgix Aug 3, 2025
3a1e4f7
Pre-merge cleanup (e.g. resequencing functions)
brgix Aug 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions src/osut/osut.py
Original file line number Diff line number Diff line change
Expand Up @@ -2136,8 +2136,8 @@ def arePlenums(spaces=None):
# By initially relying on the SDK's "partofTotalFloorArea", "space_plenum?"
# ends up catching a MUCH WIDER range of spaces, which aren't caught by
# "isPlenum". This includes attics, crawlspaces, non-plenum air spaces above
# ceiling tiles, and any other UNOCCUPIED space in a model. The term
# "plenum" in this context is more of a catch-all shorthand - to be used
# ceiling surfaces, and any other UNOCCUPIED space in a model. The term
# "plenum" in that context is more of a catch-all shorthand - to be used
# with caution. For instance, "space_plenum?" shouldn't be used (in
# isolation) to determine whether an UNOCCUPIED space should have its
# envelope insulated ("plenum") or not ("attic").
Expand Down Expand Up @@ -5371,12 +5371,11 @@ def genAnchors(s=None, sset=[], tag="box") -> int:
# others) a 'realigned' set of points (by default a 'realigned' "box").
# The latter is typically generated from an outdoor-facing roof.
# Subsequent calls to 'genAnchors' may send (as first argument) a
# corresponding ceiling tile below (both may be called from
# 'addSkylights'). Roof vs ceiling may neither share alignment
# transformation nor space/site transformation identities. All
# subsequent calls to 'genAnchors' shall recover the "out" points,
# apply a succession of de/alignments and transformations in sync, and
# overwrite tagged points.
# corresponding ceiling below (both may be called from 'addSkylights').
# Roof vs ceiling may neither share alignment transformation nor
# space/site transformation identities. All subsequent calls to
# 'genAnchors' shall recover the "out" points, apply a succession of
# de/alignments and transformations in sync, and overwrite tagged points.
#
# Although 'genAnchors' and 'genInserts' have both been developed to
# support anchor insertions in other cases (e.g. bay window in a wall),
Expand Down Expand Up @@ -7297,7 +7296,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
if not spaces:
return oslg.empty("spaces", mth, CN.DBG, 0)

mdl = spaces[0].model
mdl = spaces[0].model()

# Exit if mismatched or invalid options.
if not isinstance(opts, dict):
Expand Down Expand Up @@ -7676,9 +7675,9 @@ def addSkyLights(spaces=[], opts=dict) -> float:

# Process occupied room ceilings, as 1x or more are overlapping roof
# surfaces above. Vertically cast, then fetch overlap.
for tile in facets(space, "Surface", "RoofCeiling"):
idee = tile.nameString()
tpts = t0 * tile.vertices()
for clng in facets(space, "Surface", "RoofCeiling"):
idee = clng.nameString()
tpts = t0 * clng.vertices()
ci0 = cast(tpts, rpts, ray)
if not ci0: continue

Expand All @@ -7697,7 +7696,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
# Adding skylight wells (plenums/attics) is contingent to safely
# linking new base roof 'inserts' (as well as new ceiling ones)
# through 'leader lines'. This requires an offset to ensure no
# conflicts with roof or (ceiling) tile edges.
# conflicts with roof or ceiling edges.
#
# @todo: Expand the method to factor in cases where simple
# 'side' cutouts can be supported (no need for leader
Expand All @@ -7716,7 +7715,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
if width < wl * 3: continue
if depth < wl * 2: continue

# Vertically cast box onto tile below.
# Vertically cast box onto ceiling below.
cbox = cast(box, tpts, ray)
if not cbox: continue

Expand All @@ -7728,7 +7727,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
cbox = t0.inverse() * cbox

if idee not in ceilings:
floor = tile.adjacentSurface()
floor = clng.adjacentSurface()
if not floor:
oslg.log(CN.ERR, "%s adjacent floor? (%s)" % (idee, mth))
continue
Expand All @@ -7745,7 +7744,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
continue

ceilings[idee] = {} # idee: ceiling surface ID
ceilings[idee]["clng" ] = tile # ceiling surface itself
ceilings[idee]["clng" ] = clng # ceiling surface itself
ceilings[idee]["id" ] = ide # its space's ID
ceilings[idee]["space"] = space # its space
ceilings[idee]["floor"] = floor # adjacent floor
Expand All @@ -7771,7 +7770,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
sset["roof" ] = ruf
sset["space" ] = space
sset["m" ] = space.multiplier()
sset["clng" ] = tile
sset["clng" ] = clng
sset["t0" ] = t0
sset["ti" ] = ti
sset["t" ] = openstudio.Transformation.alignFace(vtx)
Expand Down Expand Up @@ -7883,7 +7882,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
if not stz: continue

stz = sorted(stz, key=lambda st: st["cm2"], reverse=True)
genAnchors(tile, stz, "cbox")
genAnchors(clng, stz, "cbox")

# Delete voided sets.
ssets = [sset for sset in ssets if "void" not in sset]
Expand Down Expand Up @@ -8563,25 +8562,29 @@ def addSkyLights(spaces=[], opts=dict) -> float:

for roof in ceiling["roofs"]:
sts = ssets
sts = [st for st in sts if "clng" in st]
sts = [st for st in sts if k in st]
sts = [st for st in sts if "space" in st]
sts = [st for st in sts if "roof" in st]
sts = [st for st in sts if "pattern" in st]
sts = [st for st in sts if "cm2" in st]
sts = [st for st in sts if "vts" in st]
sts = [st for st in sts if "vtx" in st]
sts = [st for st in sts if "ld" in st]
sts = [st for st in sts if id(roof) in st["ld"]]
sts = [st for st in sts if id(clng) in st["ld"]]
sts = [st for st in sts if st["space"] in rooms]
sts = [st for st in sts if "clng" in st]
sts = [st for st in sts if k in st]
sts = [st for st in sts if "space" in st]
sts = [st for st in sts if "roof" in st]
sts = [st for st in sts if "pattern" in st]
sts = [st for st in sts if "cm2" in st]
sts = [st for st in sts if "vts" in st]
sts = [st for st in sts if "vtx" in st]
sts = [st for st in sts if "ld" in st]
sts = [st for st in sts if id(roof) in st["ld"]]
sts = [st for st in sts if id(clng) in st["ld"]]

id0 = st["space"].nameString()

sts = [st for st in sts if id0 == ide]
sts = [st for st in sts if id0 in rooms]

sts = [st for st in sts if st["clng"] == clng]
sts = [st for st in sts if st["roof"] == roof]
sts = [st for st in sts if st[k ] == espace]
if len(sts) != 1: continue

stz.append(sts)[0]
stz.append(sts[0])

if not stz: continue

Expand All @@ -8593,7 +8596,8 @@ def addSkyLights(spaces=[], opts=dict) -> float:
if frame: sub["frame"] = frame

for ids, vt in st["vts"].items():
roof = openstudio.model.Surface(t0.inverse() * (ti * vt), mdl)
vec = p3Dv(t0.inverse() * list(ti * vt))
roof = openstudio.model.Surface(vec, mdl)
roof.setSpace(space)
roof.setName("%s:%s" % (ids, ide))

Expand Down Expand Up @@ -8644,7 +8648,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:

# Vertically-cast subset roof "vtx" onto ceiling.
for st in stz:
cst = cast(ti * st["vtx"], t0 * tile.vertices(), ray)
cst = cast(ti * st["vtx"], t0 * clng.vertices(), ray)
st["cvtx"] = t0.inverse() * cst

# Extended ceiling vertices.
Expand Down
7 changes: 7 additions & 0 deletions tests/test_osut.py
Original file line number Diff line number Diff line change
Expand Up @@ -4994,6 +4994,13 @@ def test34_generated_skylight_wells(self):
rm2 = osut.addSkyLights(core, dict(srr=srr))
self.assertAlmostEqual(rm2, gra_attic, places=2)

# New core skylight areas. Successfully achieved SRR%.
core_skies = osut.facets(core, "Outdoors", "Skylight")
sky_area1 = sum([sk.grossArea() for sk in core_skies])
self.assertAlmostEqual(round(sky_area1, 2), 7.89)
ratio = sky_area1 / rm2
self.assertAlmostEqual(round(ratio, 2), srr)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken from the original Ruby unit test, this checks the automated addition of skylight wells in a variant of the US DOE Prototype SmallOffice.

  • skylight well roof and 4x surrounding (paired) well walls are successfully generated
  • attic floor and adjacent core ceiling below have re-sequenced vertices (accommodating cutouts)
  • requested SRR of 5% is achieved
roof_ld

Unfortunately, North & South roof surfaces have not inherited similarly re-sequenced vertices. Their vertices remain unaltered ... TO DO.

Nonetheless, results remain consistent for a cold climate (Quebec), i.e. increases in heating, cooling & fans:

skyoffice_res

Can't explain the unexpected blip in interior lighting use - the core space/zone does not hold daylighting controls!

Almost there. Back to work ...


self.assertEqual(o.status(), 0)
del model

Expand Down