FB_BARTwilightAutomatic
Twilight automatic
The function block knows 3 different modes, which can be set via the input uiLightCtrlMode:
- Automatic mode
- Manual On mode
- Manual Off mode
Automatic mode
In automatic mode a positive edge on bSwitch activates the twilight automatic, if it had been inactive beforehand. A further edge on bSwitch deactivates the twilight automatic again. The automatic function is explicitly switched on and off with bCentralOn and bCentralOff, independent of the previous state of the automatic function. If the twilight automatic is activated, then the function block switches the output lrDimValue to the switch-on value lrDimValueOn when the brightness falls below a switch-on threshold value uiSwitchOnValue for an entered delay time uiOnDelay. Conversely, if a switch-off threshold value uiSwitchOffValue is exceeded for an entered time delay uiOffDelay, then the output is switched to the value lrDimValueOff. In the inactive state the light output value lrDimValue is set to 0.0.
Manual mode
In the manual operation modes the inputs bSwitch, bCentralOn and bCentralOff have no function: with uiLightCtrlMode=1 the output value lrDimValue is constantly set to lrManualDimValue and with uiLightCtrlMode=2 it is constantly set to 0.0.
Switch-on and switch-off delay
The switch-on and switch-off delays written in automatic mode are always run through irrespective of the state of the automatic function (active or inactive) and the operating mode, i.e. the timers are not reset by these operating states.
VAR_INPUT
eDataSecurityTyp: E_HVACDataSecurityType;
uiLightCtrlMode : UINT;
bSwitch : BOOL;
bCentralOn : BOOL;
bCentralOff : 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 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: 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. |
uiLightCtrlMode : operation mode.
- 0: Automatic mode; the commands bSwitch, bCentralOn and bCentralOff are executable and can be used to switch the twilight automatic on and off.
- 1: Manual On mode; twilight automatic is inactive – the value lrManualDimValue is output without a delay at the output lrDimValueOut, all other command inputs are ineffective.
- 2: Manual Off mode; twilight automatic is inactive – the value 0.0 is output without a delay at the output lrDimValueOut, all other command inputs are ineffective.
bSwitch : positive edges on this input switch the twilight automatic on and off alternately. When switching off the output lrDimValue is set to 0.0. This command input is active only in automatic mode (uiLightCtrlMode=0).
bCentralOn : a positive edge on this input switches the twilight automatic on. This command input is active only in automatic mode (uiLightCtrlMode=0).
bCentralOff : a positive edge on this input switches the twilight automatic off and sets the output lrDimValue to 0.0. This command input is active only in automatic mode (uiLightCtrlMode=0).
uiBrightness : actual light value [lux].
VAR_OUTPUT
lrDimValue : LREAL;
uiRemainingOnDelay : UINT;
uiRemainingOffDelay: UINT;
bControlActive : BOOL;
bError : BOOL;
udiErrorId : UDINT;
lrDimValue : light output value, 0..100%.
uiRemainingOnDelay : countdown of the switch-on delay in seconds. This output is 0 as long as no countdown of the time is taking place.
uiRemainingOffDelay : countdown of the switch-off delay in seconds. This output is 0 as long as no countdown of the time is taking place.
bControlActive : this output is TRUE if the function block is in automatic mode and the twilight automatic is activated. This is intended to serve as an additional feedback signal if switch-on has taken place but the control outputs a light value of lrDimValue=0.0.
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.
Note 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: Example_PERSISTENT.zip.
uiSwitchOnValue : UINT;
uiSwitchOffValue : UINT;
uiOnDelay : UINT;
uiOffDelay : UINT;
lrDimOnValue : LREAL;
lrDimOffValue : LREAL;
lrManualDimValue : LREAL;
uiSwitchOnValue: switch-on threshold. This is compared with the brightness value at the input uiBrightness. This value must be greater than the output threshold value uiSwitchOffValue.
uiSwitchOffValue: switch-off threshold. This is compared with the brightness value at the input uiBrightness.
uiOnDelay: switch-on delay in seconds.
uiOffDelay: switch-off delay in seconds.
lrDimOnValue : switch-on light value in %.
lrDimOffValue : switch-off light value in %.
lrManualDimValue : output dimming value in Manual On mode (uiLightCtrlMode=1).