# Fan2Speed

## `Fan2Speed` (FB)

FUNCTION\_BLOCK Fan2Speed

### Short description

> Control of a two-speed fan\
> Additional functions: air shortage monitoring, operation monitoring, maintenance switch, manual override, status display\
> Typical application: control of a fan

### Representation

<figure><img src="/files/668f5b014652863dad25ed3e93fb951da229d31b" alt=""><figcaption></figcaption></figure>

### Function description

#### General

This function block controls a single-stage fan.\
The following function blocks are essentially used:

* AirShortage
* ManBin
* OperatingHours

#### Release - fan before manual override *xAB*

The release - fan before manual override *xAB* is influenced by the fan request *xEn*, the collective fault indication *xAlarm*, the maintenance switch indication *xMSwitch*, the parameter **xAlarmControl** and the air shortage monitoring.\
\
The release - fan before manual override *xAB* is active (= TRUE) if the following conditions are present simultaneously:\
\
Case 1:\
\
\&#xNAN;*xEn* = TRUE (request active)\
\&#xNAN;*xMSwitch* = TRUE (motor protection switch not tripped)\
**xAlarmControl** = FALSE (collective fault indication not considered)\
\
Case 2:\
\
\&#xNAN;*xEn* = TRUE (request active)\
\&#xNAN;*xAlarm* = FALSE (collective fault indication not active)\
\&#xNAN;*xMSwitch* = TRUE (motor protection switch not tripped)\
**xAlarmControl** = TRUE (collective fault indication considered)\
\
In all other situations the release - fan before manual override *xAB* not active (= FALSE).

#### Release - fan after manual override *xHB*

The release - fan before manual override *xHB* corresponds to the release - fan before manual override *xAB*, additionally extended by a manual override module and by a forced override.

| *xAB* | **eManModeB**  | *xForce* | **xForceOption** | *xHB* | Notes                                          |
| ----- | -------------- | -------- | ---------------- | ----- | ---------------------------------------------- |
| FALSE | eMANBIN.Auto   | FALSE    | X                | FALSE | Manual override module in automatic            |
| TRUE  | eMANBIN.Auto   | FALSE    | X                | TRUE  | Manual override module in automatic            |
| X     | eMANBIN.ManOn  | FALSE    | X                | TRUE  | Manual override module in manual operation On  |
| X     | eMANBIN.ManOff | FALSE    | X                | FALSE | Manual override module in manual operation Off |
| X     | X              | TRUE     | FALSE            | FALSE | Forced override Off                            |
| X     | X              | TRUE     | TRUE             | TRUE  | Forced override On                             |

Legend: X = any

#### Maintenance switch indication *xMSwitch*

*xMSwitch* = TRUE: maintenance switch has not been triggered (normal state)\
\&#xNAN;*xMSwitch* = FALSE: maintenance switch has been triggered (fault state)

#### Forced override *xForce*

The forced override acts directly on the output *xHB*. The parameter **xForceOption** determines which state the output *xHB* assumes when TRUE at the input *xForce* .

#### Operating hours and switching cycles

The number of operating hours and switching cycles are recorded (= counting process active) if the fan running indication *xFb* is active and at the same time the collective fault indication *xAlarm* is not active (= FALSE).\
The results are available at the counter outputs **udiOperatingHours** and **udiCountFb** available.

> **Write access to the counter values**
>
> Via the path 'InstanceName.\_OperatingHours.udiOperatingHours' or 'InstanceName.\_OperatingHours.udiCountFb' write access to both counters is possible.

#### Date / time of the last operation of the fan *dtLastFb*

At the output *dtLastFb* the current date / time is available during the counting process.\
At the output *dtLastFb* the date / time at the end of the last counting process is available outside the counting process.\
At the output *dtLastFb* the initialization value DT#1970-1-1-0.0.0 is output before the first counting process.

#### Operating monitoring

The operating monitoring can be enabled (= TRUE) or disabled (= FALSE) by the setpoint / parameter **xFbControl** When monitoring is disabled the operating monitoring fault indication *xAlarmFb* is always disabled (= FALSE).\
When monitoring is enabled the operating monitoring fault indication *xAlarmFb* is activated (= TRUE) if the following conditions are present simultaneously for a minimum duration **udiFbControlTime** as follows:\
\
\&#xNAN;*xHB* and *xFb* = not equal (enable state and operating state do not match)\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (manual override - hardware in automatic)\
\&#xNAN;*xFbControl* = TRUE (operating monitoring is enabled)\
\
The operating monitoring fault indication *xAlarmFb* is reset (= FALSE) if at least one of the following conditions is met:\
\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (switch back to automatic operation of the manual override - hardware)\
\&#xNAN;*xQuit* = TRUE (reset of fault indications is active)\
\&#xNAN;*xFbControl* = FALSE (operating monitoring disabled)

#### Air shortage monitoring

It serves to detect an air shortage situation by evaluating the signals at the inputs air shortage indication *xPFb* and the fan running indication *xFb*.\
The air shortage monitoring can be enabled (= TRUE) or disabled (= FALSE) by the setpoint / parameter **xPFbControl** In the disabled state the output - fault indication *xAlarmPFb* is not activated (= FALSE).\
\
The output - fault indication *xAlarmPFb* is activated (*xAlarmPFb* = TRUE) if the conditions 1 and 2 below are both met simultaneously.\
\
Condition 1: The input for the differential pressure switch *xPFb* remains for at least the waiting time *udiPFbControlTime* permanently in the state FALSE (= air shortage situation).\
\
Condition 2: The running indication for the fan *xFb* remains for at least the waiting time *udiPFControlTime* remains permanently in the state TRUE (= fan in operation).\
\
\
The output - fault indication *xAlarmPFb* is deactivated in the following cases (*xAlarmPFb* = FALSE):\
\
Case 1: Conditions 1 and / or 2 are not met and the reset of the fault indication *xQuit* is active (= TRUE).

#### Collective fault indication *xAlarm*

The collective fault indication is activated (= TRUE) if at least one of the following described conditions is met.\
\
\&#xNAN;*xAlarmIn* = TRUE (fan fault indication is active)\
\&#xNAN;*xAlarmFB* = TRUE (error from the operating monitoring)\
\&#xNAN;*xAlarmPFb* = TRUE (error from the air shortage monitoring)\
\&#xNAN;*xMSwitch* = FALSE (maintenance switch has been triggered)\
\
In all other cases the collective fault is not active (= FALSE).

#### Collective automatic-mode message *xAuto*

The collective automatic-mode message *xAuto* is activated (= TRUE) if the input *eAOO* has the value HVACTYPES.eManBin.Auto and the setpoint / parameter **eManModeB** has the value eMANBIN.Auto.\
In all other cases the collective automatic-mode message *xAuto* is not activated (= FALSE).

### CODESYS

InOut:

| Scope       | Name                  | Type    | Initial      |
| ----------- | --------------------- | ------- | ------------ |
| Input       | `xEn1`                | `BOOL`  |              |
| Input       | `xEn2`                | `BOOL`  |              |
| Input       | `xForce`              | `BOOL`  | FALSE        |
| Input       | `xFb1`                | `BOOL`  |              |
| Input       | `xFb2`                | `BOOL`  |              |
| Input       | `xPFb`                | `BOOL`  |              |
| Input       | `xMSwitch`            | `BOOL`  | TRUE         |
| Input       | `xAlarmIn1`           | `BOOL`  |              |
| Input       | `xAlarmIn2`           | `BOOL`  |              |
| Input       | `eAOO1`               | eManBin | eManBin.Auto |
| Input       | `eAOO2`               | eManBin | eManBin.Auto |
| Input       | `xQuit`               | `BOOL`  | FALSE        |
| Output      | `xHB1`                | `BOOL`  |              |
| Output      | `xHB2`                | `BOOL`  |              |
| Output      | `xAB1`                | `BOOL`  |              |
| Output      | `xAB2`                | `BOOL`  |              |
| Output      | `xAlarmFb`            | `BOOL`  |              |
| Output      | `xAlarmPFb`           | `BOOL`  |              |
| Output      | `dtLastFb`            | `DT`    |              |
| Output      | `udiOperatingHours1`  | `UDINT` |              |
| Output      | `udiCountFb1`         | `UDINT` |              |
| Output      | `udiOperatingHours2`  | `UDINT` |              |
| Output      | `udiCountFb2`         | `UDINT` |              |
| Output      | `xAlarm`              | `BOOL`  |              |
| Output      | `xAuto`               | `BOOL`  |              |
| Input Const | `udiMinTime_V1_To_V2` | `UDINT` | 10           |
| Input Const | `udiDelay_V2_V1`      | `UDINT` | 6            |
| Input Const | `udiDelay_V1_V2`      | `UDINT` | 1            |
| Input Const | `udiPFbControlTime`   | `UDINT` | 60           |
| Input Const | `xPFbControl`         | `BOOL`  | TRUE         |
| Input Const | `xAlarmControl`       | `BOOL`  | TRUE         |
| Input Const | `udiFbControlTime`    | `UDINT` | 60           |
| Input Const | `xFbControl`          | `BOOL`  | TRUE         |
| Input Const | `xForceOption`        | `BOOL`  | FALSE        |
| Input Const | `eManModeB2`          | eMANBIN | eMANBIN.Auto |
| Input Const | `eManModeB1`          | eMANBIN | eMANBIN.Auto |

Methods:

> mQuit

> mResetOperatingHours

Structure:

* mQuit (Method)
* mResetOperatingHours (Method)


---

# 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/components/fan2speed.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.
