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

Revision history [back]

I found some spaces that have overlapping geometry (see below). That should be fixed but that wasn't' causing the issue.

image description

I created a custom version of the Surface Matching that only matched one pair of spaces at a time vs. all of the spaces at once. I expected it to fail but to identify problem surfaces, but it worked, just much more slowly. I'll show you that code below, but I can also email you file, but I only don't have 1.13.0 on machine I'm at now.

While the matching worked, it isn't perfect, you will have some hand matching to do, but most of the surfaces matched.

image description

The plenum zones below are examples of some ceilings that didn't match. You can hand match using the SketchUp Inspector or the gridview of OpenStudio application. For this large of a model you may want to avoid gridview for surfaces. Using the OpenStudio inspector in SketchUp you can't change the boundary condition. Instead you identify the boundary condition object. Also related to the image below. The Surface Matching measure (and the native OpenStudio intersect method, doesn't intersect sub-surfaces. That is why the interior windows didn't work. You can remove those unless they are needed or create similar surfaces in the adjacent spaces).

image description

Lastly, as shown below the native OpenStudio intersect creates convex surfaces, which is why you see the faceted surfaces in some areas.

image description

Here is the full section of the run method. You can copy the Surface Matching measure and replace the run method with what is shown below.

def run(model, runner, user_arguments)
super(model, runner, user_arguments)

# matched surface counter
initialMatchedSurfaceCounter = 0
surfaces = model.getSurfaces
surfaces.each do |surface|
  if surface.outsideBoundaryCondition == "Surface"
    next if not surface.adjacentSurface.is_initialized # don't count as matched if boundary condition is right but no matched object
    initialMatchedSurfaceCounter += 1
  end
end

#reporting initial condition of model
runner.registerInitialCondition("The initial model has #{initialMatchedSurfaceCounter} matched surfaces.")

# for diagnostics looping through vector of each pair of spaces
model.getSpaces.sort.each do |space_a|
  model.getSpaces.sort.each do |space|
    runner.registerInfo("Intersecting and matching surfaces between #{space_a.name} and #{space.name}")
    puts "Intersecting and matching surfaces between #{space_a.name} and #{space.name}"
    spaces = OpenStudio::Model::SpaceVector.new
    spaces << space_a
    spaces << space
    OpenStudio::Model.intersectSurfaces(spaces)
    OpenStudio::Model.matchSurfaces(spaces)
  end
end

# matched surface counter
finalMatchedSurfaceCounter = 0
surfaces.each do |surface|
  if surface.outsideBoundaryCondition == "Surface"
    finalMatchedSurfaceCounter += 1
  end
end

#reporting final condition of model
runner.registerFinalCondition("The final model has #{finalMatchedSurfaceCounter} matched surfaces.")

return true
end # end of the run method

I found some spaces that have overlapping geometry (see below). That should be fixed but that wasn't' causing the issue.

image description

So I created a custom version of the Surface Matching that only matched one pair of spaces at a time vs. all of the spaces at once. I expected it to fail but to identify problem surfaces, but it worked, just much more slowly. I'll show you that code below, but I can also email you file, but file later, I only don't have 1.13.0 on machine I'm at now.

While the matching worked, it isn't perfect, you will have some hand matching to do, but most of the surfaces matched.

image description

The plenum zones below are examples of some ceilings that didn't match. You can hand match using the SketchUp Inspector or the gridview of OpenStudio application. For this large of a model you may want to avoid gridview for surfaces. Using the OpenStudio inspector in SketchUp you can't change the boundary condition. Instead you identify the boundary condition object. Also related to the image below. The Surface Matching measure (and the native OpenStudio intersect method, doesn't intersect sub-surfaces. That is why the interior windows didn't work. You can remove those unless they are needed or create similar surfaces in the adjacent spaces).

image description

Lastly, as shown below the native OpenStudio intersect creates convex surfaces, which is why you see the faceted surfaces in some areas.

image description

Here is the full section of the run method. You can copy the Surface Matching measure and replace the run method with what is shown below.

def run(model, runner, user_arguments)
super(model, runner, user_arguments)

# matched surface counter
initialMatchedSurfaceCounter = 0
surfaces = model.getSurfaces
surfaces.each do |surface|
  if surface.outsideBoundaryCondition == "Surface"
    next if not surface.adjacentSurface.is_initialized # don't count as matched if boundary condition is right but no matched object
    initialMatchedSurfaceCounter += 1
  end
end

#reporting initial condition of model
runner.registerInitialCondition("The initial model has #{initialMatchedSurfaceCounter} matched surfaces.")

# for diagnostics looping through vector of each pair of spaces
model.getSpaces.sort.each do |space_a|
  model.getSpaces.sort.each do |space|
    runner.registerInfo("Intersecting and matching surfaces between #{space_a.name} and #{space.name}")
    puts "Intersecting and matching surfaces between #{space_a.name} and #{space.name}"
    spaces = OpenStudio::Model::SpaceVector.new
    spaces << space_a
    spaces << space
    OpenStudio::Model.intersectSurfaces(spaces)
    OpenStudio::Model.matchSurfaces(spaces)
  end
end

# matched surface counter
finalMatchedSurfaceCounter = 0
surfaces.each do |surface|
  if surface.outsideBoundaryCondition == "Surface"
    finalMatchedSurfaceCounter += 1
  end
end

#reporting final condition of model
runner.registerFinalCondition("The final model has #{finalMatchedSurfaceCounter} matched surfaces.")

return true
end # end of the run method