ONLINE NS2 SIMULATOR

       Online NS2 Simulator is our online service started for students, who feels to gain useful information through web. Our Online NS2-simulator offers you all types of service regarding NS-2 i.e tutoring service; guidance on projects/research, NS-2 based topics support etc. We are working with students from 120+ countries and nearly developed 1000+ projects in NS-2. Students work with us due to our privacy and confidentiality service. Students now days won’t opt for online service due to the lack of trust, they experience, but Students can feel free to work with us as we offer free demo through our team viewer support for students to verify there work, before they commit with us. Here, we have emphasize on how to create a simple script in NS2. For other particular information about NS2, refer our other articles.

KNOW ABOUT NS-2

      To work with NS-2, you must focus on two aspects of NS-2 i.e. Wired simulation and wireless simulation in NS-2. Here, we are going to explain about how to work with wired simulation. For wireless simulation, refer our other articles in this site.

Wired Simulation in NS2:[Steps to create simulation script in NS2]

To create simulator class object:
  • Every simulation script in NS2 is based on simulator object which works as scheduler to schedule the events. Now, let’s see the commands to create simulator class object. This command will create a simulator object and assign it to variable ns.
# create scheduler

Set   ns  [new   Simulator]

To store the result in the File:
  • Use of trace and NAM[Network animator] files
  • To store the result, first we need to open the files. Commands for opening the files is given as:
#Tracing the simulation result

set  finish  [ open  result.dat  w]

$ns  trace – all  $finish

#Tracing NAM

Set  nfin  [open  namtrace.nam  w]

$ns   namtrace – all  $nfin

  • First line Open result.dat will open the file and write it to W. Here, we have used “finish” as an assignment variable. Here, trace-all procedure is used to store all the simulation result in result.dat file.
  • Similarly, out.nam files are use by NAM to show the packet transmission.
To create Nodes
  • We can create any number of nodes require. Here, for simplicity, we have created a sample node.

set  node[for ex.n0] [$ns   node]

If you want to create more number of Nodes, use looping structure:
# Create 5 Nodes

for {set  i  0} {  $i < 5 } { incr  i} {

set  n($i) [$ns   node]}

To create Agents[TCP or UDP]
  • In NS2, various agents used[TCP, TCPSink,TCP/Reno,UDP]
  • Here, we have taken TCP agent, which is attach to sender and receiver is attach to TCPSink

# To Create TCP agent

set  tcp1 [ new  Agent/TCP ]

$ns  attach – agent  $n1  $tcp1

# To Create TCP receiver

set tcp2 [ new  Agent/TCPSink ]

$ns  attach – agent  $n2  $tcp2

To connect the Nodes:
  • Nodes are connected to each other through links. Links can be simplex or duplex. Bandwidth, delay and type of queue must be specified for each link.

$ns duplex-link $n1 $n2 1.0Mb 10ms Drop Tail

To connect Agents for both Nodes:
  • Every node can be attached to any number of agents. To connect agents, we have considered here sender agents as TCP and receiver agent as TCPSink

ns connect $tcp1 $tcp 2

To Setup FTP Application over TCP
  • This is used to connect traffic generator to see the packet transmission. In NS2, generally we use CBR , FTP etc for this purpose.

set  FTP1 [ new  Application/FTP ]

To attach FTP Application with Agent and schedule the Event

$ftp  attach – agent  $tcp1//used to connect FTP with TCP agent

// Schedule events

$ns  at 0.5  “$ftp  start”// start at 0.5 ms

$ ns  at 5.0  “$ftp  stop”//stop at 5.0 ms

< simulator  object >  at  <time>   <event>// syntax for Event scheduling

To flush the buffer and start the NAM

proc finish  { } {

global  ns  finish nfinish // mapping of global variable to local

$ns  flush-trace //flush the buffer

//close file objects

close   $finish

close$nfinish

exec nam out.nam &//To execute the NAM

exit  0}

To terminate the finish procedure at particular time, use the following commands:

$ns  at  5.0   “finish”

To start the Simulation: 

Run simulation [$ns run]

       This is an overall step to write any script in NS2. TCL is used as a scripting language here. C++ is used to define the internal mechanism in NS2. For further guidance and tutoring service, approach our online tutoring service, where our experts will impart their complete knowledge and expertise on NS2. When we are ready to share so much of information through online, why can’t we spend little time to share useful information through online. Our Online NS2 simulator will give you complete guidance on NS2 based projects, assignments or lab cycles. You can also approach us any time through online, we are there for you at 24/7.

SUCCESS DOES NOT LIE IN THE “RESULT” BUT IN THE EFFORT…………

PUT YOUR EFFORT AND GET OUR GUIDANCE……………………

YOUR SUCCESS WILL BE IN YOUR FEET………………….