FB_DALIV2ConstantLightControlEco
The function block FB_DALIV2ConstantLightControlEco is used for constant light control with DALI control gears.
The system tries to match a specified setpoint through cyclic dimming. The control dynamics are determined by a dead time (tDeadTime). The dead time defines the delay between the individual commands for changing the control value. The smaller the dead time, the faster the control. A freely definable hysteresis (nHysteresis) prevents continuous oscillation around the setpoint. If the actual value is within the hysteresis range around the setpoint, the lamps brightness remains unchanged. An option is available for specifying whether the lamps should be switched on and off automatically (see table below).
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;
bToggle : BOOL;
nSetpointValue : UINT := 500;
nActualValue : UINT;
nHysteresis : UINT := 50;
tDeadTime : TIME := t#10s;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;
nOptions : DWORD := 0;
END_VAR
Name | Type | Description |
---|---|---|
bEnable | BOOL | Enables the function block. If this input is FALSE, the inputs bOn, bOff and bToogle are disabled. No control values are output. |
bOn | BOOL | Switches the addressed devices to MAX_LEVEL and activates constant light control. |
bOff | BOOL | Switches the addressed devices off and disables constant light control. |
bToggle | BOOL | The lighting is switched on or off, depending on the state of the reference device. |
nSetpointValue | UINT | This input is used for specifying the setpoint. |
nActualValue | UINT | The actual value is applied at this input. |
nHysteresis | UINT | Control hysteresis around the setpoint. If the actual value is within this range, the control values for the lamps remain unchanged. |
tDeadTime | TIME | Dead time between the individual commands used for changing the control value for the DALI lamps. |
nAddr | BYTE | The address of a device or of a group |
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 of the reference lamp in the background (see ACTUAL DIM LEVEL). So that the controlling of the lamps is not disturbed, reading always has the lowest priority. If the value is set to 0, reading is prohibited. The value read is output at the nActualLevelMasterDev output. |
nOptions | DWORD | Options for swapping short addresses (see table). The individual constants must be linked with OR operators. |
Constant | Description |
---|---|
DALIV2_OPTION_SWITCH_ON_AND_OFF | The DALI commands ON_AND_STEP_UP and STEP_DOWN_AND_OFF are used for changing the control value. This switches the lamps off after reaching the MIN_LEVEL. If the control deviation is above the hysteresis, the lamps are switched on again. If this option is not set, the commands STEP_UP and STEP_DOWN are used. This keeps the lamps switched on at all times. |
DALIV2_OPTION_SWITCH_ON_WITH_MIN_LEVEL | If the light is switched on again by the constant light control, this option always uses the command MIN_LEVEL. If the option is not set, MAX_LEVEL is used. This option is available from v3.3.2.0 of the Tc2_DALI PLC library. |
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;
nDeviation : INT;
bControllerIsActive : BOOL;
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) |
nDeviation | INT | Current control deviation (setpoint/actual value) |
bControllerIsActive | BOOL | This output is set once the control is activated. |
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 |