Omnet++ Lessons Part One

Omnet++ is one simulator which I liked a lot. It gave me enough confidence that I can build a network from scratch (like Steven's book building a complete TCP/IP stack). These files were written while I was at IIT Madras and reproduced here for learning purpose.
In this post, I start with a packet generator which simply generate a packet per given period of time.
This will introduce minimum number of files needed to write an Omnet application (cc c++ source file, the network descriptor : ned and the launcher : omnetpp.ini)

Tool: Omnetpp 4.xx (which is built over eclipse)

Not too much speech, let's get our hands dirty.

Periodic packet generator
input : number of packets to generate

Steps: Define a cpp file

#include <omnetpp.h>
class generator : public cSimpleModule
int nbPackets, packetCount;
virtual void initialize()
generateMsg=new cMessage("selfMsg");
virtual void handleMessage(cMessage *msg)
EV<<"generated the msg"<packetCount++;
virtual void finish()
if (generateMsg!=NULL)
delete generateMsg;

The last line instructs the omnet tool to use this source as "generator"

Now let's build the network


simple generator
int totalPackets = default(100);
network one

Now let's write the launcher file: omnetpp.ini
network = one
**.gen.totalPackets = 10

Build and run
Just right click "one" project and from build menu, build it.

Right click on omnetpp.ini and run the same.

Output is shown below.

Gentle introduction to research

About three and a half years back, when I was joining MS by research in IIT Madras, I did not have much idea about how to do it or what to look for or what could be the outcome. This blog is about the methods I learned over the years from my guides and colleagues on research. Please note that it is for people who are just starting research or thinking of doing research. Before I begin, a special thanks to the persons who inspired me (in the order in which I met them): Dr. Achutshankar S Nair (Director Centre for Bioinformatics, Kerala University- 2005) , Prof. PanduRangan (Faculty at IIT Madras -2006), Microsoft Research team (2006 and 2009), Dr. Shalu MA (Faculty, IIIT D&M Kanchipuram 2007) and Prof. Krishna Sivalingam (My guide at IIT Madras-2007) to put me in this track.

Research needs many things. First three are patience, patience and patience. Then a passion to make things work. If you believe you have both, then comes resources, guide and affiliation. If you think that research field is completely ethical, please re-think. In academia, it is "publish or perish" attitude for 99% of the researchers. So, let's get started.

1. Area of research
No matter what area you select, it is your passion for it which matters. Sometimes you have the freedom to select. But I have seen cases where the selection made a complete mess and people later cries for changing the area. In research, all areas are equally good (equally worse). You can not judge which one is good even your likes some areas. So, number one is passion.

I was passionate about cryptography and security. But I chose/was asked to work in low power wireless networks (wireless sensor networks). My passion for networking was the only thing I had while choosing this area.

2. Basics/Fundamentals
Though area selection may not be accurate to what you may like, the fundamentals of that area remains the same.
Main things you should try to know are
  1. The way an experiment has to be conducted
  2. Basic principles by which that area itself exists
  3. Works of core people in that area
  4. basics behind the real life solutions came from that area
You may use google effectively to find out these things.

I wanted to study wireless networks fundamentals. The general queries I used to search are
  • Handout wireless networks filetype:pdf. This will give a list of universities who runs courses in this subject. I visit their site, from the pdf links and try to see the references used, the tools (software programs, simulators) or the lab experiments designed for that course. I also tried to answer the homework questions and exam papers. Other materials like presentation slides, video lectures were also used to get a start.
  • Youtube Edu( is a great resource for video lectures in given area. Watch the classes by the best professors in the world. You will start enjoying the subjects.
3. Resources
Having done the background study, you should be familiar with the tools and experiments and should have done basic experiments in the tools/labs
You need to have
  1. Knowledge in using the tools (eg: Matlab or Simulators)
  2. Understand the limitations of the tools compared to real life scenarios. That is in which all cases the tool can fail.
  3. Access to recent literature on the area such as scientific journals, edited books on research, conferences proceedings. Don't worry there is google scholar ( which can give you good results. Use British Library membership, if you don't have access to the journals/publications
  4. Guide and affiliation. See your guide as another human being. He may be wrong/ busy not looking what you are doing/ ignore the work you feel very important. It is you who is doing research and he/she is only a guide. He/she should only show the way and help you to walk your way. Affiliation is very important in later part of your research, if you do not wish to struggle a lot to get recognition of your work.

Selecting an institution and guide may not be in your hand. But try to be a part of the best. When I say best, it does not come cheap. You need to work really hard to keep the standards.

4. Literature survey

This is the situation where you have a guide, area of research and you are familiar with experiments and tools. Most of the cases, the publish or perish people might have put so much of mathematical jargon making it difficult for you to read or understand it. The method I tried was to
  1. Search for survey/ tutorials published in past two years. Each section of these articles describes current limitations and suggests possible improvements. Note down that.
  2. If possible try to repeat the experiments and verify the results. It gives different insights to the problem
  3. Do a forward search on the article you are reading to find out who else worked and improved/criticized the work you are reading. Again google scholar gives "cited by" which is highly useful.
  4. Do a reverse search on a very interesting article to see the basic papers the authors have used, to build the paper.
  5. Try to write to people who are currently working in this area for your basic doubts. At least 1 out of 10 will reply.
I might have read hundreds of articles in first six months, noting down the assumptions, making forward and reverse search and trying to just understand the results of a few classic papers in wireless networking. This part is not easy. But it helps a lot, while you write your own paper.

5. Pushing the boundaries
Once you are familiar with the classic papers in the area you are working and current open problems,
  • Try to do more experiments
  • Try different set of tools (different algorithms, approaches, assumptions)
  • Check if your assumptions holds good
  • Do come up with your own set of experiments, validate the input and expected output. Discuss with your guide/study group on the methods. At any time you can expect a blow to your assumptions or experiments
6. Publishing what you believe
Writing is the worst part in research. It is very difficult to select what is important. The things you feel important may not be that important to the people who read it. A well written paper might have undergone more than 20 iterations.
First time when you are writing a paper
  1. Write the literature survey and background section. This should make the reader ready for understanding your methodology and why it is different from existing work(s). Always try to include one or two diagrams describing the existing system and methodology
  2. Clearly state what is different in your work. It may be a specific case, but make sure that your background section is sufficient for a reader to understand what you are telling
  3. Not all things are to be explained to the ground level. Use citations to give reference to surveys, tutorials and basic articles you followed to write the paper
  4. Explain the different approaches in literature and what approach you are choosing. Justify them
  5. Write your assumptions and proposed solution
  6. Explain the experiment set-up with block diagrams/figures
  7. Add results, graphs and write clear explanations for whatever figure you add
  8. Add abstract, introduction and conclusion sections
  9. Give it for peer review and correct spelling and grammar
  10. Re-write and repeat step 9.
  11. Once you are ready, look for conferences and journals in your area.

For conference or journal call for papers, one tool I use is WikiCFP ( I have subscribed to other mailing lists which gives updates about call for papers in my area of research.

Survival Guide
I should say that, this can be really frustrating. .
  1. Have a good healthy routine.
  2. Do other activities daily, like playing
  3. Read articles from other areas
  4. Have open discussions with people working in different areas. You never know from where the spark can come.
  5. Present the summary of what you read/what you are working on at least once in two weeks. It keeps you in track, even if you feel you are lost.

Try reading articles by Douglas Comer ( and phdcomics (

All the best!!!