FB_CTRL_LIN_INTERPOLATION

FB_CTRL_LIN_INTERPOLATION 1:

This function block performs linear interpolation to obtain values on the basis of a sampling points table.

Behavior of the output

fIn

fOut

arrTable[1,1] := 10;

arrTable[1,2] := 7;

arrTable[2,1] := 15;

arrTable[2,2] := 10;

arrTable[3,1] := 21;

arrTable[3,2] := 9;

arrTable[4,1] := 22;

arrTable[4,2] := 2;

arrTable[5,1] := 30;

arrTable[5,2] := 3;

arrTable[6,1] := 40;

arrTable[6,2] := 6;

FB_CTRL_LIN_INTERPOLATION 2:

FB_CTRL_LIN_INTERPOLATION 3: VAR_INPUT

VAR_INPUT
    fIn           : FLOAT;
    fManValue     : FLOAT;
    bExtrapolate  : BOOL;
    eMode         : E_CTRL_MODE;
END_VAR

Name

Type

Description

fIn

FLOAT

Input value for the interpolation function block

fManValue

FLOAT

Input value that is output in manual mode.

bExtrapolate

BOOL

If this input is FALSE, then the value of the last interpolation point is output if the limits of the table are exceeded. If, however, it is TRUE, then extrapolation is performed on the basis of the last two interpolation points.

eMode

E_CTRL_MODE

Input that specifies the operation mode of the function block.

FB_CTRL_LIN_INTERPOLATION 4: VAR_OUTPUT

VAR_OUTPUT
    fOut                        : FLOAT;
    bInIsGreaterThanMaxElement  : BOOL;
    bInIsLessThanMinElement     : BOOL;
    eState                      : E_CTRL_STATE;
    eErrorId                    : E_CTRL_ERRORCODES;
    bError                      : BOOL;
END_VAR

Name

Type

Description

fOut

FLOAT

Table value from linear interpolation

bInIsGreater
ThanMax
Element

BOOL

A TRUE at this output indicates that the input value is greater than the largest interpolation point.

bInIsLessThan
Min
Element

BOOL

A TRUE at this output indicates that the input value is smaller than the smallest interpolation point.

eState

E_CTRL_
STATE

State of the function block

eErrorId

E_CTRL_
ERRORCODES

Supplies the error number when the output bError is set.

bError

BOOL

Becomes TRUE, as soon as an error occurs.

VAR_IN_OUT

VAR_IN_OUT
    stParams        : ST_CTRL_LIN_INTERPOLATION_PARAMS;
END_VAR

Name

Type

Description

stParams

ST_CTRL_LIN_INTERPOLATION_
PARAMS

Parameter structure of the interpolation element

stParams consists of the following elements:

TYPE ST_CTRL_2POINT_PARAMS :
STRUCT
    tCtrlCycleTime           : TIME := T#0ms;
    tTaskCycleTime           : TIME := T#0ms;
    pDataTable_ADR           : POINTER TO FLOAT := 0;
    nDataTable_SIZEOF        : UINT     := 0;
    nDataTable_NumberOfRows  : UINT     := 0;
END_STRUCT
END_TYPE

Name

Type

Description

tCtrlCycleTime

TIME

Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input value to calculate internally whether the state and the output values have to be updated in the current cycle.

tTaskCycleTime

TIME

Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task.

pDataTable_
ADR

POINTER TO FLOAT

Address of the n x 2 array on which linear interpolation is to be carried out.

nDataTable_
SIZEOF

UINT

Size of the n x 2 array

nDataTable_
NumberOfRows

UINT

Number of rows in the array