# Rules for Using Arrayed Variables

As you begin the process of defining the arrayed variables in your models, there are certain rules you need to keep in mind. The software will not allow you to create arrayed stocks or flows that violate the following rules.

General Rules for Arrayed Variables:

- Arrayed variables can be one-dimensional or two-dimensional only.

- The array status of a flow is determined by the stock(s) to which the flow is attached.

a) A flow must be attached to at least one stock before it can be arrayed.

b) An inflow from a cloud to an arrayed stock will be given the same dimension(s) as the stock.

c) An outflow from an arrayed stock to a cloud will be given the same dimension(s) as the stock.

d) When a flow runs from one arrayed stock to a second arrayed stock, and the stocks have identical specification of their dimensions, the flow will be assigned the same dimensions as the stocks. a conserved flow (stock upstream and downstream) has arrayed stocks both upstream and downstream, and the stocks use the same Dimensions (in the same order - for two-dimensional Arrays), the flow will take on the same Dimensions.

e) When a flow runs from a one-dimensional stock to a second one-dimensional stock both upstream and downstream, but the stocks are not of the same dimension, the flow will become two-dimensional. The Dimensions will be assigned the order [upstream Dimension, downstream Dimension].

f) When a flow runs between a one-dimensional stock and a two-dimensional stock, and the Dimension for the one-dimensional stock is the same as one Dimension in the two-dimensional stock, the flow will be will take on identical dimensions to the the two-dimensional stock.

g) When a flow runs between two one-dimensional stocks and the stocks use the same Dimensions, the Cross Flows check box becomes accessible within the flow dialog. When cross flows is check, this flow will become two-dimensional, using the same Dimension Name twice. As a result, you will be able to distribute the entire contents of the upstream stock across the elements of the downstream stock.

- An arrayed graphical function cannot be created unless Apply To All is checked in the arrayed variable's main equation box. After you click "Become Graph," you can uncheck Apply To All within the graphical function dialog. Then, separate curves can drawn for each element in the arrayed graphical function.

Rules for Arrayed Variables that do not share the same dimensions:

- Whenever two one-dimensional arrayed Inputs to an arrayed variable do not share a the same dimension, you need to take special care. In order to use Dimension names to define the third variable, the third variable must be two-dimensional, using the Dimensions of the two Inputs. This will allow for the full range of possible equations. If the variable is one-dimensional arrayed or non-arrayed, specific elements from the Inputs can be included in an equation. Array Builtins also are available in this situation.

- Dimension names can be used to define a two dimensional arrayed variable which contains both two-dimensional arrayed Inputs and one-dimensional arrayed Inputs as long as each two-dimensional Input shares both Dimensions with the variable and each one-dimensional arrayed Input shares at least one Dimension with the variable.

Rules for Arrayed Conveyors, Ovens, and Queues:

- All rules for non-arrayed discrete building blocks apply when working with Arrays. These rules can be found with the discussion of Conveyors, Ovens, and Queues in Chapter 4. A discussion of flow prioritization and implicit connectors can be found in Chapter 14. Some Array specific situations are listed in the next section.

- Flows out of a Conveyor must use the same Dimension(s) as the Conveyor.

- Flows into and out of an Oven must use the same Dimension(s) as the Oven.

- A non-arrayed Conveyor or Oven cannot be created immediately upstream from an arrayed stock of any type. This is because, unless it is arrayed, there is no way to distribute the contents of a Conveyor or Oven to the multiple elements of the arrayed downstream stock. Placing a non-arrayed Reservoir or Queue between the non-arrayed Conveyor or Oven and the arrayed stock will enable you to put both into the same main chain. [Note: Also, an arrayed stock cannot be created immediately downstream from a non-arrayed Conveyor or Oven.]

- When Apply To All is unchecked in an arrayed Conveyor or Oven, constant values for Transit time (Conveyor) or Cook time (Oven) must be defined from the outflow dialog. If Apply To All is then unchecked in the outflow dialog, access to the Transit time or Cook time will be enabled within the Conveyor or Oven dialog.

- If you uncheck Apply To All in the define dialog for Transit time (Conveyor) or Cook time (Oven), constant values for Transit time and Cook time will not be available within the Conveyor or Oven dialog. If you uncheck Apply To All in the Conveyor or Oven dialog, then access to constant values for Transit time or Cook time will be enabled within the Conveyor or Oven dialog.

Rules for Prioritization of outflows:

a) If you have a two-dimensional outflow from a non-arrayed Queue or non-negative Reservoir, the priorities of the flows are determined by the order of the Dimensions in the two-dimensional arrayed variable - the first Dimension gets first priority. In this case, if you have two Dimensions in the flow, where Dimension 1 = {a,b} and Dimension 2 = {x,y}, then flow priority will be [a,x], [a,y], [b,x], [b,y].

b) If you have an outflow from a one-dimensional Queue or non-negative Reservoir into a two-dimensional stock (the flow will be two-dimensional), the priorities of the flow out of any particular element are determined by the Dimension the two have in common. If there are not sufficient units in the one-dimensional stock and its inflow(s) to cover the demand for the two-dimensional outflow, the software will meet the demand as follows. Suppose the one-dimensional stock uses Dimension 1 (Dimension 1 contains elements {a,b}) and the two-dimensional flow contains Dimension 1 and Dimension 2 (Dimension 2 contains elements {x,y}). The priority for flows out of the one-dimensional stock's element a will be [a,x] then [a,y]. The priority for flows out of element b will be [b,x] then [b,y].

Using Arrays with Other Features:

- The basic Cycle-Time operations will be the same with Arrays as with non-arrayed variables. However, you must keep in mind that time stamped material will be measured within each element, not the entire Array. Figure 11-15 illustrates this concept.

Figure 11-15 Cycle-Time Measurement with Arrays

- When diagram animation is turned on in the Model Prefs... dialog, the animation you see on the diagram will be of the first element in the arrayed variable.

- Arrayed stocks (and thus flows) are not permitted inside Sub-model spaces or Space Compression spaces. Arrayed converters can be created in or pasted into Sub-model and Decision Process Diamond spaces.

- The summer converter can accept individual array elements in its equation box or if you select the * it will automatically insert the ARRAYSUM builtin.

- When you click on an arrayed variable to load it into a graph, if you choose the *, you will get all the elements in that variable in a table, and the first 5 elements in that variable in the graph. You cannot use the Dimension name to define a Graph or Table.

- When defining Numeric Displays, Sliders, Graphical Input Devices, Loop Objects, Warning Devices, Switches, Knobs, and LIDs, you can only choose one element from within the Array to define the object (i.e., you cannot define the object using the Dimension name).

- When defining the Loop tracing button, you will click the variable name into the dialog. The individual elements will not be available to define the Loop Button.