FB_DALIV2Dimmer1Switch

FB_DALIV2Dimmer1Switch 1:

An individual DALI lamp, a DALI group or a complete DALI line can be switched and dimmed using a single switch through this block.

Operating by means of the bSwitchDimm input

The light is switched on or off by a short signal at the bSwitchDimm input. Dimmer mode will be activated if the signal remains for longer than tSwitchOverTime (typical recommended value: 200 ms). The output signal then cycles between nMinLevelMasterDev and nMaxLevelMasterDev. In order to be able to set the maximum or minimum value more easily, the output signal pauses at the level of the maximum and minimum values for the time given by tCycleDelay. When the signal is once more removed, the output signal being generated at that time is retained. Another pulse at the input will set the output to 0. If the bSwitchDimm signal is briefly removed in dimmer mode, the function block changes its dimming direction.

Operation by means of the bOn and bOff inputs

If a positive edge is applied to the bOn or bOff inputs, the light is switched on or off directly. The output value is set to 0 when switching off. The switch-on behavior can be affected by the memory function (see below).

Operation by means of the bSetDimmValue and nDimmValue inputs

If the value nDimmValue changes, the addressed devices will be switched directly to this brightness value. The significant point here is that the value changes. The lighting is switched off by changing the value to 0. If there is a positive edge at the bSetDimmValue input, the value of nDimmValue immediately appears at the output. Immediate modification of the output can be suppressed by a static 1-signal at the bSetDimmValue input. This allows a value to be applied to the nDimmValue input, which is not passed to the output until the next positive edge of bSetDimmValue.

The bSetDimmValue and nDimmValue inputs can be used to implement a variety of lighting scenarios. Direct setting of the output, by means of nDimmValue, can be used to achieve particular brightness levels. Either directly or by continuously changing the value. nDimmValue must have a value between nMinLevelMasterDev and nMaxLevelMasterDev. The value 0 is an exception. If the value is outside this range, the output value is limited to the upper or lower limit, as appropriate.

The memory function

It is necessary to determine whether the memory function (bMemoryModeOn input) is active or not at switch-on. If the memory function is active, then the last set value is adopted as the brightness value as soon as the device is switched on. If the memory function is not active, a brightness specified by the nOnValueWithoutMemoryMode parameter is assigned to the devices concerned. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or the bSwitchDimm input. It should be noted that the nOnValueWithoutMemoryMode parameter must lie between nMinLevelMasterDev and nMaxLevelMasterDev. If this is not the case, the output value is adjusted to the upper or lower limit, as appropriate.

Parameter tSwitchOverTime

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimm input can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

Parameter nMasterDevAddr

The DALI system provides facilities not just for controlling lamps individually, but also for addressing them as groups or through common commands. Because the individual devices can be members of a variety of groups, it can happen that, prior to the issue of a group or common control command, the individual lamps have different brightness levels. So that it is nevertheless possible to be clear whether the lamps now are to be switched on or off, a master device is assigned to each group, whose state is followed by the other devices. It is not necessary to specify a master device if the function block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bSwitchDimm                : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
tCycleDelay                : TIME := t#500ms;
bMemoryModeOn              : BOOL := FALSE;
nOnValueWithoutMemoryMode  : BYTE := 254;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
nMinLevelMasterDev         : BYTE := 126;
nMaxLevelMasterDev         : BYTE := 254;
tCycleActualLevelMasterDev : TIME := t#0s;

bSwitchDimm: Switches or dims the addressed devices.

bOn: Switches the addressed devices to the last output value, or to the value specified by nOnValueWithoutMemoryMode.

bOff: Switches the addressed devices off (value 0).

bSetDimmValue: A positive edge at this input sets the addressed devices immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimm input.

tCycleDelay: Delay time, if either the minimum or maximum value is reached.

bMemoryModeOn: Switches over to use the memory function, so that the previous value is written to the output as soon as it is switched on.

nOnValueWithoutMemoryMode: Value at switch on if the memory function is not active.

nAddr: The address of a participating device or of a group.

eAddrType: Short address, group address or broadcast.

nMasterDevAddr: The address of the master device for group and common switching operations.

nMinLevelMasterDev: The minimum value of the master device.

nMaxLevelMasterDev: The maximum value of the master device.

tCycleActualLevelMasterDev: Cycle time required to read the current actual value (ACTUAL DIM LEVEL) in the background. So that the dimming of the lamps is not disturbed, reading always has the lowest priority. If the value is set to 0, reading is prohibited.

VAR_OUTPUT

nActualLevelMasterDev  : BYTE;
bBusy                  : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

bBusy: When the block is activated the output is set, and it remains active until execution of the command has been completed.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. Is reset to FALSE by the execution of an instruction at the inputs.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of an instruction at the inputs. See Error codes.

VAR_IN_OUT

stCommandBuffer        : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication with the FB_DALIV2Communication() (KL6811) or FB_KL6821Communication() (KL6821) block.