Smart Parking System Overview and Analysis
Smart Parking System Overview and Analysis
INTRODUCTION
1.1. Project Description
Seeking a vacant parking space during peak hours in areas like Hospitals, Hotels &
Shopping Centers, Airports, Universities, and Exhibitions & Convention Center has
always been frustrating for many drivers. Surveys says that traffic generated by cars
searching for vacancies in Parking Spaces is up to 40% of the total traffic . Now that is
a serious issue to look after, and Smart Parking System is one of the best available
solutions to at least reduce the traffic congestion caused due to the above problem. This
application gives information about the occupancy status of the spaces in the parking
lot equipped with sensors that detect the presence of vehicles.
In real time, the environment have sensors and devices embedded into parking
spaces, transmitting data on the occupancy status; and the vehicle drivers can search
for parking availability using their mobile phones or any infotainment system that is
attached to the vehicle. Hence the driver would know where there is an available spot
to park his vehicle in less time, reducing the energy consumption and air pollution.
This information is helpful in choosing one parking space when there are
multiple available, keeping in mind the history of that space. For example, when there
are more than one vacant slots the driver will want to choose the one that has less
occupancy rate because the high occupancy rated slot might be wanted by many other
drivers and you don't want to waste your time reaching that slot.
1
1.2. Motivation
A Smart Parking System like this helps drivers make smart decisions which will
reduce congestion and make the most of available spaces. Finding a parking space has
become a daily concern these days, and that is where the motivation for this project
came up from. With the evolution of technology, we have smart phones, sensors that
detect the presence of any object and my idea is having a system where parking spaces
are equipped with these ultrasonic sensors that tells about the occupancy status of the
parking spaces and a central management system that posts this occupancy status to a
web application to guide the drivers in finding a vacant slot.
Smart parking is an emerging industry, with myriad solutions already adopted
by numerous cities and universities across the U.S. and abroad. More recently,
airports, mass transit, and corporate campuses are also turning to smart parking
technology to better manage their parking assets.
You may be asking, what exactly is ‘smart parking’ and how does it work?
Smart parking refers to the use of sensing devices to determine occupancy at the space
level or at the lot/structure level. Sensing devices can refer to cameras, counting
equipment like gates at the entrance of a lot, or sensors that are embedded into the
pavement of individual parking spaces, to name a few.
More robust sensing systems determine not only the state of a parking space
(occupied or vacant), but can analyze and transmit the information to various
channels, such as: mobile applications, web applications, and dynamic signage.
It is the strength and accuracy of the algorithms and applications that make for
a successful smart parking deployment.
Data capture in and of itself is not very useful; however, capturing real-time
data, combining it with historical data sets and benchmarked data, and presenting it in
an actionable way enables adopters to truly optimize their parking real estate.
2
CHAPTER 2
REQUIREMENT ANALYSIS
[Link].Software Requirement
Operating System: Windows XP, Windows 7 or Windows 8
IDE: Eclipse with STS Plugin
Application Server: Apache Tomcat 7.0.67
3
CHAPTER 3
DEVELOPMENT BACKGROUND AND APPROACH
In order to understand our choice of frameworks we have to describe Smart Parking
System's particular application requirements. This project has two primary
components; a web service that receives the occupancy status from the client or the
sensor and a web application that displays the parking slot occupancy status and also
the parking history trends. The Java based web service is built with Spring and
Hibernate to connect to the backend system which is MySQL database. The web
service is deployed in Apache Tomcat Server. And the web application has front end
designed using HTML5, CSS, JavaScript and jQuery. And has Ajax call to the web
service URL.
3.1. Spring Framework
The Spring Framework is an application framework and inversion of control container
for the Java platform. It has become popular as a replacement for, alternative to, or
even addition to the EJB model. The Spring Framework provides about 20 modules
which can be used based on an application requirement. The below figure shows
typical Spring Framework which can be categorized into 4 groups: Core Container,
Data Access/Integration, Web and Miscellaneous.
4
3.1.1. Core Container
The Core Container consists of Beans that provide Bean Factory, Core that provides
features like Dependency Injection and Inversion of Control, Context that provides
ApplicationContext which is the focal point of this module, SpEL provides a powerful
expression language for manipulating and querying an object graph at runtime.
3.1.3. Web
This module consists of Web-Socket that provide support for two way communication
between client and server, Web-MVC that contains MVC implementation, Web that
provides basic web- oriented integration features and Web-Portlet that provides MVC
implementation for Portlet environment.
3.1.4. Miscellaneous
Some other components on Spring Architecture are AOP that provides aspect-oriented
programming implementation, Aspects that provide integration with AspectJ which is
an AOP framework, Instrumentation that provides class instrumentation support and
class loader implementations, Messaging that provides support to STOMP, Test to
support the testing of Spring Framework components with JUnit or TestNG
frameworks.
3.1.5. Hibernate ORM
Hibernate ORM (Object Relational Model) is a high performance object-relational
persistence and query service. This eliminates the time spent on writing the native
SQL queries and lets users to develop persistent classes using object-oriented
principles. Using the metadata describing the mapping between the objects and the
database, ORM persists the objects in a Java application into the tables of a relational
database.
5
Figure 3.2 - Hibernate Architecture
The Hibernate architecture is as shown above in the figure 2.2. Let us discuss a little
bit of it here. Hibernate uses Java APIs like
JTA (Java Transaction API) – To integrate with J2EE application servers
JDBC (Java Database Connectivity) – Provides abstraction to allow any database with
JDBC drivers to be supported by Hibernate.
JNDI (Java Naming and Directory Interface) - To integrate with J2EE application
servers Brief about core interfaces of Hibernate Framework:
3.1.6. Configuration
It is used to configure and bootstrap hibernate. The instance of this interface is used
by the application to specify the location of hibernate specific mapping documents.
3.1.7. Session Factory
This delivers the session objects to hibernate application. There will be a single
Session Factory for the whole application and it will be shared among all the threads.
6
3.1.8. Transaction
The above three interfaces are mandatory, whereas this is an optional interface that
abstracts the code from any kind of transaction implementations.
3.1.9. Query and Criteria
This allows user to perform queries and also control the flow of the query execution.
3.2. JavaScript
The front end of the application is developed using JavaScript and jQuery library of
JavaScript . It is the programming language of HTML and the Web. Smart Parking
System application uses:
And AJAX (Asynchronous JavaScript and XML) calls are made to the web service
every 2 sec to display the latest occupancy statuses retrieving data from the database.
7
CHAPTER 4
SYSTEM DESIGN
The User of the system is a vehicle driver who would be searching for a
vacant parking space, and the use cases are the sequence of actions that provide
something of measurable value to the user like checking the parking lot for vacant
spaces, checking the parking history to find the most occupied and less occupied
parking slots. And finally after finding a vacant space, he can park his vehicle.
8
The below figure depicts the Use Case Diagram for the Vehicle Drivers:
9
Below is the main class diagram for the entire application. The diagram clearly
explains about the relationships between two or more classes and also between classes
and interfaces.
10
Here are the other classes and their relationships in the project:
[Link].DAO Classes
their attributes clearly mentioned; top section is the class or the interface name, below
are the attributes in those particular classes. Here we have the queries required to
retrieve or update the database. GenericDao is an interface providing basic CRUD
operations. And GenericJpaDao is the JPA implementation of the GenericDao
interface. ParkingSlotDao is an interface extending GenericDao interface and
ParkingSlotDaoImpl is the implementation class for the interface. Similar with
ParkingHistoryDao interface and ParkingHistoryDaoImpl class.
11
[Link].Entity Classes, and their attributes
these are the classes that does Object Relational Mapping to the database. These
classes are the mapping of the database tables using ORM. ParkingHistory and
ParkingSlot classes are mapped to Parking History and Parking Slot tables in the
databases. And the column values of the tables are mapped with the attributes of the
classes. We also define the relationships between the tables in this classes.
12
[Link].Model Classes, and their attributes
Relationship between Parking Slot table and Parking History table. These classes have
methods that convert the Entity to Models with giving only the required information.
13
[Link].Service Classes, and their attributes
the main class diagram above depicts the relationships between these service classes
and web services classes. These classes contains methods to retrieve the requests from
the View and handle those requests by having methods to display current parking
occupancy status of all slot ids and also parking history to generate chart. The
response is sent back to the View (designed using JavaScript).
14
CHAPTER 5
IMPLEMENTATION
Smart Parking System is a web application that is developed to help drivers in finding
a vacant parking space during any time of day. The main objective of the application is
to provide the occupancy status (vacant/occupied) of the parking spaces and also to get
information about the parking history data on any particular date. The user is allowed
to choose any date and can get the information related to parking spaces occupancy
throughout that day.
The Smart Parking Application is developed on Eclipse IDE with STS Plugin using
1.7. The user interface is designed using JavaScript and the business logic I coded in
Java. The application also makes use of annotations in Java, especially Spring
Framework and Hibernate annotations. The backend database is MySQL and I have
used MySQL Query Browser in order to manage the database. The web application
developed is archived to a war file and then deployed in Tomcat Server. The total
number of lines of code breakdown with respect to language is listed below:
Language Number
of LOC
Java 1677
15
XML 132
HTML5, CSS 169
JavaScript, 164
jQuery
Total 2142
starting from zeroth hour to 24th hour. Here we can see the parking history of any day,
by just setting the required date by using the calendar provided.
In the table, the first column is Parking Slot Number or Id, second column is the
Occupancy Indicator, and third column is the Occupancy Message. Occupancy
Indicator have two buttons or LEDs red and green. Green indicates that the parking
slot is vacant and red indicates that it is already occupied by other vehicles. The last
column is to display the Occupancy Message, i.e. 'Vacant' or 'Occupied'.
In the chart below the table, we can see that there are Slot no’s and Slot
Occupancy Status at particular 4 hour slot of the day. Upon hovering on the small
16
blue bars, we can see the exact time when there was a vehicle in that slot.
The User Interface of Smart Parking web application meets all the initial
goals, being very precise and making every detail clear on screen. The UI is designed
in a way where the occupancy statuses of parking slots are very clearly visible by just
looking into the colors of the indicators. And further information can be seen in the
Occupancy message column. And this UI can be extended to mobile platforms with
the same design, as it is very much compatible with the mobile screen size as well.
One can view the occupancy status in one panel and can see the parking history by
scrolling down in the mobile screen.
17
18
Figure5. Smart Parking System
The figure 5.2 shows to set any date required to see the parking slot occupancy
statuses on that day. This is an easy way to select a date by either writing the numbers
manually or by using the + and – signs. When a date is selected, just click on Set to
apply the changes. And we would be given the information of parking spaces on that
date.
19
Tomcat Server
The screenshot below (figure 5.3) shows the web service deployed on Apache Tomcat
server.
[Link]
/1/true
Thisweb service call can be executed using any client like Android phone, web browser, or
any IoT device.
20
The output screenshot is shown in figure 5.4, where we can see that the occupancy
status of the parking slot P1 is changed from Vacant to Occupied.
All the above screenshots shows a good view of the user interface of Smart Parking
System. The goal of the UI is to clearly show the status of the parking slots. The Green
and Red indicators gives the status in just first look. And the Occupancy Message is to
precisely say the availability of the parking slot.
21
CHAPTER 6
TESTING
A process of executing a program with the explicit intention of finding errors, that is
making the program fail. It is the process of detecting errors and performs a very
critical - role for quality assurance, also for ensuring the reliability of software. The
results of testing are used later on during maintenance also.
Below are the unit test cases that are run manually:
22
Server, on the load of html file ‘Occupied’ Status Message a
s
s
After the start of Tomcat Display Green indicator for P
Server, on the load of html file ‘Vacant’ Status Message a
s
s
Upon receiving occupancy Change in the parking slot 1 only, P
status change from client for and should not affect other parking a
parking slot 1 slot status messages. s
s
Upon receiving occupancy Change in the parking slot 1 only, P
status change from client for and should not affect other parking a
parking slot 1 slot status indicators. s
s
Upon receiving occupancy Change in the parking slot 2 only, P
status change from client for and should not affect other parking a
parking slot 2 slot status messages. s
s
Upon receiving occupancy Change in the parking slot 2 only, P
status change from client for and should not affect other parking a
parking slot 2 slot status indicators. s
s
Upon receiving occupancy Change in the parking slot 3 only, P
status change from client for and should not affect other parking a
parking slot 3 slot status messages. s
s
23
Upon receiving occupancy Change in the parking slot 3 only, P
status change from client for and should not affect other parking a
parking slot 3 slot status indicators. s
s
Upon receiving Occupancy Change Green indicator to Red P
Status as ‘Occupied’ Indicator a
s
s
Upon receiving Occupancy Change Occupancy Message from P
Status as ‘Occupied’ ‘Vacant’ to ‘Occupied’ a
s
s
Upon receiving Occupancy Change Red indicator to Green P
Status as ‘Vacant’ Indicator a
s
s
Upon receiving Occupancy Change Occupancy Message from P
Status as ‘Vacant’ ‘Occupied’ to ‘Vacant’ a
s
s
Upon loading html page Display occupancy trends of all P
parking slots in the chart at all the a
recorded timings s
s
Upon a vehicle occupying a Display the presence of vehicle at P
vacant parking slot that particular time in the chart a
s
s
24
6.2. Integration Testing
Here focus is on design and construction of the software architecture. Integration
Testing is a systematic technique for constructing the program structure while at the
same time conducting tests to uncover errors associated with interfacing. The
objective is to take unit tested components and build a program structure that has
been dictated by design. The goal here is to see if modules can be integrated properly,
the emphasis being on testing interfaces between modules.
This testing activity can be considered as testing the design and hence the
emphasis on testing module interactions. In this project the main system is formed by
integrating all the modules. When integrating all the modules I have checked whether
the integration effects working of any of the services by giving different
combinations of inputs with which the two services run perfectly before integration.
Below are the few Integration Test Cases that are done manually:
25
slots in the chart at all the
recorded timings
Upon receiving Occupancy Change Green indicator to Red P
Status as ‘Occupied’ indicator and change in a
Occupancy Message from s
‘Vacant’ to ‘Occupied’ s
Upon receiving Occupancy Change Red indicator to Green P
Status as ‘Vacant’ indicator and change in a
Occupancy Message from s
‘Occupied’ to ‘Vacant’ s
Upon a vehicle occupying a Display the presence of vehicle P
vacant parking slot at that particular time in the a
chart and also change in the s
occupancy status and message s
Upon refreshing the html page Sync data with the database and P
update the page a
s
s
I made sure I have covered all the requirements that were discussed earlier at
the start of the project. And also confirmed that the application works just the way it
has to.
26
application on their machines and got expected results. I have also presented this
application in front of my Major Professor where I only completed the first phase of the
application that the application would display the occupancy status of the parking
space. But later we discussed on extending the application to display parking trends on
a chart for any given date. I successfully completed implementing that part as well and
tested to result as expected. The application was tested in all possible aspects and got
just expected results.
I have used Apache JMeter to perform load testing which can be used to test
performance both on static as well as dynamic resources (files, Servlets, Perl Scripts,
Java Objects, Databases and Queries, FTP Servers and more). It can be used to
simulate a heavy load on a server, network or object to test its strength or to analyze
overall performance under different load types. Using JMeter I have taken increased
number of users while using the page with the same Ramp-Up period and Loop Count.
27
Using JMeter I have taken increased number of users while using the page with the
same Ramp-Up period and Loop Count. We can see that with increase in the number
of users, the throughput is increased.
6.5.1. Graphical Analysis for the same test cases
The graphs below shows Response Times over Time. The vertical axis is the
Response Time in milliseconds and the horizontal axis is Elapsed Time i.e.
granularity/500 milliseconds. In all the three test cases, we can see that the Response
Times over Time is a constant graph.
28
Test Case 2: No. Of Users = 100
29
CHAPTER 7
CONCLUSION AND FUTURE WORK
7.1. Conclusion
Smart Parking System is a solution to the existing traffic congestion, to reduce
drivers’ frustration by providing information about the occupancy status of the parking
spaces. The project development went smoothly while teaching me many best
practices in programming using the current trending technologies like Spring
Framework, Hibernate ORM and REST APIs. I could see that all the initial
requirements of the project are achieved and also I tried doing minor data analysis on
the parking spaces occupancy statuses.
The web application is user friendly; any user can easily find the status
(vacant/occupied) of the parking space and also can set the required date to see the
parking history. Starting from coming up with project idea, understanding the
requirements and choosing the best technologies for the implementation, all this gave
me very good experience and exposure in development of a full stack web application.
Upon completing this project successfully, I got familiar with Eclipse IDE Shortcuts,
Database tools and Tomcat server usage.
30
CHAPTER 8
BIBLIOGRAPHY
[1] A Reservation – based Smart Parking System by Hongwei Wang and Wenbo
He – April 01, 2016
[Link]
[Link]
31