FB_CTRL_RAMP_GENERATOR_EXT

FB_CTRL_RAMP_GENERATOR_EXT 1:

This function block represents a parameterizable ramp generator. In contrast to FB_CTRL_RAMP_GENERATOR it supports E_CTRL_MODE.

Description:

This function block generates a ramp connecting the starting value fStartValue and the target value fTargetValue. The slope of the ramp (i.e. the velocity) is given in units/s by means of the fVeloPos and fVeloNeg parameters. The start value is adopted when eCTRL_MODE_RESET changes to eCTRL_MODE_ACTIVE, and calculation of the ramp begins. As long as the function block remains in eCTRL_MODE_ACTIVE 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. The current velocity is output at fVeloOut. It is possible to use this for feed forward in the control loop.

Behavior of the output value

FB_CTRL_RAMP_GENERATOR_EXT 2:

FB_CTRL_RAMP_GENERATOR_EXT 3: VAR_INPUT

VAR_INPUT
    fStartValue   : FLOAT;
    fTargetValue  : FLOAT;
    fManValue     : FLOAT;
    bHold         : BOOL;
    eMode         : E_CTRL_MODE;
END_VAR

Name

Type

Description

fStartValue

FLOAT

Start value of the ramp

fTargetValue

FLOAT

Target value of the ramp

fManValue

FLOAT

Input value to which the output in eCTRL_MODE_MANUAL is set.

bHold

BOOL

Calculation of the ramp is halted at the current value.

eMode

E_CTRL_MODE

Input that specifies the operation mode of the function block.

FB_CTRL_RAMP_GENERATOR_EXT 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 "fTargetValue".

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

Name

Type

Description

stParams

ST_CTRL_RAMP_GENERATOR_EXT_
PARAMS

Parameter structure of the ramp generator

stParams consists of the following elements:

TYPE ST_CTRL_RAMP_GENERATOR_EXT_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 (>0.0) in unit/s, with which the output is changed from a lower value to a higher one.

fVeloNeg

FLOAT

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