FB_DALIV2IAPIR

FB_DALIV2IAPIR 1:

This function block FB_DALIV2IAPIR cyclically reads the status of an IA PIR sensor and scales the measured brightness and detected occupancy based on the received value.

Two different cycle times can be specified. One cycle time that is used if no occupancy is detected and one that is used in case of occupancy. In this way access to the DALI bus can be minimized. If occupancy is detected a slower cycle time (e.g. 20 s) can usually be selected, because light control and switching off the lighting is not time-critical. If there is no occupancy, then a shorter cycle time (e.g. 2 s) should be selected. As a result, the lighting is switched on with the shortest possible reaction time when the room is entered.

Further information and a description of the electrical and physical properties can be found in the product description for the IA PIR sensor.

FB_DALIV2IAPIR 2: Inputs

VAR_INPUT
  bReadDirectly           : BOOL := FALSE;
  tCycleTimeIfOccupancy   : TIME := t#20s;
  tCycleTimeIfNoOccupancy : TIME := t#2s;
  nAddr                   : BYTE := 0;
  eAddrType               : E_DALIV2AddrType := eDALIV2AddrTypeShort;
  eCommandPriority        : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
END_VAR

Name

Type

Description

bReadDirectly

BOOL

The function block is activated by a positive edge at this input.

tCycleTimeIfOccupancy

TIME

Cycle time if occupancy

tCycleTimeIfNoOccupancy

TIME

Cycle time if no occupancy

nAddr

BYTE

The address of a device or of a group

eAddrType

E_DALIV2AddrType

Short address, group address or broadcast

eInstAddrType

E_DALIV2InstAddrType

Defines the access mode to the desired instance within the DALI control device.

eCommandPriority

E_DALIV2CommandPriority

Priority (high, medium or low) with which the command is processed by the library.

FB_DALIV2IAPIR 3: 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_KL6811Communication (KL6811) or FB_KL6821Communication (KL6821).

FB_DALIV2IAPIR 4: Outputs

VAR_OUTPUT
  bOccupancy  : BOOL;
  nBrightness : INT;
  nRawValue   : BYTE;
  bBusy       : BOOL;
  bError      : BOOL;
  nErrorId    : UDINT;
END_VAR

Name

Type

Description

bOccupancy

BOOL

The output is set if the sensor detects occupancy.

nBrightness

INT

Measured brightness in lux

nRawValue

BYTE

The value of the sensor read before the conversion

bBusy

BOOL

When the function block is activated the output is set, and it remains active until execution of the command has been completed.

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

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_DALI from v3.4.3.0