Converting a measurement with a lookup table
Download as PDFSometimes a measurement needs a custom, non-linear conversion — for example turning a level measurement into the volume of an irregular tank, or mapping a raw sensor signal onto a calibrated scale. The Lookup table virtual sensor does this by converting a single input to a single output using a table of value pairs you define.
Between two rows of the table, the output is calculated by linear interpolation. If the input goes below the lowest input value in the table — or above the highest — the output is capped to the output value of the first or last row.
Create the virtual sensor
Section titled “Create the virtual sensor”- Open the Virtual Sensors view.
- Create a new virtual sensor and select the type Lookup table.
- Under Inputs, select the element with the measurement you want to convert.
- Define the lookup table: each row maps an input value to an output value. Use Add row to extend the table — up to 10 rows — and remove rows you don’t need. The rows don’t have to be entered in order; they are sorted by input value automatically.
- Under Outputs, select (or create) the element where the converted value should be saved.
- Save the virtual sensor.
Every time the input element receives a new value, the device converts it through the lookup table and saves the result to the output element.
Example
Section titled “Example”A lookup table for converting a liquid level (in meters) to a volume (in liters) in a tank with an irregular shape:
| Input (level, m) | Output (volume, L) |
|---|---|
| 0.0 | 0 |
| 0.5 | 120 |
| 1.0 | 300 |
| 1.5 | 650 |
A level of 0.75 m falls between the second and third rows, so the volume is interpolated to 210 L. A level of 2.0 m is above the last row, so the volume is capped at 650 L.
Troubleshooting
Section titled “Troubleshooting”- No values appear on the output element: check that the input element receives values, that it comes from a device (the lookup table virtual sensor cannot run in the cloud), and that the device is online and has a recent firmware version.
- The output is stuck at the same value: the input may be outside the table’s boundaries, where the output is capped to the first/last row.
If self-help runs out, contact support@consibio.com.