How to implement a simple Man Trap using PE
A mantrap is an access methodology with an entry door and an exit door. One door of the mantrap can not be opened until the opposite door has been closed.
Mantraps are most often used to keep non-secure areas separated from secure areas and prevent unauthorized access.
'This program implements a Man Trap that allows one person at a time in the man trap. 'Once a person is in the man trap no access is allowed until the occupant leaves the
'man trap via the REX. 'The occupant is allowed to exit at either door but once they have activated the REX
'at one door they are required to leave via that door. 'If occupant stays in the trap longer than TrapMaxOccTime and alarm can be sent via ManTrapStuck 'TrapMaxOccTime and ManTrapStuck are InfinityNumeric objects in the controller. 'Program is Looping and AutoStart TRAP_READY: ManTrap_A DisRdrKpAccess = False ManTrap_B DisRdrKpAccess = False ManTrap_A OpenOnExitReqst = True ManTrap_B OpenOnExitReqst = True If ManTrap_A ValidAccess or ManTrap_B ValidAccess then Goto TRAP_OCCUPIED TRAP_OCCUPIED: ManTrap_A DisRdrKpAccess = True ManTrap_B DisRdrKpAccess = True If ManTrap_B ExitRequest then ManTrap_A OpenOnExitReqst = False Goto WAIT_EXIT_B Endif If ManTrap_A ExitRequest then ManTrap_B OpenOnExitReqst = False Goto WAIT_EXIT_A Endif WAIT_EXIT_A: If ManTrap_A DoorSwitch = Opened then Goto TRAP_READY If TS > TrapMaxOccTime then ManTrapStuck = On WAIT_EXIT_B: If ManTrap_B DoorSwitch = Opened then Goto TRAP_READY If TS > TrapMaxOccTime then ManTrapStuck = On 'Keep program from disabling due to run time errors E: If TS > 30 then Goto TRAP_READY