Friday, December 14, 2007

beginners tip for NS2 tcl scripting

Assuming that NS2 has been successfully installed.
Following guide will be helpful for those who are not familiar with NS2 :

  1. run "ns basic.tcl"and other simulation scripts example , especially the example that pop up NAM. It will be very encouraging to see the animation ^_^.
  2. Open the simulation script file using text editor. Just take a look. Especially at the syntax and common command. As example you will see set , [$ns node] , duplex-link , proc etc. Please also observe the structure. It should have some structure.
  3. To help understand the structure, refer to ns manual or tutorial. Just Google it. The Microsoft power point presentation files will be very very helpful.
  4. Study also on TCL .. instead of reading, use the tclsh or ns interpreter to test basic commands. Observe the syntax of the TCL especially on the substitution ($) , grouping [] , " " etc. Please return some errors during the testing.
  5. Look again at the basic.tcl.. now deeper understanding on the command will be achieved. How does this instruction operate : set n0 [$ns node] ?
  6. Write your own simulation script. Instead of writing it from scratch , edit existing file.
That's all.. This is what me and my friends (I'm still a beginner) did ... hopefully it will helps others too..


omid mohajerani said...

Helpful for me too . thanks

Anonymous said...

anyone can help me guys ? i have a couple of questions...please

1.How to find out the number of nodes in the network from the trace file? Also can u give any examples that would help please??

2.How to discover the “visible network topology” from the trace file? Give examples pleeeeeeeease.

3.Which parameters of the event descriptor in the trace file can be used for calculation of the throughput on the link? examples would really help

4. Which parameters of the event descriptor in the trace file can be used for calculation of the throughput on the end-to-end route? any examples??.

5.What typical functions are needed in order to extract useful data from trace files (think in terms of getting values from some text columns, sorting of strings, etc.)? Can u please make a pseudo-code for the postprocessing algorithm. Aslo do u know Which standard Unix utilities may help to extract necessary data from the trace files and process them? Give examples of sequences pleaseeeeeeeee (i.e. which to run first, which is next, etc.).