Saturday, 5 September 2015

OTCL for Ns2 Lecture 1

Create two nodes 
program:
     open any text editor and write below program 

set ns [new simulator]  #create a simulator obj [ see tcl first lect]
set nf [open out.name w ]  #open file out.nam assign nf to it . if file is not present it will create it.
$ns nametrace-all $nf #write all simulation data to this file.
           
proc  finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam & 
exit 0
}
set n0 [ $ns new node]
set n1 [ $ns new node]
$ns duplex-link $n0 $n1 1Mb 10ms DropTail  #transfer rate 1Mb and delay 10ms
$ns at 5.0 "finish"
$ns run 

Now open terminal and go to place where u have saved the file and  write ns example.tcl 
out put:


No comments:

Post a Comment

Grammar Mistakes in Technical Paper Writing

Let me share some experience in this post with you. I'm currently in the second year of my Ph.D. program. We are in the middle of paper...