FB_DALIV2xThebenPlanoSpot360

FB_DALIV2xThebenPlanoSpot360 1:

FB_DALIV2xThebenPlanoSpot360 2:

This function block is used as an example and is therefore not included in the library. The function block can be downloaded as an export file and imported into the desired project. Adjustments can be made as required.

This function block evaluates the 3 measured brightness values and the presence of the ThebenHTS PlanoSpot DALI control unit. This function block can also be used to initialize the DALI control units.

The DALI control unit occupies a short address and contains 5 instances. Instance 0 is the movement sensor and complies with the IEC 62386-303 standard. The light sensors are stored in instances 1 to 4 and comply with the IEC 62386-304 standard.

A detected movement is sent as an event, while the brightness values are read out cyclically. Each instance can be decoded individually as required.

Download the TwinCAT 2 PLC Control export file: FB_DALIV2xThebenPlanoSpot360.zip

VAR_INPUT

bInitialize               : BOOL := FALSE;
nAddr                     : BYTE;
(* Occupancy Sensor Parameters *)
bPIREnable                : BOOL := TRUE;
nPIRHold                  : BYTE := 1;     (* 10 s *)
nPIRReport                : BYTE := 30;    (* 30 s *)
nPIRSensitivity           : BYTE := 3;     (* standard *)
nPIRDetectionRange        : BYTE := 0;     (* standard *)
(* Light Sensor Parameters *)
arrLSEnable               : ARRAY [1..4] OF BOOL := TRUE, TRUE, TRUE, TRUE;
arrLSRoomCorrectionValue  : ARRAY [1..4] OF BYTE := 30, 30, 30, 30; (* 0.3 *)
tLSCycleTime              : TIME := t#1m;

bInitialize: The DALI controller is initialized by a positive edge at this input. The parameters are written to the DALI control unit, which must be accessible via the short address nAddr. The output bInitializing is TRUE during initialization.

nAddr: Short address of the DALI control unit.

bPIREnable: Parameter: If this input is TRUE, the motion sensor (instance 0) is enabled. The occupancy sensor is disabled by FALSE.

nPIRHold: Parameter: Sets the Hold Timer value. If no movement is detected, the status of the motion sensor is only changed after the Hold Timer has expired. The unit is 10 s. This means that times of up to 42 min 20 s (value 254) are possible. The value 0 corresponds to 1 s while the value 255 is ignored.

nPIRReport: Parameter: Sets the value for the Report Timer. The motion sensor status is retransmitted after the Report Timer has expired, even if the status has not changed. The unit is 1 s. The value 0 disables the Report Timer. This means that times of up to 4 min 15 s (value 255) are possible.

nPIRSensitivity: Parameter: The detection sensitivity can be adjusted in five steps (1: very insensitive to 5: very sensitive).

nPIRDetectionRange: Parameter: The sensor supports two different values for the detection range(0: standard and 1: reduced).

arrLSEnable: Parameter: If this input is TRUE, the brightness sensor (instance 1) is enabled. The brightness sensor is disabled by FALSE.

arrLSRoomCorrectionValue: Parameter: The room correction factor can be used to calibrate the value measured by the detector with the value measured with a reference device (luxmeter).

tLSCycleTime: Cycle time in which the current actual values of the brightness sensors are read out.

Further details on the parameters can be found in the IEC 62386 standard and the manufacturer's documentation.

VAR_OUTPUT

bInitializing           : BOOL;
bError                  : BOOL;
nErrorId                : UDINT;
nInputDeviceError       : BYTE;
(* Occupancy Sensor *)
bPIROccupied            : BOOL;
(* Light Sensor *)
nActualLightLevel01     : UINT;  (* Light sensor 1 (integral) *)
nActualLightLevel02     : UINT;  (* Light sensor 2 (inner) *)
nActualLightLevel03     : UINT;  (* Light sensor 3 (middle) *)
nActualLightLevel04     : UINT;  (* Light sensor 4 (window) *)

bInitializing: This output is TRUE during initialization.

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

nErrorId: Contains the command-specific error code of the most recently executed command. See Error codes.

nInputDeviceError: The status of the DALI control unit (INPUT DEVICE ERROR) is queried before the initialization. 0 means no error. The individual error numbers are manufacturer-specific.

bPIROccupied: This output indicates the status of the motion sensor.

nActualLightLevel01 ... nActualLightLevel04: These outputs indicate the status of the brightness sensors.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: Reference to the internal structure for communication with the function block FB_KL6821Communication() (KL6821).

Requirements

Development environment

Target system

Required libraries

TwinCAT 2.11 R3/x64 from build 2260

PC/CX, BX or BC

TcDALIV2 library from V2.12.0