Creating Arrayed Variables

Use the following procedures to transform a variable in your model into an arrayed variable and to specify initial values/equations for elements in the array.

Note: You can also make a variable arrayed as you create the variable. For more information, see Working with Array Dimensions and Elements.

To Create an Arrayed Variable

  1. Select the stock or converter that you want to make into an arrayed variable.
  2. In the Properties panel, click the Array tab.
  3. On the Array tab, select the Arrayed check box.

    –or–

    In the "Available Dimensions" list, select the dimensions that you want to assign to the variable and click the arrow button, or double-click each dimension to add it to the "Chosen Dimensions" list. The Arrayed check box will be selected automatically.

    Note: When you transform a stock into an arrayed stock, its attached flows are automatically arrayed for you.

  4. If you haven't already assigned dimensions to the arrayed variable, in the "Available Dimensions" list, select the dimensions that you want to assign to the variable, and then either double-click them or drag them to the "Chosen Dimensions" list.

    Note: If you haven't already created a dimension you want to assign to the variable, click the Array Editor button. For more information about creating array dimensions, see Working with Array Dimensions and Elements.

  5. Click the Equation tab to define the initial value/equations for the elements in the array.
  6. In the "Equation" section of the Equation panel, use the Apply to All check box to specify whether you're defining one initial value/equation for all elements, or if you're defining a separate initial value/equation for each element:

  7. In the Equation box, type the initial value/equation for the elements:

    Notes: If you use an arrayed variable in an equation, the Choose Subscript dialog box will open when you add the variable to the equation, so that you can select the dimension or elements to use in the equation (if the Apply To All check box is selected, you select the dimension; if the Apply To All check box is cleared, you select the elements).

    The selected dimension or element names appear in square brackets in the equation. For dimensions, the software automatically aligns corresponding elements in the equation definition (for example, if the dimension is "City" and the elements are Boston, Chicago, etc., the software aligns Boston to Boston, Chicago to Chicago, etc.).

    To use an arrayed variable in the apply-to-all equation of another arrayed variable, the dimensions of the first variable must be a subset of the dimensions of the second variable (in any order). For example, you can use A[X] in the equation for B[X, Y], and you can use A[X, Z] the equation for B[X, Y, Z] because, in both cases, all of the dimensions in array A are also in array B. Note that you can also use A[Z] in the equation for B[X], but only in a case where you do not refer directly to a dimension name. In this case, for example, you can use SUM(A) or A[1] in the equation for array B.

  8. When you've finished entering the equations, click , in the lower right corner of the Properties panel, to save and apply your changes.

To Define a Separate Equation for Each Element

When you create an array and clear the Apply To All check box, you need to specify an initial value/equation for each combination of elements in the array.

For example, if the array has two dimensions, and one dimension has three elements and the other has four elements, you need to specify 12 separate initial values/equations. Similarly, if the array has three dimensions, and one dimension has two elements, one has three elements, and one has four elements, you need to specify 36 separate initial values/equations.

  1. If you haven't already done so, create an arrayed variable, and clear the Apply To All check box on the Equation panel.

    A table will appear in the Equation box and display cells so that you can enter the initial values/equations for up to two dimensions at a time.

    The row of boxes above the table indicates the combination of elements and dimensions you're currently editing in the table.

    In the following example, the table allows you to edit the values for the "Department" and "Employee Type" elements of the "Boston" dimension.

  2. Type an initial value or equation in each table cell.

    Note: If you use an arrayed variable in an equation, the Choose Subscript dialog box will open when you add the variable to the equation, so you can select the specific elements to use in the equation. The selected element names appear in square brackets, separated by commas, in the equation.

  3. When you've finished entering values for the currently displayed combination of elements and dimensions, click the button to display the next combination of elements and dimensions.

    Tip: You can move backwards through the displayed element/dimension combinations by clicking the button.

  4. Repeat steps 2–3 until you've entered values for each element/dimension combination.

    Tip: You can enter a value for a specific element/dimension combination by selecting the elements you want in the boxes above the table. The table adjusts to display the appropriate cells in which to enter the value for the selected elements.

Concept Link IconSee Also