FB_BA_Chrct32

Linear interpolation with up to 32 interpolation points (parameterizable)

FB_BA_Chrct32 1:

Functional description

The function block FB_BA_Chrct32 represents a linear interpolation with up to 32 interpolation points and can be used to generate a characteristic curve. In contrast to the "smaller" interpolation function blocks FB_BA_Chrct02, FB_BA_Chrct04 and FB_BA_Chrct07, and in the interest of clarity, the interpolation points are determined via field variables [arrX[1]/arrY[1] to [arrX[n]/arrY[n]]. If the input variable bLmt is TRUE, lrY is limited by arrY[1] and arrY[n]. If bLmt is FALSE, lrY is not limited.

FB_BA_Chrct32 2:

Error handling

The input values for lrX[n+1] must always be at least 0.0000001 greater than the values for lrX[n].
In the event of an error the variable udiErrId indicates at which point of the characteristic curve the values are not monotonically increasing.

The parameter for the number of interpolation points, iNumOfElem, must be in the range 2..32.

Inputs/outputs

VAR_INPUT

lrX        : LREAL;
arrX       : ARRAY [1..gBA_cChrct32_NumOfElem] OF LREAL;
arrY       : ARRAY [1..gBA_cChrct32_NumOfElem] OF LREAL;
iNumOfElem : INT;
bLmt       : BOOL;

lrX: input value of the characteristic curve

arrX : field with the X-values for the interpolation points

iNumOfElem: number of interpolation points; this value must be in the range 2-32, otherwise an error is issued.

arrY : field with the Y-values for the interpolation points

bLmt: limitation of the output value lrY

VAR_OUTPUT

lrY       : LREAL;
bErr      : BOOL;
udiErrId  : UDINT;
udiErrArg : UDINT;

lrY: calculated output value of the characteristic curve

bErr: this output is switched to TRUE if the parameters entered are erroneous.

udiErrId / udiErrArg: contains the error number and the error argument. See error codes.

Requirements

Development environment

Target system

required library

required supplement

TwinCAT 2.11 R3/x64

PC/CX

TcBA library from V1.0.0

TS8040 | TwinCAT Building Automation from V1.0.0