LIN_TRAFO

This function block (util.lib. transforms a REAL-value, which lies in a value range defined by a lower and upper limit value, to a REAL-value which lies correspondingly in another range also defined by a lower and upper limit. The following equation is basis of the conversion:

(IN - IN_MIN) : (IN_MAX - IN) = (OUT - OUT_MIN) : (OUT_MAX - OUT)

../_images/4d35fd3a437588d20a33139006eab46b
Input variables
Variable Data type Description
IN REAL Input value
IN_MIN REAL Lower limit of  input value range
IN_MAX REAL Upper limit of  input value range
OUT_MIN REAL Lower limit of  output value range
OUT_MAX REAL Upper limit of  output value range
Output variables
Variable Data type Description
OUT REAL Output value
ERROR BOOL Error occurred: TRUE, if IN_MIN = IN_MAX, or if IN is outside of the specified input value range

Application example:

A temperature sensor provides Volt-values (input IN). These are to be converted to temperature values in degree centigrade (output OUT). The input(Volt) values range is defined by the limits IN_MIN=0 and IN_MAX=10. The output(degree centigrade) value range is defined by the limits OUT_MIN=-20 and OUT_MAX=40.

Thus for an input of 5 Volt a temperature of 10 degree centigrade will result.