FB_DALIV2IAPIR
This function cyclically reads the status of an IA PIR-sensor and scales the measured light intensity and the recognized presence of a person from the received value.
There are two different cycle times allowed. One cycle time which is used if no presence of a person is recognized and another, which is used if the presence of a person is recognized.
Thus it is possible to minimize the accesses to the DALI-Bus. If the presence of a person is recognized, a slow cycle time (f. e. 20s) can be used, because the light regulation and the switching off of the lighting is not time-critical. If no presence of a person is recognized, a smaller cycle time (f. e. 2s) should be used. Thus the switching on of the lighting can be done with a minimized reaction time.
You can find more informations and a description of the electrical and physical properties in the product description of the IA PIR-sensor.
VAR_INPUT
bReadDirectly : BOOL := FALSE;
tCycleTimeIfOccupancy : TIME := t#20s;
tCycleTimeIfNoOccupancy : TIME := t#2s;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
bReadDirectly: with a positive edge at this input the module is activated.
tCycleTimeIfOccupancy: cycle time if a presence is recognized.
tCycleTimeIfNoOccupancy: cycle time if no presence is recognized.
nAddr: adress of a member or a group.
eAddrType: short adress, group adress or broadcast.
eCommandPriority: priority (high, medium or low), with which the command is executed by the library.
VAR_OUTPUT
bOccupancy : BOOL;
nBrightness : INT;
nRawValue : BYTE;
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
bOccupancy: this output is set, if the sonsor recognizes presence.
nBrightness: measured light intensity in Lux.
nRawValue: the value the sonsor read before conversion.
bBusy: this output is set, when the module is activated and stays active until the command is executed.
bError: this output is set TRUE, if an error occurs while a command is executed.
nErrorId: contains the command-specific error code of the command executed last. Is set back to 0, if a new command is executed. See Error codes.
VAR_IN_OUT
stCommandBuffer : ST_DALIV2CommandBuffer;
stCommandBuffer: A reference to the structure for communication with the FB_DALIV2Communication() (KL6811) or FB_KL6821Communication() (KL6821) block.
Requirements
Development environment | Target system type | PLC library to include |
---|---|---|
TwinCAT 2.11 R3/x64 Build 2234 or higher | PC/CX, BX or BC | TcDALIV2-Library V2.9.0 or higher |