MotionSolve Expressions#

An expression is a finite, well-formed combination of numbers, constants, operators, and functions that evaluates to a scalar value.

Numbers

A number can be an integer or a real number, positive or negative. In case of a decimal number, use a dot as the decimal separator.

You can use the scientific notation \(e\) to indicate the power of 10 (eg. 100 = 1e2).

All angle inputs in MotionSolve are in radians. To specify input angle in degrees use \(D\) or \(d\) after the value (eg. “180D” is equivalent to pi radians).

Arithmetic Operators

Supported operators are addition (+), subtraction (-), multiplication (*), and division (/), as well as exponentiation (**).

MotionSolve follows the operator precedence convention expressed below:

  1. Exponentiation

  2. Multiplication/Division

  3. Addition/Subtraction

Functions

There is a wide range of available MotionSolve functions that return system information. These functions can be used in conjunction with each other to create highly sophisticated expressions.

Note

When a function is used inside an expression and one of its arguments is a reference to a MotionSolve entity, you have to use its id to point to it. Refer to Functions for more information.

Examples

The following expressions demonstrate the usage of numbers, operators, and functions to create advanced evaluations. You can use such expressions to define output requests, motion constraints, and external forces to name a few use cases.

expr1 = "IF(50-PROXIMITY(70000,2),0.0,0.0,1000*(50-PROXIMITY(70000,2)))"

expr2 = "-10*(sqrt(VX(11)**2+VY(11)**2)) -10*(sqrt(VX(11)**2+VY(11)**2))"

expr3 = "20*SIGN(DM(24,33),VZ(24,33))"

expr4 = "STEP(TIME, 0.1, 1, 0.5, STEP(FXMODE, 4, 0.05, 6, 1))"

expr5 = "IF(MODE-4:0,0,-100*DX(1,2))"