LinTransf (FUN)

FUNCTION LinTransf : REAL

Performs a linear transformation

The transformation is performed by using the minimum and maximum values of the inputs for a linear approximation of the output value.

Hint: there is similiar funtionality with Util.LIN_TRAFO (function block). LinTransf / Util.LIN_TRAFO doenst have any states, so there is no real need to implement this functionality as a function block - function would be sufficient. Util.LIN_TRAFO has been implemented as a function block in the past for historic reason (number of output arguments of functions limited to 1). Implementing LinTransf as a function is simply about bargaining application memory foodprint against application stack usage.

InOut:

Scope

Name

Type

Comment

Return

LinTransf

REAL

Input

rIn

REAL

Input value

rInMin

REAL

Minimum input value

rInMax

REAL

Maximum input value

rOutMin

REAL

Corresponding minimum output value

rOutMax

REAL

Corresponding maximum output value

Output

xError

BOOL

Inconsistent inputs