-
Notifications
You must be signed in to change notification settings - Fork 0
Adds geometry-related functions & tests #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import unittest | ||
| import openstudio | ||
| import osut | ||
| from src.osut import osut |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
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:
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There's now a single eplusout.err file warning on collinear vertices - which is expected. Otherwise, slight (expected) changes in results.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.assertTrue(zn.isVolumeAutocalculated()) | ||
| self.assertFalse(zn.volume()) | ||
|
|
||
| model.save("./tests/files/osms/out/seb_sky.osm", True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
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.



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