Project

General

Profile

Scaling and Maps » History » Version 1

Adam Klama, 06/21/2026 02:54 PM

1 1 Adam Klama
# Scaling & Maps
2
3
Many inputs read a **raw** value (a voltage, a frequency, a CANbus signal) that
4
must be converted into a meaningful **engineering value** (°C, bar, rpm…). There
5
are two ways to do that conversion, from simplest to most flexible.
6
7
> Schema: the *in/out* scaling fields of `config/AdcConfiguration.proto` and
8
> `config/CanbusInputConfiguration.proto`; the 1D map in
9
> `config/MapInputConfigData.proto` / `config/MapOutputConfigData.proto`.
10
11
## Two-point interpolation
12
The simplest conversion is a straight line defined by **two points**: a low point
13
and a high point. You give the raw value and the engineering value at each end,
14
and everything in between is **linearly interpolated**:
15
16
```
17
output = out_min + (raw - in_min) * (out_max - out_min) / (in_max - in_min)
18
```
19
20
- **In min → Out min** and **In max → Out max** define the line.
21
- Values between the points are interpolated; values outside can be clamped
22
  (saturated) or extrapolated, depending on the input's settings.
23
24
Two-point interpolation is built directly into **analog inputs** and **CANbus
25
inputs** via their *in/out* scaling fields. Use it whenever the sensor is
26
**linear** — for example a 0.5–4.5 V pressure sensor reading 0–10 bar.
27
28
## Multi-point scaling
29
When a sensor is **non-linear** (e.g. an NTC temperature sensor), two points are
30
not enough. Use a **[Map Input](Map_Input)**: a 1D lookup table of
31
*raw value → output value* with as many points as you need, interpolated between
32
points along the curve. Feed the raw input into the Map Input and reference the
33
Map Input's output as your scaled channel.
34
35
The matching **[Map Output](Map_Output)** applies the same kind of 1D
36
lookup on the way to an output.
37
38
### Editing a map
39
- Enter the raw value on the X axis and the engineering value as the output.
40
- Keep X values strictly increasing.
41
- Add points where the curve bends; the controller interpolates between them.
42
43
> The map's internal interpolation type is managed by the controller and is not
44
> something you normally set.