Friday, 23 September 2011

Prediction of Traffic Flow by Sonic Analysis of Road Surface Vibration

For my KVPY Project I chose a topic that I found interesting (to me) and also I think will add value.

We all have experienced traffic congestion. It is quite painful. In addition it causes loss of scarce resources like fuel and manpower. A study shows that India Metros are high in Commuter Pain Index. Hence a model to ease congestion will help the nation.




Project Report
Final Project Report can be found in Google Docs (PDF File).
NOTE: Links in the project report refer to the old URL i.e. http://kvpy-rohini.blogspot.in/. This need to be changed to http://rohini-banerjee.blogspot.in/.  I wanted to keep the report as it was submitted
.

Background
Often in a traffic jam, I see my father take a diversion and commute via secondary roads. Sometimes esp in heavy traffic (generally caused by accidents) I have seen that the police divert traffic from main road to a secondary road.

Once while stuck on top of a bridge (near Science City, Kolkata traffic signal),I felt my car sway when the buses at opposite lane were moving. I found it quite interesting that traffic can cause enough vibration to make a car move. As a class IX student being introduced to resonance - I thought it was due to the bridge going in resonance. (I soon understood how wrong I was, when my father showed me a video of a bridge collapsing due to resonance).

About two years ago, my father was talking about a speech he heard (from senior researcher Dr. Manish Gupta's) on Smarter Planet. There have been various attempts to measure the traffic flow like measuring the change of frequency of a horn of moving vehicle (Doppler Effect) and shifting-pattern of cell phone tower usage.

Now that I am class XII and preparing for B.Sc. in IISc., I consolidated these experiences in my project and tried to make a small prototype of a Traffic Flow Sensor by analysis Road Surface Vibration.

Project Execution
When selecting the project for KVPY - a number of ideas came in my mind. I approached a neighbor Mrs. Manidipa Roy. {Manidipa Masi (Aunty = Masi in Bengali) is working on her PhD. I am impressed that a person well settled in life (she is the principal of a polytechnic school) and so senior in age still has the enthusiasm to do a PhD. I want to be a PhD in my life, the first in my family to achieve the degree}. After discussion with her and my father I selected the topic. I was quite excited about the topic.

After about a week or two, I managed to get my father come along with me and guard me while I do my "experiment". It was fun to see a crowd come along and see me digging a small hole. When I started measuring the sound and started adjusting the record volume sensitivity, many thought that I am trying to measure cell phone signal in ground and started giving me advice. It was fun to explain to common people (road side tea stall owner & customers, passer-by) what I was trying to do. Later they started explaining my work to others with their own "add-ons" that made the story interesting (one person even told another that I was putting a device that will listen to all his cell phone conversation).

Anyway to cut the long story short, I enjoyed very much working on the project. Later at evening when I listened to the recording, I was amazed to find that the sound of train was also recorded. The railway line is about 1.2 km away. I really understood what my teachers were saying when they mentioned that sound travels better and faster is solids than in gas.

The recording of sound vibration on day-1 is available as given below
While recording the sound, I was also making a note at my diary on the time (at the recorder) and the traffic flow. This helped me to match the recorded sound with the actual traffic flow. I also ensured that the recorder level is maintained at same level for each type of microphone.

While I could easily "see" a co-relation of the wave (as displayed in Audacity) with traffic flow, it is important to analyze it to determine its distinguishing parameters. 


My guide told me that she can help by having it analyzed with MATLAB in her machine. However we were not sure on how to import MP3 files in MATLAB for analysis. I stumbled on an excellent article Wave File Analysis from Worcester Polytechnic Institute that gave a step by step approach of analysis of a MP3 file.

With the help of the above site - I made the following scripts and went with that to my guide to get MATLAB analysis done.


The MATLAB analysis of slow moving traffic (code and result)

    [wave,fs]=wavread('c:\MATLAB6p5\work\A0802ST.wav');
    %sound(wave,fs);
    %t=0:1/fs:(length(wave)-1)/fs;
    %plot(t,wave);
    n=length(wave)-1;
    f=0:fs/n:fs;
    wavefft=abs(fft(wave));
    figure(1);
    plot(f,wavefft);
    title('A0802ST - Day-1 Slow Traffic; Start time = 08:02');



The MATLAB analysis of fast moving traffic (code and result)

    [wave,fs]=wavread('c:\MATLAB6p5\work\A08135FT.wav');
    %sound(wave,fs);
    t=0:1/fs:(length(wave)-1)/fs;
    plot(t,wave);
    n=length(wave)-1;
    f=0:fs/n:fs;
    wavefft=abs(fft(wave));
    figure(2);
    plot(f,wavefft);
    title('A08135FT - Day-1 Fast Traffic; Start time = 08:13.5');


The MATLAB analysis shows that the mean of the fast moving traffic wave is about double that of slow moving traffic wave. This is a reflection of the energy in the system when vehicles move fast.

Note:
  1. My guide & me were surprised to see two waves coming in MATLAB (You may notice a greenish and a bluish line in the analysis result given above). On investigation I found that I had set Audacity to record in stereo mode and hence the two waves. Only one is taken for analysis.
  2. I now have very elementary skill in MATLAB - I was helped in MATLAB by my guide.

Limitation of the Method
The major limitation of the method is the noise captured. The microphone records horns, people talking and even faraway traffic noise (ex. traffic moving in other direction).

For the method to be deployed in real-life, it is necessary to filter out the noise. An approach can be to place the microphone deep inside (I made a hold a few inches deep). However I am skeptical that this will resolve the problem. The reason for this is that we have seen sound of train moving more than a km has got recorded.

I feel that we can capture the signal generated from a piezoelectric device. The device can be placed under the road and when vehicles press it, it will generate an electrical pulse. Frequency of the pulse will enable us to estimate the traffic flow.

What Next
For the method to be commercially viable, we need to develop small instruments that can capture the signal, analyze it and communicate the result to a central computer where city traffic planning can be done.

Traffic Control Room @ Kolkata (Feb 2011)


Developed countries have high-tech sensors and infrastructure (In Singapore, controllers receive real-time data through sensors to model and predict traffic scenarios with 90% accuracy. - source IBM).

As the above two photographs depict, we do not have the same luxury. We need to find a simple cost effective solution based on radically different approach. I think my project is innovative and hope that my project will induce innovation to solve this problem in India.