FB_DALIV2Communication
The function blocks for the DALI commands do not directly access the process image of the KL6811, but store the individual DALI commands in three different buffers. The function block FB_DALIV2Communication sequentially reads the DALI commands from these three buffers and passes the DALI commands to the KL6811. This prevents several function blocks accessing the process image of the KL6811 at the same time. Each of these three buffers is processed with a different priority (high, medium or low). You can use the eCommandPriority parameter, which is available for most function blocks, to influence the priority with which the respective DALI command is to be processed by the function block FB_DALIV2Communication.
All buffers in which the DALI commands are stored are associated with a variable of type ST_DALIV2CommandBuffer. There is one instance of the function block FB_DALIV2Communication and a variable of type ST_DALIV2CommandBuffer for each KL6811. If possible, the function block FB_DALIV2Communication should be called in a separate, faster task.
The extent to which the buffers are utilized can be determined from the outputs of the function block. Three arrays are output for this in which each element (0, 1 or 2) represents one of the three buffers (high, middle or low). If you detect regular overflow for one of the three buffers, you should consider the following:
- How heavily are the individual PLC tasks utilized? The TwinCAT System Manager offers various appropriate utilities for the analysis.
- Try reducing the cycle time of the task in which the function block FB_DALIV2Communication is called. The value should not exceed 6 ms. Ideally it should be 2 ms.
- Check the cycle time of the PLC task in which the function blocks for the individual DALI commands are called. This value should be between 10 ms and 60 ms.
- If possible avoid polling (regular reading) of values. Only read values when they are actually required.
- Distribute the individual control gears evenly over several DALI lines. Overall data throughput is increased by the fact that several DALI lines are processed simultaneously during each PLC cycle.
Inputs
VAR_INPUT
bResetMaximumDemandCounter : BOOL;
bResetOverflowCounter : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bResetMaximumDemandCounter | BOOL | A positive edge resets the stored value of the maximum command buffer utilization, arrBufferMaximumDemandMeter (0 - 100 %, see outputs). |
bResetOverflowCounter | BOOL | A positive edge resets the stored value of the number of command buffer overflows, arrBufferOverflowCounter (see outputs). |
Inputs/outputs
VAR_IN_OUT
stDALIInData : ST_DALIV2InData;
stDALIOutData : ST_DALIV2OutData;
stCommandBuffer : ST_DALIV2CommandBuffer;
END_VAR
Name | Type | Description |
---|---|---|
stDALIInData | Structure in the input process image of the KL6811. It is used for communication from the KL6811 to the PLC. | |
stDALIOutData | Structure in the output process image of the KL6811. It is used for communication from the PLC to the KL6811. | |
stCommandBuffer | ST_DALIV2CommandBuffer | Reference to the structure for communication (buffer) with the function block FB_DALIV2Communication. |
Outputs
VAR_OUTPUT
arrBufferDemandMeter : ARRAY [0..2] OF BYTE;
arrBufferMaximumDemandMeter : ARRAY [0..2] OF BYTE;
arrBufferOverflowCounter : ARRAY [0..2] OF UINT;
bLineIsBusy : BOOL;
bLineIsInitialized : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
arrBufferDemandMeter | ARRAY | Demand of the respective buffer (0 - 100 %) |
arrBufferMaximumDemandMeter | ARRAY | Previous maximum demand of the respective buffer (0 - 100 %) |
arrBufferOverflowCounter | ARRAY | Number of buffer overflows so far |
bLineIsBusy | BOOL | This output is set as long as the function block FB_DALIV2Communication is active. |
bLineIsInitialized | BOOL | If the function block is called for the first time (e.g. when starting the controller), initialization is carried out. No DALI commands can be processed during this time. |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_DALI from v3.4.3.0 |