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.

Behavior 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 diagram). 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:

fOutMinLimit = -1.0 stParams.fThreshold;

fOutMaxLimit = stParams.fOutMaxLimit;

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

fOutMinLimit = stParams.fOutMaxLimit;

fOutMaxLimit = stParams.fThreshold;

FB_CTRL_PARAMETER_SWITCH 3: VAR_INPUT

VAR_INPUT
    fManipulatedVariable  : FLOAT;
    nManSyncValue         : eCTRL_PARAMETER_RECORD_HEATING;
    bSync                 : BOOL;
    eMode                 : E_CTRL_MODE;
END_VAR

Name

Type

Description

fManipulated
Variable

FLOAT

Input value of the FB_Parameter_Switch. This should be equal to the output value of the controller.

nManSync
Value

eCTRL_PARAMETER_RECORD_
HEATING

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

bSync

BOOL

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

eMode

E_CTRL_MODE

Input that specifies the operation mode of the function block.

FB_CTRL_PARAMETER_SWITCH 4: 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

Name

Type

Description

eParameterRecord

E_CTRL_
PARAMETER_
RECORD

The output of the function block, identifying the parameter range.

fOutMaxLimit

FLOAT

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

fOutMinLimit

FLOAT

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

eState

E_CTRL_
STATE

State of the function block

eErrorId

E_CTRL_ERROR
CODES

Supplies the error number when the output bError is set.

bError

BOOL

Becomes TRUE, as soon as an error occurs.

VAR_IN_OUT

VAR_IN_OUT
    stParams    : ST_CTRL_PARAMETER_SWITCH_PARAMS;
END_VAR

Name

Type

Description

stParams

ST_CTRL_PARAMETER_SWITCH_PARAMS

Parameter structure of the function block

stParams consists of the following elements:

TYPE
ST_CTRL_2POINT_PARAMS :
STRUCT
    tTaskCycleTime    : TIME;
    tCtrlCycleTime    : TIME;
    fThreshold        : FLOAT;
    fOutMaxLimit      : FLOAT;
    fOutMinLimit      : FLOAT;
    tMinWaitTime      : TIME;
END_STRUCT
END_TYPE

Name

Type

Description

tTaskCycleTime

TIME

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

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.

fThreshold

FLOAT

Switching threshold, see illustration above.

fOutMaxLimit

FLOAT

The maximum limit; it is passed on to the controller.

fOutMinLimit

FLOAT

The minimum limit; it is passed on to the controller.

tMinWaitTime

TIME

Waiting time, see description above.