Step editor commands, Command: expression (113), Expressions – Delta RMC151 User Manual
Page 859: Expression (113), Expression, N expression (113), E expression (113), Expression (113) command examples
8 Command Reference
8.10. Step Editor Commands
8.10.1. Command: Expression (113)
Supported Axes: All
Firmware Requirement: 1.00 or newer
See the Commands Overview topic for basic command information and how to issue
commands from PLCs, HMIs, etc.
Command Parameters
# Parameter Description
1 Expression
Description
This command can only be used in User Programs. It runs the Expression as entered by
the user. Each expression command can contain multiple assignments, multiple lines,
branching using IF statements, local variables, and can include comments.
This command is very versatile and can be used for such things as:
•
Mathematical calculations.
•
Assign values to registers, such as variables, parameters and discrete I/O.
•
Turn discrete outputs on.
•
Get the state of discrete inputs or outputs.
•
Copy data from one location in the variable table to another location in the variable
table. See the COPY function for details.
Step-Local Variables
The Expression (113) command can be used together with step-local variables. These are
variables that are declared within a user program step, and can only be accessed from
that step and are valid only for the execution of the step. For complex expressions, using
local variables can significantly reduce the number of variables needed in the variable
table.
Examples
Example 1
Adds 2 to the square root of Num2 and assigns the result to Num1.
// Calculate 2 plus the square root of Num2, and save it in Num1.
Num1
:= 2.0 +
SQRT
(Num2);
Example 2
The first line adds 2.56 to the Actual Position and assigns the result to the Position Offset.
The second line divides the minimum value of Axis 0 or Axis 1 Actual Position by 2, adds
6, and assigns the result to the variable SampleVariable.
// Set the axis 0 Position Offset parameter to the current Actual
deltamotion.com
839