# Redundance2

## `Redundance2` (FB)

FUNCTION\_BLOCK Redundance2

### Short description

> Redundant control of two identical devices\
> Influencing factors: requests, operating hours, operating and fault states\
> Typical application: determination of leader and follower pump

### Representation

<figure><img src="/files/a84817e3d52aec1a1696ab265b4768cfc232a693" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name                | Data type | Value range | Initial value | Function                                            |
| ------------------- | --------- | ----------- | ------------- | --------------------------------------------------- |
| *xEnOne*            | BOOL      |             |               | Request - leader device                             |
| *xEnTwo*            | BOOL      |             |               | Request - leader 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 switching 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      |             |               | Output - Fault          |

#### Setpoints / parameters

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

### Function description

#### General

This function block is used for redundant control of two identical devices depending on the influencing variables requests (*xEnOne* and *xEnTwo*), operating hours (*uiOperatingHours1* and *uiOperatingHours2*), operating states (*xFb1* and *xFb2*), fault conditions (*xAlarm1* and *xAlarm2*) and the operating mode for sequence determination (**eModeRedundance**).\
The enablement of the leader and, if necessary, the follower device is determined internally and, taking the current sequence *iCurrentSequence* to the device outputs *xCmd1* or *xCmd2* .

#### Requests *xEnOne* and *xEnTwo*

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

| *xEnOne* | *xEnTwo* | Leader device | Follower device | Note                                 |
| -------- | -------- | ------------- | --------------- | ------------------------------------ |
| FALSE    | FALSE    | FALSE         | FALSE           | No request                           |
| TRUE     | FALSE    | TRUE          | FALSE           | Request - leader device              |
| X        | TRUE     | TRUE          | TRUE            | Request - leader and follower device |

Legend: X = Indeterminate

#### Output Fault *xErr*

It indicates a discrepancy between the requests 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   | Request - leader device and both devices faulty                     |
| X        | TRUE     | TRUE      | X         | TRUE   | Request - leader and follower device and at least one device faulty |
| X        | TRUE     | X         | TRUE      | TRUE   | Request - leader and follower device and at least one device faulty |

Legend: X = Indeterminate

#### Output *iCurrentSequence*

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

#### Setpoint / parameters **xConOperatingHours**

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

#### Setpoint / parameters **xEnFb**

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

#### Setpoint / parameters **wTolerance**

This target value determines the maximum operating hours difference before a switch of the leader and the follower device due to operating hours.

#### Setpoint / parameters **eModeRedundance**

This setpoint defines the mode of sequence determination. In automatic mode the sequence is determined automatically.\
The forced determination of the sequence in the operation modes ForceComponent1 or ForceComponent2 is done by deliberate manipulation of the internal states of the operating hours counters or of the setpoint / parameter **wTolerance**.\
The sequence switching in case of a fault therefore remains in effect.

| **eModeRedundance**               | Leader 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 leader and follower device

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

| *xAlarm1* | *xAlarm2* | Leader 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 = Indeterminate

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

A re-evaluation and -determination with low priority can be triggered as follows each time:

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

| **xConOperatingHours** | *xUpdate*        | Conditions                                                                                                             | Leader device                                                                                            |
| ---------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| FALSE                  | FALSE, TRUE, H/L |                                                                                                                        | no re-evaluation                                                                                         |
| TRUE                   | FALSE, TRUE, H/L | same operation 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 leader with the 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):

**Leader device = device 1**

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

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

**Leader device = device 2**

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

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

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

**Leader device = device 1**

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

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

**Leader device = device 2**

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

*xCmd2* = TRUE: The leader device is requested and at least one device is requested 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
