FB_DALIV2GetSettingsType01

FB_DALIV2GetSettingsType01 1:

The function block FB_DALIV2GetSettingsType01 reads the variables (BATTERY CHARGE, DURATION TEST RESULT, LAMP EMERGENCY TIME ...) from all emergency lighting control gears on a DALI line and saves them in a structure of type ST_DALIV2DeviceSettingsType01.

Applying a positive edge to the input bStart starts the function block, and the output bBusy goes TRUE. A check is first made as to whether a control gear is present at all. If this is the case, then the bPresent bit is set in the corresponding structure (see ST_DALIV2DeviceSettingsType01), after which the settings of the control gear are read out one by one and written in the associated variables in the structure. If it is found that a device is not available, the reading is skipped and work continues with the next device. The structure index here reflects the address of the device. In other words, data for the device with short address 0 is located at arrDALIDeviceSettingsType01[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettingsType01[63]. If a read error occurs when reading from a device, the corresponding bit in nErrors is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the variable nErrors when an error occurs during the reading of a variable from a control gear.

Bit

Error

0

An error occurred whilst attempting to seek the control gear.

1

Error whilst reading the variable BATTERY CHARGE

2

Error whilst reading the variable DURATION TEST RESULT

3

Error whilst reading the variable LAMP EMERGENCY TIME

4

Error whilst reading the variable LAMP TOTAL OPERATION TIME

5

Error whilst reading the variable EMERGENCY LEVEL

6

Error whilst reading the variable EMERGENCY MIN LEVEL

7

Error whilst reading the variable EMERGENCY MAX LEVEL

8

Error whilst reading the variable RATED DURATION

9

Error whilst reading the variable FUNCTION TEST DELAY TIME

10

Error whilst reading the variable DURATION TEST DELAY TIME

11

Error whilst reading the variable FUNCTION TEST INTERVAL

12

Error whilst reading the variable DURATION TEST INTERVAL

13

Error whilst reading the variable TEST EXECUTION TIMEOUT

14

Error whilst reading the variable PROLONG TIME

15

Error whilst reading the variable EMERGENCY MODE

16

Error whilst reading the variable FEATURES

17

Error whilst reading the variable FAILURE STATUS

18

Error whilst reading the variable EMERGENCY STATUS

After processing the function block, the output bBusy changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many control gears are connected.

FB_DALIV2GetSettingsType01 2: Inputs

VAR_INPUT
  bStart           : BOOL;
  bCancel          : BOOL;
  eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
  nOptions         : DWORD;
END_VAR

Name

Type

Description

bStart

BOOL

The function block is activated by a positive edge at this input.

bCancel

BOOL

A positive edge at this input will disable the function block and hence abort the reading of the variables.

eCommandPriority

E_DALIV2CommandPriority

Priority (high, medium or low) with which the command is processed by the library.

nOptions

DWORD

Options for reading the variables (see table). The individual constants must be linked with OR operators.

Constant

Description

DALIV2_OPTION_BATTERY_CHARGE

The variable BATTERY CHARGE is read.

DALIV2_OPTION_DURATION_TEST_RESULT

The variable DURATION TEST RESULT is read.

DALIV2_OPTION_LAMP_EMERGENCY_TIME

The variable LAMP EMERGENCY TIME is read.

DALIV2_OPTION_LAMP_TOTAL_OPERATION_TIME

The variable LAMP TOTAL OPERATION TIME is read.

DALIV2_OPTION_EMERGENCY_LEVEL

The variable EMERGENCY LEVEL is read.

DALIV2_OPTION_EMERGENCY_MIN_LEVEL

The variable EMERGENCY MIN LEVEL is read.

DALIV2_OPTION_EMERGENCY_MAX_LEVEL

The variable EMERGENCY MAX LEVEL is read.

DALIV2_OPTION_RATED_DURATION

The variable RATED DURATION is read.

DALIV2_OPTION_NEXT_FUNCTION_TEST

The variable FUNCTION TEST DELAY TIME is read.

DALIV2_OPTION_NEXT_DURATION_TEST

The variable DURATION TEST DELAY TIME is read.

DALIV2_OPTION_FUNCTION_TEST_INTERVAL

The variable FUNCTION TEST INTERVAL is read.

DALIV2_OPTION_DURATION_TEST_INTERVAL

The variable DURATION TEST INTERVAL is read.

DALIV2_OPTION_TEST_EXECUTION_TIMEOUT

The variable TEST EXECUTION TIMEOUT is read.

DALIV2_OPTION_PROLONG_TIME

The variable PROLONG TIME is read.

DALIV2_OPTION_EMERGENCY_MODE

The variable EMERGENCY MODE is read.

DALIV2_OPTION_FEATURES

The variable FEATURES is read.

DALIV2_OPTION_FAILURE_STATUS

The variable FAILURE STATUS is read.

DALIV2_OPTION_EMERGENCY_STATUS

The variable EMERGENCY STATUS is read.

DALIV2_OPTION_ALL

All variables are read.

FB_DALIV2GetSettingsType01 3: Inputs/outputs

VAR_IN_OUT
  stCommandBuffer             : ST_DALIV2CommandBuffer;
  arrDALIDeviceSettingsType01 : ARRAY [0..63] OF ST_DALIV2DeviceSettingsType01;
END_VAR

Name

Type

Description

stCommandBuffer

ST_DALIV2CommandBuffer

Reference to the internal structure for communication with FB_KL6811Communication (KL6811) or FB_KL6821Communication (KL6821).

arrDALIDeviceSettingsType01

ARRAY OF ST_DALIV2DeviceSettingsType01

Reference to an array with 64 elements. The settings of each individual DALI control gear are stored in this variable.

FB_DALIV2GetSettingsType01 4: Outputs

VAR_OUTPUT
  bBusy             : BOOL;
  bError            : BOOL;
  nErrorId          : UDINT;
  nCurrentShortAddr : BYTE;
END_VAR

Name

Type

Description

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

nCurrentShortAddr

BYTE

Short address of the current control gear from which an attempt is being made to read the variables.

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_DALI from v3.4.3.0