For Attributes to be useful, you must be able to refer to them and change them during a simulation run. SIMPROCESS provides opportunities to do this at many points during a simulation. The instructions that you write to process attributes and SIMPROCESS model elements are called Expressions.
An Expression is a user-defined routine that runs within the larger SIMPROCESS program. In effect, SIMPROCESS checks at various points during a simulation run to see if you've written any special instructions for it. If you have, it runs the code you've written. Expressions accomplish simulation and modeling requirements that standard SIMPROCESS processing elements do not provide for.
Dialog Field Definitions and Buttons
Expression Activation Events list box: SIMPROCESS has a set of activation points at which it checks for the existence of Expressions and runs those that it finds. You assign your Expression to an activation point at the time you define the Expression.
Each activation point corresponds to a simulation event, and has a name identifying it to SIMPROCESS. For example, the start of a simulation run is referred to as the Start Simulation event. The Start Trial event marks the end of the warmup period within a simulation. Chapter 10 of the User's Manual contains an exhaustive listing of SIMPROCESS Activation Events.
Edit: opens the Expression Editor, allowing you to add or edit an Expression associated with the selected Activation Event.
Remove: deletes any expression code associated with the selected Activation Event.
SIMPROCESS Expression Language Basics
You write Expressions using the SIMPROCESS Expression language. You can write complex Expressions in this language, but the coding required for the examples in this section require just a few language elements. In order to put a SIMPROCESS Expression together, you need to know the following about the language's syntax:
1. The SIMPROCESS
Expression language is case sensitive. An attribute named Applianceweight
is not the same attribute as the attribute referred to as applianceWeight
.
2. All built-in language elements are in capital letters (IF, END, WHILE, etc.).
3. Each Expression language statement ends with a semicolon (;).
4. You can include comments in your Expressions by enclosing them in curly brackets ({ }). For example:
{ This is
a comment }
Do not end a comment line with a semicolon.
5. Basic conditional logic has the form:
IF a < b
x := c;
ELSIF a < c
x := d;
END IF;
For example:
IF batchweight > 2000
maxBatchSize := 100;
batchWeight := 0;
ELSIF batchweight > 1800
maxBatchSize := 110;
END IF;
You can display messages in the SIMPROCESS message window with the OUTPUT statement. This is useful for tracking the value of attributes as a simulation proceeds. The OUTPUT statement has the form:
OUTPUT(expression);
For example:
OUTPUT("Just
assigned a weight to entity");
OUTPUT("Current
batch weight ", batchWeight);
In the second example, the value of attribute batchWeight
is displayed following the text "Current batch weight ". A comma
separates the literal string and attribute names.
These are just some basics of the SIMPROCESS Expression language. For more detail, see Chapter 10 and Appendix F of the User's Manual.