{"word_count": 393, "character_count": 3143}
Making Solar Envelopes¶Pre-processing¶Before being able to perform a solar envelope analysis, several operations need to be done.This analysis uses 2D data (eg: building footprints).First, select the building on which the analysis is being done. T4SU only accepts one building (ie: one polygon).Insert the building into a unique new layer. If the geometry is a group, make sure that the building elements within the group are also in the specific layer.Calling and running the SolarEnvelope method¶You can quickly create a solar envelope by entering into the ruby command box :solarEnvelope = SolarEnvelope.new("BuildingLayerName", "SurroundingBuildingsLayerName", maximum_height = 10.m, month = 11 , day = 15, hour = 13, minutes = 00, latitude = 47).runCreating a loop¶You can automate the creation of the envelopes according to multiple variables.To iterate over a set number of days, one can use the SolarDate.dayInYear method, which returns the date :Example :SolarDate::DEC_SOLSTICE Dec 21 SolarDate::DEC_SOLSTICE.dayInYear 355We can choose how many steps we want through the year. For example, setting deltaDayInYear to 1 runs the program for every day. Setting deltaDayInYear to 15 runs the program for every two weeks. We can construct the loop as such :def foo() deltaDayInYear = 15 hour = 15 minutes = 00 max_elev= 100.m latitude = 47.0 # Ranging through the entire year, every two weeks, at 15:00 (1 .. 355).step(deltaDayInYear).each { |dayInYear| solarDate = SolarDate.create(dayInYear) month, day = [solarDate.month, solarDate.day ] SolarEnvelope.new("footprint", "buildings", max_elev, month, day, hour, minutes, latitude).run } endTo visualize the results, we may want to save them into separate layers.def foo("footprint", "buildings", max_elev, month, day, hours, minutes, latitude) rootdir='~/rootFolder' outputdir='~/outFolder' Sketchup.open_file("#{rootdir}/model.skp") layername = sprintf("SolarEnvelope_%02d_%02d_%02d_%02d", month, day, hours, minutes) SolarEnvelope.new("footprint", "buildings", max_elev, month, day, hours, minutes, latitude).run Sketchup.active_model.save("#{outputdir}/#{layername}.skp") Sketchup.active_model.close(true) end deltaDayInYear = 15 hours = 16 minutes = 00 max_elev= 100.m latitude = 47.0 # Ranging through the entire year, every two weeks, at 16:00 (1 .. 355).step(deltaDayInYear).each{ |dayInYear| solarDate = SolarDate.create(dayInYear) months, day = [solarDate.month, solarDate.day ] foo("footprint", "buildings", max_elev, month, day, hours, minutes, latitude) }Similarly, one can create a loop to visualize the results of a single day, in increments of 10 minutes :#setting location site = SunLocation.new(latitude) # setting day : Winter Solstice solarDate = SolarDate.create(355) month, day = [solarDate.month, solarDate.day] # iterating over entire day sunrise = site.getSunRiseTime(solarDate) sunset = site.getSunSetTime(solarDate) ((sunrise.hours+1)..(sunset.hours)).step(deltaHours).each{ |hours| # Runnning for every 10 minutes deltaMin=10 (0..59).step(deltaMin).each{ |minutes| SolarEnvelope.new("footprint", "buildings", max_elev, month, day, hours, minutes, latitude).run