# Assigning Roll-downs and Roll-ups

Once a map which contains at least one stock/flow structure has been created within a Sub-model space, it is necessary to forge equation linkages between a portion of the Sub-model structure and main level counterpart. To forge these linkages, you must first enter the modeling mode. You'll face three tasks:

1) Rolling up a single stock/flow structure in the Sub-model space to the Sub-model icon.

2) Rolling up outflows from the Sub-model structure, to outflows from the Sub-model icon.

3) Rolling down inflows to the Sub-model icon, to inflows to the Sub-model structure.

In this section, you'll learn how to accomplish each task. After working through the basics, you'll learn about two special cases which might otherwise give you pause. The simple structure shown in Figure 9-14 provides the basis for illustrating each task.

Figure 9-14 Assigning Roll-down and Roll-ups

1) Rolling up a Sub-model Stock/Flow Structure: In this task, you'll be assigning a stock/flow within the Sub-model space to the Sub-model icon. Although you can have as much structure as you'd like within a Sub-model, only one stock/flow structure (in which flows come from and go to clouds) can be rolled up into the Sub-model icon.

To accomplish the roll-up, control-double-click (Windows) or command-double-click (Macintosh) on the Sub-model icon, while the Sub-model is open and you're in the modeling mode. When you do, you'll enter the icon's Define dialog. Figure 9-15 shows the Define dialog associated with the Sub-model icon Work in Process.

Figure 9-15 Sub-model Icon Roll-up Dialog

Within the dialog, you'll find a list of Allowable Sub-model stock/flow structures. Click on the desired structure from the Allowable list, to load it into the roll-up equation box. Then, click OK to exit the dialog. When you do, the "?" in the Sub-model icon will be extinguished.

Notes:

- To be "allowable," a stock/flow structure must have at least one inflow coming from a cloud, and at least one outflow going to a cloud.

- The software allows only one Sub-model stock/flow structure to be rolled up to the Sub-model icon.

- Each Sub-model stock/flow structure is given its own line in the Allowable list.

- When the model runs, the Sub-model icon will report out the sum of its associated stock/flow structure stock values.

2) Rolling Up Outflows from the Stock/Flow Structure: In the second task, you'll be forging linkages between the Sub-model stock/flow structure outflow(s), and outflow(s) from the Sub-model icon. In forging these connections, you must make sure to roll up all outflows from the Sub-model stock/flow structure (i.e, all outflows which go to clouds). All outflows from the Sub-model icon must be defined as roll-ups.

To roll up the outflows, control-double-click (Windows) or command-double-click (Macintosh) on an outflow from the Sub-model icon, while the Sub-model is open and you're in the modeling mode. You'll enter the outflow's Define dialog. Figure 9-16 shows the Define dialog associated with the exit process flow.

Figure 9-16 Sub-model Icon Outflow Roll-up Dialog

Within the dialog, you can select the desired flow from the Allowable Inputs list to load it into the roll-up equation box. When you click OK to exit the dialog, the "?" will be extinguished in the Sub-model icon's outflow. The Sub-model stock/flow structure's outflow will be re-named to reflect the name of the Sub-model icon's outflow, as shown in Figure 9-17.

Notes:

- Multiple outflows from a Sub-model stock/flow structure may be rolled up to a single outflow on the main level. Clicking multiple Sub-model flows in the Allowable list, will cause a "+" sign to be put between them in the equation box.

- Once a flow has been rolled up, it will become gray in the Define dialog of each outflow from the Sub-model icon. This prevents you from rolling up a single Sub-model flow to many main level outflows.

- You can never have more outflows from a Sub-model icon, than from the assigned Sub-model stock/flow structure.

- Rolling up outflows will automatically lead to the rolling up of the associated Sub-model stock/flow structure. Thus, if you start with this second task, the first task will be accomplished automatically for you.

Figure 9-17 Roll-ups Assigned

3) Rolling Down Inflows to the Sub-model icon: In the third task, which must be done after you have done the roll-up of the Sub-model stock/flow structure, you'll be forging a linkage between each inflow to the Sub-model icon, and the associated inflow to the Sub-model stock/flow structure (i.e., the inflows which come from clouds). The software enforces a one to one correspondence between inflows on the main level and roll-down inflows. This means that you must make a unique roll-down assignment for each inflow to the Sub-model stock/flow structure.

To roll down an inflow to the Sub-model icon, open the inflow to the Sub-model stock/flow structure. The inflow's define dialog will appear, with an allowable list of main level flows to roll down. For our example, Figure 9-18 shows the Define dialog for the flow Noname 1.

In the dialog, click on one flow from the Allowable list. When you click OK and exit the dialog, you'll find the diagram has changed in two ways. First, the inflow to the Sub-model stock/flow structure will be renamed to reflect the name of its associated main level inflow. Second, the display of its icon will change to reflect that it is a roll-down flow. These two changes in the diagram are shown in Figure 9-19.

Figure 9-18 Roll-down Dialog

Figure 9-19 Roll-down assigned

Note: Each inflow to the Sub-model icon can be rolled down to one (and only one) inflow to the Sub-model stock/flow structure.