Arithmetic virtual stream is a stream that is used when the final value conversion or calculation of a normal data stream is too complex for a regular linear stream.
Arithmetic virtual stream is a stream that is used when the final value conversion or calculation of a normal data stream is too complex for a regular linear stream.
An Arithmetic virtual stream applies an arithmetic transformation by leveraging its parent stream’s Final Values (values that appear in the Final Value column of a stream’s Samples table). The Raw Values of a virtual stream are replicated from the Final Values of its parent stream.
The Final Values of an Arithmetic Virtual Stream are the result of applying an arithmetic formula or calculation to the virtual stream's "Raw Values".
An arithmetic expression is an expression that can use the following functions: addition (+), subtraction (-), multiplication (*), division (/), percentages, square roots, exponentiation, maxima, minima, truncation, and logarithmic functions.
Note:
- Arithmetic expressions are case-sensitive. For example, abs(x) will fail, but Abs(x) will succeed.
The following table lists some examples of arithmetic expressions:
Name | Description |
Format* |
Example |
Result |
---|---|---|---|---|
Abs | Returns the absolute value of a specified number. | Abs(x) | Abs(-1) | 1 |
Acos | Returns the arccosine of a number in radians. | Acos(x) | Acos(0.5) |
1.0471975511965979 |
Asin | Returns the arcsine of a number in radians. | Asin(x) | Asin(1) |
1.5707963267948966 |
Atan | Returns the arctangent of a number in radians. | Atan(x) | Atan(1) |
0.7853981633974483 |
Ceiling | Returns the smallest integer greater than or equal to the specified number. | Ceiling(x) | Ceiling(1.5) | 2 |
Cos | Returns the cosine of the specified angle. | Cos(x) | Cos(1) |
0.5403023058681398 |
Exp | Returns e (Euler's number: 2.71828) raised to the specified power. | Exp(x) | Exp(2) |
7.38905609893065 |
Floor | Returns the largest integer less than or equal to the specified number. | Floor(x) | Floor(1.5) | 1 |
IEEERemainder | Returns the result from the division on specified arguments and returns the remainder according to IEEE 754 standard. | IEEERemainder(x=dividend,y=divisor) | IEEERemainder(25.0,3.0) | 1 |
if | Returns a value based on a condition. | if(x % 2.0 = 1.0,1.0,0.0) | if(3.0 % 2.0 = 1.0,1.0,0.0) | 1.0 |
Log | Returns returns the natural logarithm (base e) of a number. | Log(x, base e) | Log(1, e) | 0 |
Log10 | Returns the base 10 logarithm of a number. | Log10(x) | Log10(1) | 0 |
Max | Returns the larger of two specified numbers (x and y). | Max(x,y) | Max(1, 2) | 2 |
Min | Returns the smaller of two numbers (x and y). | Min(x,y) | Min(1, 2) | 1 |
Pow | Returns a specified number (x) raised to the specified power (y). | Pow(x,y) | Pow(3, 2) | 9 |
Round |
Rounds a value to the nearest integer or specified number of decimal places:
|
Round(x, number of decimal places) | Round(3.222, 2) | 3.22 |
Sign |
Returns the sign of a number (x).
|
Sign(x) |
Sign(7) Sign(-7) Sign(+0) Sign(-0) Sign(Hello) |
1 -1 0 -0 NaN |
Sin | Returns the sine of the specified number (x) in radians. | Sin(x) | Sin(1) |
0.8414709848078965 |
Sqrt | Returns the square root of a specified number (x). | Sqrt(x) | Sqrt(2) |
1.4142135623730951 |
Tan | Returns the tangent of the specified number (x) in radians. | Tan(x) | Tan(1) |
1.5574077246549023 |
Trunc |
Returns the integer part of a number (x). |
Trunc(x) | Trunc(1.7) | 1 |
pi |
Returns mathematical constant π |
pi | pi | ~3.14159 |
* 'x' is the value in the Raw Values column.
Supported operators can be found here
Support functions can be found here
To configure an Arithmetic virtual stream:
- In the left pane, select the device whose stream you want to configure.
- In the Sites Tree pane, select the Arithmetic virtual stream that you created.
- In the right pane, click Configuration & Threshold. In the Convert to Engineering Units area, click the pencil icon . The Edit Arithmetic Expression window opens.
- In the Edit Arithmetic Expression window, type in an arithmetic expression. Be sure to include "x" where the Raw Value is needed. For example, you might type in: 1 + Sqrt(x) * 4x .
- Click Submit.