Calculated feed enables various combinations of feed calculation in order to create a unique combination specified for certain business logic.
Calculated feed can be used on Dashboard, Rules and Reports as any other feed.
Create Calculated Feed
To create Calculated feed:
- Go to the Data Semantics module
- Select semantic group
- Click the Create button
- Select the Create calculated feed option from a drop-down list
In a new dialog fill in the following information:
- Feed name
- Reading type and Unit - (If the Unit is Numeric, specify the minimum and maximum values)
- Feed parent describes semantic group - (e.g. Home)
Stale after (min) value is set to ‘0’ by default, which means that the last calculated value will be considered as always fresh. It can be set to a proper period of time according to your business need, after which, value will be marked and considered as stale.
Note: You can use only reading type which already exists on the Platform, otherwise create one! To see further explanation on how to do that, please follow this link.
- Next step is to add inputs for calculation
You can create calculation by using two types of input: sensor value (device directly) or some feed.
You can search and select the existing sensor/feed by name. Its reference, value and stale after value which will be used for calculation are populated from the input by default. You can adjust them if needed.
In the field for Formula, calculation function needs to be written in Java Script notation.
For example: (Number(T1)+Number(T2)+Number(T3))/3; formula for average temperature, as shown below.
Once the formula is written, you can evaluate it by clicking the Evaluate button. Formula will be evaluated and calculated based on input values entered in Value fields.
You will be notified of the successful calculation.
Update Calculated Feed
To update calculated feed:
- Click on the calculated feed in question
- A dialog will open displaying all the calculated feed’s data
If you change data within your calculated feed, such as reading type or unit, recent feed history will be deleted.
You can decide if you want to delete feed history when updating calculation formula or adding/deleting any of the input.
You can set thresholds on calculated feed within Feed Threshold as well. For further explanation on Feed Thresholds, please follow this link.
Note: The calculation is always based on the last values!
The calculation will be triggered when at least one input receives a new value, but if any other input has no value or its value is stale, the calculation will not be triggered and calculated feed will not get a new value.