FB_DALIV2StairwellDimmer

FB_DALIV2StairwellDimmer 1:

Function block to control stairwell lighting.

A rising edge at the input bSwitch switches the addressed lamps to the value nPresenceValue. A falling edge on bSwitch starts or restarts a timer with the time tPresenceDuration. Following the expiry of this timer, the lamps are dimmed to the value nProlongValue over the time period tFadeOffDuration. This value is maintained for the time period tProlongDuration. After that, the light is switched off. A rising edge at the input bOff turns the light off immediately. Triggering the input bSwitch again will always restart the cycle, even during the periods of tPresenceDuration and tFadeOffDuration. With every start the setpoint-values are checked if they are within the allowed range of the DALI-Master-Device (MIN LEVEL ... MAX LEVEL or „0“) .

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.

FB_DALIV2StairwellDimmer 2:

VAR_INPUT

bEnable                     : BOOL := TRUE;
bSwitch                     : BOOL;
bOff                        : BOOL;
nPresenceValue              : BYTE := 254;
nProlongValue               : BYTE := 200;
tPresenceDuration           : TIME := t#30s;
tFadeOffDuration            : TIME := t#10s;
tProlongDuration            : TIME := t#20s;
nOptions                    : DWORD := 0;
nAddr                       : BYTE := 0;
eAddrType                   : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr              : BYTE := 0;
tCycleActualLevelMasterDev  : TIME := t#0s;

bEnable: A positive input enables the function block. A negative state deactivates the inputs and sets the function-block to the idle-mode, after the last necessary DALI-commands are sent. Except for the cyclic query of the light-level of the master-device, the function-block sends no further DALI-commands.

bSwitch: A rising edge sets the light to nPresenceValue. A falling edge starts the presence time (see diagram).

bOff: Turns the light off immediately.

nPresenceValue: Value to which the light should be set during the presence time. (Valid range: 0 or MIN LEVEL ... MAX LEVEL - Preset value: 254).

nProlongValue: Value to which the light should be set to following a falling edge on bSwitch after the time tPresenceDuration. (Valid range: 0 or MIN LEVEL ... MAX LEVEL - Preset value: 200).

tPesenceDuration: Duration of the presence time in which the light is set to nPresenceValue following a falling edge on bSwitch. (Preset value: 30 seconds).

tFadeOffDuration: Within this time the light is driven from the presence- to the prolong-value (Preset value: 10 seconds).

tProlongDuration: Duration of the dwell time. (Preset value: 20 seconds).

nOptions: Reserved for future developments.

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.

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

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: This output is set during light-change, which means turning on, off and driving a ramp. The start- and end-value are not significant. Even driving a ramp from 100 to 100 in 10s will set this output to TRUE.

bCycleActive: When the block is activated the output is set, and it remains active until the cycle 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. bError 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. nErrorId 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.