FB_BA_BrightnessPresenceDALI

FB_BA_BrightnessPresenceDALI 1:

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

Data exchange HMI

The data exchange with the HMI is realized in the base class FB_BA_BaseBrightnessPresence (internal function block). The use of the following variable is visible in this template:

Function

The device itself 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]) in the internal function block BrightnessPresenceSns. 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-specific parameters of this function block (nInstPrc, nInstBrtns and nResBrtns) are transferred to the relevant device via a TRUE signal to bInitialize or via the HMI via bInitialize_In. The device is addressed by naming the addressx (nAdr) and linking the communication block of the corresponding DALI line via ipDALICommunication.

The function block PresenceDelay provides a delayed signal bPresence. After the delay time has elapsed, a positive edge is also emitted at bRstSwi, which can be used to cancel the flag circuits for light and blinds.

Presence and brightness values are linked to the objects Presence and Brightness and are thus available in BACnet.

Any scaling of the brightness can be carried out by parameterization of Brightness in FB_Init using the parameters fResolution and fScaleOffset.

FB_BA_BrightnessPresenceDALI 2:

The initialization of the template takes place within the method FB_Init.

Block diagram

FB_BA_BrightnessPresenceDALI 3:

Syntax

FUNCTION_BLOCK FB_BA_BrightnessPresenceDALI EXTENDS FB_BA_Ext_BrightnessPresence_Base
VAR_INPUT
  bEn                      : BOOL;
  bInitialize              : BOOL;
  bResetPresence           : BOOL;
  nPrdQueryBrtns           : UDINT  := 1;
END_VAR
VAR_OUTPUT
  bPresence                : BOOL;
  bPresenceDelayActive     : BOOL;
  bRstSwi                  : BOOL;
  fBrightness              : REAL;
  bInitializing            : BOOL;
  bErr                     : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  nAdr                     : BYTE;
  nInstancePresence        : BYTE;
  nInstanceBrightness      : BYTE;
  nResBrtns                : BYTE;
  ipDALICommunication      : Tc3_DALI.I_DALICommunication;
END_VAR
VAR_INPUT CONSTANT
  BrightnessPresenceSns    : FB_BA_BrtnsPrcDALI;
  PresenceDelay            : FB_BA_PresenceMonitoring;
  Brightness               : FB_BA_AI_RAW;
  Presence                 : FB_BA_BI_RAW;
END_VAR

FB_BA_BrightnessPresenceDALI 4: 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.

bResetPresence

BOOL

Resets the internal presence delay and thus triggers the bRstSwi output once.

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.

FB_BA_BrightnessPresenceDALI 5: VAR_OUTPUT

Name

Type

Description

bPresence

BOOL

Occupancy signal output.

bPresenceDelayActive

BOOL

This output is then set to TRUE if no more presence is detected and the output bPresence is only set by the internal delay.

bRstSwi

BOOL

Reset output for manual overrides.

Is set for a PLC cycle after the internal presence delay has elapsed (see PresenceDelay) or when a TRUE signal is received at the input bResetPresence,

fBrightness

REAL

Measured brightness. The unit is vendor-specific. Conversion to lux must be requested from the manufacturer if required.

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_BrightnessPresenceDALI 6: VAR_INPUT CONSTANT PERSISTENT

Name

Type

Description

nAdr

BYTE

DALI single address of the sensor.

nInstancePresence

BYTE

Number of the presence instance to be queried.

nInstanceBrightness

BYTE

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_BrightnessPresenceDALI 7: VAR_INPUT CONSTANT

Name

Type

Description

BrightnessPresenceSns

FB_BA_BrtnsPrcDALI

Function block for reading the DALI brightness and occupancy sensor.

PresenceDelay

FB_BA_PresenceMonitoring

Universal presence monitoring template with reset inputs for delay timer and manual function.

Brightness

FB_BA_AI_RAW

This function block is used to convert the vendor-specific raw brightness value to a desired unit, for example lux, and also to display the value in BACnet.

Presence

FB_BA_BI_RAW

Function block for displaying the presence state in BACnet.

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.0.0.0