Configuring an Arithmetic Virtual 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.

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 must not include conditional expressions such as if..then or if...then...else.
  • 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 (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
Log Returns returns the natural logarithm (base e) of a number. Log(base e, x) Log(1, 10) 0
Log10 Returns the base 10 logarithm of a number. Log10(x) Log10(1) 0
Max Returns the larger of two specified numbers (and y). Max(x,y) Max(1, 2) 2
Min Returns the smaller of two numbers (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:

  • If the fractional portion > 0.5, x is rounded to the integer with the higher absolute value.
  • If the fractional portion < 0.5, x is rounded to the integer with the lower absolute value.
  • If the fractional portion = 0.5, x is rounded to the next integer in the direction of +∞.
Round(x, number of decimal places) Round(3.222, 2) 3.22
Sign

Returns the sign of a number (x).

  • Returns 1 if the number is positive.
  • Returns -1 if the number is negative.
  • Returns 0 if the number is positive zero.
  • Returns -0 if the number is negative zero.
  • Returns NaN for others.
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

* 'x' is the value in the Raw Values column.

 

For details about the functions in the table above, see JavaScript Math Object.

 

To configure an Arithmetic virtual stream:

  1. In the left pane, select the device whose stream you want to configure.
  2. In the Sites Tree pane, select the Arithmetic virtual stream that you created. 
  3. In the right pane, click Configuration & Threshold. In the Convert to Engineering Units area, click the pencil icon . The Edit Arithmetic Expression window opens. 
  4. 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 .
  5. Click Submit.