FB_BAFLightingDimmerSwitch

FB_BAFLightingDimmerSwitch 1:

Function-block for controlling a Dimmer-Switch directly out of the PLC-program.

VAR_INPUT

uiId                    : UINT;
bStartExecution         : BOOL;
bStopExecution          : BOOL;
bOn                     : BOOL;
bOff                    : BOOL;
bToggleLastControlValue : BOOL;
bToggleMaxControlValue  : BOOL;
bCallMinControlValue    : BOOL;
bCallMaxControlValue    : BOOL;
bSetControlValueDirect  : BOOL;
lrSetControlValueDirect : LREAL;
bFadeUp                 : BOOL;
bFadeDown               : BOOL;
bStepUp                 : BOOL;
bStepDown               : BOOL;

uiId: Object id of the instance (see object id).

bStartExecution: Starts the instance of the lighting.

bStopExecution: Stops the instance of the lighting.

bOn: The assigned lamp group will be turned on.

bOff: The assigned lamp group will be turned off. If the average value of the lamp group (lrAverageControlValue) is greater than 0, it will be stored in lrResettingValue.

bToggleLastControlValue: uiToggleMode = 0 (toggling between On and Off): the assigned lamp group will be turned on if the average control value is 0 and turned off if it is greater than 0. These actions will be done by sending either the bOn or the bOff-command.
uiToggleMode = 0 (toggling between lrResettingValue and Off): If the average control value of the assigned lamp group is 0, the group will be set to lrResettingValue by sending the bSetControlValueDirect-command. The group will be turned off, if its average control value is greater than 0 by sending the bOff-command.

bToggleMaxControlValue: The assigned lamp group will be switched between Off and the maximum control value. If the average control-value is greater than 0, the bOff-command will be sent to the specific group. If it is 0, the command bCallMaxControlValue will be executed.

bCallMinControlValue: The command bCallMinControlValue will be sent to the assigned lamp group.

bCallMaxControlValue: The command bCallMaxControlValue will be sent to the assigned lamp group.

bSetControlValueDirect: The command bSetControlValueDirect will be sent to the assigned lamp group. If lrSetControlValueDirect is 0, lrAverageControlValue will be saved in lrResettingValue.

lrSetControlValueDirect: Control value, which will be sent to the assigned lamp group, if bSetControlValueDirect was executed.

bFadeUp: The command bFadeUp will be sent to the assigned lamp group.

bFadeDown: The command bFadeDown will be sent to the assigned lamp group.

bStepUp: The bStepUp-command of all lamps of the assigned lamp group will be executed.

bStepDown: The bStepDown-command of all lamps of the assigned lamp group will be executed.

VAR_OUTPUT

uiErrorId             : UINT;
iErrorParameter       : INT;
eExecutionState       : E_BAF_ExecutionState;
lrAverageControlValue : LREAL;
lrResettingValue      : LREAL;

uiErrorId: Contains the error code of the last executed command (see Error codes).

iErrorParameter: Contains the specific parameter of the error code (see Error codes).

eExecutionState: Contains the actual execution state of the instance of the lighting.

lrAverageControlValue: The average control value (0% - 100%) of the assigned lamp group.

lrResettingValue: The resetting value (0% - 100%) of the lighting. If the lighting is turned off, the average value lrAverageControlValue will be stored in this variable.