[ns] problem in tcl script

2015-05-20 Thread alok kumar

sir,
  I am running  below tcl  script   it gives   the error:

  Flow 1 starts at time 0.00
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o12: no target for slot 4294967295
_o12 type: Classifier/Hash/Dest
content dump:
classifier _o12
0 offset
0 shift
1073741823 mask
1 slots
slot 0: _o109 (Classifier/Port)
-1 default
-- Finished standard no-slot{} default handler --



here tcl script  :--

-mkct2.tcl

set ns [new Simulator]

set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf


set r_(1) [$ns node]
set r_(2) [$ns node]
set r_(3) [$ns node]
set r_(4) [$ns node]


$ns duplex-link $r_(1) $r_(2)  20Mb  10ms MKCQueue
set mkcq_(1) [[$ns link $r_(1) $r_(2)] queue]
$mkcq_(1) set C 200
$mkcq_(1) set T 0.1
$mkcq_(1) set rid 1


$ns duplex-link $r_(2) $r_(4)  20Mb  15ms MKCQueue
set mkcq_(2) [[$ns link $r_(2) $r_(4)] queue]
$mkcq_(2) set C 170
$mkcq_(2) set T 0.1
$mkcq_(2) set rid 2


$ns duplex-link $r_(4) $r_(3)  20Mb  10ms MKCQueue
set mkcq_(3) [[$ns link $r_(2) $r_(4)] queue]
$mkcq_(3) set C 200
$mkcq_(3) set T 0.1
$mkcq_(3) set rid 3


$ns duplex-link $r_(3) $r_(1)  20Mb  15ms MKCQueue
set mkcq_(4) [[$ns link $r_(3) $r_(1)] queue]
$mkcq_(4) set C 170
$mkcq_(4) set T 0.1
$mkcq_(4) set rid 4


set Snk_(2)  [new Agent/MKCSink]
$Snk_(2) set packetSize_ 40
$ns attach-agent $r_(2) $Snk_(2)

set Snk_(1)  [new Agent/MKCSink]
$Snk_(1) set packetSize_ 40
$ns attach-agent $r_(4) $Snk_(2)

set Snk_(4)  [new Agent/MKCSink]
$Snk_(4) set packetSize_ 40
$ns attach-agent $r_(3) $Snk_(4)

set Snk_(3)  [new Agent/MKCSink]
$Snk_(3) set packetSize_ 40
$ns attach-agent $r_(1) $Snk_(3)


set Src_(2) [new Agent/MKC]
$ns attach-agent $r_(1)  $Src_(2)
$Src_(2) set alpha_ 20
$Src_(2) set beta_ 0.5
$Src_(2) set packetSize_ 200
$Src_(2) set init_rate_ 10
$Src_(2) set fid_ 2



set Src_(1) [new Agent/MKC]
$ns attach-agent $r_(1)  $Src_(1)
$Src_(1) set alpha_ 20
$Src_(1) set beta_ 0.5
$Src_(1) set packetSize_ 200
$Src_(1) set init_rate_ 10
$Src_(1) set fid_ 1


set Src_(4) [new Agent/MKC]
$ns attach-agent $r_(4)  $Src_(4)
$Src_(4) set alpha_ 20
$Src_(4) set beta_ 0.5
$Src_(4) set packetSize_ 200
$Src_(4) set init_rate_ 10
$Src_(4) set fid_ 4


set Src_(3) [new Agent/MKC]
$ns attach-agent $r_(4)  $Src_(3)
$Src_(3) set alpha_ 20
$Src_(3) set beta_ 0.5
$Src_(3) set packetSize_ 200
$Src_(3) set init_rate_ 10
$Src_(3) set fid_ 3


$ns connect  $Src_(1)   $Snk_(1)
$ns connect  $Src_(2)   $Snk_(2)
$ns connect  $Src_(3)   $Snk_(3)
$ns connect  $Src_(4)   $Snk_(4)

$ns  cost $r_(4) $r_(3) 1
$ns  cost $r_(4) $r_(2) 10



$ns at 0 "$Src_(1)  start"
$ns at 10 "$Src_(2)  start"
$ns at 20 "$Src_(3)  start"
$ns at 30 "$Src_(4)  start"

$ns at 85 "$Src_(1)  stop"
$ns at 90 "$Src_(2)  stop"
$ns at 95 "$Src_(3)  stop"
$ns at 100 "$Src_(4)  stop"


$ns at 100.0  "finish"


proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}

$ns run



 plz   solve this  problem  give me  solution.


thank you



[ns] Problem in TCL Script

2007-06-04 Thread manpreet grewal


Hi all,
I am writing one Tcl script with following simulation settings.
Please tell me if i am wrong somewhere

1. Nodes move within the area according to the random way-point
mobility model.
2. Velocity of the nodes is uniformly distributed between 2 
m/sec
and 38 m/sec.
3. pause time of nodes is 0.
  For above three requirements i have run the following 
command
  from
~/ns-allinone-2.28/ns-2.28.indep-utils/cmu-scen-gen/setdest..

  ./setdest -v(2) -n 20 -m 2.0 -M 38.0 -t 150 -p 0.0 -x 500 
-y
500 >scen-20

4. FreeSpace propogation model is used for radio propagation
model.
 For this i am using following statement in tcl script...
set val(prop) Propagation/FreeSpace

5. Each node generate CBR traffic at the rate of 1.5kbps
  For this i run following command from
~/ns-allinone-2.28/ns-2.28/indep-utils/cmu-scen-gen

  ns cbrgen.tcl -type cbr -nn 20 -seed 1.0 -mc 20 -rate 1.5
  >cbr-20

6.Packet lenght is set to 1000 bytes.
7.Whole traffic is destined to stationary sink node located at
(250m,250m)
   Now for 6th and 7th requirement, i am writing following
statements in TCl script. This is a part of my tcl script...

  
set node_(0) [$ns_ node]
$node_(0) random-motion 0
$node_(0) set X_ 250
$node_(0) set Y_ 250
$node_(0) set Z_ 0
$ns_ initial_node_pos $node_(0) 5

for {set i 1} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 1 ;   # disable random motion
}

 puts "Loading connection pattern..."
 source "cbr-20"
  for {set i 1} {$i < $val(nn) } {incr i} {

 set tcp_($i) [new Agent/UDP]
 #$tcp_($i) set class_ 2
 set sink_ [new Agent/Null]
 $ns_ attach-agent $node_($i) $tcp_($i)
 $ns_ attach-agent $node_(0) $sink_
 $ns_ connect $tcp_($i) $sink_
 set ftp_($i) [new Application/Traffic/CBR]
 $ftp_($i) set rate_ 1.6k
 $ftp_($i) set packetSize_ 1000
 puts "hello1"
 $ftp_($i) attach-agent $tcp_($i)
 $ns_ at [expr 10.0+0.01*$i] "$ftp_($i) start"
}

# Define traffic model

puts "Loading scenario file..."
source "scen-20"

***

Please tell me if i am going wrong somewhere...  i have doubt in
my 7th requirement... have i done it right??? Am i writing the
statements in order?? loading scenario file should be called 
here
only??
Please do tell me.. Its very urgent..
I will be highly thankful...

Regards,
Manpreet...