FB_CTRL_PARAMETER_SWITCH

FB_CTRL_PARAMETER_SWITCH 1:

This function block can be used to switch the parameter set used by FB_CTRL_PID_SPLITRANGE.

Behaviour of the output:

FB_CTRL_PARAMETER_SWITCH 2:

Description of the function block:

This function block is used to switch over the parameter set used by FB_CTRL_PID_SPLITRANGE. This function block is particularly intended to switch the parameter sets of controllers that can use two actuators to heat and to cool, and to set the limits for the controller. The time tMinWaitTime is specified as an input parameter. At least this time must elapse when switch-over is requested to allow for the parameter range to be changed, and for the controller limits set in such a way that it is possible to switch from heating operation to cooling operation. The intention of this is to prevent the operation mode being changed immediately simply because the controller overshoots slightly.

For heating operation, the parameter range eCTRL_PARAMETER_RECORD_HEATING = heating is selected, while for cooling operation the parameter range is eCTRL_PARAMETER_RECORD_COOLING = cooling. The controller's parameter sets must be specified in accordance with this arrangement.

The request for a changeover itself is provided by a 2-point element (see image). The controller's output value, in other words the control value, should be used as the input value for the illustrated characteristic hysteresis curve. A request for changeover created by the hysteresis element must be present for at least the specified waiting time, so that the parameter range can be changed.

The bDisableRange1 and bDisableRange2 inputs makes it possible to prevent switching into one of the two ranges. It is therefore possible, for instance, to deactivate heating operation in summer and to deactivate cooling in winter. It would also be possible to make the change in the operation mode depend on the current control deviation. In summer, for instance, it might have to be 2°C too hot before switching into cooling operation. This can also be achieved by connecting the inputs appropriately.

Maximum and minimum limits are output in addition to providing the output of the parameter range, and these can be copied into the PID controller's parameter set. If the FB_CTRL_PARAMETER_SWITCH is in the Heating operation mode, the limits are set as follows:

FB_CTRL_PARAMETER_SWITCH 3:

In the Cooling mode, the limits are set as follows:

FB_CTRL_PARAMETER_SWITCH 4:

VAR_INPUT

VAR_INPUT
    fManipulatedVariable    : FLOAT; (* fOut from the FB_CTRL_PID_SPLITRANGE *)
    nManSyncValue       : eCTRL_PARAMETER_RECORD_HEATING;
    bSync           : BOOL;
    eMode           : E_CTRL_MODE;
END_VAR

fManipulatedVariable : The input value of FB_Parameter_Switch. This should be the same as the controller's output value.

nManSyncValue : The input with which the function block can be set to one of the to parameter ranges.

bSync : A rising edge at this input sets the function block to the value nManSyncValue.

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

VAR_OUTPUT

VAR_OUTPUT
    eParameterRecord        : E_CTRL_PARAMETER_RECORD;
    fOutMaxLimit        : FLOAT;
    fOutMinLimit        : FLOAT;
    eState          : E_CTRL_STATE;
    eErrorId            : E_CTRL_ERRORCODES;
    bError          : BOOL;
END_VAR

eParameterRecord : The output of the function block, identifying the parameter region.

fOutMaxLimit : The maximum output value of which the controller is limited. (This should be copied into the controller's parameter structure.)

fOutMinLimit : The minimum value of the output of which the controller is limited. (This should be copied into the controller's parameter structure.)

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

stParams : Parameter structure of the function block. This consists of the following elements:

TYPE
ST_CTRL_2POINT_PARAMS :
STRUCT
    tTaskCycleTime     : TIME; (* task cycle time [TIME]
*)
    tCtrlCycleTime     : TIME; (* controller cycle time [TIME]
*)
    fThreshold     : FLOAT;
    fOutMaxLimit       : FLOAT; (* max limit for heating
*)
    fOutMinLimit       : FLOAT; (* min limit for heating
*)
    tMinWaitTime       : TIME;
END_STRUCT
END_TYPE

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.

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.

fThreshold : Switching threshold, see image above.

fOutMaxLimit : Max limit, which is passed on to the controller.

fOutMinLimit : Min limit, which is passed on to the controller.

tMinWaitTime : Waiting time (see description above)

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.8

PC (i386)

TcControllerToolbox.lib

TwinCAT v2.9 from Build 947

BC

TcControllerToolbox.lb6

TwinCAT v2.9 from Build 956

BX

TcControllerToolbox.lbx