Math Functions
There is an extensive list of math functions available in Simul8 through the Formula Editor in Visual Logic. These can be used as a part of a command that requires a Logic Flow rule before the function. You will need to use square brackets around the Object/distribution/parameter. E.g. IF [ABS[gbl_variable]] >10
ABS
Returns the absolute value of a number, i.e. converts a negative number to a positive number.
E.g. ABS[-3]
would return 3.
ARCTAN
Returns Arc Tangent of the parameter.
COS
Returns Cosine of the parameter.
DAY
Converts number from time to day 1-7 calculated from the Clock Properties.
EXP
Returns e to the power of the parameter (natural anti-log).
HOUR
Converts number from time to hour 1-23.
INSET
Search through a series of numbers without the need to use multiple IF Statements.
Note: This Command is case sensitive and must be in capital letters.
E.g. IF gbl_variable INSET[1-5,9,12]
will test if the variable is equal to 1, 2, 3, 4, 5, 9, or 12.
LOG
Returns the natural logarithm of the parameter.
MINUTE
Converts number from time to minute 1-59.
NEG
Multiplies the number by -1.
RANDOM
Returns a random number between 1 and 0. The parameter entered must be zero.
REALMOD
Calculates the mod (remainder after divide) for real number, where \ is the mod operator.
E.g. REALMOD[8\7.5]
would return 0.5,
ROUND
Rounds a number to the nearest integer. If the number to be rounded is exactly halfway between two whole numbers, the result is always the even number. This method of rounding is often called “Banker’s Rounding”. If you wish to always round to the lower integer value, use the TRUNC function.
SAMPLE
Gets a random value from a statistical distribution.
SHEETCOLN
Converts text sheet columns Label to numbers (e.g. column A = 1).
SIN
Returns the Sine of the parameter.
SQRT
Retruns the square root of the parameter.
TAN
Retruns the tangent of the parameter.
TRUNC
Rounds number to integer by moving towards zero.
WEEK
Converts number from time to week number 1, week number 2 etc. Calculated using Clock Properties.
WIPROPERTY
Access advanced Work Items properties.
More information on Work Item Properties