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

# Fan2Speed

## `Fan2Speed` (FB)

FUNCTION\_BLOCK Fan2Speed

### Short description

> Control of a two-stage fan\
> Additional functions: air shortage monitoring, operating monitoring, repair switch, manual override, status display\
> Typical application: control of a fan

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fc0QKklPuZN5Py7sonqHx%2FFan2Speed.png?alt=media&amp;token=4661abd5-c6a1-4b4b-a4d0-f61bb569e9a4" alt=""><figcaption></figcaption></figure>

### Functional description

#### General

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

* AirShortage
* ManBin
* OperatingHours

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

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

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

The enable - fan before manual override *xHB* corresponds to the enable - 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 mode  |
| TRUE  | eMANBIN.Auto   | FALSE    | X                | TRUE  | Manual override module in automatic mode  |
| X     | eMANBIN.ManOn  | FALSE    | X                | TRUE  | Manual override module in manual mode On  |
| X     | eMANBIN.ManOff | FALSE    | X                | FALSE | Manual override module in manual mode Off |
| X     | X              | TRUE     | FALSE            | FALSE | Forced override Off                       |
| X     | X              | TRUE     | TRUE             | TRUE  | Forced override On                        |

Legend: X = any

#### Maintenance switch message *xMSwitch*

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

#### Forced override *xForce*

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

#### Operating hours and switch-on cycles

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

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

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

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

#### Operating supervision

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

#### Air shortage monitoring

It is used to detect an air shortage situation by evaluating the signals at the inputs air shortage situation message *xPFb* and the fan operating signal *xFb*.\
The air shortage monitoring can be enabled (= TRUE) or disabled (= FALSE) by the setpoint / parameter **xPFbControl** In the disabled state, the output - fault message *xAlarmPFb* is not activated (= FALSE).\
\
The output - fault message *xAlarmPFb* is activated (*xAlarmPFb* = TRUE) if conditions 1 and 2 below are met at the same time.\
\
Condition 1: The input for the differential pressure switch *xPFb* is permanently in state FALSE (= air shortage situation) for at least the waiting time *udiPFbControlTime* Condition 2: The operating signal for the fan *xFb* is permanently in state FALSE (= air shortage situation) for at least the waiting time *udiPFControlTime* is permanently in state TRUE (= fan in operation).\
\
\
The output - fault message *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 message *xQuit* is active (= TRUE).

#### Collective fault message *xAlarm*

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

#### Collective automatic operation message *xAuto*

The collective automatic operation message *xAuto* is activated (= TRUE) if the input *eAOO* contains the value HVACTYPES.eManBin.Auto and the setpoint / parameter **eManModeB** contains the value eMANBIN.Auto.\
In all other cases, the collective automatic operation 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
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/components/fan2speed.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.
