-
Notifications
You must be signed in to change notification settings - Fork 0
Tweaks 'genConstruction' (tested) #7
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
Changes from 1 commit
31fe98c
0ca5976
01f0f11
f36e9a2
d4634be
a57c25c
3c630f9
02b8023
ab70a66
a33b3b0
efacdf8
b294f50
8214f2f
7a35d64
7fbf1a2
3721304
c212c30
c2129da
5c33a23
f24ad09
10087e1
512e84b
bb299a7
e4df93b
1c3d672
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1656,18 +1656,28 @@ def scheduleIntervalMinMax(sched=None) -> dict: | |
| - "min" (float): min temperature. (None if invalid inputs - see logs). | ||
| - "max" (float): max temperature. (None if invalid inputs - see logs). | ||
| """ | ||
| mth = "osut.scheduleCompactMinMax" | ||
| mth = "osut.scheduleIntervalMinMax" | ||
| cl = openstudio.model.ScheduleInterval | ||
| vals = [] | ||
| res = dict(min=None, max=None) | ||
|
|
||
| if not isinstance(sched, cl): | ||
| return oslg.mismatch("sched", sched, cl, mth, CN.DBG, res) | ||
|
|
||
| vals = sched.timeSeries().values() | ||
| values = sched.timeSeries().values() | ||
| length = len(values) | ||
|
|
||
| res["min"] = min(values) | ||
| res["max"] = max(values) | ||
| for i in range(length): | ||
| try: | ||
| value = float(values[i]) | ||
| value = vals.append(value) | ||
| except: | ||
| oslg.invalid("numerical at %d" % i, mth, 1, CN.ERR) | ||
|
|
||
| if not vals: return res | ||
|
|
||
| res["min"] = min(vals) | ||
| res["max"] = max(vals) | ||
|
|
||
| try: | ||
| res["min"] = float(res["min"]) | ||
|
|
@@ -2601,6 +2611,17 @@ def availabilitySchedule(model=None, avl=""): | |
|
|
||
| return schedule | ||
|
|
||
| # ---- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---- # | ||
| # This final set of utilities targets OpenStudio geometry. Many of the | ||
| # following geometry methods rely on Boost as an OpenStudio dependency. | ||
| # As per Boost requirements, points (e.g. vertical polygon) must be 'aligned': | ||
| # - first rotated/tilted as to lay flat along XY plane (Z-axis ~= 0) | ||
| # - initial Z-axis values now become Y-axis values | ||
| # - points with the lowest X-axis values are 'aligned' along X-axis (0) | ||
| # - points with the lowest Z-axis values are 'aligned' along Y-axis (0) | ||
| # - for several Boost methods, points must be clockwise in sequence | ||
| # | ||
| # Check OSut's poly() method, which offers such Boost-related options. | ||
|
|
||
| def transforms(group=None) -> dict: | ||
| """"Returns OpenStudio site/space transformation & rotation angle. | ||
|
|
@@ -2704,7 +2725,7 @@ def p3Dv(pts=None) -> openstudio.Point3dVector: | |
| pts (list): OpenStudio 3D points. | ||
|
|
||
| Returns: | ||
| openstudio.Point3dVector: Vector of 3D points (see logs if empty). | ||
| openstudio.Point3dVector: Vector of 3D points (see 'p3Dv' logs if empty). | ||
|
|
||
| """ | ||
| mth = "osut.p3Dv" | ||
|
|
@@ -6085,7 +6106,7 @@ def genSlab(pltz=[], z=0) -> openstudio.Point3dVector: | |
| slb = vtx | ||
|
|
||
| # Once joined, re-adjust Z-axis coordinates. | ||
| if abs(z) > CN.TOL: | ||
| if round(z, 2) != 0.00: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More appropriate. |
||
| vtx = openstudio.Point3dVector() | ||
|
|
||
| for pt in slb: vtx.append(openstudio.Point3d(pt.x(), pt.y(), z)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -392,7 +392,7 @@ def test05_construction_generation(self): | |
| self.assertEqual(o.status(), 0) | ||
| del model | ||
|
|
||
| # Insulated (conditioned), parking garage roof (polyiso under 8" slab). | ||
| # Roof above conditioned parking garage (polyiso under 8" slab). | ||
| specs = dict(type="roof", uo=0.214, clad="heavy", frame="medium", finish="none") | ||
| model = openstudio.model.Model() | ||
| c = osut.genConstruction(model, specs) | ||
|
|
@@ -1731,9 +1731,27 @@ def test17_minmax_heatcool_setpoints(self): | |
| self.assertTrue(cc.setTemperatureCalculationRequestedAfterLayerNumber(1)) | ||
| self.assertTrue(floor.setConstruction(cc)) | ||
|
|
||
| # Test 'fixed interval' schedule. Annual time series - no variation. | ||
| start = model.getYearDescription().makeDate(1, 1) | ||
| inter = openstudio.Time(0, 1, 0, 0) | ||
| values = openstudio.createVector([22.78] * 8760) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OSut enabled ScheduleFixedInterval checks, e.g.:
Yet no unit test had been in place. |
||
| series = openstudio.TimeSeries(start, inter, values, "") | ||
| limits = openstudio.model.ScheduleTypeLimits(model) | ||
| limits.setName("Radiant Electric Heating Setpoint Schedule Type Limits") | ||
| self.assertTrue(limits.setNumericType("Continuous")) | ||
| self.assertTrue(limits.setUnitType("Temperature")) | ||
|
|
||
| schedule = openstudio.model.ScheduleFixedInterval(model) | ||
| schedule.setName("Radiant Electric Heating Setpoint Schedule") | ||
| self.assertTrue(schedule.setTimeSeries(series)) | ||
| self.assertTrue(schedule.setTranslatetoScheduleFile(False)) | ||
| self.assertTrue(schedule.setScheduleTypeLimits(limits)) | ||
|
|
||
| tvals = schedule.timeSeries().values() | ||
| self.assertTrue(isinstance(tvals, openstudio.Vector)) | ||
| for i in range(len(tvals)): self.assertTrue(isinstance(tvals[i], float)) | ||
|
|
||
| availability = osut.availabilitySchedule(model) | ||
| schedule = openstudio.model.ScheduleConstant(model) | ||
| self.assertTrue(schedule.setValue(22.78)) # reuse cooling setpoint | ||
|
|
||
| # Create radiant electric heating. | ||
| ht = (openstudio.model.ZoneHVACLowTemperatureRadiantElectric( | ||
|
|
@@ -5384,15 +5402,15 @@ def test35_facet_retrieval(self): | |
|
|
||
| translator = openstudio.osversion.VersionTranslator() | ||
|
|
||
| path = openstudio.path("./tests/files/osms/out/seb2.osm") | ||
| path = openstudio.path("./tests/files/osms/out/seb_ext2.osm") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harmonizing with Ruby test. |
||
| model = translator.loadModel(path) | ||
| self.assertTrue(model) | ||
| model = model.get() | ||
| spaces = model.getSpaces() | ||
| surfs = model.getSurfaces() | ||
| subs = model.getSubSurfaces() | ||
| self.assertEqual(len(surfs), 56) | ||
| self.assertEqual(len(subs), 8) | ||
| self.assertEqual(len(surfs), 59) | ||
| self.assertEqual(len(subs), 14) | ||
|
|
||
| # The solution is similar to: | ||
| # OpenStudio::Model::Space::findSurfaces(minDegreesFromNorth, | ||
|
|
@@ -5416,15 +5434,15 @@ def test35_facet_retrieval(self): | |
| roofs1 = osut.facets(spaces, "Outdoors", "RoofCeiling", "top") | ||
| roofs2 = osut.facets(spaces, "Outdoors", "RoofCeiling", "foo") | ||
|
|
||
| self.assertEqual(len(windows), 8) | ||
| self.assertEqual(len(skylights), 0) | ||
| self.assertEqual(len(walls), 26) | ||
| self.assertEqual(len(windows), 11) | ||
| self.assertEqual(len(skylights), 3) | ||
| self.assertEqual(len(walls), 28) | ||
| self.assertFalse(northsouth) | ||
| self.assertEqual(len(northeast), 8) | ||
| self.assertEqual(len(north), 14) | ||
| self.assertEqual(len(floors1a), 4) | ||
| self.assertEqual(len(floors1b), 4) | ||
| self.assertEqual(len(roofs1), 4) | ||
| self.assertEqual(len(roofs1), 5) | ||
| self.assertFalse(roofs2) | ||
|
|
||
| # Concise variants, same output. In the SEB model, floors face "Ground". | ||
|
|
||
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.
typo