Functions

The following function requires no arguments and can be used in an expression.
The syntax is function_name().

timeNow

returns the current simulation clock value.

The following arithmetic functions can be used in an expression.
The syntax is function_name(argument, argument, ...).

abs

returns the absolute value of a single numeric argument.

floor

returns the largest integer that is less than or equal to a single numeric argument.

ceil

returns the smallest integer that is greater than or equal to a single numeric argument.

round

returns the integer that is closest to a single numeric argument.

min

returns the minimum value among two or more numeric arguments.

max

returns the maximum value among two or more numeric arguments.

power

returns the first numeric argument raised to the power of the second numeric argument.

sin

returns the trigonometric sine of a single numeric radians argument.

cos

returns the trigonometric cosine of a single numeric radians argument.

tan

returns the trigonometric tangent of a single numeric radians argument.

asin

returns the trigonometric arc sine of a single numeric radians argument.

acos

returns the trigonometric arc cosine of a single numeric radians argument.

atan

returns the trigonometric arc tangent of a single numeric radians argument.

sinh

returns the trigonometric hyperbolic sine of a single numeric radians argument.

cosh

returns the trigonometric hyperbolic cosine of a single numeric radians argument.

tanh

returns the trigonometric hyperbolic tangent of a single numeric radians argument.

log

returns the base 10 logarithm of a single numeric argument.

ln

returns the natural logarithm of a single numeric argument.

exp

returns e (Euler’s number) raised to the power of a single numeric argument.

The following text functions can be used in an expression.
The syntax is function_name(argument, argument, ...).

concat

returns the concatenation of two or more text arguments.

The following conversion functions can be used in an expression.
The syntax is function_name(argument).

degrees

returns the degrees equivalent of a single numeric radians argument.

radians

returns the radians equivalent of a single numeric degrees argument.

toString

returns a string representation of a single argument.

toNumber

returns a numeric representation of a single argument (if possible).

toBoolean

returns the Boolean value false for a numeric argument with value 0 or a string argument with value other than "true". Returns the Boolean value true for a nonzero numeric argument or a string argument with value "true".

The following argument-index functions can be used in an expression.
The syntax is function_name(argument, argument, ...).

minindex

returns the zero-based index of the argument with the smallest value among two or more numeric arguments.

maxindex

returns the zero-based index of the argument with the largest value among two or more numeric arguments.

The following logical functions can be used in an expression.
The syntax is function_name(argument, argument, ...).

cond

has the following syntax: cond(Boolean expression, true return value, false return value). The value returned by this function is determined by evaluating the Boolean expression that is the first argument. If the Boolean expression evaluates to true, the second argument is returned. Otherwise, the third argument is returned.

switch

has the following syntax: switch(Boolean expression 1, value 1, Boolean expression 2, value 2, ..., default value). The value returned by this function is the value argument immediately following the first Boolean expression argument that evaluates to true. The default value is returned if none of the Boolean expression arguments evaluate to true.