SCALE

Linearly scales the input value (PV) according to the low input (IPmin), high input (IPmax), low output (OUTmin) and high output (OUTmax) values. The input value is bound to the range set by IPmin and IPmax.
OUT = ( ( (Min(Max(PV, IPmin), IPmax) - IPmin) / (IPmax - IPmin) ) * (OUTmax - OUTmin) ) + OUTmin
scale_block
Parameter values for the SCALE function block:
Parameter
Data Type
Description
PV
REAL
Input value
IPmax
REAL
High input REAL value. Infinity or Not a Number (NaN) values are not supported by this input.
When PV > IPmax, scales PV using the IPmax value.
IPmin
REAL
Low input REAL value. Infinity or Not a Number (NaN) values are not supported by this input.
When PV < IPmin, scales PV using the IPmin value.
OUTmax
REAL
High output REAL value. Infinity or Not a Number (NaN) values are not supported by this input.
OUTmin
REAL
Low output REAL value. Infinity or Not a Number (NaN) values are not supported by this input.
OUT
REAL
When PV is within the range set by IPmax and IPmin, OUT scales the input value.
When PV is <= IPmin, the value set is OUTmin
When PV is >= IPmax, the value set is OUTmax
LIMIT
BOOL
Indicates PV is out of range.
When FALSE, PV is within the range set by IPmin and IPmax.
When TRUE, PV is out of range.
TIP: Loss of precision may occur when using this function.
When IPmax < IPmin, the function block assumes that the values are reversed and swaps them. The
ERRSTAT
Reversed error counter increments each time the function has to swap the parameters.
When IPmax = IPmin, OUT sets to the value of OUTmin, LIMIT sets to FALSE and the
ERRSTAT
ZeroDivide error counter increments.
When PV is Not a Number (NaN) value, OUT sets to the value of OUTmin, LIMIT sets to FALSE and the
ERRSTAT
Param error counter increments.
When an overflow or underflow condition occurs during execution of the function block, OUT sets to OUTmax or OUTmin respectively, LIMIT sets to FALSE and the corresponding
ERRSTAT
Overflow or Underflow error counter increments. If both occur, OUT sets to OUTmin, LIMIT sets to FALSE and both Overflow and Underflow error counters increment.
Function Block Diagram Example
scale_example
Structured Text Example
SCALE(Input, MaxValue, MinValue, OutMaxV, OutMinV); ScaledValue := SCALE.OUT; Result := SCALE.LIMIT;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal