FB_BARSunblindTwilightAutomatic

This function block controls the blind if the outdoor brightness has fallen below a limit value.

FB_BARSunblindTwilightAutomatic 1:

The twilight automatic operates with both a value hysteresis and a temporal hysteresis: if the outdoor brightness value usiBrightness [lux] falls below the value usiActivateValue [lux] for the time uiActivateDelay [s], then the function block is active and will supply the blind positions uiPositionActiveMode (height in %) and uiAngleActiveMode (slat angle in degrees), which are specified on the IN-OUT variables, at the output in the positioning telegram stSunblind. Conversely, if the outdoor brightness exceeds the value usiDeactivateValue [lux] for the time uiDeactivateDelay [s], then the automatic function is no longer active. The active flag in the positioning telegram stSunblind is reset and the positions for height and angle are set to "0". A function with a lower priority can then take over control.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
bEnable          : BOOL;
uiBrightness     : UINT;

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 released internally.

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_BARSunblindTwilightAutomatic 2: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. In the positioning telegram stSunblind, 0 is output for the position and the angle, and bActive is FALSE. This means that another function takes over control of the blind via the priority controller.

uiBrightness: outdoor brightness in lux.

VAR_OUTPUT

stSunblind               : ST_BARSunblind;
bActive                  : BOOL;
uiRemainingTimeActivate  : UINT;
uiRemainingTimeDeactivate: UINT;
bError                   : BOOL;
udiErrorId               : UDINT;

stSunblind: output structure of the blind positions, 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.

uiRemainingTimeActivate: indicates the time remaining in seconds after falling below the switch value usiActivateValue until automatic mode is activated. This output is 0 as long as no countdown of the time is taking place.

uiRemainingTimeDeactivate: indicates the time remaining in seconds after exceeding the switch value usiDeactivateValue until automatic mode is deactivated. This output is 0 as long as no countdown of the time is taking place.

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_BARSunblindTwilightAutomatic 3:

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

The need for entered parameters to be preserved across a control failure makes it necessary for them to be declared as IN-OUT variables. A reference variable is then assigned to them in the program. Each change in the value of this reference variable is persistently saved in the function block and written back to the reference variable after 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_BARSunblindTwilightAutomatic 4:Example_PERSISTENT.zip.

uiActivateValue      : UINT; 
uiDeactivateValue    : UINT; 
uiActivateDelay      : UINT; 
uiDeactivateDelay    : UINT; 
uiPositionActiveMode : UINT; 
iAngleActiveMode     : INT; 

uiActivateValue: activation limit value in lux.

uiDeactivateValue: deactivation limit value in lux.

uiActivateDelay: activation delay in seconds.

uiDeactivateDelay: deactivation delay in seconds.

uiPositionActiveMode: height position of the blind in % if the twilight automatic is active.

iAngleActiveMode: slat angle of the blind in degrees if the twilight automatic is active.