FB_CTRL_SETPOINT_GENERATOR

FB_CTRL_SETPOINT_GENERATOR 1:

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

Behavior of the output value

FB_CTRL_SETPOINT_GENERATOR 2:

Example table:

Index

 

1

12

2

42

3

25

73

Description

The individual setpoints are stored in the array. The array must be made known to the function block through the appropriate parameters. One of the setpoints 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 setpoint 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 setpoint has been reached.

FB_CTRL_SETPOINT_GENERATOR 3: VAR_INPUT

VAR_INPUT
    nSetpointIndex  : INT;
    fManValue       : FLOAT;
    eMode           : E_CTRL_MODE;
END_VAR

Name

Type

Description

nSetpointIndex

INT

Index of the selected setpoint

fManValue

FLOAT

Input whose value is output in manual mode.

eMode

E_CTRL_MODE

Input that specifies the operation mode of the function block.

FB_CTRL_SETPOINT_GENERATOR 4: VAR_OUTPUT

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

Name

Type

Description

fOut

SETPOINT_
TABLE_ELEMENT

Output of the setpoint generator

bValueReached

BOOL

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

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_SETPOINT_GENERATOR_PARAMS;
END_VAR

Name

Type

Description

stParams

ST_CTRL_SETPOINT_
GENERATOR_
PARAMS

Parameter structure of the ramp generator

stParams consists of the following elements:

TYPE ST_CTRL_SETPOINT_GENERATOR_PARAMS:
STRUCT
    tCtrlCycleTime           : TIME := T#0ms;
    tTaskCycleTime           : TIME := T#0ms;
    pDataTable_ADR           : POINTER TO
     INTERPOLATION_TABLE_ELEMENT := 0;
    nDataTable_SIZEOF        : UINT := 0;
    nDataTable_NumberOfRows  : UINT := 0;
    fVeloPos         
        : FLOAT;
    fVeloNeg                 : FLOAT;
    bDisableRamping          : BOOL := FALSE;
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.
Indent: -103; margin-left: 108">

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 INTERPOLATION_
TABLE_ELEMENT

Address of the data array

nDataTable_SIZEOF

UINT

Size of the data array

nDataTable_NumberOfRows

UINT

Number of rows in the data array

fVeloPos

FLOAT

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

fVeloNeg

FLOAT

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

bDisableRamping

BOOL

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