FB_ScenesLighting

FB_ScenesLighting 1:

This function block is intended for the management of lighting scenes. The function block is enabled via the bEnable input. The loading of the saved scenes is started by a positive edge at the bEnable input. The input must remain TRUE until the operation is completed. The values of the scenes are saved non-volatile in the TwinCAT Boot directory as a *.bin file. The last data status is saved in a *.bak file as a backup.

Save scene

The values of the inputs nActualValueLighting_1..14 are saved in the respective scene by a rising edge at the input bSaveScene_1...16.

Load scenes

The saved values are output at the output nDimmValue_1..14 by a rising edge at the input bInvokeScene_1..16. Furthermore, a positive edge is generated at output bSetDimmValue_1..14 for a PLC cycle.

VAR_INPUT

bEnable                  : BOOL;
bInvokeScene_1           : BOOL;
bInvokeScene_2           : BOOL;
bInvokeScene_3           : BOOL;
bInvokeScene_4           : BOOL;
bInvokeScene_5           : BOOL;
bInvokeScene_6           : BOOL;
bInvokeScene_7           : BOOL;
bInvokeScene_8           : BOOL;
bInvokeScene_9           : BOOL;
bInvokeScene_10          : BOOL;
bInvokeScene_11          : BOOL;
bInvokeScene_12          : BOOL;
bInvokeScene_13          : BOOL;
bInvokeScene_14          : BOOL;
bInvokeScene_15          : BOOL;
bInvokeScene_16          : BOOL;
bSaveScene_1             : BOOL;
bSaveScene_2             : BOOL;
bSaveScene_3             : BOOL;
bSaveScene_4             : BOOL;
bSaveScene_5             : BOOL;
bSaveScene_6             : BOOL;
bSaveScene_7             : BOOL;
bSaveScene_8             : BOOL;
bSaveScene_9             : BOOL;
bSaveScene_10            : BOOL;
bSaveScene_11            : BOOL;
bSaveScene_12            : BOOL;
bSaveScene_13            : BOOL;
bSaveScene_14            : BOOL;
bSaveScene_15            : BOOL;
bSaveScene_16            : BOOL;
nActualValueLighting_1   : UINT;
nActualValueLighting_2   : UINT;
nActualValueLighting_3   : UINT;
nActualValueLighting_4   : UINT;
nActualValueLighting_5   : UINT;
nActualValueLighting_6   : UINT;
nActualValueLighting_7   : UINT;
nActualValueLighting_8   : UINT;
nActualValueLighting_9   : UINT;
nActualValueLighting_10  : UINT;
nActualValueLighting_11  : UINT;
nActualValueLighting_12  : UINT;
nActualValueLighting_13  : UINT;
nActualValueLighting_14  : UINT;
sFile                    : STRING;
nOptions                 : UDINT;

bEnable: enables the function block.

bInvokeScene_1..16: calls the respective scene.

bSaveScene_1..16: saves the current analog value nActualValueLighting_1..14 in the respective scene.

nActualValueLighting_1..14: current control value of the respective lamp. Return value from the dimmer function block FB_Dimmer1Switch().

sFile: file name (without path and file extension) for saving the scenes. The file name must be unique in the entire project. If several instances of the function blocks FB_ScenesLighting() or FB_ScenesVenetianBlind() are created, then each instance must use a different file name. The file is always saved to the TwinCAT Boot directory and is given the extension .bin. Example: 'ControlPanelA'.

nOptions: Reserved for future developments.

VAR_OUTPUT

bSetDimmValue_1     : BOOL;
nDimmValue_1        : UINT;
bSetDimmValue_2     : BOOL;
nDimmValue_2        : UINT;
bSetDimmValue_3     : BOOL;
nDimmValue_3        : UINT;
bSetDimmValue_4     : BOOL;
nDimmValue_4        : UINT;
bSetDimmValue_5     : BOOL;
nDimmValue_5        : UINT;
bSetDimmValue_6     : BOOL;
nDimmValue_6        : UINT;
bSetDimmValue_7     : BOOL;
nDimmValue_7        : UINT;
bSetDimmValue_8     : BOOL;
nDimmValue_8        : UINT;
bSetDimmValue_9     : BOOL;
nDimmValue_9        : UINT;
bSetDimmValue_10    : BOOL;
nDimmValue_10       : UINT;
bSetDimmValue_11    : BOOL;
nDimmValue_11       : UINT;
bSetDimmValue_12    : BOOL;
nDimmValue_12       : UINT;
bSetDimmValue_13    : BOOL;
nDimmValue_13       : UINT;
bSetDimmValue_14    : BOOL;
nDimmValue_14       : UINT;
bInit               : BOOL;
bError              : BOOL;
nErrorId            : UDINT;

bSetDimmValue_1..14: output with the edge for the input bSetDimmValue of the function block FB_Dimmer1Switch().

nDimmValue_1..14: Output with the value for the input nDimmValue of the function block FB_Dimmer1Switch().

bInit: this output goes TRUE as soon as the initialization of the function block is complete.

bError: this output is set to TRUE as soon as an error is detected during execution. The error code is contained in nErrorId.

nErrorId: contains the error code as soon as bError goes TRUE. See Error codes.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4020.32

Tc2_BABasic from v3.1.0.0