FB_CTRL_PTt
The function block provides an PTt transfer element in the functional diagram.
Transfer function:
This function block contains internally an array of 500 elements with which the input values can be delayed. Using tCtrlCycleTime yields a maximum delay of 500 * tCtrlCycleTime. If this maximum delay is insufficient, the sampling time is extended internally to make it possible to reach the requested dead time. It should, however, be remembered that this process involves increasing the time between the discretisation steps. If a new sampling time has been calculated, this is indicated by a TRUE on the bSampleRateChanged output.
VAR_INPUT
VAR_INPUT
fIn : FLOAT;
fManSyncValue : FLOAT;
bSync : BOOL;
eMode : E_CTRL_MODE;
END_VAR
fIn : Input variable of the PTt element.
fManSyncValue : Input value to which the PTt element can be set, or that is issued at the output in manual mode.
bSync : A rising edge at this input sets the PTt element to the value fManSyncValue.
eMode : Input that specifies the block's operating mode.
VAR_OUTPUT
VAR_OUTPUT
fOut : FLOAT;
bSampleRateChanged : BOOL;
eErrorId : E_CTRL_ERRORCODES;
bError : BOOL;
END_VAR
fOut : Output of the PTt element.
bSampleRateChanged : Output that indicates whether the block has internally reduced the sampling rate because of the array being used to delay the input signal not otherwise providing sufficient room.
eErrorId : Supplies the error number when the bError output is set.
bError : Becomes TRUE, as soon as an error occurs.
VAR_IN_OUT
VAR_IN_OUT
stParams : ST_CTRL_PTt_PARAMS;
END_VAR
stParams : Parameter structure of the PTt element. This consists of the following elements:
TYPE
ST_CTRL_PTt_PARAMS :
STRUCT
tCtrlCycleTime : TIME := T#0ms; (* controller cycle
time [TIME] *)
tTaskCycleTime : TIME := T#0ms; (* task cycle time
[TIME] *)
fKp : FLOAT := 0; (* proportional gain
*)
tTt : TIME := T#0ms; (* Tt *)
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 cycle this corresponds to the task cycle time of the calling task.
fKp : Controller amplification / transfer coefficient
tTt : Dead time