The Divide and Math.Ceiling nodes are used to perform the Occupant Load calculation, and the Element.SetParameterByName node writes the data to Revit.
- [Instructor] In the last video, we collected all the information we needed from each room object, to perform our occupant load calculations. Now let's have Dynamo do the math and write the data back to each room element in the model. As we've discussed before, a space's occupant load is calculated by dividing the space's area by the space's load factor. We have our areas in one list, and our load factors in another. We simply need a node that'll divide the first by the second. I'll go ahead and drop in a division node, which we'll find in the Operator Section of the Node Library, along with several other nodes for performing common math functions.
I'll plug our list of areas into x, and our list of load factors into y. Then I'll hit Run. Let's double-check our node preview. We want to confirm that the values look realistic and accurate. We'll also want to compare the length of this list to the length of the original list of rooms, since we'll be writing these values back to those room objects in the next step. It seems we calculated 24 occupant loads from our original 24 rooms. Good. So the number of items in each list matches up. I'm noticing two things that we should talk about.
The first is that at index 11, we see the value infinity. How did it get there, you might wonder. Well, let's take a look at index 11 of the load factor list. We find the number zero. Follow that wire back to the division node, and you'll see that Dynamo is trying to divide a number by zero, which is mathematically impossible, so the result is the number infinity. I should mention here that this is less of an accident than it might seem. Occupancy-wise, the room that lives at index 11 is a special case that we're going to address in the next video. Besides, Dynamo didn't return a warning, so it's possible this isn't something that we need to worry about.
Let's keep moving forward, and if it presents a problem, we'll take care of it. The second thing I notice is that a lot of the numbers in this list aren't whole numbers. Standard practice when you're calculating occupant loads, is to round these numbers up to the nearest integer, since the occupant load is describing a number of people who should occupy a space. It doesn't make sense for this number to be a fraction of a person. There is a number in the core math section of the Node Library called Round, which rounds a number to the nearest integer. That's close to what we need, but the IBC requires us to always round up for this calculation, regardless of how small the fraction is.
Nearby, in the same section of the Node Library, is a node called Math Ceiling, which is a programming term for rounding up to the nearest integer. If we wanted to round down, we could use Math Floor. Since we want to round up, I'm going to drop a Ceiling Node onto our canvas. Then I'll run our occupant loads through it to round them up to the nearest whole number. A yellow node means Dynamo needs to warn us about something. I'll hover over the yellow bubble to read what the warning says. It seems that the warning is related to the infinity value in index 11. If we take a look at the Node Preview, the value is simply zero.
This is a much better situation than if Dynamo returned a value like null, which would hold up the entire workflow and require a lot more action on our part to correct. Remember, this zero value is actually intentional. Much like working in Revit, sometimes a warning is just that, a warning. Let's move forward with caution, and again, if we need to take any action we will. Looking at the rest of the information in the Node Preview, our occupant load data is now free from fractions, and it's ready to be written back to the room objects in Revit. Let's plug our occupant load list into the value input of Set Parameter by Name Node.
We'll also create a code block with the text occupant load, which is the name of the room parameter we'd like to write this data to. Just like in the last example, we'll plug our list of rooms into the Element input. Now I'll go ahead and hit Run. If the script ran properly, each room in Revit should now have a number in the occupant load parameter, which was blank before. I'll go ahead and minimize my Dynamo window, and select a room in Revit. If I scroll down in the Properties palette, we do in fact see a number.
This is a good sign. Let's also double-check Dynamo's math while we're here. I'm going to pull up the calculator, and start with the area parameter, which in this particular room is, 578 square feet. Then I'll divide it by the occupation load factor, which is 20. 28.9 rounded up to the nearest integer is 29, which is the value that Dynamo calculated for us. Excellent, it seems like our script is working. Aside from being able to see occupancy data in Navisworks or BIM 360, another major advantage to recording the occupant load in a room parameter, is the ability to visualize the data using a color scheme and plan views, which would not have been possible if we'd simply treated it as a calculated value in a schedule somewhere.
I'm going to apply a color scheme to my floor plans called occupancy load, which highlights rooms in several shades of grey. Darker shades meaning higher occupant loads, and lighter meaning fewer. It also identifies, by highlighting them in red, rooms with an occupant load of 100 people or more. Those are the rooms which require panic hardware on the doors, according to the NFPA. Lastly, it also highlights the rooms with an occupant load of zero, like this auditorium with fixed seating. This is the room that lived at index 11 and was returning those funny infinity and zero values.
In the next video, we'll look at why this room was an exception to the rule, and we'll calculate its occupant load in a way that's unique to this room.
- Renumbering rooms by their building level
- Reading Revit element data with Dynamo
- Setting Revit parameter values
- Calculating occupant loads
- Analyzing room layouts
- Interpreting Revit geometry and curtain panel boundaries
- Generating architectural patterns based on random numbers