Wireless Simulation in NS2 is mainly used for Wireless networks like wireless sensor networks, Ad hoc Networks, vehicular ad hoc Networks, Wireless body area network, wireless Mesh networks etc. Today, we are living in the era of wireless networking, where everything we see and feel is based on Wireless technology. Why we have moved towards wireless technology, may be a revolving question for many of us. But there is nothing to think about it as Wireless technology has advanced features like mobility support, work from anywhere, flexibility and reach ability, which makes our world to revolve around it. NS2 is one of the best simulation tools to simulate wireless networks to analyze its performance and behavior. We are working with NS2 for the past 10 years, which has enhanced our knowledge and expertise in NS2. From our vast knowledge and experience, we have shared few important aspects about Wireless simulation in NS2 below. Have a glance over it and get to know about NS2 simulation.


Highlights to Know:

  • Unlike Wired nodes, which use links for connectivity, in wireless nodes distance between the nodes is measured.

Node Configuration parameters

  • Address Type[flat/Hierarchical]
  • Multi protocol label switching
  • Link layer[LL/LL-SAT]
  • Interface queue type[Queue/Drop tail, Queue/Drop Tail/PriQueue]
  • Physical Layer type[phy/wirelessphy, phy/sat]
  • Medium Access Control[Mac/802_11, MAC/CSMA/CA, MAC/SAT,MAC/Sat/Unslotted Aloha, MAC/TDMA]
  • Ad hoc Routing protocol [Diffusion/Rate, Diffusion/Prob, DSDV, Flooding, DSR, AODV, Omnicast, TORA, PUMA ]
  • Antenna type[Antenna/Omni Antenna]
  • Propagation types[Propagation/TwoRay Ground, propagation/shadowing]
  • Channel Used[Channel/wireless channel, channel/sat]
  • Mobile IP[ON/OFF]
  • Energy Model[Enabled or not]
  • Initial Energy[Joules]
  • Transmitted and receiver power[txPower/txPower]
  • Idle Power[in watts(0.02)]
  • Agent type, Router trace, Mactrace, movement trace[ON/OFF]
  • ToraDebug[ON/OFF] and errProc[UniformErrorProc]

Common Node configuration used:

    $ns_ node-config -llType           LL

-ifqType        “Queue/DropTail/PriQueue”

-ifqLen          60

-macType        Mac/802_11

-phyType        “Phy/WirelessPhy”

-addressingType  flat

-adhocRouting    DSDV or DSR

-propType        “Propagation/TwoRayGround”

-antType            “Antenna/OmniAntenna”

-channelType    “Channel/WirelessChannel”

-topoInstance   $ topo

-agentTrace          ON/OFF

-routerTrace          ON /OFF

-macTrace            ON/OFF

-movementTrace   ON/OFF

GOD in Wireless Simulation

  • As in wireless simulation, nodes moves from one place to another distance between them changes.
  • For this GOD[General Operation director] is created to keep track of the node positions in the topology grid.
  • God is used to store global information about the state of network, environment and nodes
  • It stores[total number of Mobile nodes, table of shortest number of hops required to reach from one node to another]
  • Before Simulation begins, next hop information is loaded into GOD from the movement pattern files.

Mobility Models in Wireless Simulation

  • Random Walk Mobility Model
  • Random direction Mobility Model
  • Random Waypoint Mobility Model
  • Boundless Simulation Area Mobility Model
  • Probabilistic version of Random walk Mobility Model
  • Gauss Markov Mobility Model

Performance Metrics Used

  • Thread Task level Metrics[Task completion time, average power expended]
  • Scenario Metrics[Area size of Network, density per node, Offered load and traffic pattern, number of Network Nodes, Nodal movement etc]
  • Diagnostic packet level Metrics[Packet delivery Ratio, Overhead analysis, delay, energy consumption]

Creating  Wireless Simulation Script:

  1. Create a Simulator class object:

To create a simulator object, we have given the following command

        Set ns[ new   simulator ]

Next configure the node, using the above mentioned node configuration.

  1. Create topology instance and GOD

Create god 2// To create god for 2 nodes

set  topography  [new  Topography]// to create topology instance

$ topo  load_flatgrid  200   200// to set the boundary

  1. To create Node

Set  n1  [ $ns  node ]

Set  21  [ $ns  node ]

  1. To set the coordinate for the Nodes.

$n1  set  X_ 30.0

$n1  set  Y_ 30.0 $n2  set  X_ 500.0$n2  set  Y_ 500.0


     We have explained to create a simple script in NS2. Here, we have just created two nodes and set position to it. This is the basics of Wireless Simulation in NS2. If you feel to work with advanced concepts or programming in NS2, approach our online tutoring service, our experts will guide you completely regarding wireless simulation in NS2 along with your projects, assignments or particular lab cycle topic in NS2. Approach us anytime, as we are there, only to serve you.