FB_CTRL_2POINT_PWM_ADAPTIVE
The function block provides an adaptive two-position controller. It is particularly suitable for single-area controllers in which high flow temperatures are present and which make use of a thermal actuator.
Behaviour of the output:
Description of the function:
Internally, the controller uses a PWM function block that is used to control the thermal actuator. The mark-to-space ratio of the PWM function block is adaptively adjusted to the behavior of the controlled system. The PWM output is switched on as soon as the system deviation, fE, which is the setpoint minus the actual value, is greater than zero, and is switched off when the system deviation is less than zero. The mark-to-space ratio is not changed as long as the system deviation remains within the range [ -fOkRange ... fOkRange]. If fE > fOkRange, the mark-to-space ratio is increased by fStepSize. After such an increase, time tWaitTime must elapse before the mark-to-space ratio can be changed again. If fE falls below -fOkRange, the mark-to-space ratio is reduced by fStepSize. The mark-to-space ratio is only modified over the range [fMinLimit ... fMaxLimit]. The period of the PWM signal is specified by the parameter tPWMPeriod.
VAR_INPUT
VAR_INPUT
fSetpointValue : FLOAT;
fActualValue : FLOAT;
fManSyncValue : FLOAT;
bSync : BOOL;
eMode : E_CTRL_MODE;
END_VAR
fSetpointValue : Set value of the controlled variable.
fActualValue : Actual value of the controlled variable.
fManSyncValue : Input to which the controller's mark-to-space ratio can be set, or with which the output can be set in Manual Mode. The output is set in Manual Mode if fManSyncValue > 0.0.
bSync : A rising edge at this input will set the mark-to-space ratio of the internal PWM block to the value fManSyncValue.
eMode : Input that specifies the block's operating mode.
VAR_OUTPUT
VAR_OUTPUT
bOut : BOOL;
fPWMDutyCycle : FLOAT; (* debug only *)
eState : E_CTRL_STATE;
eErrorId : E_CTRL_ERRORCODES;
bError : BOOL;
END_VAR
bOut : Output of the controller.
fPWMDutyCycle : Current mark-to-space ratio of the internal PWM block.
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 occurs.
VAR_IN_OUT
VAR_IN_OUT
stParams : ST_CTRL_2POINT_PWM_ADAPTIVE_PARAMS;
END_VAR
stParams : Parameter structure of the 2-point element. This consists of the following elements:
TYPE
ST_CTRL_2POINT_PWM_ADAPTIVE_PARAMS:
STRUCT
tCtrlCycleTime : TIME := T#0ms; (* controller cycle
[TIME] *)
tTaskCycleTime : TIME := T#0ms; (* task cycle time
[TIME] *)
tPWMPeriod : TIME
fOkRange : FLOAT
fForceRange : FLOAT
fStepSize : FLOAT
fMinLimit : FLOAT (* [0% ... 100%]
*)
fMaxLimit : FLOAT (* [0% ... 100%]
*)
tWaitTime : TIME
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.
tPMWPeriod : Period of the PWM signal.
fOkRange : The range of fE over which the mark-to-space ratio will not be modified.
fForceRange : If fE exceeds this range, the output is permanently set to TRUE.
fStepSize : Value by which the mark-to-space ratio is varied each time it is adapted. [0% ... 100%]
fMaxLimit : Maximum mark-to-space ratio in percent [0% ... 100%].
fMinLimit : Minimum mark-to-space ratio in percent [0% ... 100%].
tWaiTimet : Waiting time between individual modifications of the mark-to-space ratio.