Maple Systems OIT Family User Manual

Page 57

Advertising
background image

The linear scaling conversion is accomplished using the simple equation Y=MX+B,

where “X” is the raw data read from the PLC, “Y” is the data presented to the OIT

operator after the conversion, “M” is used to convert the scale of one unit of measure to

another unit of measure, and “B” is the offset variable used for alignment.
For example, if an 8-bit A/D converter (255 steps) is used to measure voltage ranging

from 0 to 15 volts, the raw data needs to be reduced so that a value of 255 A/D units

equals 15 volts. The OIT needs to multiple the raw data by 1/17 (255/15=17) to properly

convert the data into volts. Since the A/D value of 0 correctly represents 0 volts, the

variable B is not used. The equation for this example would be Y = (1/17)X + 0.
Let’s look at a similar example. Suppose an 8-bit A/D converter (255 steps) is used to

measure voltage ranging from 5 to 20 volts. Now we need to do two things, adjust the

A/D range of 1-255 down to a range of 15 volts (20 volts-5 volts) and offset the data so

that an A/D value of 0 represents 5 volts. Let’s start with the range conversion. As in the

previous example, M is calculated by dividing the A/D range by the voltage range

(255/15=17). Since we are reducing the raw data, M must be 1/17. Now to offset the raw

data so that an A/D value of 0 represents 5 volts, set B to 5. The equation for this

example would be Y = (1/17)X + 5.
The multiplier M can be entered in as a fraction which allows both range expansion and

range reduction. To expand the range of the raw data, make sure the numerator (top

number) is greater than the denominator (bottom number). To reduce the range of the raw

data, make sure the numerator is less than the denominator. In the previous examples, M

would be specified as 1/17.
16-bit PLC registers using the Signed or Decimal formats and 32-bit PLC registers using

the Long format can be converted using linear scaling. Therefore, the input variable X,

which represents the raw PLC register value, can be a signed integer, unsigned integer, or

signed long integer value. The output variable Y is determined by the linear equation.

Therefore, it may be a positive or negative number with a maximum range of

-2,147,483,648 to +2,147,483,647.
When using low and high limits, the values should be entered in the unit of measure

being used by the OIT operator not the unit of measure being used in the PLC register.
The OIT always performs integer arithmetic when calculating the linear scaled values to

be displayed. Therefore, you should be aware of what kind of accuracy you wish to have

when using linear conversion. For example, if the OIT converts degrees Celsius to

degrees Fahrenheit using the formula Y = (9/5)X + 32, 1°C would be converted to 34°F.

Technically, this is inaccurate since 1°C=33.8°F. Fortunately, this can be corrected by

simply using a different formula. If the conversion accuracy must be to one decimal

point, then multiply the given equation on the left side by 10 (for example, Y = (90/5)X +

320) and select a decimal point of 1 for the register monitor display. Finally, the above

formulas only work if the Celsius temperature values stored in the PLC register are

always integer whole number values. If the Celsius temperature values in the PLC

register are to one decimal point and the Fahrenheit temperature values are to be

displayed to one decimal point, the following formula should be used Y = (9/5)X + 320.

PLC Register Monitors

57

1010-0099, Rev. 07

Advertising