Calculated feed functionality enables feed calculation in order to create unique combination specified for user’s business logic.
Calculated feed can be used on Dashboards, 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
Fill out new dialog with the following information:
- Feed name
- Reading type and Unit - (If Unit is Numeric, specify 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 needs, 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! For further explanation on how to do that, please follow this link.
- Next step is to add inputs for calculation
Create calculation by using one out of two types of input: sensor value (device directly) or a 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 Formula field, 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. It will be evaluated and calculated based on the input values entered in the Value fields.
You will be notified of successful calculation.
Create Feed Thresholds
For more information on how to create Feed Thresholds, go to Data Semantics module, Create/Edit/Delete Feed section.
Update Calculated Feed
To update calculated feed:
- Select the calculated feed in question
- New dialog will appear displaying calculated feed’s data
If you change the data within your calculated feed, recent feed history will be deleted.
Note: Feed unit cannot be edited.
You can delete feed history while updating calculation formula or while adding/deleting any of the inputs.
Note: Calculation is always based on the last values!
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.