Page 726 - ExtendSim User Guide

P. 726

```
700
Math and Statistical Distributions
Equation-based blocks
Output Variable Type
Attribute – the value of the attribute named in Variable Name Item quantity – the item’s quantity value
Item priority – the item’s priority value
3D object ID – the index of the item’s 3D object
X X X X X X X X X X X X
For the Variable Name column, use the default name, assign a name that has more relevance to the model, or select a name from a popup, depending on the type of variable selected. The Variable Value field reports the results for the selected output variable. In the Equation(I) block there is also a column to specify what should happen to the result if an output is needed but there is no item to trigger the equation’s recalculation.
☞ The notation PRI (Parent Record Index) is used in blocks that interface with the ExtendSim database. It describes the type of value that is being read or written when dealing with a Child field.
☞ The Queue Equation, Query Equation, and Query Equation(I) blocks have additional specific output variable types. See “Sorting items using the Queue Equation block” on page 145 or “Query Equation and Query Equation(I) blocks” on page 775.
Equation
An equation is a list of commands to be executed on one or more input variables, resulting in one or more output variables. In the equation pane, enter an equation that uses the names of the input and output variables and any of ExtendSim’s built-in functions and operators. (Note that user-defined functions and procedures must be defined in include files; they cannot be called directly in the equation block.) The equation must be of the general form output = equation; (the semicolon at the end is required).
For example, an equation that uses the values from input connectors named Input1 and Input2 and outputs the result to an output connector named OutputA would be:
if(Input1 > Input2)
OutputA = 2;
else
OutputA = 5;
☞ To find out how to debug your equations, see “Debugging equations” on page 720.
The equation does not have to use all the names assigned to the input and output variables. However, if an input connector is connected, ExtendSim assumes that you will want to use it in the equation. If you don’t use it, ExtendSim will give a warning when the simulation runs. ExtendSim will also warn if the equation uses a connector that is not named or is not con- nected.
How To
Equation Equation(I) Queue Equation Query Equation Query Equation(I)
```