FB_BA_BrtnsPrcDALI

FB_BA_BrtnsPrcDALI 1:

This function block is used to read a combined DALI brightness and occupancy sensor.

For information on the function of the DALI device used, please refer to the manufacturer's device documentation.

Function

The device is specified by the instance number of the presence, nInstancePresence, and the instance number of the brightness, nInstanceBrightness. Added to this is the device-specific resolution, nResBrtns. These three parameters vary from manufacturer to manufacturer.

The brightness is queried cyclically (interval nPrdQueryBrtns [s]). With presence, on the other hand, the device's internal notification system is used, which automatically sends a telegram as soon as presence or absence is detected.

The DALI brightness and presence function block can be initialized via the input bInitialize with partly parameterizable (see VAR_INPUT CONSTANT PERSISTENT) and partly fixed pre-set values (see VAR CONSTANT).

Syntax

FUNCTION_BLOCK FB_BA_BrtnsPrcDALI
VAR_INPUT
  bEn                    : BOOL;
  bInitialize            : BOOL;
  nPrdQueryBrtns         : UDINT;
  nAdr                   : BYTE;
  nInstPrc               : BYTE;
  nInstBrtns             : BYTE;
  nResBrtns              : BYTE := 10;
  ipDALICommunication    : Tc3_DALI.I_DALICommunication;
END_VAR
VAR_OUTPUT
  bPrc                   : BOOL;
  nBrtns                 : UINT;
  bInitializing          : BOOL;
  bErr                   : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  nDeadtime              : BYTE := 2;
  nHold                  : BYTE := 90;
  nReport                : BYTE := 60;
END_VAR
VAR CONSTANT
  nEventFilter           : DWORD := 7;
  eEventPriority         : Tc3_DALI.E_DALIEventPriority := Tc3_DALI.E_DALIEventPriority.Middle;
  eEventScheme           : Tc3_DALI.E_DALIEventScheme := Tc3_DALI.E_DALIEventScheme.DeviceInstance;
END_VAR

FB_BA_BrtnsPrcDALI 2: VAR_INPUT

Name

Type

Description

bEn

BOOL

Enabling the function block: a TRUE signal at this input enables the function.

bInitialize

BOOL

A positive edge at this input starts the DALI initialization routine, which transfers the set parameters to the DALI device, see FB_BA_Swi4DALI.

nPrdQueryBrtns

UDINT

Brightness query interval in seconds. The declaration of this variable as an input is intended to enable a variable query speed. In the case of constant light regulation, for example, a slow query interval is initially sufficient until a larger deviation to be compensated is detected, at which point a shorter interval is used. A "0" at this input disables the query.

nAdr

BYTE

DALI short address of the sensor.

nInstPrc

BYTE

Vendor-specific number of the presence instance to be queried.

nInstBrtns

BYTE

Vendor-specific number of the brightness instance to be queried.

nResBrtns

BYTE

Vendor-specific brightness resolution.

ipDALICommunication

Tc3_DALI.I_DALICommunication

Interface pointer to the DALI communication block.

FB_BA_BrtnsPrcDALI 3: VAR_OUTPUT

Name

Type

Description

bPrc

BOOL

Occupancy signal output.

nBrtns

BOOL

Measured brightness. The unit is vendor-specific.

bInitializing

BOOL

The sensor is in the DALI initialization phase, i.e. the entered parameters are transferred to the DALI device.

bErr

BOOL

Error output. A plain text is output in TwinCAT in the error list in the output window.

FB_BA_BrtnsPrcDALI 4: VAR_INPUT CONSTANT PERSISTENT

FB_BA_BrtnsPrcDALI 5:

The following parameters are transferred to the DALI control gear or the DALI devices by the initialization routine.

Name

Type

Description

nDeadtime

BYTE

Dead time of the occupancy sensor as a multiple of 50 ms, pre-set to 2 (=100 ms).

nHold

BYTE

Hold time of the occupancy sensor as a multiple of 10 s, pre-set to 90 (=900 s).

nReport

BYTE

Report time of the occupancy sensor in seconds, pre-set to 60 s.

VAR CONSTANT

FB_BA_BrtnsPrcDALI 6:

The following parameters cannot be changed and are transferred to the DALI device by the initialization routine.

Name

Type

Description

nEventFilter

DWORD

DALI event filter mask for occupancy sensors. This value is set to 7 and thus queries the Occupied, Vacant and Repeat Event states.

eEventPriority

Tc3_DALI.E_DALIEventPriority

DALI event priority with which input notification events are sent by the instance of the DALI control device, set to Middle.

eEventScheme

Tc3_DALI.E_DALIEventScheme

DALI event scheme. This is set to DeviceInstance (device/instance addressing with short address and instance number).

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.0.0.0