FB_BA_FIFO04
Sequential control of up to four units
Functional description
The function block FB_BA_FIFO04 enables sequential control of up to four units, with automatic switching of the switch-on sequence based on operating hours.
The function block is available in two versions: for a sequence of four or eight units.
Units with fewer operating hours take precedence in the sequence over units with more operating hours.
A rising edge at bChg forces a sequence change. The units with the fewest operating hours are set to the top of the FIFO and thus given priority for switching on.
In the sequence only units are entered, which are enabled at inputs bEn01..bEn04. udiNum indicates the number of requested units.
The operating hours of the units are entered at inputs udiActvTi01 to udiActvTi04. If all these inputs are set to a constant value of zero, the sequence change is controlled cyclically, depending on bChg.
The first unit is removed from the FIFO, the other units are advanced, and the first unit is appended at the end of the FIFO again. As a result is an alternating sequence of units.
If more units are requested at input udiNum than are available at inputs bEn01 to bEn04, this is indicated with TRUE at bErr.
Error handling
If more units are requested at input udiNum than are available at inputs bEn01 to bEn04, this is indicated with TRUE at bErr.
Inputs/outputs
VAR_INPUT
bEn : BOOL;
udiNum : UDINT;
bChg : BOOL;
bEn01 : BOOL;
bEn02 : BOOL;
bEn03 : BOOL;
bEn04 : BOOL;
udiActvTi01 : UDINT;
udiActvTi02 : UDINT;
udiActvTi03 : UDINT;
udiActvTi04 : UDINT;
bEn: enable of the function block
udiMyNum: number of aggregates
bChg: force sequence change
bEn01...bEn04: enable aggregate 1...enable aggregate 4
udiActvTi01...udiActvTi04: operating hours aggregate 1...operating hours aggregate 4
VAR_OUTPUT
bQ01 : BOOL;
bQ02 : BOOL;
bQ03 : BOOL;
bQ04 : BOOL;
udiNextOn : UDINT;
udiNextOff : UDINT;
arrFIFO : ARRAY [1..4] OF UDINT;
udiNumOfEn : UDINT;
bErr : BOOL;
udiErrId : UDINT;
udiErrArg : UDINT;
bQ01...bQ04: switches aggregate 1…4
udiNextOn: number of the aggregate that is switched on next.
udiNextOff: number of the aggregate that is switched off next.
arrFIFO: FIFO buffer as a field
udiNumOfEn: number of devices, depending on the individual enable states
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 |