Apps Market - Virtual devices App (Virtual Devices Calculation)

In this article you will learn how to use the Virtual devices App, available in the Apps Market inside the Platform. mceclip0.png


Contents of the article:



This application allows you to create new devices using existing devices by defining formulas. Example: v1 + v2 - (v3*0.5)/v4



Available frequencies

The available frequencies in this screen are the ones that you have configured in the Preferences section of the Platform (Settings --> Preferences).

It can go from 5min to monthly.



Available operations

  • sin: The sinus function. Usage: v1+sin(43.12)
  • cos: The cosinus function. usage: v1+cos(33.33)
  • tan: The tangent function. Usage: v1+tan(33.33)
  • tanh: The hyperbolic tangent function. Usage: v1+tanh(15)
  • sqrt: The Square root function. Usage: v1+sqrt(v2+25)
  • exp: The exponential function. Usage: v3+exp(v2)
  • factorial: The factorial function. usage: v6*factorial(v2)
  • floor: The Floor function is to get the integer part of number.
    • floor(300.67) = 300
    • floor(300.06) = 300
    • floor(300.99) = 300
  • log: Is the neperian logarithm, so is equal to log with base e.
  • log10: Is the log with base 10
  • pi: The constant PI. usage: v1+pi+3.0
  • fabs: Absolute value of a given number. Usage:v1+fabs(-3.9)
  • asin: Arc sine of the given number
  • acos: Arc cosine of the given number
  • atan: Arc tangent of the given number



In order to be able to use this app you will need first:

  1. To install it through the EMS Apps market.
  2. A gateway available where the devices will be created. If you want to have all the devices under the same gateway, we recommend you to create a virtual gateway (follow this article to do so)

In order to see data in the Analyse section, you need to:

  1. Create the device (through the app)
  2. Accept the datapoints generated on the gateway where we will have created the device
  3. And assign those devices to its corresponding location


How does it work?

Creating a new virtual device

  1. Click on "Add new device" in order to start creating a new virtual device
    • Device Id: The ID or key of the device, and the default name it will take. This will represent the device, so it should be unique and not use special characters. Once the device has been created, the ID cannot be modified. However, the name of the device in the gateway can be changed once it has been calculated and accepted by editing the device.
    • Gateway: Select the gateway where the new device will be created.
    • Parameter: final parameter of the devices. Example: Active Energy, Reactive Energy, etc.
    • Frequency:  frequency of the imported data.
  2. Once you have indicated the previous fields, click on "Show variables" and "Add new variable". Add all the devices that will be part of the formula in order to create the new virtual device. 
    • vX: name of the variable we have to use in the formula. They are created consecutively and automatically (v1, v2, etc.)
    • Device: name of the devices used to create the new virtual device and that appears on the formula.
    • Parameter: Parameter from the selected device that will be used. It's related to the device previously selected.

Important: It is not recommended to use another virtual device as a variable. Always use "real" devices as variables, as using virtual devices as variables might lead to data not calculated timely.

  1. Formula: indicate the final formula la formula using the variables previously created. We can use any kind of operations: addition, subtraction, multiplication, division, sin, cos, etc.
  2. Save device button: Save the virtual device once it has been configured
  3. Recalculate the device: After configuring and saving the device, you can recalculate it from selected dates. It may take several minutes before the device is recalculated and appears on the gateway, ready to be accepted.
  4. Once the new virtual device has been recalculated, it needs to be accepted in the Virtual Gateway created in step 1 (in Configuration > Gateways). *
  5. To finalize the process, the new virtual device must be assigned to a location. Without this final step, you will not be able to see the data in the Platform.

* Note that the virtual device will be created when new data comes in. We can provoke the creation by recalculating the virtual device.

Note: Use a point for the decimal numbers (Ex: 0.2)


Edit, recalculate and delete a device

  • In order to calculate historical data of the new virtual device, click on "Recalculate". Select the "From" and "To" and wait until all the data is imported. Remember that all the devices that form the new virtual devices must have data available.
  • If you want to delete a device, just click on "delete device".
  • Remember to save a device if you introduce changes to the formula or variables used.

Dealing with data gaps

  • If data is not available for one or more variables in a formula, or one of the variables does not have data in the selected frequency, the Virtual Device will not be calculated for those periods of time. If this only occurs only for a certain period of time, i.e. one hour, only this hour will be without data.
  • If you are calculating a virtual device in specific a resolution, for instance 15 min, and some of the variables don't have data for a specific 15 min timestamp, for instance 00:15, the virtual device will not be calculated in that 15 min interval. The platform will nonetheless add the available data for that hour to calculate an hourly consumption, using the readings from 00:00, 00:30 and 00:45. Bear this in mind when comparing hourly (or higher resolutions) values for virtual devices calculated in lower resolutions.


To keep in mind

  • New virtual devices will count as new datapoints, so you will need extra datapoints in order to accept them. 
  • Related to the previous point, it is not recommended to use virtual devices as variables for other virtual devices, it might lead to delays in the calculation of the last virtual device in the chain.
  • New virtual devices must be associated with a location in order to visualise them on all the analysis menus.
  • If you are dividing by a variable, and it turns 0, a division by 0 will be treated as a 0 by the app (not infinite)
  • Select the frequency you wish to report in order to calculate the device. If the formula used is not linear, the calculations might differ from what they would yield if performed a different frequencies. For instance if you are calculating an efficiency or COP ratio by adding several variables and dividing them by another variable (or sum of variables) on 15 min parameter, the ratio will be calculated correctly for that frequency. The platform will automatically average the 15min results to calculate the hourly, daily etc... frequencies, but they will be the average of the 15 min ratio, not the hourly, daily etc... ratio. Be sure to select the frequency in which you report when configurating the virtual device.



This is a free app, so you won't have to pay to download it.

However, as it is an app that creates datapoints, all of them will be charged according to your pricing, as if they were normal datapoints sent from the field.

Like any other parameter in the EMS, they will be available on every screen possible, according to the parameter type.





Was this article helpful?