FB_CTRL_RAMP_GENERATOR

FB_CTRL_RAMP_GENERATOR 1:

The function block provides a parameterizable ramp generator.

Description

This function block generates a ramp connecting the starting value fStart and the target value fTarget. The slope of the ramp (i.e. the velocity) is given in units/s by means of the fVeloPos and fVeloNeg parameters. The starting value is adopted when a rising edge appears at bEnable; calculation of the ramp then begins. As long as the signal bEnable remains TRUE the target value can be changed, and the output value changes, taking the form of a ramp as it moves from the current value to the presently active target value.

Behavior of the output value

FB_CTRL_RAMP_GENERATOR 2:

FB_CTRL_RAMP_GENERATOR 3: VAR_INPUT

VAR_INPUT
    bEnable  : BOOL;
    fStart   : FLOAT;
    fTarget  : FLOAT;
END_VAR

Name

Type

Description

bEnable

BOOL

Start of ramp generation

fStart

FLOAT

Start value of the ramp

fTarget

FLOAT

Target value of the ramp

FB_CTRL_RAMP_GENERATOR 4: VAR_OUTPUT

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

Name

Type

Description

fOut

FLOAT

Output of the ramp generator

fVeloOut

FLOAT

Current velocity of the ramp generator

bValueReached

BOOL

This output indicates by going TRUE that the output fOut has reached the value fTarget.

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 situation occurs.

VAR_IN_OUT

VAR_IN_OUT
    stParams    : ST_CTRL_RAMP_GENERATOR_PARAMS
END_VAR

Name

Type

Description

stParams

ST_CTRL_RAMP_GENERATOR_
PARAMS

Parameter structure of the ramp generator

stParams consists of the following elements:

TYPE ST_CTRL_RAMP_GENERATOR_PARAMS :
STRUCT
    tTaskCycleTime  : TIME;
    tCtrlCycleTime  : TIME;
    fVeloPos        : FLOAT;
    fVeloNeg        : FLOAT;
END_STRUCT
END_TYPE

Name

Type

Description

tTaskCycleTime

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.

tCtrlCycleTime

TIME

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

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.