FB_DALIV2StairwellDimmer
The function block FB_DALIV2StairwellDimmer is used to control stairwell lighting.
A rising edge at input bSwitch switches the light to the value nPresenceValue. A falling edge on bSwitch starts or restarts a timer with the runtime tPresenceDuration. On expiry of this timer the controlled lamps are dimmed within the time tFadeTime to the value nProlongValue. This value is maintained for the duration tProlongDuration. Following which the light is switched off. A positive edge at input bOff switches the light off immediately, another rising edge at input bSwitch switches the light on again at any time - even during the dimming and waiting times.
Each time the light is switched on, a check is carried out to ensure that the values nPresenceValue and nProlongValue are within the permissible limits (MIN LEVEL ... MAX LEVEL) of the master device. The value "0" is also allowed. It is also possible that nPresenceValue is smaller than nProlongValue or that both values are identical.
Comment on the nMasterDevAddr parameter
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.

Inputs
VAR_INPUT
bEnable : BOOL := TRUE;
bSwitch : BOOL;
bOff : BOOL;
nPresenceValue : BYTE;
nProlongValue : BYTE;
tPresenceDuration : TIME := t#30s;
tFadeOffDuration : TIME := t#10s;
tProlongDuration : TIME := t#20s;
nOptions : DWORD := 0;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrType Short;
nMasterDevAddr : BYTE;
tCycleActualLevelMasterDev : TIME := t#0s;
END_VAR
Name | Type | Description |
---|---|---|
bEnable | BOOL | The inputs bOn and bOff are active as long as this input is TRUE. A negative state deactivates the inputs and resets the function block after processing the last necessary DALI commands. No further DALI commands are then output, apart from the cyclic querying of the brightness of the master device. |
bSwitch | BOOL | With a rising edge: the controlled lamps are switched directly to PresenceValue. With a falling edge: start of the presence time (see diagram). |
bOff | BOOL | Immediately switches off the controlled lamps. |
nPresenceValue | BYTE | Value to which the controlled lamps are to be switched during the presence time. (Valid value range:0 or MIN LEVEL ... MAX LEVEL -preset value: 254). |
nProlongValue | BYTE | Value to which the controlled lamps are to be switched during the dwell time. (Valid value range:0 or MIN LEVEL ... MAX LEVEL -preset value: 200). |
tPesenceDuration | TIME | Duration of the presence time for which the controlled lamps are switched to nPresenceValue after a falling edge at bSwitch. (Preset value: 30 seconds). |
tFadeOffDuration | TIME | Time duration in which the brightness value is controlled from nPresenceValue to nProlongValue. (Preset value: 10 seconds). |
tProlongDuration | TIME | Duration of the dwell time. (Preset value: 20 seconds) |
nOptions | DWORD | Reserved for future developments. |
nAddr | BYTE | Address of the single device for individual control or of the group for group control |
eAddrType | Short address, group address or broadcast | |
nMasterDevAddr | BYTE | The address of the master device (reference device) for group and common switching operations |
tCycleActualLevelMasterDev | TIME | Cycle time required to read the current actual value in the background (see ACTUAL DIM LEVEL). 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. |
Inputs/outputs
VAR_IN_OUT
stCommandBuffer : ST_DALIV2CommandBuffer;
END_VAR
Name | Type | Description |
---|---|---|
stCommandBuffer | ST_DALIV2CommandBuffer | Reference to the internal structure for communication with FB_KL6811Communication (KL6811) or FB_KL6821Communication (KL6821). |
Outputs
VAR_OUTPUT
nActualLevelMasterDev : BYTE;
bBusy : BOOL;
bCycleActive : BOOL;
bError : BOOL;
nErrorId : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
nActualLevelMasterDev | BYTE | Current output value of the master device (always the respectively addressed device if eAddrType = eAddrTypeShort) |
bBusy | BOOL | This output is always set when a change of light is active, i.e. on, off and ramp. Start and target value are irrelevant. This output would also be set in the case of a ramp, for example, from 100 to 100 in 10 s. |
bCycleActive | BOOL | When the function block is activated, the output is set and remains active until the cycle has been completed or the lamps have been switched off. |
bError | BOOL | This output is switched to TRUE as soon as 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 a command at the inputs. |
nErrorId | UDINT | Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs (see error codes). |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_DALI from v3.4.3.0 |