LIVEsite Help

Virtual Equations


Virtual Equations allow you to graph or tabulate readings from a Virtual Sensor.
You can enter a virtual sensor equation on the Readings Page. If left blank, no virtual sensor is calculated.



Equation Format

An equation consists of Sensor names, mathematical operations and built-in functions and constants.

A very simple equation example would be
LVDT1+1

Here we are saying the virtual sensor should return the value of the sensor LVDT1 with 1 added it.

You could also add 2 sensors like this:
LVDT1+LVDT2

You can use parenthesis to do more complex operations such as:

(LVDT1+LVDT2)*5

Using Functions

Integrated functions similar to those found in maths libraries are also available.
When using integrated functions ensure the number of parameters is correct.
Some functions use one parameter and some require more.

ABS
Returns the absolute value of the parameter.
eg ABS(1)

MAX
Returns the maximum of 2 values
eg MAX(LVDT1, 10), MAX(1,5), MAX(LVDT1, LVDT2)

MIN
Returns the minimum of 2 values
eg MIN(LVDT1, 10), MIN(1,5), MIN(LVDT1, LVDT2)

Trigonometry
SIN, ASIN, COS, ACOS, TAN, ATAN return the trigonometric function value in radians
eg SIN(PI)

SQRT
Returns the square root of the given value
eg SQRT(LVDT1)

POW
Returns X to the Power of Y. Requires 2 parameters, X and Y
eg POW(LVDT1, 3) returns LVDT1 cubed.

FLOOR
Rounds the value down to the nearest integer.
eg FLOOR(3.5) returns 3

Constants

Constants are used without brackets.
Available constants include PI and RAND.
PI returns PI to 15 decimal places.
RAND returns a random number between 0 and 1
SECS returns the project run-time in seconds.

Errors

If you enter a virtual equation incorrectly, an error page will describe the error.
The error page also shows the available functions and gives some more examples of how to enter equations.