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

How do you fix orphaned objects in OpenStudio

asked 2014-10-30 17:10:04 -0500

updated 2015-11-09 14:11:18 -0500

Wondering what your tricks are to fix a situation where OpenStudio orphans an object? For example, as of version 1.5.0 if you remove a water coil in a certain way it can be orphaned and cause OS to crash during some actions. This is related to a known bug in OS, but I'm curious if you've experienced other similar bugs and what your fix was?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
8

answered 2014-10-30 21:37:03 -0500

I would write an OpenStudio Measure to remove these orphaned objects. You can run the Measure on your model via "Components & Measures > Apply Measure Now" and see the impact of the Measure before saving the edited model.

Here is the ruby code you to put inside the run method in measure.rb:

# Remove orphaned hot water heating coils
model.getCoilHeatingWaters.each do |coil|
  if coil.airLoopHVAC.is_initialized and coil.plantLoop.is_initialized
    next # Ignore coils that are already connected properly
  elsif coil.plantLoop.is_initialized
    next # Ignore hot water coils that are already connected properly inside air terminals
  else
    coil.remove
    runner.registerInfo("Removed an orphaned hot water coil called #{coil.name.get}")
  end
end    

# Remove orphaned chilled water cooling coils
model.getCoilCoolingWaters.each do |coil|
  if coil.airLoopHVAC.is_initialized and coil.plantLoop.is_initialized
    next # Ignore coils that are already connected properly
  else
    coil.remove
    runner.registerInfo("Removed an orphaned chilled water coil called #{coil.name.get}")
  end
end        

# Remove orphaned water coil controllers (for hot and chilled water coils)
model.getControllerWaterCoils.each do |controller_water_coil|
  controller_used = false
  model.getCoilHeatingWaters.each do |coil|
    if coil.controllerWaterCoil.is_initialized
      if coil.controllerWaterCoil.get == controller_water_coil
        controller_used = true
      end
    end
  end
  model.getCoilCoolingWaters.each do |coil|
    if coil.controllerWaterCoil.is_initialized
      if coil.controllerWaterCoil.get == controller_water_coil
        controller_used = true
      end
    end
  end      
  # Remove unused water coil controllers
  if controller_used == false
    controller_water_coil.remove
    runner.registerInfo("Removed #{controller_water_coil.name.get} because it is unused")
  end
end
edit flag offensive delete link more
2

answered 2014-11-26 13:19:59 -0500

I just uploaded a measure to do this very thing, although the current version doesn't address orphan HVAC objects. Looks like I need to take @aparker's code and extend the measure. But until then it works for internal loads and surfaces. It also optionally allows you to remove unused resources from the model.

The OpenStudio user documentation troubleshooting page has additional details and screenshots of the measure.

edit flag offensive delete link more
1

answered 2014-10-31 15:33:20 -0500

I've used a kind of brute force method in the past, by directly manipulating the .osm file, but be very careful in doing so, you can break your model in all kinds of ways! Caveat emptor definitely applies, and I would definitely make a copy of the file before doing any manual manipulation.

In my case, it happened to be with some orphaned luminaires.

You can usually narrow down your search to the few objects you suspect to be the orphans based on the behaviour of your model, or maybe error messages you are getting. I've then taken the object ID text, and done a search in the file for that string of characters to see if it is associated with any other objects. If the object ID is being used by another object, you could safely assume that that object is not your orphan.

In the case of coils, the object ID would show up in a NodeList somewhere if it is not orphaned.

Again, I can't stress this enough: BE CAREFUL doing it this way.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

2 followers

Stats

Asked: 2014-10-30 17:10:04 -0500

Seen: 599 times

Last updated: Nov 26 '14