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

Revision history [back]

If you now that neither the space or the building are rotated to a non 0 value then you can get the azimuth in degrees of a surface using OpenStudio::convert(surface.azimuth,"rad","deg").get but the code below, which is from the Window to Wall Ratio gives absolute azimuth including space and building rotation. You could change the test for south to 90 to 270

  # get the absoluteAzimuth for the surface so we can categorize it
  absoluteAzimuth =  OpenStudio::convert(s.azimuth,"rad","deg").get + s.space.get.directionofRelativeNorth + model.getBuilding.northAxis
  until absoluteAzimuth < 360.0
    absoluteAzimuth = absoluteAzimuth - 360.0
  end

  if facade == "North"
    next if not (absoluteAzimuth >= 315.0 or absoluteAzimuth < 45.0)
  elsif facade == "East"
    next if not (absoluteAzimuth >= 45.0 and absoluteAzimuth < 135.0)
  elsif facade == "South"
    next if not (absoluteAzimuth >= 135.0 and absoluteAzimuth < 225.0)
  elsif facade == "West"
    next if not (absoluteAzimuth >= 225.0 and absoluteAzimuth < 315.0)
  else
    runner.registerError("Unexpected value of facade: " + facade + ".")
    return false
  end

You could also include or exclude horizontal surfaces using surface.tiltbut you may want to put in a small tolerance as shown here in the SketchUp Plugin surface search. As you might expect the azimuth returned isn't very reliable on horizontal surfaces, what is returned might related order of vertices.

If you now that neither the space or the building are rotated to a non 0 value then you can get the azimuth in degrees of a surface using OpenStudio::convert(surface.azimuth,"rad","deg").get but the code below, which is from the Window to Wall Ratio gives absolute azimuth including space and building rotation. You could change the test for south to 90 to 270

  # get the absoluteAzimuth for the surface so we can categorize it
  absoluteAzimuth =  OpenStudio::convert(s.azimuth,"rad","deg").get + s.space.get.directionofRelativeNorth + model.getBuilding.northAxis
  until absoluteAzimuth < 360.0
    absoluteAzimuth = absoluteAzimuth - 360.0
  end

  if facade == "North"
    next if not (absoluteAzimuth >= 315.0 or absoluteAzimuth < 45.0)
  elsif facade == "East"
    next if not (absoluteAzimuth >= 45.0 and absoluteAzimuth < 135.0)
  elsif facade == "South"
    next if not (absoluteAzimuth >= 135.0 and absoluteAzimuth < 225.0)
  elsif facade == "West"
    next if not (absoluteAzimuth >= 225.0 and absoluteAzimuth < 315.0)
  else
    runner.registerError("Unexpected value of facade: " + facade + ".")
    return false
  end

You could also include or exclude horizontal surfaces using surface.tiltbut you may want to put in a small tolerance as shown here in the SketchUp Plugin surface search. As you might expect the azimuth returned isn't very reliable on horizontal surfaces, what is returned might related order of vertices.

Specific to adapting the Rooftop PV measure with non horizontal surfaces, I believe the measure increases the z value for all vertices to 'offset' the pv shading surface vertically above the roof, so with a heavily tilted roof, this may not be what you want. There may be a nice method to offset a surface within its current plane, but I have not done that before.

If you now know that neither the space or the building are rotated to a non 0 value then you can get the azimuth in degrees of a surface using OpenStudio::convert(surface.azimuth,"rad","deg").get but the code below, which is from the Window to Wall Ratio gives absolute azimuth including space and building rotation. You could change the test for south to 90 to 270

  # get the absoluteAzimuth for the surface so we can categorize it
  absoluteAzimuth =  OpenStudio::convert(s.azimuth,"rad","deg").get + s.space.get.directionofRelativeNorth + model.getBuilding.northAxis
  until absoluteAzimuth < 360.0
    absoluteAzimuth = absoluteAzimuth - 360.0
  end

  if facade == "North"
    next if not (absoluteAzimuth >= 315.0 or absoluteAzimuth < 45.0)
  elsif facade == "East"
    next if not (absoluteAzimuth >= 45.0 and absoluteAzimuth < 135.0)
  elsif facade == "South"
    next if not (absoluteAzimuth >= 135.0 and absoluteAzimuth < 225.0)
  elsif facade == "West"
    next if not (absoluteAzimuth >= 225.0 and absoluteAzimuth < 315.0)
  else
    runner.registerError("Unexpected value of facade: " + facade + ".")
    return false
  end

You could also include or exclude horizontal surfaces using surface.tiltbut you may want to put in a small tolerance as shown here in the SketchUp Plugin surface search. As you might expect the azimuth returned isn't very reliable on horizontal surfaces, what is returned might related order of vertices.

Specific to adapting the Rooftop PV measure with non horizontal surfaces, I believe the measure increases the z value for all vertices to 'offset' the pv shading surface vertically above the roof, so with a heavily tilted roof, this may not be what you want. There may be a nice method to offset a surface within its current plane, but I have not done that before.