← All exercises

Scale

easy

Scale a sensor reading from 4-20 mA into a 0-100 °C output.

What it teaches

Map a sensor's 4-20 mA signal into 0-100 °C. The everyday analog conditioning pattern — when the sensor reads 4, the output is 0; when it reads 20, the output is 100; everything between scales linearly.

Inputs and outputs

TagTypeDefaultDescription
In_RawREALRaw analog input signal in mA
Out_ScaledREALScaled output value in degrees Celsius

Required behavior

  • Out_Scaled is 0.0 when In_Raw is 4.0.
  • Out_Scaled is 100.0 when In_Raw is 20.0.
  • Out_Scaled interpolates linearly for In_Raw values between 4.0 and 20.0.
  • Out_Scaled extrapolates linearly for In_Raw values outside the 4.0 to 20.0 range.