← All exercises

Configurable Scaling

medium

Linearly scales a raw input to engineering units between two configurable endpoints.

What it teaches

Generalize Scale into range mapping, also called remapping. Instead of hardcoded 4-20 to 0-100, the endpoints are inputs, so the engineer can tune any sensor to any output range.

Inputs and outputs

TagTypeDefaultDescription
In_RawREALRaw input value to scale
Cfg_RawMinREALRaw value at the minimum endpoint
Cfg_RawMaxREALRaw value at the maximum endpoint
Cfg_EUMinREALEngineering unit value at the minimum endpoint
Cfg_EUMaxREALEngineering unit value at the maximum endpoint
Out_ScaledREALScaled engineering unit value

Required behavior