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

AddDaylightSensors.rb error

asked 2014-10-28 22:03:38 -0500

jdunn's avatar

updated 2015-07-27 11:56:44 -0500

When trying to use this script in the OpenStudio application as an "add measure now," I get the error that my spaces "has no exterior natural lighting. No sensor will be added." However, the spaces have a thermal zone, and have outdoor boundary conditions, so I'm not sure what qualifies as having exterior natural lighting. Here is a snippet of the code from the github site, but I can't interpret it, thanks for the help!

 #eliminate spaces that don't have exterior natural lighting
  has_ext_nat_light = false
  space.surfaces.each do |surface|
    next if not surface.outsideBoundaryCondition == "Outdoors"
    surface.subSurfaces.each do |sub_surface|
      next if sub_surface.subSurfaceType == "Door"
      next if sub_surface.subSurfaceType == "OverheadDoor"
      has_ext_nat_light = true
  if has_ext_nat_light == false
    runner.registerWarning("Space '#{}' has no exterior natural lighting. No sensor will be added.")
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-28 22:40:10 -0500

updated 2014-10-29 08:33:18 -0500

This measure doesn't add in any windows, it only adds dayligt sensors. It first loops throu surfaces looking for surfaces with an exterior boundary condition. Then it loops through any subsurfaces that the surface has and if it has a sub-surface that isn't a door or overhead door sets this flag to true. "has_ext_nat_light = true". If one or more surface in a space is true for this it will add a sensor.

It was a basic proof of concept measure. We have office and school AEDG measures that are more advanced. They add fenestration as well as shading surfaces, light shelves, skylights, and daylighting controls. It removes your existing objects, and adds objects based on the 50% AEDG guidelines. To use this you need to use our templates or manually flag the building type and space types so the measure knows about the function of each space. This applies a more advanced logic on placing the sensor than the other measure.

edit flag offensive delete link more


Thanks David for the prompt reply! I was indeed trying to run the measure before running the set window to wall area measure, so that totally makes sense. Even though this measure isn't as powerful as the AEDG ones, it is still very useful in automating the addition of daylight sensors in large models. Keep up the great work and thanks for your help!

jdunn's avatar jdunn  ( 2014-10-29 09:03:44 -0500 )edit

David -

One additional thing I noticed -- while the measure adds the control sensor, it does not connect the thermal zone and the daylight control together. The thermal zone in OS has a field for "Primary Daylighting Control Name," which gets autopopulated as long as you add the daylight control after you specify the thermal zone. With the measure, however, I noticed that it does not modify this field.

I know you mentioned that it was a "proof of concept" measure, so this might not have been in the scope of the script. However, adding this functionality would provide great value.

jdunn's avatar jdunn  ( 2014-11-03 09:59:14 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2014-10-28 22:03:38 -0500

Seen: 200 times

Last updated: Oct 29 '14