Tuesday, November 11, 2008

How to execute hier-rtg-100.tcl

Hi,

The ns-allinone-2.33 package has a set of example scripts in the directory "~/ns-allinone-2.33/ns-2.33/tcl/ex" where you can find example TCL scripts, which can be executed. I have observed that the file hier-rtg-100.tcl gives some errors when you try to run it. Actually the problem is that the Network Simulator-2 is changing from version to version and a lot has changed from orignal version to now. Some scripts present in this tcl/ex directory are written for old versions of NS-2 and they are not updated for new version of NS-2 till date.

After searching in NS-2 mailing lists and Google I figured out what the problem was and after doing the neccessary modifications I was able to successfully run this hier-rtg-100.tcl script file.

Here I enclose in this post the modifications I have done:
Actually the hier-rtg-100.tcl calls another script hts100.tcl, which needs to be modified
1. Open the file hts100.tcl present in "~/ns-allinone-2.33/ns-2.33/tcl/ex/", in any of your favourite editor, and insert the below mentioned lines at the starting of the file

Simulator instproc duplex-link-of-interfaces {args} {

;# Defining the Arguments
set n1 [lindex $args 0]
set n2 [lindex $args 1]
set BW [lindex $args 2]
set delay [lindex $args 3]
set queue [lindex $args 4]

;#Execution statement
$self duplex-link $n1 $n2 $BW $delay $queue
}

2. Save the file and close it.

Now we also need to do a small but an important modification (fix) to the hier-rtg-100.tcl file also
1. Open the hier-rtg-100.tcl file present in "~/ns-allinone-2.33/ns-2.33/tcl/ex/" in any of your favourite editor.
2. Search for the line containing the following text

create-hier-topology {$linkBW}

It is probably the Line number 15
Now replace this line with the below mentioned line

create-hier-topology $linkBW

i.e.., we need to remove the flower braces
3. Save the file and close it.

Now comes the main part.....Execution :)
1. Open the terminal
2. Go to the directory where ns-allinone-2.33 is installed

$ cd ns-allinone-2.33

3. Navigate to the ns-2.33/tcl/ex

$ cd ns-2.33/tcl/ex

4. Now run the program

$ ns hier-rtg-100.tcl

5. If you are able to see animation in nam, then the program is successfully executed, else you are having some trouble, review the modifications again and try to execute the program or refer the NS-2 mailing list for further assistance.

Hope it helped you...
Good Luck :)

1 comment:

Maira said...

Hi,

I just want to tahnk you. You did help me :)