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

# Shade

## `Shade` (FB)

FUNCTION\_BLOCK Shade

### Short description

> Control of a shade drive with up/down commands and central control\
> Additional functions: slat adjustment / central control / comfort functions\
> Typical application: control of a standard shade drive

### Representation

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

### Interfaces

#### Inputs

| Name           | Data type         | Value range                                                               | Initial value          | Function                                                       |
| -------------- | ----------------- | ------------------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------- |
| *xButtonUp*    | BOOL              |                                                                           |                        | Request - shade opening via button                             |
| *xButtonDown*  | BOOL              |                                                                           |                        | Request - shade closing via button                             |
| *xCentralUp*   | BOOL              |                                                                           |                        | Request - shade opening via central control                    |
| *xCentralDown* | BOOL              |                                                                           |                        | Request - shade closing via central control                    |
| *eAOOUp*       | HVACTYPES.eManBin | HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn | HVACTYPES.eManBin.Auto | Operating mode of manual override - hardware for shade opening |
| *eAOODown*     | HVACTYPES.eManBin | HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn | HVACTYPES.eManBin.Auto | Operating mode of manual override - hardware for shade closing |

#### Outputs

| Name    | Data type | Value range | Initial value | Function                               |
| ------- | --------- | ----------- | ------------- | -------------------------------------- |
| *xUp*   | BOOL      |             |               | Enable - shade opening                 |
| *xDown* | BOOL      |             |               | Enable - shade closing                 |
| *xAuto* | BOOL      |             |               | Collective automatic operation message |

#### Setpoints / Parameters

| Name              | Data type | Value range                                 | Initial value | Function                                                                  |
| ----------------- | --------- | ------------------------------------------- | ------------- | ------------------------------------------------------------------------- |
| **tFullMovement** | TIME      |                                             | T#30s         | Time period for complete opening / closing                                |
| **tPulse**        | TIME      |                                             | T#600ms       | Time period of the pulse for slat adjustment                              |
| **tButton**       | TIME      |                                             | T#900ms       | Time period for distinguishing slat adjustment / complete opening/closing |
| **tWaitReverse**  | TIME      |                                             | T#2s          | Waiting time for the switching between opening and closing                |
| **eManModeUp**    | eMANBIN   | eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn | eMANBIN.Auto  | Operating mode of manual override - shade opening                         |
| **eManModeDown**  | eMANBIN   | eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn | eMANBIN.Auto  | Operating mode of manual override - shade closing                         |

### Functional description

#### General

This function block controls a shade drive with up (*xUp*) and down commands (*xDown*).\
The up and down commands can be overridden by the parameters **eManModeUp** or **eManModeDown** independently of the automatic functions.\
Operation takes place via the button inputs *xButtonUp* and *xButtonDown*.\
Central control via the inputs *xCentralUp* and *xCentralDown*  is possible.\
The duration of actuation of the inputs *xButtonUp* and *xButtonDown*  determines the function performed (actuation time < **tButton**: complete opening/closing, actuation time >= **tButton**: slat adjustment).\
In addition, a forced control of the outputs *xUP* and *xDown*  takes place, i.e. if output *xUp*  is active (= TRUE), then output *xDown*  is deactivated (= FALSE) at the same time. This also applies to the reverse case.\
If, during a complete opening/closing, one of the two buttons (*xButtonUp* = TRUE and / or *xButtonDown* = TRUE) is pressed, opening/closing is interrupted immediately.

#### Central control

Each rising edge at the input Request - shade opening via central control *xCentralUp* triggers the complete opening of the shade (*xUp* = TRUE and *xDown* = FALSE during the time period **tFullMovement**).\
Each rising edge at the input Request - shade closing via central control *xCentralDown* triggers the complete closing of the shade (*xDown* = TRUE and *xUp* = FALSE during the time period **tFullMovement**).\
If the inputs for central control are permanently active (= TRUE), operation via the buttons *xButtonUp* and *xButtonDown*  is not possible.

#### Waiting time for the switching between opening and closing **tWaitReverse**

The switching from opening to closing of the shade and vice versa can be delayed in time by this setpoint / parameter.\
The value 0.0s allows immediate switching.

#### Slat adjustment

The slat adjustment is triggered by continuous actuation of the control buttons *xUp* or *xDown* during a period greater than the time for distinguishing slat adjustment / complete opening/closing **tButton** .\
During actuation of the respective button, a symmetrical output signal (pause duration = pulse duration = **tPulse**) is generated at the assigned output.

#### Complete opening / closing

Complete opening / closing is triggered by actuation of the respectively assigned buttons *xUp* or *xDown* during a period less than the time for distinguishing slat adjustment / complete opening/closing **tButton** .\
A signal (state = TRUE) with a duration of **tFullMovement**  is then generated at the corresponding output without further influence.\
No signal (state = FALSE) is generated at the respective other output during this time period.

#### Collective automatic operation message *xAuto*

The collective automatic operation message *xAuto* is activated (= TRUE) if the following conditions are simultaneously met:

* Input *eAOOUp* = HVACTYPES.eManBin.Auto
* Input *eAOODown* = HVACTYPES.eManBin.Auto
* Setpoint / parameter **eManModeUp** = eMANBIN.Auto
* Setpoint / parameter **eManModeDown** = eMANBIN.Auto

### CODESYS

InOut:

| Scope       | Name            | Type    | Initial      |
| ----------- | --------------- | ------- | ------------ |
| Input       | `xButtonUp`     | `BOOL`  |              |
| Input       | `xButtonDown`   | `BOOL`  |              |
| Input       | `xCentralUp`    | `BOOL`  |              |
| Input       | `xCentralDown`  | `BOOL`  |              |
| Input       | `eAOOUp`        | eManBin |              |
| Input       | `eAOODown`      | eManBin |              |
| Output      | `xUp`           | `BOOL`  |              |
| Output      | `xDown`         | `BOOL`  |              |
| Output      | `xAuto`         | `BOOL`  |              |
| Input Const | `tFullMovement` | `TIME`  | TIME#30s0ms  |
| Input Const | `tPulse`        | `TIME`  | TIME#600ms   |
| Input Const | `tButton`       | `TIME`  | TIME#900ms   |
| Input Const | `tWaitReverse`  | `TIME`  | TIME#2s0ms   |
| Input Const | `eManModeUp`    | eMANBIN | eMANBIN.Auto |
| Input Const | `eManModeDown`  | eMANBIN | eMANBIN.Auto |


---

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