FB_BARSunblindTwilightAutomatic

This function block controls the blind if the outdoor brightness has fallen below a limit value.
The automatic twilight function operates with both a value hysteresis and a temporal hysteresis: If the external 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 position telegram stSunblind. Conversely, if the external 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:= eHVACDataSecurityType_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: 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 both position and angle in the positioning telegram stSunblind and bActive is FALSE. This means that another function takes over control of the blind via the priority controller.
uiBrightness: External 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 serves merely to indicate whether the function block is sending an active telegram.
uiRemainingTimeActivate: Indicates the time remaining in seconds until the activation of the automatic function after falling below the switch value usiActivateValue. This output is 0 as long as no countdown of the time is taking place.
uiRemainingTimeDeactivate: Indicates the time remaining in seconds until the deactivation of the automatic function after the switch value usiDeactivateValue has been exceeded. 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.
![]() | 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
uiActivateValue : UINT;
uiDeactivateValue : UINT;
uiActivateDelay : UINT;
uiDeactivateDelay : UINT;
uiPositionActiveMode : UINT;
iAngleActiveMode : INT;
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 to be defined as input variables, they would not be able to write a reference variable.
Application example: example_persistent.zip.
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 automatic twilight function is active.
iAngleActiveMode: Slat angle of the blind in degrees if the automatic twilight function is active.
Requirements
Development environment | required library | required function |
---|---|---|
TwinCAT 3.1 build 4022.16 or higher | Tc2_HVAC V3.3.1.0 | TF8000 | TC3 HVAC V1.0.0.0 |