FB_DALIV2xOsramProfSensorCoupler

FB_DALIV2xOsramProfSensorCoupler 1:

FB_DALIV2xOsramProfSensorCoupler 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 Osram DALI Professional Sensor Coupler. This function block can also be used to initialize the DALI control units.

The movement sensor and the light sensor have separate short addresses. The DALI control unit thus occupies two short addresses. 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.

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

VAR_INPUT

bInitialize         : BOOL := FALSE;
(* Occupancy Sensor Parameters *)
nPIRAddr            : BYTE;
tPIRBlankingTime    : TIME := T#1M;
(* Light Sensor Parameters *)
nLSAddr             : BYTE;
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 addresses nPIRAddr and nLSAddr. The output bInitializing is TRUE during initialization.

nPIRAddr: Short address of the DALI control unit for the motion sensor.

tPIRBlankingTime: Parameter: Once the status of the motion sensor was sent, no further changes are sent for this time. The unit is 1 s. This means that times of up to 4 min 15 s (value 255) are possible.

nLSAddr: Short address of the DALI control unit for the brightness sensor.

tLSCycleTime: Cycle time in which the current actual value of the brightness sensor is read out.

Further details about the parameters can be found in the manufacturer's documentation.

VAR_OUTPUT

bInitializing        : BOOL;
bError               : BOOL;
nErrorId             : UDINT;
(* Occupancy Sensor *)
nPIRStatus           : BYTE;
bPIROccupied         : BOOL;
(* Light Level *)
nLSStatus            : BYTE;
nActualLightLevel    : WORD;

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.

nPIRStatus: Before the initialization, the status of the DALI control unit for the motion sensor is queried and output at this output.

bPIROccupied: This output indicates the actual value of the motion sensor.

nLSStatus: Before the initialization, the status of the DALI controller for the brightness sensor is queried and output at this output.

nActualLightLevel: This output indicates the actual value 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