Creating Scenario in NS 2.34 for Wireless Communications

In this tutorial, we will look at how to create a scenario in ns-2.34 for wireless communication.

I’m going to open up the terminal, inside the terminal, I’ll change the directory to cd ns, and then to ns all in one 2.34, independent utilities, CMU and I will type ./setdest, as you can see it displays the usage of the command for creating scenarios.

We need to have parameters such as a number of nodes, pause time, the maximum speed with which nodes will be moving, simulation time, length and breadth representing the area of simulation.

Now let’s assume that I have already created a set of parameters where the number of nodes is 50, the pause time is 0, the nodes will wait for a certain amount of time then start moving and the maximum speed is 10 meters per second, simulation time is 100 seconds and area, the X is 800 meters and Y is 600 meters.

The video below describes the entire process of creating a scenario file in NS2.34 for wireless communications.


Creating a Scenario in NS 2.34 for Wireless Communications
Now I am going to execute the setdest command using these parameters:

./setdest – n 50 -p 0 -M 10 – t 100 –x 800 -y 600

setdest command creates the scenario which can be used in the TCL file for simulation, this output needs to be saved in the file which can be called later in the TCL file.

To save the output and the file we use the file redirection operator that is we use the same destination command with greater than that is your redirection operator and let’s give the filename as scene-10

You can open the file scene-10, which is created, where you will find all this simulation scenario generated by setdest command or utility.