How to add your knowledge

Example 07: Using Solar Radiation Analysis to Drive the Model

    Goal: Now that we have some basic familiarity with the new Dynamo Visual Programming environment, let’s use it on a more real-life example. The goal of this exercise is to set up a feedback loop that optimizes the amount of solar radiation incident on the roof of a proposed building. We will use Dynamo to read Solar Insolation analysis results and then make changes to the building model in the form of driving parameters back into a family instance.

     

    Changing Form and Orientation Semi-automatically and Automatically

    As a case study, we will look at a 20,000 sqft building in an urban area.  The local climate and state incentives support the use of alternative energy sources to offset building energy consumption.   We want to maximize the incident solar radiation on the roof of the building to make the most of a photovoltaic array, but because of some overshadowing by neighboring buildings, it isn't obvious where the "sweet spot" is for solar orientation.

     Parametric Form Creation

    ex8-1.png

    The overall building size must always accommodate 20,000 square feet, but he shape of the building is not yet defined.  This family establishes the basic set of constraints, by allowing a full 360 degree rotation of the building form, and maintaining a constant volume for the building, with height being driven by building footprint.  This however does not allow us to explore the requirements of rooftop solar optimization

     

        

    ex8-2.png 

     Adding Height and Angle control to Mass Family

     

    Using the same basic skeleton as the first mass family, we can now manipulate the angle of the roof while maintaining the overall square footage of the building.  We have already added parameters for the front and back elevation heights for the building to allow the roof to slope

    Automating orientation optimization

    ex8-3.png

     Formulae to control rotation via increment parameter

     

    The mass we will use has been constructed so that  if you change the increment parameter it will rotate the building however many degrees as defined by another parameter, angleIncrement.  We will use Dynamo to iteratively rotate the building and find an optimal orientation relative to the sun while taking nearby building overshadowing into account.

     


    1. If you have Dynamo running, shut down the add-in using the X
    2. From Vasari 2.5, Click File:Vasari/enu/Community/Works_In_Progress/Dynamo_for_Vasari/Example_8:_Using_Solar_Radiation_Analysis_to_Drive_the_Model/V.png > File:Vasari/enu/Community/Works_In_Progress/Dynamo_for_Vasari/Example_8:_Using_Solar_Radiation_Analysis_to_Drive_the_Model/filefolder.png  (Open).    
    3. Navigate to  C:\VasariWIP\2-5\Dynamo\Samples
    4. Open SolarRadiationProject.rvt from the Samples directory
    5. Select Mass family 04_paramBuilding_increment and set "increment" parameter to anything other than 0
    6. Click Analysis tab>Solar Analysis panel>Ecotect Solar Radiation.
    7. Select the angled roof and perform a Solar Radiation analysis.
    8. Export the analysis data to a .csv file and then enable Automatically update export.

    ex8-4.png

    Set up the Automatic Export for the Solar Radiation results

     

    1. Go to Add-ins tab and launch Dynamo
    2. From the Dynamo File Menu, go to File/Samples/8. Solar Radiation Optimizer. You should see this workspace appear:

    ex8-5.png

    Solar Radiation Optimizer Sample

     

    11)We will use Dynamo to do a few things:

    a)    Vary the rotation angle of a building a set number of degrees and run through a set number of increments. This is called a ‘brute force’ approach where every increment is computed first and then evaluated.

    b)    Read and parse the analysis results from the Solar Radiation tool for each increment. Compute the maximum energy for that increment.

    c)    Compare the current analysis result to the previous ones, holding onto the maximum value and the parameter that relates to it.

    d)    Once all iterations are completed and a global maximum is found, update the model to show the optimal state.

    e)    Below we see a few inputs: the family instance to control, the name of the parameter in the family instance, the maximum increments and the filename of the analysis results CSV file to watch.

    ex8-6.png

    Set inputs for the Solar Radiation Optimizer in the Home workspace

     

    1. First select the mass family using the Family Instance Selection Node
    2. Then using the FileName Node, select the .CSV file created previously from the Solar Radiation Export
    3. Now we can simply hit Run and watch the results! This example will iterate through the entire solution space (a full 360 rotation) and then set the model to the optimal result.

     

    ex8-7.png

    The Solar Radiation Optimizer in action – sit back and watch Dynamo automatically find the optimum result!

     

    15)To learn more about how this is set up, we will dig into the user-created nodes below. Double-click on the Solar Radiation Optimizer node and you will see something like this:

     

    ex8-8.png

    Solar Radiation Optimizer  - a user-created node to control program flow

     

    16)The Solar Radiation Optimizer node takes in a bunch of inputs:

    a)    famInst - The mass family instance we are working with

    b)    parameter - The name of the parameter to vary

    c)    increment - The current increment value

    d)    max - The maximum increment value

    e)    path - And finally the path to the CSV file to watch.

    f)       The Watch File node is quite important in this example, as it simple watches and waits for the CSV file to update. Once the Solar Radiation tool re-writes this file, the Watch File node is notified. We use this as a trigger to kicks off the next round of the optimization automatically.

    g)    The solarradopt node is a user-created node. This one actually does the bulk of the work and iterates (or more precisely recurses) through the permutations.

    h)    The solarradupdate node is another user-created node. This node is responsible for updating the family. Notice how each node has a particular responsibility.

    ex8-9.png    

     solarradopt  - a user-created node to recurse through the rotations

     

    17)The solarradopt node actually does the bulk of the work and recurses through the permutations. It takes in certain inputs:

    a)    fI - The mass family instance we are working with

    b)    p - The name of the parameter to vary

    c)    i - The value to increment by, 1 in this case.

    d)    max - The maximum increment value

    e)    amt – the current increment value

    f)       acc – the previously computed values (initialized to 0 in the outer node). This parameter is a list that holds the computed SR value and the associated iteration number

    g)    path - the path to the CSV file to watch.

    h)    Fw – the filewatcher

    18)This node processes the CSV file using Read File andExtract Solar Radiation Value and then compares the new value to the previous value using another user-created node called solarradcomp.

    19)It also sets the family instance to the current iteration.

    20)Notice the node called solarradadopt? Wait, isn’t that the node we are editing right now? This is a concept called recursion, where a function can call itself. We are using this here instead of a for next loop or a do while loop.

     

    ex8-10.png

       solarradcomp compares the two values, old and new

     

    21)The solarradcomp node does what it says, it compares two solar radiation values and returns the larger of the two values. Variable old is a list containing the SR results values and its iteration. Variable data is the new SR data and newAmt is the number of the newest iteration. If data is larger than the data in old, then we return a new list containing data and newAmt.

     

    ex8-11.png

    solarradupdate pushes the final optimal value back into Revit

     

    22)The solarradupdate node does the final updating.The largest value is the only one passed back out from the solarradopt – it recurses through the 36 cases and only holds onto the largest value, passing it back out after each recursion.  So the result passed out at the end and into solarradupdate is just a list with two members, the value and the index. The Get node in this case is getting the second member, result[1] which is the increment value of the optimal case, and then we pass in this increment value to the set instance parameter node. The result[0] andresult[1] data are set up when the list is constructed in solarradcomp. 

     

    ex8-12.png

    Solar Radiation Sample in action – two addins talking to each other and pushing data back into Revit

    Conclusion

    These examples demonstrate powerful new visual programming tools on top of Vasari and Revit. These examples also show a hybrid application of custom tools and standard smart Revit/Vasari components with Vasari’s Analysis tools.  While these tools are more than a little rough around the edges, we hope that they are convincing indicators of several things:

    • Standard Family creation tools provide a generalizable interface for receiving and reacting to analysis data
    • The analysis tools available in Vasari can be used to drive design responses to environmental conditions
    • Smart families and built in analysis tools can be made to speak to each other through various methods.  Dynamo in particular seems to be a promising way to leverage the existing strengths of Vasari and the Revit platform in general.