Skip to content

Conversation

@brgix
Copy link
Member

@brgix brgix commented Jul 8, 2025

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

@brgix brgix self-assigned this Jul 8, 2025
import unittest
import openstudio
import osut
from src.osut import osut
Copy link
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.

indx = i

if not indx: return False
if indx is None: return False
Copy link
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.

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 ...


# Extended vertex sequence of the larger polygon.
genExtendedVertices(s, sset)
return genExtendedVertices(s, sset)
Copy link
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.

self.assertTrue(ia_set.setWallConstruction(construction))
if o.logs(): print(o.logs())

model.save("./tests/files/osms/out/office_attic.osm", True)
Copy link
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.

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
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.

self.assertTrue(zn.isVolumeAutocalculated())
self.assertFalse(zn.volume())

model.save("./tests/files/osms/out/seb_sky.osm", True)
Copy link
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 ...

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
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

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
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.

2 participants