This chapter deals with simulation and animation of an access control
system for car parking.
This case study exemplifies the development of a multithreaded and
event-based software architecture. The system is organized into a client
server hierarchy of control modules. The clients send commands to the
servers according to the caller
provider paradigm. The servers notify state
changes by raising events.
Focus: hierarchical control architecture.
OO techniques: encapsulation, abstract classes and inheritance.
Java features: the observer
observable mechanism offered by the java.util
Background: patterns and mechanisms discussed in Chapters 8, 9 and 10.
Access control systems are employed when the flow of people or vehicles
must be regulated. Typical examples are museums, motorway toll stations
and car parking.
Let us consider Figure 11.1. It depicts the access zone to car parking.
Only one car at a time can be in the access zone. When a car arrives, the
driver should withdraw the ticket and then proceed into the parking area.
The car flow is regulated by an access control system that is made up of
the following devices:
SEM is a semaphore. When it is red the car should stop. When it is green
the car can proceed towards the ticket dispenser.
IN_PhC is a photocell positioned at the beginning of the access zone. It
detects the arrival of a car.
TD is a ticket dispenser that delivers one ticket at a time.
SB is a stopping bar that prevents the car from proceeding.
OUT_PhC is a photocell positioned at the end of the access zone. It
detects the entrance of a car inside the parking area.
A computer is connected to the devices with a field bus. It transmits
signals from the devices to the computer and commands from the computer