Arrays add depth to your model. Imagine you are creating a sales model for a company that sells three different products in five different cities. You need to predict the sales volume for each of the products in each of the cities. The traditional way to go about this would be to create fifteen separate stocks or parameters, one for each combination of cities and products. For all of these primitives you would then have to add flows, links, parameters and the equations needed to predict the sales volume. This is clearly a lot of work and requires significant duplication of effort.
Using arrays, however, you create one single sales model for a generic product in a generic city. Then you convert each of the primitives in this generic model into what is known as an array[8]. The primitives in the array take on separate values for each of the cities and products you are studying. You can adjust the individual primitives in the array one at a time or all of them at once as a group. As you add new product classes or new cities, the array automatically adjusts in size to accommodate your changes.

An example of The Array Definition WindoW
Arrays are created by selecting “Define Arrays” under the “Analysis” menu. The basic building blocks of arrays are one or more dimensions. Each dimension has one or more elements. For our sales model we would create two dimensions: “Location” and “Product”. You may create as many dimensions as you wish, but no two dimensions may have the same name. To each dimension we add one or more elements representing the values that dimension may take on. For the Location dimension, this would be “Boston”, “Miami”, “Portland”, “Paris”, and “London”. For the Product dimension, the elements would be “PowerWizz”, “SuperSlice”, and “DoubleDice”. We then select which primitives in our model should be converted into arrays using these dimensions. Since we have specified two dimensions with a total of 15 unique pairings (shown in the table below) each primitive that these dimensions are applied to will be cloned into 15 identical primitive elements. Each primitive may have one or more dimensions applied to it. You do not need to apply the same dimensions to all the primitives but you must make sure dimensions are applied in a consistent and logical manner within your model.
Table of Elements Defined By Two Dimensions
|
|
Dimension: Product |
|||
|
Dimension: Location |
|
PowerWizz |
SuperSlice |
DoubleDice |
|
Boston |
Boston,PowerWizz |
Boston,SuperSlice |
Boston,DoubleDice |
|
|
Miami |
Miami,PowerWizz |
Miami,SuperSlice |
Miami,DoubleDice |
|
|
Portland |
Portland,PowerWizz |
Portland,SuperSlice |
Portland,DoubleDice |
|
|
Paris |
Paris,PowerWizz |
Paris,SuperSlice |
Paris,DoubleDice |
|
|
London |
London,PowerWizz |
London,SuperSlice |
London,DoubleDice |
|
The different primitives within an array can be selected and manipulated using the Library Browser. For instance if you had a Sales Growth Rate parameter value to determine the rate of change in the sales for the different products in the different locations you could select the Paris,SuperSlice element of the Sales Growth Rate and assign it a unique growth rate value.
The method of referring to an individual primitive element within an array is the same as the standard method of referring to a primitive but with an array selector (within parenthesis) added to the end of the primitive reference. For example:
[My Array Stock](Element for Dim 1, Element for Dim 2, Element for Dim 3)
The above example is to select a single element from an array with three dimensions applied (arrays may have an unlimited number of dimensions applied to them). The order of the elements listed is the same as the order of the dimensions in the Array Definition window.
The above example is used to specify a single primitive element of all the elements in the array. Thus, this equation could be used when you wanted to take a value from a three-dimensional array and place it into a primitive that has not been converted into an array. If, however, we want to preserve the dimensionality of the array, we use “*”’s instead of the element names. For example:
[My Array Stock](Element 1 Name, Element 2 Name,*)
or
[My Array Stock](Element 1 Name,*,*)
or
[My Array Stock](*,*,*)*2
The first example converts a three-dimensional array into a one-dimensional array where only the third of the original three dimensions is applied to the result. The second example returns a two-dimensional array. The last example preserves the entire three-dimensional array but multiplies each element of the array by 2. If no array selectors are specified, the last example is assumed to be the default by Simgua. Thus the last example above is identical to the following where My Array Stock is a three-dimensional array:
[My Array Stock]*2
The above examples aggregated or collapsed an array by choosing a specific element from one or more of the array dimensions. Often, however, you will want carry out some form of algebraic manipulation during these aggregations.
For instance, we can sum all the elements of a one-dimensional array using the following command that makes use of the “sum” combination method:
[My Array Parameter](sum)
This takes a one-dimensional array and returns the result of the sum all the elements within the array. On the other hand, we could multiply all the elements in an array over two dimensions of a three-dimensional array while preserving the array’s second dimension using the following:
[My Array Flow](prod,*,prod)
When using a combination method over multiple dimensions, the same combination method must be used for all the dimensions. Of course, combination methods may not be used as element names. The following is a list of combination methods that Simgua supports:
Table of Array Combination Methods
|
Operator |
Meaning |
Application to Array: (5, 8, -1, 2.3, 9) |
|
sum |
Sum all elements in the array |
23.3 |
|
prod |
Multiply all elements in the array |
-828 |
|
max |
Return the maximum value in the array |
9 |
|
min |
Return the minimum value in the array |
-1 |
|
mean |
Return the mean of the array |
4.66 |
|
med |
Return the median of the array |
5 |
|
dev |
Return the standard deviation of the array |
4.11 |
|
count |
Return the count of elements in the array |
5 |