FB_BARLightActuator

This function block serves to control a conventional light actuator. The outputs cover the value ranges 0..100%, 0..32767 and On/Off.
On top of that the function block contains a scene memory in which up to 21 different light values can be saved.

FB_BARLightActuator 1:

In principle the function block passes the values on the input lrTargetValue through to the output lrDimValue. Conversely, a positive edge on the input bCallScene sets the output to the light value that is saved in the scene table arrLightScenes under the index usiSelectedScene. The output bSceneMode then changes to TRUE. If the scene index usiSelectedScene changes, then the newly selected scene value is adopted only on another positive edge on bCallScene. The scene mode is quit again by a change of value on the input lrTargetValue or a positive edge on bStopScene. The output bSceneMode goes back to FALSE and the output lrDimValue once again follows the input lrTargetValue. A TRUE signal on bSaveScene saves the current light output value into the scene table arrLightScenes under the index usiSelectedScene.

The light output value lrDimValue always follows the target values specified to it via a ramp. As in the case of the user function FB_BARLightCircuitDim, this is defined by a ramp time – in this case uiSecDimTime – which indicates the time interval in seconds that the light output value should require in order to change by 100%.

FB_BARLightActuator 2:

Since the light sensor function block FB_BARLightCircuitDim also contains a ramp function for presetting the target value, the light actuator function described here is called the "secondary dimtime" - uiSecDimTime.
If both have different values, then the longer ramp time is always the relevant one:

Example1:

FB_BARLightActuator 3:

In this constellation the function block FB_BARLightCircuitDim will change its output value lrDimValue from 0% to 100% in 10 s. However, the function block FB_BARLightActuator can follow these continuously changing setpoint values only with a ramp time of 20 s (related to a change from 0% to 100%). Therefore this is ultimately the resulting ramp time.


Example2:

FB_BARLightActuator 4:

Conversely the function block FB_BARLightActuator could follow much faster here with a ramp time of 10 s. However, since the dimming function block FB_BARLightCircuitDim presets its setpoints in this example only with a ramp time of 20 s, this longer time is also relevant in this case.
It must be noted in this example that a short button press on the function block FB_BARLightCircuitDim immediately changes the output lrDimValue to the internally-saved value (see FB_BARLightCircuitDim). Hence, the ramp time on the FB_BARLightActuator is then relevant.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
lrTargetValue    : LREAL;
usiSelectedScene : USINT;
bCallScene       : BOOL;
bStopScene       : BOOL; 
bSaveScene       : BOOL;

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_BARLightActuator 5: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.

lrTargetValue : target value of light output in 0..100%;

usiSelectedScene : selected lighting scene, 0..20;

bCallScene : sets the output value, controlled by a ramp, to the light value entered in the index usiSelectedScene (arrLightScenes).

bStopScene : resets the output value to the value lrTargetValue. The change is likewise controlled by a ramp.

bSaveScene : saves the current light value at the output lrDimvalue in the light value table arrLightScenes under the index usiSelectedScene.

VAR_OUTPUT

lrDimValue: LREAL;
iDimValue : INT;
bOn       : BOOL;
bSceneMode: BOOL;
bError    : BOOL;
udiErrorId: UDINT;

lrDimValue : output light value in 0..100%.

iDimValue : output light value in 0..32767.

bOn : output light status: lrDimmValue=0.0 => bOn=FALSE - lrDimmValue>0.0 => bOn=TRUE.

bSceneMode : the function block presently outputs a scene value and not the value lrTargetValue on the input.

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_BARLightActuator 6:Example_PERSISTENT.zip.

uiSecDimTime   : UINT;
arrLightScenes : ARRAY[0..20] OF LREAL;

uiSecDimTime : ramp time in seconds. This is the time that the light actuator function requires in order to regulate from 0..100%.

arrLightScenes : table of saved light values.