FB_BAFLightingDaylightLightControl

FB_BAFLightingDaylightLightControl 1:

Function-block for controlling a Daylight Lighting-Control 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;
bDisableRegulator       : BOOL;
bEnableRegulator        : 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.
Sending this command, while the light-control is active will turn off all assigned lamp-groups and disable the regulator.

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 lrResettingValueand 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 groups will be executed.

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

bSetSetpointValueShiftDirect: The setpoint value shift, entered in lrSetSetpointValueShiftDirect will be taken over.

lrSetSetpointValueShiftDirect: See lrSetSetpointValueShiftDirect.

bSetpointValueShiftUp: The setpoint value shift will, be increased by lrSetpointValueShiftStepSize (parameter structure).

bSetpointValueShiftDown: The setpoint value shift will, be decreased by lrSetpointValueShiftStepSize (parameter structure).

bDisableRegulator: A rising edge at this input disables the twilight control.

bEnableRegulator: A rising edge at this input activates the twilight control.

All commands, which change the light control value directly (bOn, bOff, bToggleLastControlValue, bToggleMaxControlValue, bCallMinControlValue, bCallMaxControlValue, bSetControlValueDirect, bFadeUp and bFadeDown) are disabled if the control is active.

VAR_OUTPUT

uiErrorId                   : UINT;
iErrorParameter             : INT;
eExecutionState             : E_BAF_ExecutionState;
lrAverageControlValue       : LREAL;
lrResettingValue            : LREAL;
lrActualValue               : LREAL;
bRegulatorActive            : BOOL;
lrControlValueSubLampGroup1 : LREAL;
lrControlValueSubLampGroup2 : 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.

lrActualValue: Measured (day-) light value of the control.

bRegulatorActive: Tells if the control is actually active or disabled.

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

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