FB_DALIV2xSteinelLiveLinkMotionSensor

FB_DALIV2xSteinelLiveLinkMotionSensor 1:

FB_DALIV2xSteinelLiveLinkMotionSensor 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 measured brightness and presence of the Steinel LiveLink 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 2 instances. Instance 1 contains the movement sensor, instance 0 the light sensor. The device does not fully comply with the IEC 62386 standard and uses a company-specific protocol instead.

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

Download TwinCAT 2 PLC Control export file: FB_DALIV2xSteinelLiveLinkMotionSensor.zip

VAR_INPUT

bInitialize            : BOOL := FALSE;
nAddr                  : BYTE;
(* Occupancy Sensor Parameters *)
bPIREnable             : BOOL := TRUE;
nPIRMotion             : BYTE := 4;     (* 5 s + (nPIRMotion * 5 s) *)
nPIRRepeat             : BYTE := 6;     (* 5 s + (nPIRRepeat * 5 s) *)
nPIRVerificationLevel  : BYTE := 1;     (* standard *)
nPIRDetectionRange     : BYTE := 255;   (* (only for HF sensors) 100 % *)
(* Light Sensor Parameters *)
bLSEnable              : BOOL := TRUE;
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 1) is enabled. The occupancy sensor is disabled by FALSE.

nPIRMotion: Parameter: Sets the value for the Motion Timer. If no movement is detected, the status of the motion sensor is not changed until after the Motion Timer has expired. The time is calculated based on the formula 5 s + nPIRMotion * 5 s. This means that times of 5 s to 21 min 20 s are possible.

nPIRRepeat: Parameter: Sets the value for the Repeat Timer. The motion sensor status is retransmitted after the Report Timer has expired, even if the status has not changed. The time is calculated based on the formula 5 s + nPIRRepeat * 5 s. This means that times of 5 s to 21 min 20 s are possible.

nPIRVerificationLevel: Parameter: The detection sensitivity can be adjusted (0: motion detection disabled, 1: very sensitive to 15: very insensitive).

nPIRDetectionRange: Parameter: If an HF sensor is used, the detection range can be set (0: 0% to  255: 100%).

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

tLSCycleTime: Cycle time in which the current actual value of the brightness sensor is 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 *)
nActualLightLevel  : UINT;

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.

nActualLightLevel: This output indicates the status of the brightness sensor.

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