FB_DALIV2xThebenPlanoSpot360

FB_DALIV2xThebenPlanoSpot360 1:
FB_DALIV2xThebenPlanoSpot360 2:

The function block FB_DALIV2xThebenPlanoSpot360 serves as an example and is 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.

The function block FB_DALIV2xThebenPlanoSpot360 evaluates the measured brightness and the occupancy of the ThebenHTS PlanoSpot DALI control device. This function block can also be used to initialize the DALI control device.

The DALI control device occupies a short address and contains 5 instances. Instance 0 is the motion 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 cyclically. Each instance can be disabled individually as required.

Download the TwinCAT 3 PLCopenXML file: FB_DALIV2xThebenPlanoSpot360.zip

FB_DALIV2xThebenPlanoSpot360 3: Inputs

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 BYTE := TRUE, TRUE, TRUE, TRUE;
  arrLSRoomCorrectionValue : ARRAY [1..4] OF BYTE := 30, 30, 30, 30; (* 0.3 *)
  tLSCycleTime             : TIME := T#1M;
END_VAR

Name

Type

Description

bInitialize

BOOL

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

nAddr

BYTE

Short address of the DALI control device

bPIREnable

BOOL

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

nPIRHold

BYTE

Parameter: Sets the value for the Hold Timer. 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

BYTE

Parameter: Sets the value for 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. A value of 0 deactivates the Report Timer. This means that times of up to 4 min 15 s (value 255) are possible.

nPIRSensitivity

BYTE

Parameters: The detection sensitivity can be adjusted in five levels (1: very insensitive to 5: very sensitive).

nPIRDetectionRange

BYTE

Parameters: The sensor supports two different sizes for the detection range (0: Standard and 1: Reduced).

arrLSEnable

ARRAY

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

arrLSRoomCorrectionValue

ARRAY

Parameter: The room correction factor can be used to compare the measured value of the light sensor with a reference device (luxmeter).

tLSCycleTime

TIME

Cycle time in which the current actual value of the light sensor is read.

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

FB_DALIV2xThebenPlanoSpot360 4: 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_KL6821Communication (KL6821).

FB_DALIV2xThebenPlanoSpot360 5: Outputs

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) *)
END_VAR

Name

Type

Description

bInitializing

BOOL

This output is TRUE during initialization.

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

nInputDeviceError

BYTE

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

bPIROccupied

UINT

This output indicates the status of the motion sensor.

nActualLightLevel01 ... nActualLightLevel04

UINT

This output indicates the actual value of the light sensors.

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4022.4

Tc2_DALI from v3.6.2.0