Problem: SCALE TANK LEVEL in range of 0 to 1000 gallons
Assume Analog Input range is 0 to 32767 counts
Scale to: 0 = 0 gal, 20 ma = 1000 gallons
Slope = Scaled Maximum - Scale Minimum / Input Max - Input Min
Slope = (1000 - 0) / (0 - 32767) = -0.0305185
Offset = Scaled Min - (Input Min X Slope) = 0 - (32767 X -0.0305185) = 1000
Scaled value = (Input value x Slope) + Offset
Scaled value = Signal Input x (-0.0305185) + 1000 = -0.0305185 X Signal Input + 1000