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

Accessing isConditioned() from a Surface in 0penStudio Ruby

asked 2015-06-26 05:07:16 -0600

updated 2015-07-10 13:32:14 -0600

Hi! Thanks for all the answers by now.

I have this problem in OpenStudio Ruby SDK as I want to access the isConditioned from a Surface. All that comes to my mind is doing something like:

surface.space.get.thermalZone.isConditioned()

And it doesn't works. I can get the thermal zone and it works till than but I can't get any property of it. Anyone knows the right syntax or way to do it?

Thanks a lot as always

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2015-06-26 09:31:52 -0600

Here is a method that you pass a surface into. It returns true if conditioned, false if not.

def is_surface_conditioned(surface)
  # Not conditioned if not in a space
  return false unless surface.space.is_initialized
  space = surface.space.get
  # Not conditioned if space has no zone
  return false unless space.thermalZone.is_initialized
  zone = space.thermalZone.get
  # Not conditioned if zone is not conditioned
  return false unless zone.isConditioned
  # Must be conditioned
  return true
end
edit flag offensive delete link more

Comments

Your original idea was almost right (just missing a .get on the thermalZone) and would have worked for many cases. However, Andrew's code includes a lot more error checking and is more robust.

macumber's avatar macumber  ( 2015-06-26 10:02:29 -0600 )edit

Thanks a lot @aparker thanks a lot, that actually helped so much. @macumber thanks! but no, believe me I tried!

Pouya Kary's avatar Pouya Kary  ( 2015-06-26 13:50:02 -0600 )edit

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2015-06-26 05:07:16 -0600

Seen: 137 times

Last updated: Jun 26 '15