Throughput in Ns2

Are you people eagerly waiting to know about the process of calculating throughput in network simulator 2? Then take a look at this article which describes the step by step process of throughput calculation.

Phase: I

As the first process, we have to calculate the throughput based on events in Ns2 trace files through the utilization of awk script code.

if (level == “RTR” && event == “r” && time >0 && $7 ==”AODV”) {

if (time > stopTime) { stopTime = time }



if(thru !=”inf” ){

printf(” %.2f %.2f \n” ,time,thru)

} }

Additionally, we have highlighted the Tcl code to execute the awk file based on trace file.

exec ./xgraph -t “Average Throughput Graph” -x ” Time” -y “Average Throughput” -bg pink &

Phase: II

Following that we have to run the Ns2 simulator for throughput calculation, for that we have to change the Ns2 Tcl main file location and execute the following commands to run the Ns2 main file.

cd /home/research/Desktop/ns2_simulation

sudo ./ns Main.tcl

Running Ns2 for Throughput Calculation

Then, we have highlighted the result based on graph generation which is about the average throughput calculation based on time and the auto generated trace file is stored with in the file extension .tr.

Result of Average Throughput Calculation

Reach us at any time to get to know more about the process of calculating throughput!!!