FB_BA_SeqCtrl

PID controller as part of a sequence. The functionalities of this controller are identical to FB_BA_PIDCtrl. However, if it is enabled via bEn=TRUE, it is controlled via a higher-level control function block FB_BA_SeqLink.

The data exchange between the control function block FB_BA_SeqLink and the sequence controllers FB_BA_SeqCtrl takes place via the structure variable stSeqLink.

FB_BA_SeqCtrl 1:

Functional description

Heating/cooling sequence

The controller sequence should be configured such that the sequence controller with lower ordinal number are used for heating and the ones with the higher number for cooling. Only one change is permitted:

Exclusive programming of cooling and heating controllers is also possible.

Any parameterisation that contradicts this convention is detected and indicated as an error at control function block FB_BA_SeqLink.

Controller output

While the control function block FB_BA_SeqLink specifies which sequence controller is active, each sequence controller independently decides its output at control output lrY. Since each sequence controller knows the state of the other controllers via the in/out variable stSeqLink, it can distinguish between four cases:

  1. The sequence controller detects that it and all other sequence controllers are not enabled, be it due to missing activations (bEn) at the input or because an error was detected at the control function block FB_BA_SeqLink
    -> The sequence controller disables its internal PID controller and issues 0.0 at the control output lrY.
  2. The sequence controller detects that it is enabled and set as active by the control function block FB_BA_SeqLink
    -> The sequence controller enables its internal PID controller. Its output signal is output at the control output lrY.
  3. The sequence controller detects that it is enabled, but a sequence controller with a higher ordinal number was set as active by the control function block FB_BA_SeqLink
    -> The sequence controller disables its internal PID controller. If the sequence controller is in heating mode (bActn=FALSE), it will output its minimum value lrYMin at the control output lrY. If it is in cooling mode (bActn=TRUE), it will output its maximum value lrYMax at the control output lrY.
  4. The sequence controller detects that it is enabled, but a sequence controller with a lower ordinal number was set as active by the control function block FB_BA_SeqLink
    -> The sequence controller disables its internal PID controller. If the sequence controller is in heating mode (bActn=FALSE), it will output its maximum value lrYMax at the control output lrY. If it is in cooling mode (bActn=TRUE), it will output its minimum value lrYMin at the control output lrY.

Synchronisation

If a sequence controller is activated by the higher-level controller, this always results in synchronisation, i.e. the controller starts with a fixed value at the output lrY. 3 cases are distinguished:

  1. The entire sequence control was switched on via the input bEn of the higher-level controller FB_BA_SeqLink. The controller with the ordinal number usiStartSeq at the input of FB_BA_SeqLink is the start controller.
    -> The sequence controller is synchronised with the value, which is entered at its input lrYSeqInit.
  2. The sequence controller, which has just has been activated, had a higher ordinal number than the "previous" one
    -> If the sequence controller is in heating mode (bActn=FALSE), it is synchronised with its minimum value lrYMin. If it is in cooling mode (bActn=TRUE), the synchronisation value is its maximum value lrYMax.
  3. The sequence controller, which has just has been activated, had a lower ordinal number than the "previous" one
    -> If the sequence controller is in heating mode (bActn=FALSE), it is synchronised with its maximum value lrYMax. If it is in cooling mode (bActn=TRUE), the synchronisation value is its minimum value lrYMin.

Each sequence controller can also be synchronised by specifying a value lrSync and activating bSync, if it has just been activated by the higher-level controller. A constant TRUE signal at the input bSync (e.g. accidental) is internally intercepted through edge formation, so that obstruction of the synchronisation described above on activation is avoided.

Start-up behaviour

In order to enable "sensible" adjustment of the entire control sequence, the start controller is maintained in active state as a minimum for the time udiIniswiOvrDly [s], which is entered at the function block FB_BA_SeqLink. During this time, no switching takes place to another controller of this sequence.
The output lrY of the start controller is synchronised once to its value lrYSeqInit.

Inputs/outputs

VAR_INPUT

bEn          : BOOL;
usiMyNum     : USINT;
bActn        : BOOL;
bSync        : BOOL;
lrSync       : LREAL;
lrYSeqInit   : LREAL;
lrW          : LREAL;
lrX          : LREAL;
lrNZ         : LREAL;
lrYMin       : LREAL;
lrYMax       : LREAL;
lrKp         : LREAL;
udiTn        : UDINT;
udiTv        : UDINT;
udiTd        : UDINT;
udiMinToMax  : UDINT;
udiMaxToMin  : UDINT;
uiCycCl      : UINT;

bEn: activation of the sequence controller

usiMyNum: ordinal number of the sequence controller

bActn: reversal of control direction of the controller. For heating/cooling operation: bActn=FALSE corresponds to heating mode, bActn=TRUE corresponds to cooling mode.

bSync / lrSync: synchronization command: set output value lrY to lrSync.

lrYSeqInit: start value of the controller after restart of the whole control sequence.

lrW: setpoint

lrX: actual value

lrNZ: neutral zone

lrYMin: lower controller output limit [%]. Selectable range: 0..100%.

lrYMax: upper limit of the working range of the controller [%]. Selectable range: 0..100%.

lrKp: controller amplification. Only affects the P component.

udiTn: integral action time of the I component [ms]. A zero value at this parameter disables the I component.

udiTv: integral action time of the D component [ms]. A zero value at this parameter disables the D component.

udiTd: damping time of the D component [ms]

udiMinToMax: slope limit of controller output for increase: udiMinToMax [s] related to a change from lrYMin to lrYMax.

udiMaxToMin: slope limit of controller output for decrease: udiMaxToMin [s] related to a change from lrYMax to lrYMin.

uiCycCl: call cycle of the function block as a multiple of the cycle time. A zero entry is automatically interpreted as uiCycleCall =1.
Example: tTaskCycleTime = 20 ms, uiCtrlCycleCall =10 -> The control algorithm is called every 200 ms. Thus the outputs are also updated only every 200 ms.

VAR_IN_OUT

stSeqLink : ST_BA_SeqLink;

stSeqLink: data and command structure between the individual sequence controllers and the function block FB_BA_SeqLink.

FB_BA_SeqCtrl 2:

If several sequence controllers have the same number (usiMyNum), this is detected and output as an error at the sequence controller and at the control function block FB_BA_SeqLink.

VAR_OUTPUT

lrY        : LREAL;
bErr       : BOOL;
udiErrId   : UDINT;
udiErrArg  : UDINT;

lrY: control value. Range: 0..100%, unless limited further by lrYMin and lrYMax.

bErr: this output is switched to TRUE if the parameters entered are erroneous.

udiErrId / udiErrArg: contains the error number and the error argument. See error codes.

Requirements

Development environment

Target system

required library

required supplement

TwinCAT 2.11 R3/x64

PC/CX

TcBA library from V1.0.0

TS8040 | TwinCAT Building Automation from V1.0.0

See also:

ST_BA_SeqLink / ST_BA_SeqLinkData