Table of Contents

Create Virtual Variables

Andres Andresson Updated by Andres Andresson

Virtual variables are used to create new calculated variables that are a mathematical function of one or more sensor readings. Virtual Variables can be used as any other sensor in the system. Add it to a plot and configure for an alarm.

Configure Virtual Variables (VV)

Go to Setup > Virtual Variable. 

Click + button in the top right corner to create a new VV.

  • Select the Site and Variable to include in the formula. Double click it to add it to the Equation window.
  • It is possible to select Variables from different Sites into the same Equation

Here is a basic sensor calibration Equation. Notice the $1612$ which is the Variable ID. All variables in the equation will be listed in the Variable table. 

Match Timestamps

When the Virtual Variable Equation includes variables with mismatching timestamps the Non Matching Timestamps can be selected.

  • Main Variable - The selected Main Variable values will be used as a reference when calculating the formula
  • Before/After Buffer - Decide how far to search from each timestamp of the Main Variable. 

Match Timestamp Calculation Example

The following variables are being used in an equation

Sensor

Sensor Update Rate

Sensor update time (HH:MM)

A

Hourly

HH:56

B

Hourly

HH:31

C

15 Minutes

HH:00, HH:15, HH:30, HH:45

Scenario 1.

Equation

Main Variable

Pre Buffer

Post Buffer

A + C

Sensor C

30 min

30 min

The VV calculates the formula at 15 minute intervals where the C uses its own data and looks for data in A 30 minutes before and 30 minutes after.

Scenario 2.

Equation

Main Variable

Pre Buffer

Post Buffer

A + B + C

Sensor A

30 min

5 min

The VV calculates the formula hourly with the timestamp as HH:56.

C uses its own data and looks for data in A 30 minutes before and 5 minutes after. This means that at HH:56 if it does not find data for both B and C in the range 30 minutes before and 5 minutes after it will not return anything. And as B only updates at HH:31 this scenario will not return any data.

Note however that it would have found data for C at HH:00 and HH:15. It would use the HH:00 measurement as that is closer.

Scenario 3.

Equation

Main Variable

Pre Buffer

Post Buffer

A + B + C

Sensor C

25 min

20 min

The VV calculates the formula at 15 minute intervals.

At HH:00 the buffer doesn't reach Sensor B so no reading will be returned there.

At HH:15 the buffer finds values from both A and B and returns normal values

At HH:30 the buffer doesn't reach Sensor A so no reading will be returned there.

At HH:45 the buffer finds values from both A and B and returns normal values

If the time is 9:50, the data for Sensor A hasn't been read yet so Scenario 3 will only return the reading for 9:45 after Sensor A has recieved it's data at 9:56

Time Variable

It is possible to have different formula for different time period. This is useful if the sensor has been replaced or re-calibrated and a new formula is needed. 

Check the Time Variable checkbox to activate the Time variable. A date picker appears above the equation to select the data when this formula starts. 

To add a new time period click the + button below the first equation calculation example.

VV Constants

It is simple to add constants into the Equation to make it easier to manage and read.

Expand the Constant section and add a New constant. It is possible to add multiple constants. 

Rate of Change

Rate of change is used to calculate how fast a sensor value is changing. This is useful in order to indicate a flood or a landslide or any sudden movement that is otherwise hart to detect. RoC for a sensor value may be plotted just like the sensor value itself.

The Precision is selected in the drop down menu and indicates the numerical precision of the results.

The Interval can be in minutes, hours or days, RoC is calculated for this time interval

The Unit can be in seconds, minutes, hours or days. The RoC unit allows the user to plot the average difference for specific units for the RoC.

Example 1: RoC with an Interval of 1 day and a Unit of 1 day, means that the user is plotting the Rate of Change for each timestamp (the Unit) comparing it to the one exactly 1 day back (the Interval). So if the current value is 7 and the value exactly 1 day ago was 4 then the RoC value is equal 3.
Example 2: RoC with an Interval of 24 hours and 1 hour Unit, means that the user is plotting the average difference per hour (the Unit) for those 24 hours (the Interval).
Sometimes it is of interest to plot both a sensor value and its RoC which gives a clear picture of how RoC behaves. In order to plot both the sensor value and its RoC value you need to create a virtual variable of the sensor value and then choose to plot one of the two as a normal trend line and the other as RoC

VV Datum

Often there is a need to use a baseline reading in the equation. The Datum feature is useful for this purpose. 

Expand the Datum Section and click Select.

Select SiteVariable and Timestamp for the Datum Reading. VDV will automatically select the oldest reading in the database. Click Select to select the Datum value. 

Now we can change the baseline reading (8553.91) and simply type in datum. When the Datum reading is changed the formula is updated at once.

Calculation Example

When a VV has been created it is a good practice to make sure it is working properly. 

Expand the Calculation Example section.

Change the Value for each Variable in the equation and see how the result changes. 

How did we do?

Export/Import Virtual Variables

Contact Support