> 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-1.md).

# Shade B

## `ShadeB` (FB)

FUNCTION\_BLOCK Shade B

### Short description

> Control of a blind actuator with open/close commands, pushbutton operation, and central control.&#x20;
>
> Additional functions: slat adjustment via long button press, target-position travel, and end-position approach.&#x20;
>
> Convenience functions: start/stop toggle via short button press, direction-change lockout, overrun time, and mutual interlocking.&#x20;
>
> Typical application: control of a standard blind actuator with local operation, central command, and position setpoint.

### Representation

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

### Interfaces

#### Inputs

<table><thead><tr><th width="117">Name</th><th width="105">Data type</th><th width="136">Value range</th><th width="113">Initial value</th><th width="192">Function</th></tr></thead><tbody><tr><td><em>xButtonUp</em></td><td>BOOL</td><td></td><td></td><td>Request - blind opening via button</td></tr><tr><td><em>xButtonDown</em></td><td>BOOL</td><td></td><td></td><td>Request - blind closing via button</td></tr><tr><td><em>xCentralUp</em></td><td>BOOL</td><td></td><td></td><td>Request - blind opening via central control</td></tr><tr><td><em>xCentralDown</em></td><td>BOOL</td><td></td><td></td><td>Request - blind closing via central control</td></tr><tr><td><em>eAOOUp</em></td><td>HVACTYPES.eManBin</td><td>HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn</td><td>HVACTYPES.eManBin.Auto</td><td>Manual override operating mode - hardware for blind opening</td></tr><tr><td><em>eAOODown</em></td><td>HVACTYPES.eManBin</td><td>HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn</td><td>HVACTYPES.eManBin.Auto</td><td>Manual override operating mode - hardware for blind closing</td></tr><tr><td>rTargetPos</td><td>REAL</td><td>0.0 … 100.0 %</td><td></td><td>Target position of the blind; 0% = open / up, 100% = closed / down</td></tr></tbody></table>

#### Outputs

<table><thead><tr><th>Name</th><th>Data type</th><th width="142">Value range</th><th>Initial value</th><th>Function</th></tr></thead><tbody><tr><td><em>xUp</em></td><td>BOOL</td><td></td><td></td><td>Enable - blind opening</td></tr><tr><td><em>xDown</em></td><td>BOOL</td><td></td><td></td><td>Enable - blind closing</td></tr><tr><td><em>xAuto</em></td><td>BOOL</td><td></td><td></td><td>Collective message automatic mode</td></tr><tr><td>rPos</td><td>REAL</td><td>0.0 … 100.0 %</td><td></td><td>Calculated current position of the blind; 0% = open / up, 100% = closed / down</td></tr></tbody></table>

#### Setpoints / Parameters

<table><thead><tr><th>Name</th><th width="114">Data type</th><th>Value range</th><th width="82">Initial value</th><th width="200">Function</th></tr></thead><tbody><tr><td>rHysterese</td><td>REAL</td><td></td><td>3.0</td><td>Hysteresis for setpoint position comparison and end-position range (%)</td></tr><tr><td>udiFullMovement</td><td>UDINT</td><td></td><td></td><td>Time for complete blind opening / closing movement (seconds)</td></tr><tr><td>udiAddFullMovement</td><td>UDINT</td><td></td><td></td><td>additional safety time for end position (seconds)</td></tr><tr><td>udiPulseNeigung</td><td>UDINT</td><td></td><td></td><td>Pulse time for slat adjustment (milliseconds)</td></tr><tr><td>udiButton</td><td>UDINT</td><td></td><td></td><td>Time to distinguish short press / long press (milliseconds)</td></tr><tr><td>udiWaitReverse</td><td>UDINT</td><td></td><td></td><td>Lockout time when changing direction (seconds)</td></tr><tr><td>eManModeUp</td><td>eMANBIN</td><td>eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn</td><td></td><td>Manual override operating mode for UP</td></tr><tr><td>eManModeDown</td><td>eMANBIN</td><td>eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn</td><td></td><td>Manual override operating mode for DOWN</td></tr></tbody></table>

### Functional description

#### General

***

The function block ShadeB controls a blind via the outputs xUp (open) and xDown (close). Both outputs are mutually interlocked: if xUp is active (= TRUE), xDown is simultaneously deactivated (= FALSE) and vice versa. Simultaneous activation of both outputs is not possible.

The output commands can be manually overridden independently of the automatic function by the parameters eManModeUp and eManModeDown.

Operation is primarily via the local pushbutton inputs xButtonUp and xButtonDown. A higher-level central control is available via the inputs xCentralUp and xCentralDown. The duration of the button press determines the function performed:

* Duration < tButton → short press: complete opening / closing (toggle start/stop)
* Duration ≥ tButton → long press: slat adjustment in pulse mode

If one of the buttons xButtonUp or xButtonDown is pressed during an ongoing complete opening or closing, the movement is stopped immediately.

***

**Central control**

Each rising edge at input xCentralUp triggers a complete opening of the blind (xUp = TRUE, xDown = FALSE for the duration tFullMovement). An additional overrun time tAddFullMovement ensures that the mechanical end position is reached reliably.

Each rising edge at input xCentralDown triggers a complete closing of the blind (xDown = TRUE, xUp = FALSE for the duration tFullMovement).

If xCentralUp or xCentralDown remain active (= TRUE) permanently, simultaneous local operation via xButtonUp / xButtonDown is not possible. Only after the central command is removed can the movement be stopped or restarted by local button operation. A central command during an active automatic movement stops it immediately and takes over control.

***

**Complete opening / closing (short press)**

A short button press (actuation duration < tButton) on xButtonUp or xButtonDown activates the start/stop toggle of the movement. On first press the movement starts, on second press it stops. A signal (= TRUE) is generated at the corresponding output for the duration tFullMovement. No signal is present at the respective other output (= FALSE).

***

**Slat adjustment (long press)**

A long button press (actuation duration ≥ tButton) on xButtonUp or xButtonDown activates pulse mode for stepwise slat adjustment. During button actuation, a symmetrical pulse signal is generated at the assigned output (pulse duration = pause duration = tPulse). Pulse mode is active only while the button is pressed and stops immediately upon release.

***

**Waiting time for direction change (tWaitReverse)**

Switching from opening to closing and vice versa is delayed by the parameter tWaitReverse in order to protect the actuator from damage caused by an immediate reversal of direction. A value of 0.0 s allows immediate switching without delay.

***

**Automatic movement (rTargetPos)**

Via the input rTargetPos (REAL, 0–100%), the blind can be automatically moved to a target position. Automatic movement starts as soon as the setpoint differs from the current position by more than the configured hysteresis. Targets in the end-position range are automatically snapped in:

* Setpoint ≤ hysteresis → target position is set to 0% (fully open)
* Setpoint ≥ 100% − hysteresis → target position is set to 100% (fully closed)

Automatic movement is interrupted immediately by any local button press or central command. After reaching the target position, the automatic system stops automatically.

***

**End-position handling**

In the end ranges of the blind (position 0–3% and 97–100%), special stop logic applies: A button press during a movement in the end position stops the movement immediately and locks the output. Another button press (any button, local or central) lifts the lock and restores normal operation. At program start (rPos = 0, no active movement command), this logic is not triggered.

***

**Collective message automatic mode xAuto**

The collective 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

### Codsys

InOut

| Scope       | Name               | Type    | Initial      |
| ----------- | ------------------ | ------- | ------------ |
| Input       | xButtonUp          | BOOL    |              |
| Input       | xButtonDown        | BOOL    |              |
| Input       | xCentralUp         | BOOL    |              |
| Input       | xCentralDown       | BOOL    |              |
| Input       | eAOOUp             | eManBin |              |
| Input       | eAOODown           | eManBin |              |
| Input       | rTargetPos         | REAL    |              |
| Input       | xNewTarget         | BOOL    |              |
| Output      | xUp                | BOOL    |              |
| Output      | xDown              | BOOL    |              |
| Output      | xAuto              | BOOL    |              |
| Output      | rPos               | REAL    |              |
| Input Const | udiFullMovement    | UDINT   | 30           |
| Input Const | udiAddFullMovement | UDINT   | 5            |
| Input Const | udiButton          | UDINT   | 900          |
| Input Const | udiPulseNeigung    | UDINT   | 600          |
| Input Const | udiWaitReverse     | UDINT   | 2            |
| Input Const | rHysterese         | REAL    | 3            |
| 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/components/shade-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
