FB_BARSunblindScene

This function block represents an extension of the manual operation FB_BARSunblindSwitch by a scene memory and a call function. The blind actuator FB_BARSunblindActuator or the roller blind actuator FB_BARRollerblind can thus be controlled in manual operation mode and can also drive directly to previously saved positions (scenes). Up to 21 scenes can be saved.

FB_BARSunblindScene 1:

Structure of the blind positioning telegram stSunblind.

TYPE ST_BARSunblind:
STRUCT
     uiPosition  : UINT;
     iAngle      : INT;
     bManUp      : BOOL;
     bManDown    : BOOL;
     bManualMode : BOOL;
     bActive     : BOOL;
END_STRUCT
END_TYPE

Mode of operation

In manual mode, the function block controls the blind function block FB_BARSunblindActuator or the roller blind function block FB_BARRollerblind via the command inputs bSwitchUp and bSwitchDown; bSwitchUp has priority. The commands are passed on to the respective commands bManUp and bManDown of the positioning telegram. If a command input is activated for longer than the entered time uiSwitchOverTime (in ms), the corresponding control command latches. Activating a command input again clears this latching.
A rising edge at bSaveScene saves the current position and the slat angle in the scene selected at usiSelectedScene. This procedure is possible at any time, even during active positioning. The selected scene is called with bInvokeScene, i.e. the saved position and angle values are approached.

Linking to the blind function block

Like the "normal" manual control function block, FB_BARSunblindSwitch, the scene selection function block can be connected to the blind function block either directly or via an upstream priority controller FB_BARSunblindPrioritySwitch. The connection is made via the positioning telegram stSunblind. Furthermore the scene function block requires the current positions from the blind function block for the reference blind:

Use of a priority controller:

FB_BARSunblindScene 2:

Direct connection:

FB_BARSunblindScene 3:

VAR_INPUT

eDataSecurityType : E_HVACDataSecurityType;
bEnable           : BOOL;
usiSelectedScene  : USINT;
bSwitchUp         : BOOL;
bSwitchDown       : BOOL;
bInvokeScene      : BOOL;
bSaveScene        : BOOL;
uiSetpointPosition: UINT;
iSetpointAngle    : INT;

eDataSecurityType:if eDataSecurityType:= eDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not internally released.

A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted, the saved data are automatically read back from the flash into the RAM.

Application example: FB_BARSunblindScene 4:Example_PERSISTENT.zip

If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.

Notice

A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

bEnable : the function block has no function if this input is FALSE. 0 is output for the position and the angle in the positioning telegram stSunblind - bManualMode and bActive are set to FALSE. For a connection with priority controller this means that another functionality takes over control of the blind. Conversely, a direct connection allows the blind to drive directly to the 0 position, i.e. fully up, since the actuator function block does not evaluate the bit bActive itself.

usiSelectedScene : selected scene which should either be saved (bSaveScene) or called (bInvokeScene).

bSwitchUp: command input blind up.

bSwitchDown: command input blind down.

bInvokeScene : call selected scene.

bSaveScene: save selected scene.

uiSetpointPosition: set position in % that is to be saved in the selected scene. This must be linked to the actual position of the actuator function block FB_BARSunblindActuator or FB_BARRollerblind of the reference blind/roller blind, in order to be able to save a position that was previously approached manually.

iSetpointAngle : ditto slat angle in degrees.

VAR_OUTPUT

stSunblind            : ST_BARSunblind;
bActive               : BOOL;
uiPositionActScene    : UINT;
iAnglePositionActScene: INT;
bError                : BOOL;
udiErrorId            : UDINT;

stSunblind: positioning telegram, see ST_BARSunblind.

bActive : corresponds to the boolean value bActive in the blind telegram ST_BARSunblind and is solely used to indicate whether the function block sends an active telegram.

uiPositionActScene : indicates the saved relative blind height position in % for the currently selected scene.

iAnglePositionActScene : ditto slat angle in degrees.

bError: this output is switched to TRUE if the parameters entered are erroneous.

udiErrorId : contains the error code if the values entered should be erroneous. See error codes.

FB_BARSunblindScene 5:

If an error should occur, then this automatic function is deactivated and position and angle are set to 0. This means that if a priority controller is in use, another function with a lower priority (see Overview) automatically takes over control of the blind. In the case of a direct connection, conversely, the blind will drive to position/angle 0.

VAR_IN_OUT

In order for the registered parameters to be retained beyond a controller failure, it is necessary to declare them as In-Out variables. A reference variable is then assigned to them in the program. Each change of the value of these reference variables is persistently stored in the function block and written back to the reference variable following a controller failure and restart. If the parameters were only declared as input variables, they would not be able to write a reference variable.
Application example: FB_BARSunblindScene 6:Example_PERSISTENT.zip.

uiSwitchOverTime : UINT;
arrBlindScenes   : ARRAY[0..20] OF ST_BARSunblindScene;

uiSwitchOverTime : time in milliseconds until the corresponding manual command in the positioning telegram stSunblind switches to latching mode, if the command input is activated permanently.

arrBlindScenes : table with the scene entries of the type ST_BARSunblindScene. Up to 21 scenes can be saved: 0..20.