# Shade

## `Shade` (FB)

FUNCTION\_BLOCK Shade

### Short description

> Control of a roller-shutter actuator with up/down commands and central control\
> Additional functions: slat adjustment / central control / comfort functions\
> Typical application: control of a standard roller-shutter actuator

### Representation

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

### Interfaces

#### Inputs

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

#### Outputs

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

#### Setpoints / parameters

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

### Function description

#### General

This function block controls a roller-shutter actuator 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 is via the pushbutton inputs *xButtonUp* and *xButtonDown*.\
A higher-level central control via the inputs *xCentralUp* and *xCentralDown* is possible.\
The duration of the activation of the inputs *xButtonUp* and *xButtonDown* decides which function is executed (duration < **tButton**: full opening/closing, duration >= **tButton**: slat adjustment).\
There is additionally a forced control of the outputs *xUP* and *xDown* , i.e. when the output *xUp* is active (= TRUE), the output *xDown* is simultaneously deactivated (= FALSE). This also applies to the reverse case.\
If during a full opening / closing one of the two buttons (*xButtonUp* = TRUE and / or *xButtonDown* = TRUE) is pressed, the opening / closing is interrupted immediately.

#### Central control

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

#### Wait duration for switching between opening and closing **tWaitReverse**

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

#### Slat adjustment

Slat adjustment is triggered by continuous pressing of the control buttons *xUp* or *xDown* for a duration greater than the duration for distinguishing slat adjustment / full opening/closing **tButton** is triggered.\
During the activation of the respective button a symmetrical output signal (pause duration = pulse duration = **tPulse**) is generated at the assigned output.

#### Full opening / closing

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

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

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

* Input *eAOOUp* = HVACTYPES.eManBin.Auto
* Input *eAOODown* = HVACTYPES.eManBin.Auto
* Setpoint / parameters **eManModeUp** = eMANBIN.Auto
* Setpoint / parameters **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: 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/shade.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.
