FB_BA_PresenceMonitoring
![FB_BA_PresenceMonitoring 1:](Images/png/12505047947__Web.png)
Universal presence monitoring template with reset inputs for delay timer and manual function.
Via the input bPresence a switch-off delayed occupancy signal is issued at the output bPresenceState.
The switch-off delay is defined by nDlyPrc [s]. After this time has elapsed, not only bPresenceState is set to FALSE again, but also a TRUE pulse at output bRstSwi. This pulse can be used to reset manual overrides, for example, on blind or light functions.
If a TRUE signal is given at input bRstDelayTimer, the delay timer is cleared and output bPresenceState goes to FALSE until presence is detected again by input bPresence.
A TRUE signal at input bRstManMod specifically triggers output bRstSwi.
Both reset functions are important for a central shutdown, where it is assumed that no one is left in place.
At the output nCountdownPresence the remaining time of the delay timer can be read in seconds for commissioning purposes.
![]() | The initialization of the template takes place within the method FB_Init. |
Syntax
FUNCTION_BLOCK FB_BA_PresenceMonitoring
VAR_INPUT
bPresence : BOOL;
bRstDelayTimer : BOOL;
bRstManMod : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
nDlyPrc : UDINT;
END_VAR
VAR_OUTPUT
bRstSwi : BOOL;
bPresenceState : BOOL;
nCountdownPresence : UDINT;
END_VAR
VAR
tofPrcDetc : TOF;
rtRstDelayTimer : R_TRIG;
rtRstManMod : R_TRIG;
ftPrc : F_TRIG;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bPresence | BOOL | The presence signal input is passed on to the output bPresenceState with a switch-off delay. |
bRstDelayTimer | BOOL | Reset input for the switch-off delay. A TRUE signal at this input resets the internal timer. |
bRstManMode | BOOL | Reset input for the manual override. A TRUE signal at this input generates a positive edge at the output bRstSwi. |
Inputs CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
nDlyPrc | UDINT | Switch-off delay time [s]. Preset to 3600 in FB_Init. |
Outputs
Name | Type | Description |
---|---|---|
bRstSwi | BOOL | Reset output for manual overrides. |
bPresenceState | BOOL | Switch-off delayed presence state. |
nCountDownPresence | UDINT | Remaining time of the delay timer in seconds. |
Variables
Name | Type | Description |
---|---|---|
tofPrcDetc | TOF | Switch-off delay presence. |
rtRstDelayTimer | R_TRIG | Trigger for the reset of the timer. |
rtRstManMod | R_TRIG | Trigger for the reset of the manual override. |
ftPrc | F_TRIG | Trigger for the reset of the manual override, but controlled by the omission of the presence. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.35 | TF8040 | TwinCAT Building Automation from V5.2.1.0 |