Starting to Use NS2 is Easy
At first glance, learning NS2 is not very hard. You can go through the tutorial byMark Greis’ Tutorial, and learn NS2 in few hours.
Then you will feel like you are on the right track. NS2 is a very simple. The Tcl is a very simple and intuitive language. You can construct a complex network (e.g., TCP over wireless networks) very easily. Moreover, you can get a nice animation from nam (network animator) and plot graphs using Xgraph. What’s more do you want?
Hit by Reality when Extending NS2 beyond its Scope
There is only one problem. One big problem. Things are simple as long as what you would like to work on is built-in to NS2. What’s the odds? Very slim! If you are doing research, you would do something innovative. Something that no one has done before. And, that thing, my friends, is not very likely to be one of NS2 built-in modules.
From this point, everything goes downhill. A common question everyone ask is as follow. I have a great research idea. How can run NS2 to validate my idea.? Good question but the answer can be harsh.
Nothing in Life is Easy
I don’t mean to discourage you. But learning NS2 beyond its scope is excruciatingly painful. You’ve got a lot of work to do. If you really want to know NS2, here is the step that I would suggest you should learn.
Quick Fix: An Easy Way in Doing Simulation in NS2 (not Recommended)
I started learning NS2 in a wrong way. I did not start from basic. So I chose a quick and easy way, trying to modified the NS2 codes to fit my needs and hoping that it’ll work. Sometimes, it did. Sometimes, it did not. In the end, I had to abandon NS2, and wrote my own simulation code in C++. Do not follow my footstep!
If you are reading upto this point, it means you do not want to follow my mistake, and you are commit yourself to seriously learn NS2. Here are few things that you need to do before proceed further:
1. Learn C++: Not just C. The OOP (object oriented programming) concept is the very core of NS2.
2. Learn Tcl: The scripting language by NS2. I find the following book quite useful.
You only need to read chapters 3-7.
3. Learn OTcl: Objected Oriented version of OTcl. The most useful resource is [This website].
5. Go through Mark Greis’ Tutorial.
After you clear the above checklist, you can proceed to the key steps in learning NS2 below.
Key Steps in Learning NS2
Regardless of you research work, I believe you should get the basic first. And, here are the key steps.
1. Learn how NS2 pass packets from one object to another (e.g., from aNode to a SimpleLink).
2. Learn how to bind C++ and OTcl. This is a hard one. But, it will be easier when you understand the first step.
3. Learn the module you are interested in. Really, it’s quite hard if you don’t have the basic in NS2, and want to jump start to do your own work. It’s like a baby trying to jump before learning how to crawl!
4. Modify, include, and build. This would be the final thing that you need to learn.