FB_DALIV2Sequencer

FB_DALIV2Sequencer 1:

Function block for the implementation of light sequences with up to 50 interpolation points.

The core of this function block is a ramp block that drives over an adjustable time to individual brightness values defined in a table and then remains at this brightness value for a similarly definable time. After the dwell time the next value is then driven to. As already mentioned, the table arrSequenceTable consists of 50 entries with the values for nTargetValue (target value), tRampTime (time taken to reach the target value) and tProlongTime (dwell time at the target value). It is not absolutely necessary to use all 50 values. A 0 entry of all 3 values marks the end of a sequence. Beyond that it is possible using the nStartIndex input to have a light sequence begin at any desired place in the table. This allows several different light sequences to be programmed even within the 50 entries, the sequences being separated from one another by 0 entry elements:

FB_DALIV2Sequencer 2:

Over the course of time sequence 1, for example, looks like the following (nStartIndex=1, nOptions.bit0=TRUE, see below for explanation):

FB_DALIV2Sequencer 3:

Beyond that the function block can be switched "normally" on and off (On: maximum value of the lamps, Off: 0) and switched back and forth between "On" and "Off" using the bToggle input. However, none of the command inputs is active unless the bEnable input is TRUE. If it is reset to FALSE, no more commands are accepted and the light value retains its current state – even from a ramp.

FB_DALIV2Sequencer 4:

As explained at the beginning, this function block is based on the FB_DALIV2Ramp. The ramp block tries to map the set ramp time as accurately as possible. Nevertheless it is necessary to query data from the DALI control gears both once and cyclically, which takes a different amount of time depending on the set PLC cycle time. Therefore inaccuracies in the ramp time cannot be ruled out.

VAR_INPUT

bEnable                     : BOOL := TRUE;
bOn                         : BOOL;
bOff                        : BOOL;
bToggle                     : BOOL;
bStart                      : BOOL;
nStartIndex                 : USINT := 0;
arrSequenceTable            : ARRAY [1..nMaxSequenceValues] OF ST_DALIV2SequenceTable;
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 the inputs bOn, bOff, bToggle and bStart and sets the function-block to the idle-mode.

bOn: A rising edge sets the output nLightLevel directly to the maximum-level.

bOff: A rising edge sets the output nLightLevel immediately to "0".

bToggle: Rising edges at this input toggle the light.

bStart: This input lets the sequence begin with the element defined with nStartIndex.

nStartIndex: See bStart.

arrSequenceTable: Light-value-table with the information about the target-value, the ramp-time and the prolong-time.

nOptions: Parameter-input. Setting (resp. not-setting) of the single bits will affect the behavior of the function-block as follows:

Bit

Description

0

not set: After running through a sequence, the function-block will stop its activity. To start again, a rising edge at bStart is necessary.
set: After running through a sequence, the function-block will automatically restart at the element defined with nStartIndex.

1 - 31

-- reserved for futuredevelopments --

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;
nActualIndex           : USINT;
bLight                 : BOOL;
bSequenceActive        : BOOL;
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).

nActualIndex : This output shows the actual element of the light-sequence. If the sequence is finished or stopped (bSequenceActive = FALSE , see below) , the output will fall back to "0".

bLight: As long as nLightLevel is greater than "0", this output is set to TRUE.

bSequenceActive: If a light-sequence is running, this output is set to TRUE.

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. 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.