How do I Run a TCL Script in Ns2

As the matter of fact, you can easily run the TCL script in network simulator 2 along with some instructions. Through this article, our research professionals have enlisted required process to run simulation in Ns2.

Create TCL Script in Ns2

The TCL script has to be created in the workspace location in Ubuntu and that has to be stored with the file extension of .tcl to perform the network simulation projects using Ns2.

Creation of TCL Script in Ns2

In addition, we have highlighted some sample TCL script code to execute the trace files and Xgraph packages.

global ns tracefd namtrace

    $ns flush-trace

    close $tracefd

    close $namtrace

exec nam AODV.nam &

exec ./xgraph AODV_End_to_End_Delay.tr -t “End to End Delay Graph” -x “No.of.MobileNodes” -y “End to End Delay” -bg gray &

Run TCL Script in Ns2

To run the TCL script in Ns2 in Ubuntu, we have to change the location where the tcl script file is located through implementation of the below mentioned commands.

cd /home/research/Desktop/TCL_Script_Location

In addition, we have to execute the main TCL script file through implementing the below mentioned commands.

sudo ./ns TCL_Script.tcl

Execution of Main TCL Script File

Therefore, we have highlighted the result which is attained from running the Ns2 TCL script in Ubuntu.

In addition, the research scholars can research us to acquire more research assistance based on the implementation of the TCL script in Ns2.