Sometimes the raw value recorded by your sensing equipment is not the information you need to make the right decision.
For example, your raw value may require scaling to make it easier to read; a new value calculated according to a known relationship (such as a rating); or consider other sensors in the decision making process.
‘Program’ may sound like an intimidating word, but rest assured most calculations are simple to achieve — i prefer to think of it as a fancy Microsoft Excel formula ;-p
Let’s dive right into a couple of examples that demonstrate common uses for derived data.
Adjust a value
First up, we create a new Process Parameter to represent our derived value.
We are now presented with the Processing tab of our new parameter which is where our program will be expressed.
Add 10 to each reading from the Level sensor
Here we use the
NODE function to access raw data from our Level sensor and return each value with 10 added.
It’s that simple.
Here you can see the originalLevelsensor along with our new derived parameter side-by-side on a chart.
Translate a value
Another common scenario is translating one sensor reading into another using an equation or rating table that describes the relationship.
Above, we translate readings from a water level sensor into corresponding flow units using a polynomial equation.
Below, we use a 3rd party libraryin conjunction with a rating table to perform linear interpolation as we convert to flow.
These examples have only focussed on modifying values but similar techniques can be used to achieve more advanced outcomes (e.g. spike removal, forecasting).
More details on how to make the most from Processing & Logic can be found in our online documentation.
Feel free to experiment and use your imagination!