Most of the researcher who try to understand the source codes of network simulator 2 are unable to understand those. It is because they do not know the correct path to understand it. If one try to learn it in a proper way then it is not that much tough. Here are some steps to understand these steps and I will be writing blog on each these steps and will be conducting online live sessions once I have sufficient audience for it. It will take around 2 months to learn NS2 while going through a proper path.
Step 1: Learn basic commands of Linux: Some basic terminal commands are necessary for installation of NS2 and work on it. The number of these commands is not more than 10.
Step 2: Learn Tcl Script: Understanding Tcl script is the second step. Since it is used in the scenario generation.
Step 3: Learn Trace file: Trace file is the output of Tcl file. Events of simulation are arranged in rows in it.
Step 4: Learn to write AWK script: AWK scripts are used to get the outputs from trace file.
Step 5: Study most important source files: The most important source files are packet.h, packet.cc, node.h, node.cc, mac802_11Ext.cc, aodv.h, aodv.cc, Scheduler.h, Scheduler.cc, nsdefault.tcl etc. To understand these files, one should go through a proper path that I will be discussing in upcoming articles and Live sessions.
Step 6: Finding relevant files depending upon your requirement: Now try to identify the files which are directly related to your work. For example if you want to work on wireless sensor network MAC layer then you should focus on wpan folder in your ns-2.35 directory.
Step 7: Further search exact point of code where you need to change: If you want to work on queuing, or contention window in MAC layer of the wireless sensor networks then relevant code for it must be present somewhere in the files of wpan folder. In this way one should narrow down ones search in that area of code where relevant code is given.
Hence you need not to understand each and every file of source code. Just follow the right direction and a little hard work is sufficient to simulate a network.