Skip to main content
Skip table of contents

Expressions

This page covers the expression component of the simulator. An expression is an arithmetic or logical statement used to assign a value. Expressions are evaluated while running the simulator, can use variables defined in Simulation Properties, a plethora of built in functions, and various mathematical operations.

Basic Data Types

Expressions come with three basic data types: number, text, and true/false. A number can either have a decimal or not, so both 5 and 10.25 are valid numbers. Text is anything surrounded by quotation marks, like “The simulator is the coolest”. True/false has two values: true and false.

Inputting an Expression

When inputting an Expression, there are four different modes that you can use: Constant, Expression, Between (Normal), and Between (Uniform). You can change between them by using the dropdown on the right side of the box.

image-20240417-173259.png

In addition, whenever an expression is saved, it will check for any possible errors in the expression.

image-20240419-153513.png
image-20240419-153539.png

Warning means that it might still evaluate the expression, but it could do something unexpected. On the other hand, Error means that the expression cannot run, and you will be unable to run a simulation until you fix the error.

Constant Mode

Constant mode is for simple expressions, usually comprised of just a number or true/false. For example, if you want to set the duration of an activity to take exactly 1 second every time a case enters the activity, this is the way to do so.

image-20240417-173049.png

Between (Uniform) and Between (Normal)

Between (Uniform) and Between (Normal) are used to quickly get a distribution. When you switch to this mode, the single input of constant or expression mode gets replaced with two inputs, specifying a lower bound and an upper bound. Once you specify these two bounds, every time this expression is evaluated, you will get a number between the lower bound and the upper bound. In addition, these numbers will follow the distribution specified, either a normal distribution or a uniform distribution, over the range.

image-20240417-173943.png

Expression Mode

Expression mode is the most powerful mode. In expression mode, you are empowered to create any type of expression, using all of the features available. When you start typing in expression mode, you will be prompted with suggestions for how to continue writing your expression. For example, if you want to create a normal distribution using the NormDist function, and start typing it in, you will see something like this:

image-20240417-174745.png

In addition to seeing the names of functions, hovering over them gives you a tooltip about what they do. Once you start putting in parameters for that function, it will also tell you the name and order of the parameters, like so:

image-20240417-174911.png

You can also use a variable by typing in its name:

image-20240419-153323.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.