Expressions Overview

Expressions are used to assign values to tags or variable, and perform mathematical calculations, both simple and complex. Expressions provide for efficient calculations and compact User Programs. RMCTools provides an Expression Editor, which includes the Expression Browser, to help you create expressions. Expressions can be used in the following places:

How to Create Expressions

See the Condition Expressions topic for creating expressions in the Program Triggers and in link types.

See the Assignment Expressions topic for creating expressions in user programs with the Expression (113) command.

See the Value Expressions topic for details on creating expressions in the Delay Link Type and in command parameters.

Examples

For examples of expressions, see the Condition Expressions and Assignment Expressions topics.

For examples of user programs that use expressions, see the Programming Examples topic.

Parts of an Expression

The building blocks of all expressions are:

Operators

These are symbols that represent an action to be performed, such as +, -, /, etc.

Functions

These are predefined, named formulas, such as SIN(), MIN(), LOG_EVENT(), etc.

User Functions

User functions are custom functions created or imported by the user. User functions can be edited in the User Function Editor.

Operands

These are the elements that the operators and functions work on:

Type

Examples

Constant Value

3, 10.345

Register (tag)

_Axis[0].ActPos, %MD8.3

Variable

SampleVariable1 (must exist in the variable table)

Keywords

These are words that have a specific meaning for the code, such as IF, THEN, ELSE, True, False, etc.

Comments

Comments are a good way of documenting the code.

Expression Color-Coding

Expressions are color-coded as follows:

Blue: Keywords

Dark Red: System-defined tags

Beige: User-defined tags

Black: Operators and numbers

Magenta: Functions

Red with yellow background: Invalid value

Troubleshooting Expressions

For help on troubleshooting expressions, see the Troubleshooting Expressions topic.

Operators and Functions

For details on the operators and functions used in expressions, see the Operators and Functions topics.

 

See Also

Assignment Expressions | Condition Expressions | Value Expressions | Functions | User Functions | Operators | Keywords | If Statement | Arrays | Limitations of 32-bit Numbers | Comments


Send comments on this topic.

Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion