NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
501 stars 191 forks source link

v370-rc1 : too stringent polyhedron checks? #5002

Closed brgix closed 11 months ago

brgix commented 12 months ago

Context

OSut holds a number of geometry methods, as well as supporting RSpecs like "checks for space/surface convexity". The latter tests OpenStudio behaviour when adding holes cut in (larger) surfaces. The intention here is to first test, prior to developing a general OSut method (accommodating either other smaller surfaces or shafts, e.g. skylight wells). Roughly half of the comments/illustrations of this merged PR describe encountered pitfalls/workarounds for a handful of scenarios. The (simple) solution rests on properly winding extra vertices (of the larger surface) around a new hole.

osut

Current Behavior

As reported here, the RSpec fails with v3.7.0-rc1 calculated volume for irregular geometries (SmallOffice, Attic):

Failure/Error: expect(attic.volume).to be_within(TOL).of(720.19) unless v < 350
       expected 798.4139451428566 to be within 0.01 of 720.19

720.19 m3 is the correct volume. It is my understanding that v3.7.0-rc1 reverts to pre-v3.5.0 volume calculations due to (revised) polyhedron checks (i.e. more stringent than v3.6.1, than EnergyPlus v23.2.0 ?):

[utilities.Polyhedron] <0> Polyhedron is not enclosed in original testing. Trying to add missing colinear points.
[utilities.Polyhedron] <0> Polyhedron is not enclosed.
[openstudio.model.Space] <0> Object of type 'OS:Space' and named 'Core_ZN' is not enclosed, there are 2 edges that aren't used exactly twice. Falling back to ceilingHeight * floorArea. Volume calculation will be potentially inaccurate.
[utilities.Polyhedron] <0> Polyhedron is not enclosed in original testing. Trying to add missing colinear points.
[utilities.Polyhedron] <0> Polyhedron is not enclosed.
[openstudio.model.Space] <0> Object of type 'OS:Space' and named 'Attic' is not enclosed, there are 1 edges that aren't used exactly twice. Falling back to ceilingHeight * floorArea. Volume calculation will be potentially inaccurate.

However, a forward translated IDF (v23.2.0) of the same modified model (files/osms/out/miniX.idf) reports the right volume (720.19 m3 for the attic). This remains consistent with older EnergyPlus versions (tested for v9.5.0 up to v23.2.0).

Steps to Reproduce

  1. git clone https://github.com/rd2/osut.git
  2. git checkout v370rc1
  3. bundle update
  4. bundle exec rake (running OpenStudio v3.7.0-rc1)

Expected Behavior

Redo "Steps to Reproduce" with OpenStudio v3.6.1:

Possible Solution

Currently looking into which recently-added checks (vs 3.6.1) could be slightly less stringent.

Details

Environment

OpenStudio versions 3.0.0 through 3.7.0-rc1 (MacOS Intel Sonoma 14.0, GitHub Actions : Ubuntu 22.04)

Work in progress

There may be yet unidentified (Boost?) side effects of the tested solution - it's still work in progress. Nonetheless, it remains a fairly straightforward solution to accommodate similar geometry changes (without having to split surfaces). This is the favoured solution to accommodate mandatory skylight (and skylight wells) in support of Canadian NECBs (e.g. BTAP). It would be preferable to retain v3.6.1-like checks (or a similar degree of stringency). In a nutshell: if it's OK for EnergyPlus, it should be OK for OpenStudio. Regardless, giving a big thumb's up to the OpenStudio geometry/surface/vertex updates/fixes over the last few releases.

macumber commented 12 months ago

Hmm, this might be related to some polygon work @jmarrec has been working on lately? @brgix do you have a small, standalone osm and/or ruby script that could be used to reproduce the issue?

brgix commented 12 months ago

miniX.zip

... holds both the v3.7.0 OSM and the forward translated v23.2 IDF of the miniX case; a US DOE Prototype SmallOffice variant.

To raise the OpenStudio stdout polyhedron warnings, simply fetch the "Attic" volume in a very basic .rb script (e.g. puts attic.volume). The reported SDK volume shouldn't match the value generated by EnergyPlus (e.g. eplustbl.htm).

macumber commented 12 months ago

Hmm, yeah I see attic.volume reported out as 804.0368 in the 3.7.0-rc.1 build and attic.isEnclosedVolume returns false

For what it's worth, if you group the attic space surfaces in SketchUp it will detect them as a solid group with area of 720.1877

This seems to be the problem edge (highlighted in blue below), attic.polyhedron.edgesNotTwo[0] Surface3dEdge: start=[5, 13.46, 3.05], end=[12.845, 10.23, 3.05], count=1, firstSurface='Attic_floor_core'

image

I wonder if it's possible to detect this edge as belonging to the same surface twice (in opposite directions) and count that as ok?

brgix commented 12 months ago

@macumber : Correct about the (culprit) edge. My initial comments may be somewhat obscure, but I point this out in the very last paragraph:

If one were to comment out the final vertex addition of all 3 sets of extra wrapping vertices (e.g. vtx << mini_floor_vtx[3] # ?), then OpenStudio v3.7.0-rc1 will not log to stdout the aforementioned unenclosed polyhedron messages. However, neither OpenStudio nor EnergyPlus will then report the correct floor areas and volumes. As with previous EnergyPlus runs, there are no reported warnings or errors with this slightly-altered solution. The initial solution is obviously preferred.

There's a brief paragraph on this here. So one could comment out the following 3 lines (here, here and here) and rerun (bundle exec rake) with v3.7.0-rc1: polyhedron messages would no longer flash to stdout. Not a good long term solution, but it isolates the issue.

macumber commented 12 months ago

I just pushed a pull request that I believe addresses this issue, I will do some more testing later today and hopefully add a unit test for this case.

brgix commented 11 months ago

Can confirm that updated v370-rc1 (PR #5003) works just fine now (locally - waiting for OSut GitHub Actions to complete). Big thumbs up! Merci !