FB_BARRollerBlind

This function block is used for positioning of a blind via two outputs: up and down. The blind can be driven to any desired position with the positioning telegram stSunblind. On top of that, the positioning telegram stSunblind also contains manual commands with which the blind can be moved individually to certain positions. These manual commands are controlled by the function block FB_BARSunblindSwitch.

FB_BARRollerBlind 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

The current height position and the slat angle are not read in by an additional encoder, but are determined internally by the runtime of the blind.
The two different runtime parameters udiTotalTimeUp (runtime blind up in ms) and udiTotalTimeDown (runtime blind down in ms) take into account the different travel characteristics.

Functioning

The function block fundamentally controls the blind via the information from the positioning telegram stSunblind. If automatic mode is active (bManualMode=FALSE), the current position is always approached, and changes are immediately taken into account. In manual mode (bManualMode=TRUE) the commands bManUp and bManDown control the blind.

Referencing

Secure referencing is ensured if the blind is driven upward for longer than its complete travel-up time. The position is then always "0". Since a blind positioning without encoder is always error-prone by nature, it is important to reference automatically as often as possible: every time the position "0" is to be approached, the blind first moves up normally with continuous position calculation. Once the calculated position value 0% is reached, the output bBlindUp continues to be held for the complete travel-up time + 5s.
For reasons of flexibility there are now two possibilities to interrupt the referencing procedure: until the calculated 0% position is reached, a change in position continues to be assumed and executed. Once this 0% position is reached, the blind can still be moved with the manual "blind down" command. These two sensible limitations make it necessary for the user to ensure that the blind is securely referenced as often as possible.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
bEnable          : BOOL;
stSunblind       : ST_BARSunblind;

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_BARRollerBlind 2:Example_PERSISTENT.zip

If eDataSecurityType:= eDataSecurityType_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: enable input for the function block. As long as this input is TRUE, the actuator function block accepts and executes commands as described above. A FALSE signal on this input resets the control outputs bBlindUp and bBlindDown and the function block remains in a state of rest.

stSunblind: positioning telegram, see ST_BARSunblind.

VAR_OUTPUT

bBlindUp     : BOOL;
bBlindDown   : BOOL;
uiActPosition: UINT;
bReferencing : BOOL;
bBusy        : BOOL;
bError       : BOOL;
udiErrorId   : UDINT;

bBlindUp: control output blind up.

bBlindDown: control output blind down.

uiActPosition: current position in percent.

bReferencing: the blind is referencing, i.e. the output bBlindUp is set for the complete travel-up time + 5 s. Only a manual "down" command can move the blind in the opposite direction and terminate this mode.

bBusy: a positioning or a referencing procedure is in progress.

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.

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_BARRollerBlind 3:Example_PERSISTENT.zip.

udiTotalTimeUp      : UDINT;
udiTotalTimeDown    : UDINT;

udiTotalTimeUp: total time for driving up in ms.

udiTotalTimeDown: total time for driving down in ms.