Step 1 |
Add a variable outside the tree submodel, and rename it total.
|
Step 2 |
Draw an influence arrow from the compartment size inside the tree submodel to the variable total.
|
Step 3 |
Enter the expression sum({size}) for the variable total.
Be very careful to get the brackets right. The outer (round) brackets enclose the argument for the built-in function sum( ), which can find the total value of an array of a list. In this case, we want the sum( ) function to find the total value of a list of size values, one for each tree. It’s a “list” rather than an “array” of values, because the number of trees (and hence the number of values to be summed) is not fixed, but changes over time. Simile uses braces {....} to denote a list, and square brackets [....] to denote an array. |
Step 4 |
Re-build the model.
|
Step 5 |
Call up a plotter display for the variable total.
|
Step 6 |
Run the model again
In additional to the plot for the growth of individual trees, you should see a graph with a single line for the total size of all the trees, rising smoothly up, then bouncing around an asymptotic value. Why does it show this behaviour? First, trees are growing and more are being added, with none dying. Later, the growth of existing trees and the addition of new (small) ones is balanced by the sporadic death of big trees. The top of the curve is not smooth because the time it takes for a tree to die depends on its growth rate, which is randomly determined. |
Your model diagram should now look like this:
Notice how the influence arrow crosses the submodel boundary.