FB_CTRL_SETPOINT_GENERATOR

FB_CTRL_SETPOINT_GENERATOR 1:

The function block provides a set value generator that outputs the set value selected from a table. Changing from one set value to another can be implemented continuously or discontinuously.

Behavior of the output value:

FB_CTRL_SETPOINT_GENERATOR 2:

Example table:

18

20

22

24

The first line of the table corresponds to Index 1, at the second to Index 2, and so forth.

Description:

The individual set values are stored in the array. The array must be made known to the block through the appropriate parameters. One of the set values stored in the table is selected by means of the nSetpointIndex input. This is then made available at the output, and can be used as the set value for the controller. Changing from one value to another can be implemented in a linear fashion or as a jump. The velocity of a continuous transition is specified by the fVeloPos and fVeloNeg parameters. The bValueReached output indicates that the chosen set value has been reached.

VAR_INPUT

VAR_INPUT
    nSetpointIndex  : INT  (*[1 ... n] *);
    fManValue       : FLOAT;
    eMode       : E_CTRL_MODE;
END_VAR

nSetpointIndex : Index of the selected set value.

fManValue : Input whose value is output in manual mode.

eMode : Input that specifies the block's operating mode.

VAR_OUTPUT

VAR_OUTPUT
    fOut        : SETPOINT_TABLE_ELEMENT;
    bValueReached   : BOOL;
    eState      : E_CTRL_STATE;
    eErrorId        : E_CTRL_ERRORCODES;
    bError      : BOOL;
END_VAR

fOut : Output of the set value generator.

bValueReached : The output is TRUE when the selected set value has been reached, i.e. the ramp leading to the selected value has finished.

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_SETPOINT_GENERATOR_PARAMS; (* parameters *)
END_VAR

stParams : Parameter structure of the ramp generator. This consists of the following elements:

TYPE
ST_CTRL_SETPOINT_GENERATOR_PARAMS:
STRUCT
    tCtrlCycleTime          : TIME     := T#0ms; (*
controller cycle time [TIME] *)
    tTaskCycleTime          : TIME     := T#0ms; (* task
cycle time [TIME] *)
    pDataTable_ADR          : POINTER TO
INTERPOLATION_TABLE_ELEMENT := 0;
    nDataTable_SIZEOF       : UINT     := 0;
    nDataTable_NumberOfRows     : UINT     := 0;
    fVeloPos            : FLOAT; (* velocity ramp by
time range > 0.0 *)
    fVeloNeg            : FLOAT; (* velocity ramp by
time range > 0.0 *)
    bDisableRamping         : BOOL     := FALSE;
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 output values must be updated in the current cycle.indent: -103; margin-left: 108"> 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 data array.

pDataTable_SIZEOF : Size of the data array.

pDataTable_NumberOfRows: Number of rows of the data array.

fVeloPos : Velocity in unit/s, with which the output is changed from a lower value to a higher one.

fVeloNeg : Velocity in unit/s, with which the output is changed from a higher value to a lower one.

bDisableRamping: A continuous output value is not calculated if this parameter is TRUE. There is a step change between the output values.

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