> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/general/redundance3.md).

# Redundance3

## `Redundance3` (FB)

FUNCTION\_BLOCK Redundance3

### Short description

> Redundant control of 0 - 3 identical devices\
> Influencing factors: requirements, operating hours, operating and fault states\
> Typical application: definition of the lead and follow devices

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-ec817feccd901cf42adda2d631e666ee95a1ea0b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name                     | Data type | Value range | Initial value | Function                                                          |
| ------------------------ | --------- | ----------- | ------------- | ----------------------------------------------------------------- |
| *wActiveNumberOfDevices* | WORD      |             | 0             | Number of active devices (0 - 3)                                  |
| *xFb1*                   | BOOL      |             | FALSE         | Operation - device 1 (TRUE = operation)                           |
| *xFb2*                   | BOOL      |             | FALSE         | Operation - device 2 (TRUE = operation)                           |
| *xFb3*                   | BOOL      |             | FALSE         | Operation - device 3 (TRUE = operation)                           |
| *xAlarm1*                | BOOL      |             | TRUE          | Fault - device 1 (TRUE = fault)                                   |
| *xAlarm2*                | BOOL      |             | TRUE          | Fault - device 2 (TRUE = fault)                                   |
| *xAlarm3*                | BOOL      |             | TRUE          | Fault - device 3 (TRUE = fault)                                   |
| *uiOperatingHours1*      | UDINT     |             | 0             | Operating hours - device 1                                        |
| *uiOperatingHours2*      | UDINT     |             | 0             | Operating hours - device 2                                        |
| *uiOperatingHours3*      | UDINT     |             | 0             | Operating hours - device 3                                        |
| *xUpdate*                | BOOL      |             |               | Triggering the recalculation of the sequence on every rising edge |

#### Outputs

| Name                          | Data type                     | Value range | Initial value | Function                                       |
| ----------------------------- | ----------------------------- | ----------- | ------------- | ---------------------------------------------- |
| *udiCurrentSequence*          | UDINT                         |             | 0             | Current device sequence as an integer          |
| *sCurrentSequence*            | STRING                        |             | ‘’            | Current device sequence as a string            |
| *wNumberOfOperationalDevices* | WORD                          |             | 0             | Number of operational devices                  |
| *xCmd1*                       | BOOL                          |             | FALSE         | Enable - device 1 (TRUE = enable)              |
| *xCmd2*                       | BOOL                          |             | FALSE         | Enable - device 2 (TRUE = enable)              |
| *xCmd3*                       | BOOL                          |             | FALSE         | Enable - device 3 (TRUE = enable)              |
| *wPrio1*                      | WORD                          |             | 0             | Current priority of device 1 (0 = none, 1 - 3) |
| *wPrio2*                      | WORD                          |             | 0             | Current priority of device 2 (0 = none, 1 - 3) |
| *wPrio3*                      | WORD                          |             | 0             | Current priority of device 3 (0 = none, 1 - 3) |
| *xErr*                        | BOOL                          |             | FALSE         | Fault output                                   |
| *eOperationalCondition*       | eRedundance3\_OperationalMode |             |               | Number / name of the current operating state   |

#### Setpoints / Parameters

| Name                   | Data type | Value range | Initial value | Function                                                                                                            |
| ---------------------- | --------- | ----------- | ------------- | ------------------------------------------------------------------------------------------------------------------- |
| **xConOperatingHours** | BOOL      |             | TRUE          | FALSE = sequence switching only via input xUpdate, TRUE = sequence switching automatically based on operating hours |
| **xEnFb**              | BOOL      |             | TRUE          | FALSE = switching based on enable (xCmdX), TRUE = switching based on operation message (xFbX)                       |
| **wTolerance**         | WORD      |             | 100           | Limit value - operating-hours difference for direct follower change in part-load operation                          |

### Functional description

#### General

This function block is used for redundant control of 0 - 3 identical devices depending on the influencing factors\
requirements (*wActiveNumberOfDevices*), operating hours (*uiOperatingHours*), operating states (*xFb*) and fault states (*xAlarm*).

#### Input *wActiveNumberOfDevices*

This input is used to define the number of devices that are currently to be used.\
Permissible range: 0 - 3

#### Input *xUpdate*

Every rising edge at this input triggers a recalculation of the current device sequence.\
Boundary conditions: *xConOperationHours* = FALSE, operating-hours difference = 0 hours.

#### Output *udiCurrentSequence*

This output always indicates the current device sequence as an integer. The number of the device with the highest priority is always at the beginning, followed by the number of the device with the second-highest priority, and so on.

{% hint style="info" %}
Example: *udiCurrentSequence* = 145 means: device 1 = priority 1, device 4 = priority 2 and device 5 = priority 3
{% endhint %}

#### Output *sCurrentSequence*

This output always shows the current device sequence as a string with separators. The same applies to the priorities as for the output *udiCurrentSequence*.

{% hint style="info" %}
Example: *sdiCurrentSequence* = ‘1-4-5’ means: device 1 = priority 1, device 4 = priority 2 and device 5 = priority 3
{% endhint %}

#### Output *wNumberOfOperationalDevices*

This output always shows the number of operational devices.

#### Fault output *xErr*

This output is active (= TRUE) if at least one of the following conditions is met.

1. *wActiveNumberOfDevices* > 3
2. *wActiveNumberOfDevices* > *wOperationalNumberofDevices*

\
In all other cases, the output is **xErr** not active (= FALSE).

#### Output *eOperationalCondition*

This output always represents the current load situation (idle, part load, full load) depending on the setpoint / parameter **xEnFb** .\
**xEnFb** = FALSE: The enable outputs *xCmd* of the operational devices are evaluated / considered.\
**xEnFb** = TRUE: The operating states *xFb* of the operational devices are evaluated / considered.

{% hint style="info" %}
Example: **xEnFb** = TRUE and *xFb1* = TRUE and *xFb2* = TRUE: Output = *PartLoad\_Inputs\_Fb*
{% endhint %}

#### Setpoint / parameter **xConOperatingHours**

**xConOperatingHours** = FALSE: The switching of the device sequence is triggered only by a rising edge at the input *xUpdate* .\
**xConOperatingHours** = TRUE: The switching of the device sequence is triggered depending on the operating hours, the operating messages (when **xEnFb** = TRUE)\
and the enables (when **xEnFb** = FALSE).

#### Setpoint / parameter **xEnFb**

**xEnFb** = FALSE: The enable outputs 'xCmd' of the operational devices are evaluated / considered.\
**xEnFb** = TRUE: The operating states 'xFb' of the operational devices are evaluated / considered.

#### Setpoint / parameter **wTolerance**

This setpoint defines the maximum operating-hours difference before a switching of the device sequence based on operating hours.

#### Determination of the device sequence

A changeover of the device sequence can generally only take place if at least one of the following conditions is met:

1. The fault state of at least one device has changed (high priority)
2. The operating hours of at least one device ready for operation have changed (low priority)

#### Definition - Idle:

xEnFb = FALSE: The enable outputs 'xCmd' of all devices ready for operation are inactive (= FALSE)\
xEnFb = TRUE: The operating messages 'xFb' of all devices ready for operation are inactive (= FALSE)

#### Definition - Full load:

xEnFb = FALSE: The enable outputs 'xCmd' of all devices ready for operation are active (= TRUE)\
xEnFb = TRUE: The operating messages 'xFb' of all devices ready for operation are active (= TRUE)

#### Definition - Part load:

xEnFb = FALSE: The number of enable outputs ‘xCmd‘ of all operational devices in the active state (= TRUE) is greater than/equal to 1 and less than the number of all operational devices.\
xEnFb = FALSE: The number of operating messages ‘xFb‘ of all operational devices in the active state (= TRUE) is greater than/equal to 1 and less than the number of all operational devices.\
\
\
\
Switching with high priority (= immediate) depending on the fault states (inputs xAlarm)\
\
The fault state of each device in the range 1 - 3 is cyclically recorded and evaluated for changes.\
Each faulty device in the range 1 - 3 (input xAlarm = TRUE) is no longer operational.\
Any change in the fault state of at least one device in the range 1 - 3 triggers an immediate recalculation of the device sequence.\
\
\
\
Switching with low priority depending on the operating hours (inputs udiOperationHours), operating states (inputs xFb) and enable outputs (outputs xCmd) of devices 1 - 3.\
\
The operating hours of each operational device in the range 1 - 3 are cyclically recorded and evaluated for changes.\
The operating states and enable outputs of each operational device in the range 1 - 3 are cyclically recorded.

\
The device sequence is recalculated as soon as one of the situations described below occurs:\
\
\
\
**Situation 1 (xConOperationHours = FALSE, rising edge at input xUpdate)**\
\
The device sequence is recalculated with an operating-hours difference of 0 hours, i.e. the fault-free device with the lowest operating-hours count has the highest priority (if the operating hours are equal, the device with the lower number has the higher priority).\
\
\
\
**Situation 2 (xConOperationHours = TRUE, idle or full load)**\
\
In idle mode or under full load, the device sequence is recalculated with an operating-hours difference of 0 hours, i.e. the fault-free device with the lowest operating-hours count has the highest priority (if the operating hours are equal, the device with the lower number has the higher priority).

\
The device sequence is recalculated if the operating-hours count of at least one operational device has changed.\
\
\
\
**Situation 3 (xConOperationHours = TRUE, partial load)**\
\
When switching to partial-load operation for the first time, the device sequence is recalculated with an operating-hours difference of 0 hours, i.e. the fault-free device with the lowest operating-hours count has the highest priority (if the operating hours are equal, the device with the lower number has the higher priority).\
\
In regular partial-load operation, the device sequence is recalculated with an operating-hours difference of **wTolerance** hours.

\
The device sequence is recalculated if the operating-hours count of at least one operational device has changed.

#### Enable outputs xCmd’

\
The states of the outputs of the devices in the range 1 - 3 are finally defined as follows:\
\
The enable outputs of the operational devices in the range 1 - 3 are activated if their current priority <= the number of requested devices (input wActiveNumberOfDevices).<br>

The enable outputs of the operational devices in the range 1 - 3 are deactivated if their current priority > the number of requested devices (input wActiveNumberOfDevices).

#### Priority outputs *wPrio*

\
The priority outputs of each device always contain the current priority in the range 0 - 3.\
\
Priority = 0: The device has no priority or an invalid priority\
Priority = 1: The device has the highest priority\
Priority = 2: The device has the second-highest priority\
Priority = 3: The device has the third-highest priority

### CODESYS

InOut:

| Scope       | Name                          | Type                          | Initial |
| ----------- | ----------------------------- | ----------------------------- | ------- |
| Input       | `wActiveNumberOfDevices`      | `WORD`                        | 0       |
| Input       | `xFb1`                        | `BOOL`                        | FALSE   |
| Input       | `xFb2`                        | `BOOL`                        | FALSE   |
| Input       | `xFb3`                        | `BOOL`                        | FALSE   |
| Input       | `xAlarm1`                     | `BOOL`                        | TRUE    |
| Input       | `xAlarm2`                     | `BOOL`                        | TRUE    |
| Input       | `xAlarm3`                     | `BOOL`                        | TRUE    |
| Input       | `udiOperatingHours1`          | `UDINT`                       | 0       |
| Input       | `udiOperatingHours2`          | `UDINT`                       | 0       |
| Input       | `udiOperatingHours3`          | `UDINT`                       | 0       |
| Input       | `xUpdate`                     | `BOOL`                        |         |
| Input Const | `xConOperatingHours`          | `BOOL`                        | TRUE    |
| Input Const | `xEnFb`                       | `BOOL`                        | TRUE    |
| Input Const | `wTolerance`                  | `WORD`                        | 100     |
| Output      | `udiCurrentSequence`          | `UDINT`                       | 0       |
| Output      | `sCurrentSequence`            | `STRING`                      | ‘’      |
| Output      | `wNumberOfOperationalDevices` | `WORD`                        | 0       |
| Output      | `xCmd1`                       | `BOOL`                        | FALSE   |
| Output      | `xCmd2`                       | `BOOL`                        | FALSE   |
| Output      | `xCmd3`                       | `BOOL`                        | FALSE   |
| Output      | `wPrio1`                      | `WORD`                        | 0       |
| Output      | `wPrio2`                      | `WORD`                        | 0       |
| Output      | `wPrio3`                      | `WORD`                        | 0       |
| Output      | `xErr`                        | `BOOL`                        | FALSE   |
| Output      | `eOperationalCondition`       | eRedundance3\_OperationalMode |         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/general/redundance3.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
