FB_CTRL_RAMP_GENERATOR_EXT

FB_CTRL_RAMP_GENERATOR_EXT 1:

This function block represents a parameterisable ramp generator. In contrast to FB_CTRL_RAMP_GENERATOR it supports the E_CTRL_MODEs.

Description:

This function block generates a ramp connecting the starting value fStartValue and the final 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 starting value is adopted when eCTRL_MODE_RESET changes to eCTRL_MODE_ACTIVE, and calculation of the ramp begins. As long as the 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.

Behaviour of the output value:

FB_CTRL_RAMP_GENERATOR_EXT 2:

VAR_INPUT

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

fStartValue : Starting value for the ramp.

fTargetValue : Finishing value for the ramp.

fManValue : Input magnitude to which the output in eCTRL_MODE_MANUAL is set.

bHold : Calculation of the ramp is halted at the current value.

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

VAR_OUTPUT

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

fOut : Output of the ramp generator.

fVeloOut : Current velocity of the ramp generator.

bValueReached : This output indicates by going TRUE that the output fOut has reached the value fTargetValue.

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

VAR_IN_OUT

VAR_IN_OUT
    stParams : ST_CTRL_RAMP_GENERATOR_EXT_PARAMS;
END_VAR

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

TYPE
ST_CTRL_RAMP_GENERATOR_EXT_PARAMS :
STRUCT
    tTaskCycleTime   : TIME;  (* task cycle time [TIME]      
*)
    tCtrlCycleTime   : TIME;  (* controller cycle time [TIME]
*)
    fVeloPos     : FLOAT; (* velocity ramp by time range:
> 0.0 *)
    fVeloNeg     : FLOAT; (* velocity ramp by time range:
> 0.0 *)
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 the output values have to be updated in the current cycle.

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

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

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.8

PC (i386)

TcControllerToolbox.lib

TwinCAT v2.9, build 947 onwards

BC

TcControllerToolbox.lb6

TwinCAT v2.9, build 956 onwards

BX

TcControllerToolbox.lbx