lib/urbanopt/geojson/helper.rb in urbanopt-geojson-0.11.1 vs lib/urbanopt/geojson/helper.rb in urbanopt-geojson-0.11.2
- old
+ new
@@ -240,10 +240,11 @@
other_spaces = []
runner.registerInfo("#{other_buildings[:features].size} nearby buildings found")
other_buildings[:features].each do |other_building|
other_id = other_building[:properties][:id]
next if other_id == building.id
+
# Consider building, if other building type is ShadingOnly and other id is not equal to building id
if other_building_type == 'ShadingOnly' && other_id != building.id
# Checks if any building point is shaded by any other building point.
roof_elevation = other_building[:properties][:roof_elevation]
number_of_stories = other_building[:properties][:number_of_stories]
@@ -275,10 +276,11 @@
shadowed = URBANopt::GeoJSON::Helper.is_shadowed(feature_points, other_building_points, origin_lat_lon)
if shadowed
runner.registerInfo("Feature #{other_building[:properties][:id]} is acting as shading object for #{building.id}")
end
next unless shadowed
+
new_building = building.create_other_building(:space_per_building, model, origin_lat_lon, runner, zoning, 0, other_building)
if new_building.nil? || new_building.empty?
runner.registerWarning("Failed to create spaces for other building '#{name}'")
end
other_spaces.concat(new_building)
@@ -319,10 +321,11 @@
end
if is_shaded(min_pair[:building_point], min_pair[:other_building_point], origin_lat_lon)
return true
end
+
return false
end
##
# Returns Boolean indicating if specified building is shadowed.
@@ -337,11 +340,12 @@
vector = other_building_point - building_point
distance = Math.sqrt(vector.x * vector.x + vector.y * vector.y)
if distance < 1
return true
end
- elevation_angle = 2.5 #not sure of best value maybe allow as project level argument
+
+ elevation_angle = 2.5 # not sure of best value maybe allow as project level argument
height = vector.z
apparent_angle_rad = Math.atan2(height, distance)
apparent_angle = OpenStudio.radToDeg(apparent_angle_rad)
if elevation_angle < apparent_angle
result = true
@@ -349,11 +353,11 @@
result = false
end
return result
end
- class << self
- private :is_shaded
- end
- end
- end
+ class << self
+ private :is_shaded
end
+ end
+ end
+end