FB_CTRL_NORMALIZE
This function block can be used to linearize a non-linear transfer element, with the aid of an inverse characteristic curve.
The characteristic curve of the transfer element that is to be linearized is stored in the table associated with this function block. The function block uses this to calculate the inverse characteristic curve with which the linearization can be carried out.
Sample
The following valve characteristic curve is stored in the table with 4 interpolation points.
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:
In the ideal case, applying these two characteristic curves in series will result in a linear transfer behavior.
VAR_INPUT
VAR_INPUT
fIn : FLOAT;
fManValue : FLOAT;
bExtrapolate : BOOL;
eMode : E_CTRL_MODE;
END_VAR
Name | Type | Description |
---|---|---|
fIn | FLOAT | Input value |
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. |
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 |
bInIsGreaterThanMaxElement | BOOL | A TRUE at this output indicates that the input value is greater than the largest interpolation point. |
bInIsLessThanMinElement | BOOL | A TRUE at this output indicates that the input value is smaller than the smallest interpolation point. |
eState | E_CTRL_ | State of the function block |
eErrorId | E_CTRL_ERRORCODES | Supplies the error number when the output |
bError | BOOL | Becomes TRUE, as soon as an error occurs. |
VAR_IN_OUT
VAR_IN_OUT
stParams : ST_CTRL_NORMALIZE_PARAMS;
END_VAR
Name | Type | Description |
---|---|---|
stParams | ST_CTRL_NORMALIZE_PARAMS | Parameter structure of the function block |
stParams
consists of the following elements:
TYPE ST_CTRL_NORMALIZE_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_ | POINTER TO FLOAT | Address of the n x 2 array on which linear interpolation is to be carried out. |
nDataTable_ | UINT | Size of the n x 2 array |
nDataTable_ | UINT | Number of rows in the array |