Skip to content
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

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

Closed
manuvarkey opened this issue Sep 5, 2022 · 5 comments
Labels
component - Geometry Editor OpenStudio SDK Issue An issue that is not related to OpenStudioApplication but to NREL/OpenStudio SDK severity - Normal Bug 🐛

Comments

@manuvarkey
Copy link
Contributor

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 manuvarkey added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Sep 5, 2022
@macumber
Copy link
Collaborator

macumber commented Sep 6, 2022

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.

@manuvarkey
Copy link
Contributor Author

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

@manuvarkey
Copy link
Contributor Author

manuvarkey commented Apr 17, 2024

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 ?

@macumber
Copy link
Collaborator

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
Copy link
Collaborator

Opened NREL/OpenStudio#5153

@jmarrec jmarrec added the OpenStudio SDK Issue An issue that is not related to OpenStudioApplication but to NREL/OpenStudio SDK label Aug 29, 2024
@jmarrec jmarrec closed this as completed Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Geometry Editor OpenStudio SDK Issue An issue that is not related to OpenStudioApplication but to NREL/OpenStudio SDK severity - Normal Bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants