You are on page 1of 3
Basic instructions 7.7 Convert 774 Scale and normalize instructions Table 7-81 SCALE_X and NORM_X instructions LAD /FBD__| Description ‘Scales the normalized real parameter VALUE where ( 0.0 <= VALUE <= 1.0 in the data type and value range specified by the MIN and MAX parameters: (OUT = VALUE (MAX MIN) + MIN Normalizes the parameter VALUE inside the value range specified by the MIN and MAX parameters: ‘OUT = (VALUE - MIN) / (MAX - MIN), where (0.0 <= OUT <= 1.0) For LAD and FBD: Click the "272" and select a data type from the drop-down menu. Table 7-82 Data types for the parameters, Parameter Data type" Description MIN ‘Sint, Int, Dint, USint, Uint, UDInt, Real, LReal Tnput minimum value for range VALUE ‘SCALE_X: Real, LReal Input value to scale or normalize NORM_X: Sint, int, Dint, USint, Uint, UDInt, Real, LReal MAX ‘Sint, In, Dint, USint, Uint, UDInt, Real, LReal Input maximum value for range ‘our ‘SCALE_X: Sint, Int, Dint, USInt, Uint, UDInt, Real, LReal | Scaled or normalized output value NORM_X: Real, LReal For SCALE_X: Parameters MIN, MAX, and OUTmust be the same data type, For NORM_X: Parameters MIN, VALUE, and MAXmust be the same data type. '$7-1200 Programmable controller ‘System Manual, 07/2011, ASE02486680-04 191 Basic instructions 7.7 Convert Table 7-83 Note ‘SCALE_X parameter VALUE should be restricted to ( 0.0 <= VALUE <= 1.0) If parameter VALUE is less than 0.0 or greater than 1.0: + The linear scaling operation can produce OUT values that are less than the parameter MIN value or above the parameter MAX value for OUT values that fit within the value range of the OUT data type. SCALE_X execution sets ENO = TRUE for these cases. + Itis possible to generate scaled numbers that are not within the range of the OUT data type. For these cases, the parameter QUT value is set to an intermediate value equal to the least-significant portion of the scaled real number prior to final conversion to the OUT data type. SCALE_X execution sets ENO = FALSE in this case. NORM_X parameter VALUE should be restricted to ( MIN <= VALUE <= MAX) If parameter VALUE is less than MIN or greater than MAX, the linear scaling operation can produce normalized OUT values that are less than 0.0 or greater than 1.0. NORM_X. ‘execution sets ENO = TRUE in this case. ENO status Condition Result OUT No error Valid result Resull exceeds valid range for the OUT data _| intermediate result: The least-significant portion of a real ‘ype ‘number prior to final conversion to the OUT data type. Parameters MAX <= MIN ‘SCALE_X: The least-signficant portion of the Real number VALUE to fil up the OUT size. NORM_X: VALUE in VALUE data type extended to fil a double word size, Parameter VALUE = +: INF or #/- NaN VALUE is written to OUT Example (LAD); normalizing and scaling an analog input value 192 ‘An analog input from an analog signal module or signal board using input in current is in the range 0 to 27648 for valid values. Suppose an analog input represents a temperature where the 0 value of the analog input represents ~30.0 degrees C and 27648 represents 70.0 degrees C. To transform the analog value to the corresponding engineering units, normalize the input to ‘a value between 0.0 and 1.0, and then scale it between -30.0 and 70.0. The resulting value is the temperature represented by the analog input in degrees C: ‘87-1200 Programmable controller System Manual, 07/2011, ASEO2486680.04 Basic instructions 7.7 Convert Hon SCALE x eM XQ = MIN patoo & yoo ng Nomad sovsu0wu0.0 UT = "hve en Tenpiopt VALUE OUT ive fia) wy Note that if the analog input was from an analog signal module or signal board using voltage, the MIN value for the NORM_X instruction would be -27648 instead of 0, Example (LAD): normalizing and scaling an analog output value ‘An analog output to be set in an analog signal module or signal board using output in current must be in the range 0 to 27648 for valid values. Suppose an analog output represents a temperature setting where the 0 value of the analog input represents -30.0 degrees C and 27648 represents 70.0 degrees C, To convert a temperature value in memory that is between -30.0 and 70.0 to a value for the analog output in the range 0 to 27648, you must normalize the value in engineering units to a value between 0.0 and 1.0, and then scale it to the range of the analog output, 0 to 27648: resi aa oa oweo Target erp! = VALUE eee a = MAK Note that if the analog output was for an analog signal module or signal board using voltage, the MIN value for the SCALE_X instruction would be -27648 instead of 0. Additional information on analog input representations (Page 639) and analog output representations (Page 639) in both voltage and current can be found in the Technical Specifications. '$7-1200 Programmable controller ‘System Manual, 072011, ASE02486680-04 193,

You might also like