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

- Introduction
- Available frequencies
- Available parameters
- Available operations
- Requirements
- How does it work?
- To keep in mind
- Pricing

**Introduction**

This application allows you to create new devices using existing devices and establishing formulas defined by the user. **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 parameters**

*(Under development)*

**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

**Requirements**

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

- To install it through the EMS Apps market.
- 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:

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

**How does it work? **

- Click on "
**Add new device**" in order to start creating a new virtual device**Name**: name of the device. This name will represent the ID of the device, so it should be unique and not use special characters.**Gateway**: we have to select where the new device will be created. It has to be one of the gateways configured in steps 1 and 2.**Parameter**: final parameter of the devices. Example: Active Energy, Reactive Energy, etc.**Frequency**: frequency of the imported data.

- Once we have indicated the previous fields, we click on "
**Show list of variables**" and "**Add new variable**". Here we have to select 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.**Device**: one of the devices used to create the new virtual device and that appears on the formula.**Parameter**: initial parameter. It's related to the device previously selected.

**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.-
**Save all devices**: save all the devices created. - Once the new virtual device has been created,
**it needs to be accepted**in the Virtual Gateway created in step 1 (in*Configuration > Gateways*).***** - 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 meter.

**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".

**To keep in mind**

- New virtual devices will count as new datapoints, so you will need extra
**datapoints**in order to accept them. - The app will be executed every
**2 hours**and will calculate the values from**6 hours ago**. This restriction is to assure that all the data included in the formula have arrived correctly. - If data has not arrived for one or more variables in a formula, or one of the devices does not have data in the selected frequency for the virtual device to be created,
**the Virtual Devices App won't calculate any value**. If this only occurs only for a certain period of time, i.e. one hour, only this hour will be without data. - 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.

**Pricing**

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.