FB_CTRL_NORMALIZE

FB_CTRL_NORMALIZE 1:

This function block can be used to linearise a non-linear transfer element, with the aid of an inverse characteristic curve.

The characteristic curve of the transfer element that is to be linearised is stored in the table associated with this block. The function block uses this to calculate the inverse characteristic curve with which the linearisation can be carried out.

Sample:

The following valve characteristic curve is stored in the table with 4 interpolation points.

FB_CTRL_NORMALIZE 2:

Control value

Valve position

arrTable[1,1] := -6;

arrTable[1,2] := -100;

arrTable[2,1] := -1;

arrTable[2,2] := -70;

arrTable[3,1] := 1;

arrTable[3,2] := 70;

arrTable[4,1] := 6;

arrTable[4,2] := 100;

The inverse characteristic curve is calculated from this characteristic curve:

FB_CTRL_NORMALIZE 3:

In the ideal case, applying these two characteristic curves in series will result in a linear transfer behavior.

FB_CTRL_NORMALIZE 4:

VAR_INPUT

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

fIn : Input value.

bManValue : Input variable whose value is output in manual mode.

bExtrapolate : 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 : Input that specifies the block's operating mode.

VAR_OUTPUT

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

fOut : Table value from linear interpolation.

bInIsGreaterThanMaxElement : A TRUE at this output indicates that the magnitude of the input is greater than the largest interpolation point.

bInIsLessThanMinElement : A TRUE at this output indicates that the magnitude of the input is smaller than the smallest interpolation point.

eState : State of the function block.

eErrorId : Supplies the error number when the bError output is set.

bError : Becomes TRUE, as soon as an error occurs.

VAR_IN_OUT

VAR_IN_OUT
    stParams        : ST_CTRL_NORMALIZE_PARAMS;
END_VAR

stParams : Parameter structure of the function block. This consists of the following elements:

TYPE
ST_CTRL_NORMALIZE_PARAMS:
STRUCT
    tCtrlCycleTime         : TIME     := T#0ms; (*
controller cycle time [TIME] *)
    tTaskCycleTime         : TIME     := T#0ms; (* task
cycle time [TIME] *)
    pDataTable_ADR         : POINTER TO FLOAT := 0;
    nDataTable_SIZEOF      : UINT         := 0;
    nDataTable_NumberOfRows    : UINT         := 0;
END_STRUCT
END_TYPE

tCtrlCycleTime : 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 : 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 : Address of the n x 2 array on which linear interpolation is to be carried out

pDataTable_SIZEOF : Size of the n x 2 array.

pDataTable_NumberOfRows : Number of rows of the array.

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.8

PC (i386)

TcControllerToolbox.lib

TwinCAT v2.9 from Build 947

BC

TcControllerToolbox.lb6

TwinCAT v2.9 from Build 956

BX

TcControllerToolbox.lbx