Use standard math operators, functions, and constants to customize existing hardware channels in the system.
All formulas must adhere to the following rules:
Refer to the following table for examples of formula formats that you can use to configure a calculated channel.
Description | Formula Format | Example |
---|---|---|
Element-wise arithmetic addition | 'channel name' + x | 'AI7' + 1 |
'channel name x' + 'channel name y' | 'AI7' + 'AI8' | |
Element-wise arithmetic subtraction | 'channel name' - x | 'AI7' - 1 |
'channel name x' - 'channel name y' | 'AI7' - 'AI8' | |
Element-wise arithmetic multiplication | 'channel name' * x | 'AI7' * 5 |
'channel name x' * 'channel name y' | 'AI7' * 'AI8' | |
Element-wise arithmetic division | 'channel name' / x | 'AI7' / 5 |
'channel name x' / 'channel name y' | 'AI7' / 'AI8' | |
Apply the function to the channel element | function('channel name') | sin('AI7') |
Arithmetic equation | x + y * z / 'channel name' | 2 + 3 * 4 / 'AI7' |
Arithmetic equation | (x + y) * z / 'channel name' | (2 + 3) * 4 / 'AI7' |
Number with scientific representation | 'channel name' + 1.23e-5 | 'AI8' + 1.23e-5 |
Constant usage | function(constant * 'channel name') | sin(pi * 'AI7') See Supported Functions, Operators, and Constants table. |
Unary minus | -'channel name' | -'AI7' |
Unary plus (a no-op) | +'channel name' | +'AI7' |
Power operator | 'channel name'^x | 'AI7'^3 |
Note: The data type for all numerics is double-precision, floating-point. |
Refer to the following table for examples of formula elements that you can use to configure a calculated channel.
Formula Element | Signal Type | Definition | |
---|---|---|---|
Supported Functions | sin | Analog | Sine |
cos | Analog | Cosine | |
tan | Analog | Tangent | |
arcsin | Analog | Inverse of sine | |
arccos | Analog | Inverse of cosine | |
arctan | Analog | Inverse of tangent | |
abs | Analog | Absolute value of any number | |
log | Analog | Logarithm | |
log10 | Analog | Common logarithm (logarithm to base 10) | |
Supported Operators | + | Analog | Addition |
- | Analog | Subtraction | |
* | Analog | Multiplication | |
/ | Analog | Division | |
( ) | Analog, digital | Bracket; contents are evaluated first | |
^ | Analog | Calculate the base raised to the power of the exponent | |
< | Analog | Less than | |
> | Analog | Greater than | |
<= | Analog | Less than or equal to | |
>= | Analog | Greater than or equal to | |
= | Analog, digital | Equal | |
!= | Analog, digital | Not equal | |
& | Digital | Logical and | |
| | Digital | Logical or | |
~ | Digital | Negation | |
? : | Analog, digital | Ternary operator indicating condition ? valueIfTrue : valueIfFalse. The data type of valueIfTrue and valueIfFalse must be the same. | |
Supported Constants | pi | Analog | Pi (π) constant |
e | Analog | Natural logarithm base constant (𝑒) | |
true | Digital | Is TRUE | |
false | Digital | Is FALSE |