[FONT="]The formula typically used to scale data is: y = mx + b [straight line equation]; where[/FONT]
[FONT="]desired "scaled" value[/FONT]
[FONT="]slope[/FONT]
[FONT="]raw "input" value[/FONT]
[FONT="]offset or y intercept[/FONT]
[FONT="]The following calculations are used to determine values for m and b:
m = slope = (scaled max. - scaled min.)/(input max. - input min.)
b = offset (y intercept) = scaled min - (input min x slope)[/FONT]
[FONT="]Examples[/FONT][FONT="][/FONT]
[FONT="]Analog input data[/FONT][FONT="][/FONT]
[FONT="]A 4-20mA signal is represented in the PLCs %AI00? register as 0 to 32000. The 4-20mA signal represents 50-150 psi.
Now calculate m and b:
m = (150-50)/(32000-0) = 100/32000 = 0.003125
b = 50 - (0 x 0.003125) = 50[/FONT]
[FONT="]In this example, instead of multiplying by 0.003125, we can divide by 320. To obtain this value divide m into 1; m = 1/0.003215 = 320.
The formula to implement in the PLC becomes: %AI00? / 320 + 50 = scaled value
Use a DIVIDE and an ADD function.[/FONT]
[FONT="]Analog Output data[/FONT][FONT="][/FONT]
[FONT="]The user enters the speed of a motor from an operator interface; 0 to 2000 rpm. This motor is controlled by a 0-10 Vdc analog output. The PLCs %AQ00? register will be 0-32000 and corresponds to the 0-2000 rpm speed.[/FONT]
[FONT="]Now calculate m and b:
m = (32000-0)/(2000-0) = 32000/2000 = 16
b = 0 - (0 x 16) = 0
The formula to implement in the PLC becomes: User Input x 16 = %AQ00? scaled value
The offset, of course, is not required. b = 0
Use a MULTIPLY function.[/FONT]