ABSTRACT

To simulate a network protocol in NS2, we must write simulation scripts in Tcl for encoding the protocol that NS2 can invoke, and also for setting up a few necessary aspects of simulation such as nodes, links, traffic generations, etc. The focus of this chapter is the development of such Tcl scripts. After a simulation experiment, we can analyze the network/protocol performance by extracting data values from the trace output file produced during the protocol execution in the NS2 engine. To extract relevant values, AWK scripting is required, which is also discussed in this chapter. Finally, the data extracted need to be displayed as a plot using Gnuplot, which is discussed in the last section of this chapter. Data extraction and graph plotting are commonly called post-processing tasks, whereas writing the simulation script in Tcl is known as a pre-processing task.