Topic: DMD0025

Help File Version: 2.10.0.636

SCALE - Scale Value


The Scale Value (SCALE) instruction converts the Input value from input units to scaled (engineering) units. The minimum and maximum values are used only for defining the scale, they are NOT for clamping the actual input value or output value. See the CLAMP - Limit Range or LERP - Linear Interpolation instructions for clamping functionality.

 

If the Input value is an Integer, both the input minimum and maximum values should also be integers. If the input value is a Real, both the input minimum and maximum values should also be Real values. if the Output value is an Integer, both the output minimum and maximum values should also be integers. If the output value is a Real, both the output minimum and maximum values should also be Real values. Refer to the following example, Input (WX0) is an Integer so In Min and In Max values are also Integers (the values are 0 and 4095, not 0.0 and 4095.0), The output (R0) is a Real value, so Out Min and Out Max are Real values as well (the values are 32.0 and 212.0, not 32 and 212).

 

 

The formula used in the conversion is:

 

         (( Input - In Min) * ( Out Max - Out Min ))

Output = ------------------------------------------- + Out Min

                     ( In Max - In Min )

 


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Input is the numeric memory location that contains the value to scale. This value can be any readable numeric location.

 


In Min is the minimum raw value for the Input variable. This can be any constant value or any readable numeric location.

 

In Max is the maximum raw value for the Input variable. This can be any constant value or any readable numeric location.

 


Out Min is the minimum scaled value for the Input variable. This value should be the output equivalent of the In Min value. This can be any constant value or any readable numeric location.

 

Out Max is the maximum scaled value for the Input variable. This value should be the output equivalent of the In Max value. This can be any constant value or any readable numeric location.

 


Output is the location to store the scaled value. This value can be any writable numeric location.

 


See Also:

CLAMP - Limit Range

 

FREQCNT - Frequency Counter

 

FREQTMR - Frequency Timer

 

GRAY - Gray Code to Integer

 

LERP - Linear interpolation

 

SCALE - Scale Value

 

SEG - Hex / BCD to 7 Segment Display

 

STR2INT - Convert String to Integer

 

STR2REAL - Convert String to Real

 

SWAPB - Swap Bytes

 


Related Topics:

PID - Closed Loop Controller

 

MATH - Calculate Expression

 


Rung Example: