FB_BARDelayedHysteresis

This function block represents a threshold switch for brightness. The switch-on and switch-off behavior can additionally be delayed.

FB_BARDelayedHysteresis 1:

VAR_INPUT

eDataSecurityType  : E_HVACDataSecurityType;
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 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_BARDelayedHysteresis 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.

uiBrightness: outdoor brightness in lux.

VAR_OUTPUT

bOut       : BOOL;
bError     : BOOL;
udiErrorId : UDINT;

bOut: binary delayed output of the threshold switch.

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

uiOnValue  : UINT;
uiOffValue : UINT;
uiOnDelay  : UINT;
uiOnDelay  : UINT;

uiOnValue: switch-on threshold value in lux. This must be greater than the switch-off threshold value usiOffValue.

uiOffValue: switch-off threshold value in lux. This must be smaller than the switch-on threshold value usiOnValue.

uiOnDelay: switch-on delay in seconds.

uiOffDelay: switch-off delay in seconds.