How to run NS2 simulation

This post explains the method of running ns2 and important phases of simulating any network

Executable file ns created in the NS2 home directory after installing or recompiling NS2 can be invoked by executing the following statement from the shell:

$ ns [filename] [arguments], where [filename] and <arguments> are optional.

Without any argument the command will bring up an NS2 environment. NS2 waits to interpret commands from the standard input (i.e., keyboard) line-by-line.

If [filename] is present, NS2 will interpret the input script [filename] a tcl simulation script written according to tcl syntax.

Finally, the [arguments] separated by a white space are input to [filename].

Simulation Steps

Any simulation consists of three main phases: pre simulation, simulation and post simulation.

Phase 1: Pre Simulation

The first phase in simulating any network is to design or plan the simulation. In this phase the simulation purposes, network configuration and assumptions, network parameters, movement and traffic scenarios, the performance measures, and the type of expected results should be determined.

Phase 2: Simulation

This step implements the design of phase 1. It consists of two phases:

• Configuration phase: In this phase network components are created and configured according to the simulation design. Also, the events are scheduled to start at a certain time.

• Simulation Phase: This phase starts simulation configured in previous configuration phase. It maintains the simulation clock and executes events chronologically. This phase usually runs until the simulation clock reached a value specified in the configuration phase.

Phase 3: Post Simulation Processing

The main tasks in this phase include verifying the integrity of the program and evaluating the performance of the simulated network. While the first task is referred to as debugging and any debugger like gdb can be used. The second one can be achieved by collecting and compiling simulation results. During simulation trace files are generated and these trace file can be used to evaluate the performance of simulated network. Trace file can be processed by Awk (gawk) or perl.

Leave a Reply

Your email address will not be published. Required fields are marked *