Skip to content

Adds geometry-related functions & tests#3

Merged
brgix merged 50 commits into
developfrom
geo
Aug 3, 2025
Merged

Adds geometry-related functions & tests#3
brgix merged 50 commits into
developfrom
geo

Conversation

@brgix
Copy link
Copy Markdown
Member

@brgix brgix commented Jul 8, 2025

Incrementally adding geometry-based functions (and unit tests).

@brgix brgix self-assigned this Jul 8, 2025
Comment thread tests/test_osut.py
import unittest
import openstudio
import osut
from src.osut import osut
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Novice mistake: avoids pulling in pip-installed package/module - my bad.

Comment thread src/osut/osut.py
indx = i

if not indx: return False
if indx is None: return False
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If a list's index equals 0, if not indx returns False - not good! if indx is None is better here. Made multiple changes to ensure consistency.

Comment thread tests/test_osut.py
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
Copy Markdown
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 ...

Comment thread src/osut/osut.py

# Extended vertex sequence of the larger polygon.
genExtendedVertices(s, sset)
return genExtendedVertices(s, sset)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That'll do it. A remnant of Ruby's implicit return - my bad.

Comment thread tests/test_osut.py
self.assertTrue(ia_set.setWallConstruction(construction))
if o.logs(): print(o.logs())

model.save("./tests/files/osms/out/office_attic.osm", True)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Both North & South roof surfaces now inherit leader lines and cutouts to accommodate skylight wells. Although roof surfaces inherit such extended vertices (consult generated office_attic.osm file with a text editor), the OpenStudio Application won't necessarily render them - that's OK.

office_wells

There's now a single eplusout.err file warning on collinear vertices - which is expected. Otherwise, slight (expected) changes in results.

skyoff2_res

All good for now. More testing to come.

Comment thread tests/test_osut.py
sky_area2 = sum([sk.grossArea() for sk in core_skies])
self.assertAlmostEqual(sky_area2, 29.94, places=2)
ratio2 = sky_area2 / rm2
self.assertAlmostEqual(ratio2, srr, places=2)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Converting SmallOffice UNCONDITIONED "attic" to an INDIRECTLY-CONDITIONED "plenum" (or similar dead-air space). Greater roof surface areas? Larger skylights + wells (for the same 5% SRR):

offplenum_sky

Tests are green. Same (single) eplusout.err warning on coincident/collinear vertices - that's fine.

Comment thread tests/test_osut.py
self.assertTrue(zn.isVolumeAutocalculated())
self.assertFalse(zn.volume())

model.save("./tests/files/osms/out/seb_sky.osm", True)
Copy link
Copy Markdown
Member Author

@brgix brgix Aug 3, 2025

Choose a reason for hiding this comment

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

In buildings with smaller rooms, addSkylights' built-in filters favour adding a single skylight strip (+ well) in the largest room:

seb_sky

Moving along ...

Comment thread tests/test_osut.py
sky_area2 = sum([sk.grossArea() for sk in bulk_skies])
self.assertAlmostEqual(sky_area2, 128.19, places=2)
ratio2 = sky_area2 / rm2
self.assertAlmostEqual(ratio2, srr, places=2)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For the US DOE Warehouse, addSkylights first purges existing skylights (clean slate), before adding new skylight arrays to meet the requested SRR 4%.

whouse_sky

Comment thread src/osut/osut.py Outdated
# Favour (large) arrays if meeting residual target, unless constrained.
if "array" in fpm2:
if round(fpm2["array"]["m2"], 2) >= round(dm2, 2):
if not fpm2["tight"]: pattern = "array"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Annoyed that Ruby'esque quirks remain in the Python implementation. Only catching these with runtime errors - my bad.

Otherwise, all unit tests (matching prior Ruby OSut unit tests) are green.

May test other US DOE Prototypes (and possible Canadian DND models) before merging.

@brgix brgix merged commit 449dde8 into develop Aug 3, 2025
4 checks passed
@brgix brgix deleted the geo branch August 3, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant