+91 94 448 29 228 --- E-Mail ID:networksimulators2@gmail.com

Ns2 Tutorial

Ns2 Tutorial for engineers.For Creating  latest ad hoc network,wireless sensor network simulations using ns2 contact us for best implementation.Our staff helps in clearing all your doubts with best effort.Get guidance for better implementation of ns2 projects.

What is Ns2?

  • Ns2 is a discrete event simulator for networking research and also work at packet level research. It simulates both wired and wireless network.
  • Ns2 was Developed by UC Berkeley and is currently maintained by usc.

Components of ns2:

  • Nam.
  • Ns2.
  • Post processing like simple trace analysis, often in AWK, perl or OTCL.
  • Pre-processing like traffic and topology generators.

 Procedures to create simulating script:

  • Create the event scheduler.
  • Turn on tracing.
  • Create network.
  • Setup routing.
  • Insert errors.
  • Create transport connection.
  • Create traffic.
  • Transmit application-level data.

Advantages of simulation:

  • Cheaper.
  • Can simulate detail at arbitrary level.
  • Generality.
  • Find bugs in advance.


Sample code for how to set node configuration in ns2:

set val(chan)       Channel/WirelessChannel
set val(prop)       Propagation/TwoRayGround
set val(netif)      Phy/WirelessPhy
set val(mac)        Mac/802_11
set val(ifq)        Queue/DropTail/PriQueue
set val(ll)         LL
set val(ant)        Antenna/OmniAntenna
set val(x)              1300    
set val(y)              1300    
set val(ifqlen)         201            
set val(seed)           0.0
set val(routingprotocol) AMMNET 
set val(nn)             50  
set val(nnn)             49             
set val(cp)            cbr
set val(sc)            scen
set val(stop)           27.3 
set val(stop1)           16.0             
set val(traffic)        tcp
set val(rxPower)        0.1                          
set val(txPower)        0.1     
set val(energymodel)    EnergyModel     
set val(initialenergy)  1000                       
set val(sleeppower)     0.00005   
set val(ener)           500
set val(energy)         cal
set val(freq)        node

NS2 Member Accounts | |
© 2005 - 2020 Vanet Projects

© 2005 - 2020 Matlab Projects