Statements are simply commands to be executed at particular stages in an entity’s progress through the process. The following pages explain in detail each statement listed below.
System reserved words cannot be used as variable names, attributes, or scenario parameters.
( ) = ( ) assignment
Comments You can add explanatory comments to your action logic by placing special characters in front of the comment. Comment lines are for user information only and the simulation ignores them during run time. To include a single-line comment, use a pound sign “#” or two forward slashes “//” at the beginning of the line. Multiline comments begin with a “/*”… and end with a “*/”. Some statements and functions such as GET or FREE are not ignored when found in a single comment line. To ensure they are ignored, you must use the multiline /* . . . */ comment indicators, and the ending “*/” must appear on a different line than the opening “/*”.
FREE, GET, and JOINTLYGET, PERCENT and GROUP statements are not ignored by the // comment indicator. Use the /* … */ comment indicators. These indicators are normally used to comment multiple lines. So if you are only commenting out a single line, the closing */ must appear on a second line since it cannot exist on the same line as the opening /*.
IF Test = Reject THEN INC RejectQty
/*Number of rejects increased
for each test reject.*/
// The logic below describes how rejects are handled.
( ) = ( )
This is the assignment statement which allows you to assign a value (or descriptor) to a variable or to one of the attributes defined for your entities.
assignee = assignor
assignee The variable or attribute to which the value is assigned.
assignor The value assigned to the variable. This could be another variable or attribute, a pre-defined descriptor, or a mathematical expression.
In the first example, the attribute a_ Attr1 is assigned a value of 2. The second example assigns the value of a_ PO_No to the attribute a_ Invoice_No . Number three assigns the descriptor Red to the attribute a_ Color . And the last example assigns the product of 5 and the value of Base to the attribute a_ Size.
1) a_Attr1 = 2
2) a_Invoice_No = a_PO_No
3) a_Color = Red
4) a_Size = 5 * Base
The ANIMATE statement allows the control of the animation speed through the action logic dialog.
speed A numeric value between 0 and 100. One is the slowest and one hundred is the fastest speed of animation. A speed of zero turns the animation off.
In the first example, ANIMATE statement is used to turn the animation off so that the model will run ahead in time quickly. In the second example the speed of animation is set very slow (usually to show a particular entity or activity). In the third example the speed of animation is set to the highest possible speed with animation still on (often used to help the user gain a “feel” for the general flow and buildups that would occur over time.
The ANIMATE statement is usually implemented by placing a separate entity, arrival and activity combination in the existing model. Scheduled arrivals work well because the exact time can be assigned for the arrival(s) and individual action logic applies for each scheduled arrival. The first arrival could be used to “fast forward” to a time in the model of particular importance, while the next arrival could be used to slow the animation for inspection of a particular aspect of the simulation and then a third to again “fast forward” to see the results.
The decrement statement allows you to decrement a variable or attribute’s value. It subtracts one (the default) or more from the value of the variable or attribute.
DEC name [, expression]
name This is the name of the variable or attribute to be decremented.
[expression] You can optionally decrement the variable or attribute by more than one using an expression which can be a constant or a mathematical expression. The name and expression must be separated by a comma. (The square brackets illustrate only that this element is optional.)
The following are several easy-to-understand examples. The first decrements the value of v_ Var1 by one. The second decrements the value of a_ Attr1 by five. The third decrements the value of Number_in_System by the value of an attribute called a_ Batch_Size.
1) DEC v_Var1
2) DEC a_Attr1, 5
3) DEC Number_in_System, a_Batch_Size
Pauses the simulation and displays a message. The simulation will resume when the user selects OK.
DISPLAY “< text string >” [,< attribute / variable / function call >]
DISPLAY “Now completing the 100th set”
DISPLAY “The current number of entries is: “, Var1
DISPLAY “Var1 = “, Var1 $ CHAR(13) $ “Attr1 = ” $ Attr1
text string The message ProcessModel will display. The text string must be enclosed in quotes.
[attribute / variable / function call] The text string or numeric value you wish to display.
After the original set of information (i.e. text string, variable) the “$” character is used to add additional information (i.e another text string or variable). You can force a carriage return by using the statement CHAR(13). Each new item that is appended to the statement must be prefaced with the “$” character.
This example displays a message whenever a new order type begins processing at the current activity. A variable, v_ Last_Order , stores the order type of the last entity processed at the activity. If the current entity’s a_ Order_Type attribute value is different from the previous order type, ProcessModel displays a message stating the new order’s type.
IF Order_Type <> Last_Order THEN
DISPLAY “New Order Type: ”, a_Order_Type
v_Last_Order = a_Order_Type
This example displays the entity name during simulation.
Display “Entity Name = “, Name
Display “Entity Name = “, Ent(Name)
Using just Name will display the entity number rather than the text name. Name is the system defined attribute which contains the numeric value of the entity name. Ent(Name) will display the text name of the entity.
The display statement is valuable for debugging complex models and for halting a model temporarily during a presentation to display information.
The free statement allows you to free a resource (or resources) being used by the current entity.
FREE [ quantity ] resource
FREE [ quantity ] resource , [ quantity ] resource , …
[quantity] The number of units of the following resource to free. If no quantity is used, the quantity is assumed to be one. (The square brackets illustrate only that this element is optional.)
resource The name of the resource or list of resource names to be freed. If any resource specified is not being used by the current entity, it is simply ignored.
ALL The keyword used with the FREE statement to free all captured resources.
In the following example, an entity, which earlier captured the resource Operator, frees the Operator after a three minute activity time. This action is followed by an increment of the variable called v_TimesUsed.
If no action statements follow the freeing of a resource, the resource can just as easily be freed by drawing a Free resource assignment connection between the resource and the activity.
The get statement enables an entity to obtain a resource. ProcessModel attempts to capture the resources in the order they are listed. If multiple resources are requested, but not available, those that are available will be captured and tied up until all are available.
If you get and free your resources in action logic (rather than with a connector line), the entity must enter the activity before it knows whether a resource is available or not. Therefore, if the resource is not available and the entity must wait “in” the activity for the resource to be available as compared to the GET/FREE route where the entity will wait at the input queue for the resource to be available before entering the activity.
To have the GET/ FREE action logic to behave in the same manner as the GET / FREE routes, add an extra activity that will server as the input queue, before the the activity where you want the resource to work. Remove the input/output queue from the new activity as well as the working activity. Change the capacity of the new activity to the input queu size for the work activity and GET the resource at the new activity.