OpenStudioApplication icon indicating copy to clipboard operation
OpenStudioApplication copied to clipboard

Subsurfaces across thermal zones do not have outside boundary condition object assigned

Open manuvarkey opened this issue 3 years ago • 5 comments

Issue overview

While geometry is created using inbuilt FloorspaceJS editor, subsurfaces (windows and doors) in walls across thermal zones do not have outside boundary condition object assigned in Spaces->Subsurfaces.

Current Behavior

No outside boundary condition objects are assigned in Spaces->Subsurfaces for internal windows and doors.

Following EnergyPlus error is thrown for all such subsurface.

   ** Severe  ** FenestrationSurface:Detailed="FACE 3", invalid blank Outside Boundary Condition Object
   **   ~~~   ** ...when Base surface uses "Surface" as Outside Boundary Condition Object, subsurfaces must also specify specific surfaces in the adjacent zone.
   ** Severe  ** FenestrationSurface:Detailed="FACE 12", invalid blank Outside Boundary Condition Object
   **   ~~~   ** ...when Base surface uses "Surface" as Outside Boundary Condition Object, subsurfaces must also specify specific surfaces in the adjacent zone.
   **  Fatal  ** GetSurfaceData: Errors discovered, program terminates.

Expected Behavior

Automatic assignment of Outside Boundary Condition Object should happen.

Steps to Reproduce

  1. Create a model with two rooms with common interior wall.
  2. Create a window or door in the common wall.
  3. Assign both rooms to different thermal spaces.
  4. Run simulation

sample file.zip

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): Ubuntu 22.04
  • Version of OpenStudioApplication (if using an intermediate build, include SHA): 1.4.0+e0fb8f854d

manuvarkey avatar Sep 05 '22 08:09 manuvarkey

Thanks for the report @manuvarkey. I believe that this issue is with the OpenStudio SDK, interior windows are not translated from FloorspaceJS to OSM with the correct Outside Boundary Condition Object property set. We could implement workarounds in the OS App but I think the best fix would be in the OS SDK, especially if there is work happening in this translation now.

macumber avatar Sep 06 '22 02:09 macumber

@macumber As per discussion on upstream bug report, this may not be an upstream issue. Further investigation may be required.

manuvarkey avatar Sep 09 '22 18:09 manuvarkey

I did some troubleshooting regarding this issue and found that ModelMerger::mergeModels is causing the Subsurface adjacent surfaces to be unset. Please see the following python code examples.

Following code where a floorspace plan is loaded and translated produces out1.osm with properly set outside boundary condition objects for subsurfaces.

import openstudio as os

# Open floorplan and get translated OSM model
with open('floorplan.json') as fp:
    json_str = fp.read()
fp_json = os.FloorplanJS(json_str)
ts_scene = fp_json.toThreeScene(True)
rt = os.model.ThreeJSReverseTranslator()
os_model_tr = rt.modelFromThreeJS(ts_scene).get()

# Save translated model
os_model_tr.save('out1.osm')

However the following code where a floorspace plan is loaded, translated and subsequently merged with a blank model produces out2.osm with outside boundary condition objects unset for subsurfaces.

import openstudio as os

# Open floorplan and get translated OSM model
with open('floorplan.json') as fp:
    json_str = fp.read()
fp_json = os.FloorplanJS(json_str)
ts_scene = fp_json.toThreeScene(True)
rt = os.model.ThreeJSReverseTranslator()
os_model_tr = rt.modelFromThreeJS(ts_scene).get()
model_handle_mapping = rt.handleMapping()

# Merge translated model with blank model and save
model = os.model.Model()
mm = os.model.ModelMerger()
mm.mergeModels(model, os_model_tr, model_handle_mapping)
model.save('out2.osm')

On going through the code in OpenStudioApplication/src/openstudio_lib/GeometryEditorView.cpp, it is seen that model::ModelMerger::mergeModels function is used to merge new model from floorspace plan to current openstudio model.

On going through the code for OpenStudio/src/model/ModelMerger.cpp, the following code segment was found dealing with setting adjacentSuface for Surface elements.

https://github.com/NREL/OpenStudio/blob/d2f0bdd21a70e6a9711f6da8f5aabecadc4a1a1c/src/model/ModelMerger.cpp#L349C1-L359C6

      boost::optional<Surface> newAdjacentSurface = newSurface.adjacentSurface();
      if (newAdjacentSurface) {
        boost::optional<UUID> currentAdjacentSurfaceHandle = getCurrentModelHandle(newAdjacentSurface->handle());
        if (currentAdjacentSurfaceHandle) {
          boost::optional<Surface> currentAdjacentSurface = m_currentModel.getModelObject<Surface>(*currentAdjacentSurfaceHandle);
          if (currentAdjacentSurface) {
            clone.setAdjacentSurface(*currentAdjacentSurface);
            }
          }
        }
      }

However similar code is missing for setting adjacentSubSurface for SubSurface elements.

In view of the above, it seems that the issue can be resolved by adding similar code to set adjacentSubSurface for SubSurface elements in model::ModelMerger::mergeSpace.

output files.zip

@macumber since bug seems to be related to upstream, can you reopen the upstream bug report ?

manuvarkey avatar Apr 17 '24 07:04 manuvarkey

Wow, nice investigation @manuvarkey! I guess this is why @ggartside didn't find an issue with the floorspace reverse translator, the issue is in the ModelMerger. I'll file a new upstream issue to prevent confusion.

macumber avatar Apr 18 '24 03:04 macumber

Opened https://github.com/NREL/OpenStudio/issues/5153

macumber avatar Apr 18 '24 05:04 macumber