Spring 2004
Programming Assignment 1: A Sensor Network
Due: March 11th - in class
(for off-campus students - 14 days after viewing Lecture 9 )
In the first part of the programming project, you are to implement a sensor network. The network consists of a sensor proxy server that receives data from various data sources (or sensors) at periodic intervals and distributes the data to appropriate data sinks.
There are three components to this system ;
Sources (or Sensors): A source generates new data at periodic
intervals which it sends to the sensor proxy server for distribution. The data
is in the form of integer values. E.g. Sink 1 generates the value 47 at time
11:24:00. A source should register with the sensor proxy server (with
source_id, IP address, maybe even update time, if known) so that the sensor
proxy can update its list of sources. Real-life examples of such data are
weather updates, sports scores, IBM stock quotes etc.
Each of the sources
generates data at some periodicity and sends the new data to the sensor
proxy.
Sinks : Each sink subscribes to one (or more than one) source on the proxy's source list (say IBM stock quotes and weather updates). The sink IP address and respective source_ids are specified during the subscription process. After this, the proxy pushes data to sinks at sink-specified intervals. Thus, this is a push-based system, where sensors push data to the proxy and the proxy, in turn, pushes data to sinks.
Sensor Proxy : There are 2 roles that the proxy performs.
Collects data from sources. For this, it maintains a list of all data sources that send it data and some information about each source. The sensor proxy receives updated data at the interval specified by the source.
Distributes data to the sinks. For this purpose, a subscription list is maintained that stores the information about which sinks have subscribed to which sources. Based on this, the sensor proxy sends the data sent by a source (say IBM quotes) to all the sinks that have subscribed to that source.
You can be creative with this project. You are free to use any programming languages (C, C++, Java, etc) and any abstractions such as sockets, RPCs, RMIs, threads, events, etc. that might be needed.
Some things to keep in mind:
Deploy atleast 3 sources and atleast 4 sinks. They may be set up on the same machine or on different machines. Implement atleast one sink that is subscribed to more than one source. The data value returned to this sink by the sensor proxy should be the sum of the most recent values obtained from each of the different sources the sink is subscribed to. In this case, synchronization becomes very important. Study how the data transfer rate is affected by varying the intervals at which data is sent to the proxy by calculating the time for 100 data updates to a sink and averaging over the number of updates and number of sinks. Do the same thing by varying the size of the data files.
Do a simple experiment to study the scalability of the proxy server. Measure how the data tranfer rate from the proxy to sinks is affected by increasing the number of sinks and sources.
When you have finished implementing the complete assignment as described above, put all the code in a seperate directory in your edlab account (/677/project1).
You are required to submit your solution in the form of printouts.
Each program must work correctly and be documented. You should hand in:
- A copy of the output generated by running your program. When the sensor proxy receives data, have your program print a message "data received from source s" . When a sink is sent data by the proxy server, have your program print messages for the data being sent by the proxy and for the data being received by the sink.
- A seperate (typed) document of approximately two pages describing the overall program design, a description of "how it works", and design tradeoffs considered and made. Describe clearly how multiple threads and synchronization are handled. Also describe possible improvements and extensions to your program (and sketch how they might be made).
- A program listing containing in-line documentation.
- Instructions to compile and run the code from 677/project1.
- A seperate description of the tests you ran on your program to convince yourself that it is indeed correct. Also describe any cases for which your program is known not to work correctly.
- Performance results.
Let us not waste a lot of trees. So, if any of the above turn out to be large, just save the relevant information in a file, leave it on your EDLAB account and submit the name of the file.
Grading:
- Program Listing
- works correctly ------------- 50%
- in-line documentation -------- 15%
- Design Document
- quality of design ------------ 15%
- understandability of doc ------- 10%
- Thoroughness of test cases ---------- 10%
Grades for late programs will be lowered 12 points per day late.