I need to set window constructions by orientation, at the moment I am using some code which I ripped from the ReplaceExteriorWindowConstruction measure and modified a bit. The code is as follows:
pi = 3.1415926
orientations = ["South","East","West","North"]
orientations.each do |orientation|
case orientation
when "South"
max_azimuth = pi*5/4
min_azimuth = pi*3/4
max_1_azimuth = pi*5/4
min_1_azimuth = pi*3/4
max_2_azimuth = pi*5/4
min_2_azimuth = pi*3/4
winConstruction = WindowTypeSouth
when "East"
max_azimuth = pi*3/4
min_azimuth = pi/4
max_1_azimuth = pi*3/4
min_1_azimuth = pi/4 #(0.78539815)
max_2_azimuth = pi*3/4
min_2_azimuth = pi/4
winConstruction = WindowTypeEast
when "West"
max_azimuth = pi*7/4
min_azimuth = pi*5/4
max_1_azimuth = pi*7/4
min_1_azimuth = pi*5/4
max_2_azimuth = pi*7/4
min_2_azimuth = pi*5/4
winConstruction = WindowTypeWest
else
# "North"
max_azimuth = pi/4
min_azimuth = 0
max_1_azimuth = pi*2
min_1_azimuth = pi*7/4
max_2_azimuth = pi*2
min_2_azimuth = pi*7/4
winConstruction = WindowTypeNorth
end
sub_surfaces.each do |sub_surface|
next if not (sub_surface.outsideBoundaryCondition == "Outdoors" and sub_surface.subSurfaceType == "FixedWindow")
if (sub_surface.azimuth < max_azimuth and sub_surface.azimuth >= min_azimuth) or (sub_surface.azimuth < max_1_azimuth and sub_surface.azimuth >= min_1_azimuth) or (sub_surface.azimuth < max_2_azimuth and sub_surface.azimuth >= min_2_azimuth)
sub_surface.setConstruction(winConstruction)
end # Large if statement
end # sub_surfaces.each
As far as I can tell it works fine but what happens if we change the orientation of the building? That why I was thinking of modifiying the getExteriorWindowAndWllAreaByOrientation function in os_lib_geometry.rb to produce
spaceArray.each do |space|
space.surfaces.each do |s|
next if s.surfaceType != 'Wall'
next if s.outsideBoundaryCondition != 'Outdoors'
# loop through sub surfaces and add area including multiplier
absoluteAzimuth = OpenStudio.convert(s.azimuth, 'rad', 'deg').get + s.space.get.directionofRelativeNorth + model.getBuilding.northAxis
absoluteAzimuth -= 360.0 until absoluteAzimuth < 360.0
# add to exterior wall counter if north or south
if (options['northEast'] <= absoluteAzimuth) && (absoluteAzimuth < options['southEast']) # East exterior walls
winConstruction = WindowTypeEast
elsif (options['southEast'] <= absoluteAzimuth) && (absoluteAzimuth < options['southWest']) # South exterior walls
winConstruction = WindowTypeSouth
elsif (options['southWest'] <= absoluteAzimuth) && (absoluteAzimuth < options['northWest']) # West exterior walls
winConstruction = WindowTypeWest
else # North exterior walls
winConstruction = WindowTypeNorth
end
s.subSurfaces.each do |subSurface|
sub_surface.setConstruction(winConstruction)
end
end
end
I think that the latter is the better option as I believe that it takes into account building orientation, what does everyone recommend? Or is there some better code out there which Im missing? Suggestions are most appreciated!