# Shade

## `Shade` (FB)

FUNCTION\_BLOCK Shade

### Short description

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

### 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 - 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      |             |               | Combined message automatic mode |

#### Setpoints / Parameters

| Name              | Data type | Value range                                 | Initial value | Function                                                           |
| ----------------- | --------- | ------------------------------------------- | ------------- | ------------------------------------------------------------------ |
| **tFullMovement** | TIME      |                                             | T#30s         | Duration for complete opening / closing                            |
| **tPulse**        | TIME      |                                             | T#600ms       | Duration of the pulse for slat adjustment                          |
| **tButton**       | TIME      |                                             | T#900ms       | Duration to distinguish slat adjustment / complete opening/closing |
| **tWaitReverse**  | TIME      |                                             | T#2s          | Waiting 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 shutter/venetian blind actuator with up ( *xUp* ) and down commands ( *xDown* ).\
The up and down commands can be overridden by the parameters **eManModeUp** and **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 the function to be executed ( duration < **tButton**: complete 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 in the reverse case.\
If during a complete 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 complete 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 complete closing of the shutter ( *xDown* = TRUE and *xUp* = FALSE during the duration **tFullMovement** ).\
If the inputs for the central control remain permanently active ( = TRUE ), operation via the buttons *xButtonUp* and *xButtonDown* is not possible.

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

The switching from opening to closing of the shutter 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 a continuous pressing of the control buttons *xUp* or *xDown* for a duration greater than the duration to distinguish slat adjustment / complete opening/closing **tButton** is triggered.\
While the respective button is pressed, a symmetric output signal ( pause duration = pulse duration = **tPulse** ) is generated at the assigned output.

#### Complete opening / closing

Complete opening / closing is triggered by pressing the respective assigned buttons *xUp* and *xDown* for a period shorter than the duration to distinguish slat adjustment / complete opening/closing **tButton** is triggered.\
At the corresponding output a signal ( state = TRUE ) is then generated without further influence for a duration of **tFullMovement** is generated.\
At the other output no signal ( state = FALSE ) is generated during this period.

#### Combined message automatic mode *xAuto*

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

* 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 |
