Utilizing Scale Instructions to convert analog sign into engineering units

Relating 4-20mA Analog input signals to engineering units has proven to be difficult for users. At first glance, this seems like a simple task- apply a mathematical formula to an analog input value to convert the result into engineering units. The execution of this “simple task” rarely seems simple at all. Thankfully with Horner’s Cscape SCALE instruction, the need for algebra or any math is eliminated.

Utilizing Scale Instructions

Scale instruction is configured in ladder logic. The Scale instruction has the following parameters (see table 1 below):

Table of Scale Instruction

This will allow the user to take an analog input and its native values (in A/D counts), and convert it into a variable scaled to engineering units (pressure, temperature etc.) All that’s left to do is filling in the blanks. Before doing so its important for the user to have a better understanding of the input side of the instructions:

So as demonstrated in the table above as the sensor output varies between its minimum and maximum values – the analog input values will vary from 0-32000 (or 0-4000 for SmartRail).
Now the user can fill in the blanks on an example Scale instruction to convert the analog inputs into engineering units.

  • Sensor Type: Pressure Transducer
  • Sensor Range: 10-100psi
  • Sensor Output: 4-20mA
  • OCS Analog Input: %Al1 on an XL Series OCS with Built-in I/O
  • Ladder Logic:

 

Now, when this Scale (REAL) function block is executed, the output variable TANK_PSI (mapped to %R503) will contain the proper PSI value in floating-point format. Before executing Scale instruction you have to convert the %Al1 input to a REAL value. The reason for this is that any REAL-type Math instruction requires all variables to be REAL. Analog inputs are natively INT type.

Need more PLC help? Talk to our experienced engineers today

  • This field is for validation purposes and should be left unchanged.