Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page

OpenStudio 3.1 erases surfaces when surface matching. Not present in OpenStudio 2.9

See the image below for context. At the top, you'll see the model before surface matching. Below, you'll see the model in OS 2.9 and in 3.1. You'll notice how the boundary condition for the floors changes to Surface for all the surfaces except a sliver that remains adjacent to Ground.

If you look at the roof surfaces, you'll notice this sliver is now missing altogether in OS 3.1.

I'm unsure why this is happening. Here is a clue I get when doing the intersect surfaces in OS 3.1

[openstudio.model.Surface] <1> Initial area of surface 'Surface 18' 646.605 does not equal post intersection area 646.605

Link to source in C++ code as far as I can tell. Appears to have something to do with intersection code

Things I have checked:

• The order in which spaces are matched is identical
• Both versions of OpenStudio agree upon which spaces intersect.
• The OpenStudio methods OpenStudio::Model.intersectSurfaces(spaces) and OpenStudio::Model.matchSurfaces(spaces) do not resolve the issue (they made it worse somehow, not sure why).

https://github.com/jugonzal07/stack_o...

Meat of the surface code is under match_spaces on L95

def match_spaces(spaces)

# Sort spaces for consistency between models
spaces = sort_spaces(spaces)

n = spaces.size

boundingBoxes = []
(0...n).each do |i|
boundingBoxes[i] = spaces[i].transformation * spaces[i].boundingBox
end

(0...n).each do |i|
(i+1...n).each do |j|
next unless boundingBoxes[i].intersects(boundingBoxes[j])
puts "#{spaces[i].name.to_s} intersects #{spaces[j].name.to_s}"
spaces[i].intersectSurfaces(spaces[j])
spaces[i].matchSurfaces(spaces[j])
end #j
end #i
end

edit retag close merge delete

@jugonzal07 is this a result of surface matching via SketchUp plug-in or an OpenStudio measure? Both would use Ruby.

( 2022-01-29 09:56:30 -0500 )edit

hi Aaron - this is being done with the OpenStudio SDK. In the code snippet I posted, you can see spaces[i].intersectSurfaces(spaces[j]) and spaces[i].matchSurfaces(spaces[j]) . That is where the surface intersecting and matching happens.

( 2022-01-29 11:28:47 -0500 )edit

@jugonzal07 thanks for all the details. The surface matching doesn't alter surface geometry, but only the outside boundary condition field and the outside condition object. This is definitely from intersection which does alter geometry. We have been working to improve it, and have added in some additional logging that you have seen, but in some fixes we go fix some instances, but create new issues. In your repo, I assume can test with either of the OSM files with before in the name, but didn't know what os_matching_method.osm was for. [Issue filed.](https://github.com/NREL/OpenStudio/issues/4526)

( 2022-01-29 17:24:23 -0500 )edit

oh, sorry about that! I didn't mean to add os_matching_method.osm to the repo. That was a dummy file I was using to test different ideas.

( 2022-01-29 19:40:25 -0500 )edit

Sort by » oldest newest most voted

I haven't tried your code, but I did take your model and ran it though surface matching measure in OpenStudio 3.3.0 and that seems to work.

Is there a reason you are using OpenStudio 3.1 instead of 3.3, it could be good for you to confirm on your end that 3.30 also works. I have selected the surface that for you you is being deleted in OpenStudio 3.1.

more

Thanks so much David! This has all been very helpful.

I will try explicitly running the measure you ran in 3.3 in 3.1 to see if it works. If it works, I'll try and replicate our surface intersecting and matching code with it.

Updating to 3.3 would require rerunning our regression tests and possibly creating new issues to resolve (plus any ruby update issues that might come along). We've been working toward 3.1 for a bit now. However, if we can't get this working in 3.1 pulling the band aid off might be worth it.

( 2022-01-29 19:53:04 -0500 )edit

Unfortunately running the measure appeared to have had the same result as when I manually ran OpenStudio::Model.intersectSurfaces(spaces) and OpenStudio::Model.matchSurfaces(spaces) . I'm not sure what's different in OS 3.1, but it causes about half to match correct and half to not. A very different result than our internal surface intersection and mapping code.

( 2022-01-29 20:06:06 -0500 )edit

Running the measure you linked in OS 3.3 correctly intersects and matches surfaces on my end as well.

( 2022-01-30 08:03:51 -0500 )edit