FB_CTRL_RAMP_GENERATOR

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

Inputs
VAR_INPUT
bEnable : BOOL;
fStart : FLOAT;
fTarget : FLOAT;
END_VARName | Type | Description |
|---|---|---|
bEnable | BOOL | Start of ramp generation |
fStart | FLOAT | Start value of the ramp |
fTarget | FLOAT | Target value of the ramp |
Outputs
VAR_OUTPUT
fOut : FLOAT;
fVeloOut : FLOAT;
bValueReached : BOOL;
eState : E_CTRL_STATE;
eErrorId : E_CTRL_ERRORCODES;
bError : BOOL;
END_VARName | 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 |
eState | E_CTRL_STATE | State of the function block |
eErrorId | E_CTRL_ | Supplies the error number when the output |
bError | BOOL | Becomes TRUE as soon as an error situation occurs. |
Inputs/ outputs
VAR_IN_OUT
stParams : ST_CTRL_RAMP_GENERATOR_PARAMS
END_VARName | Type | Description |
|---|---|---|
stParams | ST_CTRL_RAMP_GENERATOR_ | 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. |