Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- added a first pass to the aggregator section

- modified simulator for testing
  • Loading branch information...
commit 981d8d52310a3cfd0440af2706b7dfcb4f76265e 1 parent 81b6caf
Michael Schultz authored
View
38 doc/paper/report.bib
@@ -10,6 +10,44 @@ @Misc{ pgi:signal-park
note="\url{http://www.signalpark.com/}",
}
+@Misc{ google:appengine,
+ title="Google AppEngine",
+ publisher="Google, Inc.",
+ note="\url{http://code.google.com/appengine/}",
+}
+
+@Inproceedings{ google:bigtable,
+ author = "Fay Chang and Jeffrey Dean and Sanjay Ghemawat and Wilson C.
+ Hsieh and Deborah A. Wallach and Mike Burrows and Tushar Chandra
+ and Andrew Fikes and Robert E. Gruber",
+ title = {Bigtable: A distributed storage system for structured data},
+ booktitle = {In Proceedings of the 7th Conference on USENIX SymposiuM
+ on Operating Systems Design and Implementation},
+ year = {2006},
+ pages = {205--218},
+ publisher = {}
+}
+
+@Inproceedings{ pautasso:restful,
+ author = {Pautasso, Cesare and Zimmermann, Olaf and Leymann, Frank},
+ title = {Restful web services vs. "big"' web services: making the right
+ architectural decision},
+ booktitle = {Proceeding of the 17th international conference on World
+ Wide Web},
+ series = {WWW '08},
+ year = {2008},
+ location = {Beijing, China},
+ pages = {805--814},
+ publisher = {ACM},
+ address = {New York, NY, USA},
+}
+
+
+@Misc{ geomodel,
+ title="geomodel",
+ note="\url{http://code.google.com/p/geomodel/}",
+}
+
@Misc{ pgi:streetline,
title="Streetline Parking Management System",
publisher="Streetline, Inc.",
View
BIN  doc/paper/report.pdf
Binary file not shown
View
86 doc/paper/report.tex
@@ -208,17 +208,87 @@ \subsection{Collection Software}
transportation systems.
% end from proposal
-
\subsection{Aggregation Software}
-A paragraph laying out what Google AppEngine is, why we chose it, and what
-it does for us.
-
-A paragraph or two describing the AE backend and frontend(s).
+Data leaving the base station of a parking lot is directed over then
+Internet to our aggregation software hosted on Google's
+AppEngine~\cite{google:appengine}.
+For this project, we decided the AppEngine environment was an appropriate
+choice for several reasons:
+\begin{itemize}
+ \item The service is free for light usage (testing and development).
+ \item It provides a Python programming environment.
+ \item Most importantly, it is designed to scale up with ease
+ transparently with large datasets.
+\end{itemize}
-More detailed description of the underlying implementation (packet formats
-in the network, sending data to AppEngine, specific technology used on
-backend, any frontend stuff).
+The nature of our project is to have one sensor per parking space in a
+parking lot for every parking lot.
+This implies that over time our backend must be able to accept, store, and
+recall large amounts of current and historical data.
+We could have sunk our resources into using a traditional server model for
+the purposes of a prototype, however if the project were to start scaling
+up great amounts we would start running into resource barriers.
+Google's AppEngine is designed to scale with demand, this is largely due to
+their use of a datastore built on top of Bigtable~\cite{google:bigtable}.
+Though transparent to users of our system, this non-SQL based datastore
+forced a few notable differences from a SQL based datastore.
+
+First, while queries appear to be SQL, they are actually ``GQL,'' a
+SQL-like language.
+In general this does not bring any problems, but because of the
+organization of the datastore imprecise queries are not acceptable.
+You must know the data you are looking for.
+You cannot simple SELECT one or two columns from the datastore, rather you
+must get all the columns or a unique key identifier that matches the query.
+
+Second, its harder to perform proximity searches with the datastore because
+there is not concept of ``similar'' or ``like'' queries, you either know
+the data or don't know the data.
+However, with the help of the geomodel API~\cite{geomodel} we are able to
+use geohashing to perform proximity searches on the datastore.
+This is useful to locate nearby parking lots, allowing the end-user to
+identify other potential parking areas.
+
+With an understanding of the underlying technology, we are able to present
+an easy to use API.
+
+\subsubsection{A RESTful API}
+
+REpresentational State Transfer (REST) is an abstract model for building
+large-scale web services~\cite{pautasso:restful}.
+The principles of a RESTful architecture are an identification of resources
+through a URI, a ``pure'' HTTP interface, and self-contained hyperlinks.
+In this section we describe how we achieved these principles.
+
+Our URI scheme is straight-forward.
+Each lot is given a unique identification consisting of alphanumerics and
+the underscore (\_) character.
+When attempting to access a specific lot, that identifier is part of the
+URI (i.e.,
+\texttt{http://<host>/lot/wustl\_millbrook/}
+identifies the Milbrook lot on Washington University's campus).
+
+Any request concerning this lot must go through its URI.
+Requests use one of the HTTP verbs of \texttt{GET}, \texttt{PUT}, or
+\texttt{POST}.
+A \texttt{GET} request simply returns the information for the requested URI
+in either the HTML or JSON format.
+A \texttt{PUT} request attempts to store updated status information to the
+lot.
+This request contains the list of parking spaces to update, their
+identification and status, as well as any associated meta-information that
+should be put in the datastore.
+Finally, a \texttt{POST} request handles the creation of new parking lots.
+
+With the API in place, we are able to create rich applications with ease
+for expansion and integration into other software.
+As a demonstration, we build up a web-based frontend in the next section
+that takes advantage of our API.
+
+\subsubsection{Web Frontend}
+
+Explanation of the frontend will go here.
\section{Experiment}\label{sec:experiment}
View
39 src/frontend/simulator.py
@@ -4,6 +4,9 @@
import sys
import random
import json
+import time
+from datetime import datetime as dtdt
+from datetime import time as dtt
if len(sys.argv) >= 2 :
hostname = sys.argv[1]
@@ -19,17 +22,39 @@ def space_list(min, max, items) :
for i in range(items) :
yield random.randint(min,max)
-host = httplib.HTTPConnection(hostname)
simulating = True
while simulating :
+ host = httplib.HTTPConnection(hostname)
print 'PUT to',hostname,'in lot',lotname,'...',
# generage a random number of spaces to change
spaces = []
- changed = random.randint(1, 8)
- for space_id in space_list(0, 10, changed) :
+ changed = random.randint(1, 10)
+ now = dtdt.now()
+ six_oclock = dtdt.combine(now.date(), dtt(6, 00))
+ seven_oclock = dtdt.combine(now.date(), dtt(7, 00))
+ twelve_oclock = dtdt.combine(now.date(), dtt(12, 00))
+ thirteen_oclock = dtdt.combine(now.date(), dtt(13, 00))
+ eighteen_oclock = dtdt.combine(now.date(), dtt(18, 00))
+ nineteen_oclock = dtdt.combine(now.date(), dtt(19, 00))
+ twentytwo_oclock = dtdt.combine(now.date(), dtt(22, 00))
+ five_oclock = dtdt.combine(now.date(), dtt(5, 00))
+ if six_oclock <= now <= seven_oclock :
+ weight = 3
+ elif twelve_oclock <= now <= thirteen_oclock :
+ changed *= 2
+ weight = 3
+ elif eighteen_oclock <= now <= nineteen_oclock :
+ weight = 3
+ elif now >= twentytwo_oclock or now <= five_oclock :
+ weight = 5
+ changed /= 2
+ else :
+ weight = 1
+
+ for space_id in space_list(0, 30, changed) :
space = {'space_id': space_id,
- 'is_empty': bool(random.randint(0,1))}
+ 'is_empty': bool(random.randint(0,weight))}
for thing in ('temperature','sonar','light','magnet') :
if bool(random.randint(0,1)) :
space[thing] = int(random.random()*256)
@@ -48,8 +73,8 @@ def space_list(min, max, items) :
del space['is_empty']
print '\t'+str(space)
- next_round = raw_input('Continue (Y/n): ')
- if next_round not in ('', 'yes', 'y', 'Y') :
- simulating = False
+ host.close()
+ time.sleep(90+random.randint(-30,30))
+ # sleeps between 60 and 120 seconds
print 'Done.'
Please sign in to comment.
Something went wrong with that request. Please try again.