> 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/redundance2.md).

# Redundance2

## `Redundance2` (FB)

FUNCTION\_BLOCK Redundance2

### Short description

> Redundant control of two identical devices\
> Influencing factors: demands, operating hours, operating and fault states\
> Typical application: setting the lead and follower pump

### Representation

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

### Interfaces

#### Inputs

| Name                | Data type | Value range | Initial value | Function                                           |
| ------------------- | --------- | ----------- | ------------- | -------------------------------------------------- |
| *xEnOne*            | BOOL      |             |               | Demand - lead device                               |
| *xEnTwo*            | BOOL      |             |               | Demand - lead and follower device                  |
| *xFb1*              | BOOL      |             |               | Operation - device 1                               |
| *xFb2*              | BOOL      |             |               | Operation - device 2                               |
| *xAlarm1*           | BOOL      |             |               | Fault - device 1                                   |
| *xAlarm2*           | BOOL      |             |               | Fault - device 2                                   |
| *uiOperatingHours1* | UDINT     |             |               | Operating hours - device 1                         |
| *uiOperatingHours2* | UDINT     |             |               | Operating hours - device 2                         |
| *xUpdate*           | BOOL      |             |               | Input - follower sequence based on operating hours |

#### Outputs

| Name               | Data type | Value range | Initial value | Function                |
| ------------------ | --------- | ----------- | ------------- | ----------------------- |
| *iCurrentSequence* | INT       |             |               | Current device sequence |
| *xCmd1*            | BOOL      |             |               | Enable - device 1       |
| *xCmd2*            | BOOL      |             |               | Enable - device 2       |
| *xErr*             | BOOL      |             |               | Fault output            |

#### Setpoints / Parameters

| Name                            | Data type         | Value range                                                                                  | Initial value          | Function                                                                      |
| ------------------------------- | ----------------- | -------------------------------------------------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------------- |
| **eModeRedundance**             | eOpModeRedundance | eOpModeRedundance.Auto, eOpModeRedundance.ForceComponent1, eOpModeRedundance.ForceComponent2 | eOpModeRedundance.Auto | Operating mode of sequence determination                                      |
| **xConOperatingHours**          | BOOL              |                                                                                              | TRUE                   | Enable - follower sequence based on operating hours                           |
| **xEnFb**                       | BOOL              |                                                                                              | TRUE                   | Enable - use of operating messages                                            |
| **wTolerance**                  | WORD              |                                                                                              | 100                    | Threshold value - operating hours difference                                  |
| **xIgnoreAlarmXFollowerDevice** | BOOL              |                                                                                              | FALSE                  | Parameter for ignoring the fault state of the follower device (TRUE = ignore) |

### Functional description

#### General

This function block is used for redundant control of two identical devices depending on the influencing factors demands (*xEnOne* and *xEnTwo*), operating hours (*uiOperatingHours1* and *uiOperatingHours2*), operating states (*xFb1* and *xFb2*), fault states (*xAlarm1* and *xAlarm2*) and the operating mode for sequence selection (**eModeRedundance**).\
The enabling of the lead device and, if required, of the follower device is determined internally and taking into account the current sequence *iCurrentSequence* to the device outputs *xCmd1* or *xCmd2* transferred.

#### Demands *xEnOne* and *xEnTwo*

They are used to determine whether only the lead device or both the lead and follower device should be demanded.

| *xEnOne* | *xEnTwo* | Lead device | Follower device | Note                              |
| -------- | -------- | ----------- | --------------- | --------------------------------- |
| FALSE    | FALSE    | FALSE       | FALSE           | No demand                         |
| TRUE     | FALSE    | TRUE        | FALSE           | Demand - lead device              |
| X        | TRUE     | TRUE        | TRUE            | Demand - lead and follower device |

Legend: X = Undefined

#### Fault output *xErr*

It indicates a discrepancy between the demands and the fault states of the devices.\
The function table describes the constellations that activate the output *xErr* (= TRUE), i.e. indicate a fault.\
In all other cases, the output is *xErr* not active (= FALSE).

| *xEnOne* | *xEnTwo* | *xAlarm1* | *xAlarm2* | *xErr* | Note                                                             |
| -------- | -------- | --------- | --------- | ------ | ---------------------------------------------------------------- |
| TRUE     | X        | TRUE      | TRUE      | TRUE   | Demand - lead device and both devices faulty                     |
| X        | TRUE     | TRUE      | X         | TRUE   | Demand - lead and follower device and at least one device faulty |
| X        | TRUE     | X         | TRUE      | TRUE   | Demand - lead and follower device and at least one device faulty |

Legend: X = Undefined

#### Output *iCurrentSequence*

It always shows the current sequence of the two devices.\
The first digit always shows the device number of the lead device (example: *iCurrentSequence* = 1X ... lead device = device 1)\
The second digit always shows the device number of the follower device. (example: *iCurrentSequence* = X2 ... follower device = device 2)

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

When TRUE, the follower sequence is triggered each time the function block is executed depending on the operating hours and operating messages (when **xEnFb** = TRUE) of devices 1 and 2.\
When FALSE, the follower sequence can only be triggered by a rising edge at the input *xUpdate* be triggered.

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

When TRUE, the operating states of devices 1 and 2 are evaluated and taken into account in the follower sequence.\
When FALSE, the device outputs of devices 1 and 2 are evaluated and taken into account in the follower sequence.

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

This setpoint determines the maximum difference in operating hours before switching the lead and follower device based on operating hours.

#### Setpoint / parameter **eModeRedundance**

This setpoint defines the operating mode of the sequence determination. In automatic mode, the sequence is determined automatically.\
The forced determination of the sequence in the operating modes ForceComponent1 or ForceComponent2 is achieved by a targeted influence on the internal states of the operating hour counters or the setpoint / parameter **wTolerance**.\
The sequence switchover in the event of a fault is therefore still maintained.

| **eModeRedundance**               | Lead device             | Follower device         | Note                             |
| --------------------------------- | ----------------------- | ----------------------- | -------------------------------- |
| eOpModeRedundance.Auto            | Automatic determination | Automatic determination | Automatic sequence determination |
| eOpModeRedundance.ForceComponent1 | Device 1                | Device 2                | Forced sequence Device 1 - 2     |
| eOpModeRedundance.ForceComponent2 | Device 2                | Device 1                | Forced sequence Device 2 - 1     |

#### Determination of the lead and follower device

Switchover with high priority depending on the fault states of devices 1 and 2

| *xAlarm1* | *xAlarm2* | Lead device  | Follower device | Note                       |
| --------- | --------- | ------------ | --------------- | -------------------------- |
| FALSE     | FALSE     | not affected | not affected    | Both devices without fault |
| TRUE      | FALSE     | Device 2     | Device 1        | Device 1 faulty            |
| X         | TRUE      | Device 1     | Device 2        | Device 2 faulty            |

Legend: X = Undefined

Switchover with low priority depending on the operating hours, operating messages (**xFb**) and enable outputs (**xCmd**) of devices 1 and 2

A reevaluation and redetermination with low priority can be triggered as follows:

**xConOperatingHours** = TRUE and / or rising edge at input *xUpdate*

| **xConOperatingHours** | *xUpdate*        | Conditions                                                                                                             | Lead device                                                                                              |
| ---------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| FALSE                  | FALSE, TRUE, H/L |                                                                                                                        | no reevaluation                                                                                          |
| TRUE                   | FALSE, TRUE, H/L | same operating messages (**xFb** = TRUE or = FALSE) or same enable outputs (**xCmd** = TRUE or = FALSE) of the devices | Device with lower operating hours count                                                                  |
| TRUE                   | FALSE, TRUE, H/L | One device in operation (**xFb** = TRUE) or one device enabled (**xCmd** = FALSE)                                      | Switch to the device with the lower operating hours count if operating hours difference > **wTolerance** |
| FALSE                  | L/H              | *uiOperatingHours1* = *uiOperatingHours2* = 0 (no operating hours available)                                           | Switch of the lead and follower device                                                                   |
| FALSE                  | L/H              | *uiOperatingHours1* or *uiOperatingHours2* > 0                                                                         | Device with lower operating hours count                                                                  |

Legend: L/H … rising edge, H/L … falling edge

#### Device outputs *xCmd1* and *xCmd2*

The device outputs are finally determined as follows (xIgnoreAlarmXFollowerDevice = FALSE):

**Lead device = device 1**

*xCmd1* = TRUE: The lead device is demanded and at least one device is demanded and device 1 is not faulty *xCmd1* = FALSE: In all other cases

*xCmd2* = TRUE: The follower device is demanded and at least one device is demanded and device 2 is not faulty *xCmd2* = FALSE: In all other cases

**Lead device = device 2**

*xCmd1* = TRUE: The follower device is demanded and at least one device is demanded and device 1 is not faulty *xCmd1* = FALSE: In all other cases

*xCmd2* = TRUE: The lead device is demanded and at least one device is demanded and device 2 is not faulty *xCmd2* = FALSE: In all other cases

The device outputs are finally determined as follows ( xIgnoreAlarmXFollowerDevice = TRUE and both devices are not faulty at the same time ):

**Lead device = device 1**

*xCmd1* = TRUE: The lead device is demanded and at least one device is demanded and device 1 is not faulty *xCmd1* = FALSE: In all other cases

*xCmd2* = TRUE: The follower device is demanded and at least one device is demanded. *xCmd2* = FALSE: In all other cases

**Lead device = device 2**

*xCmd1* = TRUE: The follower device is demanded and at least one device is demanded *xCmd1* = FALSE: In all other cases

*xCmd2* = TRUE: The lead device is demanded and at least one device is demanded and device 2 is not faulty *xCmd2* = FALSE: In all other cases

### CODESYS

InOut:

| Scope       | Name                          | Type              | Initial                |
| ----------- | ----------------------------- | ----------------- | ---------------------- |
| Input       | `xEnOne`                      | `BOOL`            |                        |
| Input       | `xEnTwo`                      | `BOOL`            |                        |
| Input       | `xFb1`                        | `BOOL`            |                        |
| Input       | `xFb2`                        | `BOOL`            |                        |
| Input       | `xAlarm1`                     | `BOOL`            |                        |
| Input       | `xAlarm2`                     | `BOOL`            |                        |
| Input       | `uiOperatingHours1`           | `UDINT`           |                        |
| Input       | `uiOperatingHours2`           | `UDINT`           |                        |
| Input       | `xUpdate`                     | `BOOL`            |                        |
| Input Const | `xIgnoreAlarmXFollowerDevice` | `BOOL`            | FALSE                  |
| Input Const | `eModeRedundance`             | eOpModeRedundance | eOpModeRedundance.Auto |
| Input Const | `xConOperatingHours`          | `BOOL`            | TRUE                   |
| Input Const | `xEnFb`                       | `BOOL`            | TRUE                   |
| Input Const | `wTolerance`                  | `WORD`            | 100                    |
| Output      | `iCurrentSequence`            | `INT`             |                        |
| Output      | `xCmd1`                       | `BOOL`            |                        |
| Output      | `xCmd2`                       | `BOOL`            |                        |
| Output      | `xErr`                        | `BOOL`            |                        |


---

# 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/redundance2.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.
