FB_DALIV2LightControl
The function block FB_DALIV2LightControl is used for daylight-dependent lighting control with up to 30 interpolation points.
At the core of this function block is an input/control value table of 30 elements with threshold switching. If the actual value of the brightness reaches the range of an interpolation point (arrControlTable[n].nActualValue-arrControlTable[n].nSwitchRange/2 ... arrControlTable[n].nActualValue+arrControlTable[n].nSwitchRange/2), the control value jumps to the corresponding value arrControlTable[n].nControlValue (see diagram). Coupled to this is a ramp block that runs up the control value over the time tRampTime. When switching on with a positive edge at bOn, however, the light is initially switched directly to the nearest control value. Only then is the controller activated. While the controller is active, ‘post-starting’ can take place at any time with a positive edge at bOn, thus directly controlling the light to the nearest control variable. A positive edge at bOff directly switches off all the controlled lamps.
The whole range of the table does not have to be used. The first table element that has a 0 as the table end nSwitchRange is regarded as the beginning of the unused range.
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. Since the individual devices may belong to different groups, the individual lamps may have different brightness states before a group or common control command. 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;
bOn : BOOL;
bOff : BOOL;
nActualValue : UINT;
tRampTime : TIME := t#30s;
arrControlTable : ARRAY[1..30] OF ST_DALIV2ControlTable;
nOptions : DWORD := 0;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrType Short;
nMasterDevAddr : BYTE := 0;
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. |
bOn | BOOL | A rising edge switches the controlled lamps directly to the nearest control value. |
bOff | BOOL | A rising edge immediately switches off the controlled lamps. |
nActualValue | UINT | Actual value of the brightness |
tRampTime | TIME | Period during which the control value is controlled to the next value (preset value: 30 s). |
arrControlTable | ARRAY OF ST_DALIV2ControlTable | Input/control value table: arrControlTable[1] to arrControlTable[30] of the type ST_DALIV2ControlTable |
nOptions | DWORD | Reserved for future developments. |
nAddr | BYTE | Address of the single device for individual control or of the group for group control |
nMasterDevAddr | BYTE | The address of the master device (reference device) for group and common switching operations |
eAddrType | Short address, group address or broadcast | |
tCycleActualLevelMasterDev | TIME | Cycle time required to read the current control 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;
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 | When the function block is activated the output is set, and it remains active until execution of the command has been completed. |
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 |