[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] question regarding PGM for ns
Hi,
I am trying to get PGM running for the latest version of ns.
i integrated the old .tcl files( ns-default.tcl, ns-packet.tcl,
ns-node.tcl , ns-lib.tcl) that come with the contributed module to
the latest .tcl files in ns/tcl/lib. Also i have pgm.tcl in ns/tcl/mcast.
I am trying to run the test file binary-pgm.tcl ( Attached here ) and am
getting the following error.
invalid command name "Agent/Mcast/PGM"
while executing
"Agent/Mcast/PGM instproc init { protocol } {
$self next
$self instvar proto
set proto $protocol
}"
(file "tcl/mcast/pgm.tcl" line 40)
invoked from within
"source.orig tcl/mcast/pgm.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig $fileName"
(procedure "source" line 12)
invoked from within
"source tcl/mcast/pgm.tcl "
(file "binary-pgm.tcl" line 5)
Can somebody please help me regarding this.
thanks,
Darshant.
#
# PGM test topology: Binary tree of height 6
#
source tcl/mcast/pgm.tcl
set ns [new Simulator]
$ns namtrace-all [open out.nam w]
$ns color 0 red
$ns color 1 black
$ns color 2 white
$ns color 3 blue
$ns color 4 yellow
$ns color 5 LightBlue
$ns color 6 green
$ns color 7 magenta
$ns color 8 orange
set height 6
set nodeNum [expr 1 << $height]
set linkNum [expr $nodeNum - 1]
set rcvrNum [expr 1 << [expr $height - 1]]
puts "Height $height nodes $nodeNum rcvrs $rcvrNum"
set color { red black white blue yellow LightBlue green magenta orange
red black white blue yellow LightBlue green magenta orange }
#
#Enable Multicast
#
set ns [new Simulator -multicast on]
#Simulator set EnableMcast_ 1
#Simulator set NumberInterfaces_ 1
set group [Node allocaddr]
puts "Group addr: $group"
#
# Create source node
#
set n(0) [$ns node]
$n(0) shape "circle"
# $n(0) color "red"
#
# Create nodes
#
set agentlist ""
for {set k 1} {$k < $rcvrNum} {incr k} {
set n($k) [$ns node]
$n($k) shape "circle"
lappend agentlist $n($k)
#$n($k) color "green"
}
for {set k $rcvrNum} {$k < $nodeNum} {incr k} {
set n($k) [$ns node]
$n($k) shape "circle"
#$n($k) color "blue"
}
#
# Set PGM as the RM protocol
# (must be done AFTER node creation,
# but BEFORE link and agent creation)
#
if {$agentlist != ""} {
set rmproto PGM
set rmhandle [$ns mrtproto $rmproto $agentlist]
}
proc makelinks { bw delay pairs } {
global ns n
foreach p $pairs {
set src $n([lindex $p 0])
set dst $n([lindex $p 1])
$ns duplex-link $src $dst $bw $delay DropTail
$ns duplex-link-op $src $dst color "red"
}
}
set pairs {
{ 0 1 }
{ 1 2 }
{ 1 3 }
{ 2 4 }
{ 2 5 }
{ 3 6 }
{ 3 7 }
{ 4 8 }
{ 4 9 }
{ 5 10 }
{ 5 11 }
{ 6 12 }
{ 6 13 }
{ 7 14 }
{ 7 15 }
{ 8 16 }
{ 8 17 }
{ 9 18 }
{ 9 19 }
{ 10 20 }
{ 10 21 }
{ 11 22 }
{ 11 23 }
{ 12 24 }
{ 12 25 }
{ 13 26 }
{ 13 27 }
{ 14 28 }
{ 14 29 }
{ 15 30 }
{ 15 31 }
{ 16 32 }
{ 16 33 }
{ 17 34 }
{ 17 35 }
{ 18 36 }
{ 18 37 }
{ 19 38 }
{ 19 39 }
{ 20 40 }
{ 20 41 }
{ 21 42 }
{ 21 43 }
{ 22 44 }
{ 22 45 }
{ 23 46 }
{ 23 47 }
{ 24 48 }
{ 24 49 }
{ 25 50 }
{ 25 51 }
{ 26 52 }
{ 26 53 }
{ 27 54 }
{ 27 55 }
{ 28 56 }
{ 28 57 }
{ 29 58 }
{ 29 59 }
{ 30 60 }
{ 30 61 }
{ 31 62 }
{ 31 63 }
}
makelinks 1.5Mb 10ms $pairs
#
#Set routing protocol
#
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]
#
# Create loss modules - Cycle is 100,
# loss module i drops (i*5)th packet in the cycle
#
for {set i 1} {$i <= $linkNum} {incr i} {
set loss_module($i) [new PGMErrorModel]
$loss_module($i) drop-packet 2 200 [expr $i]
$loss_module($i) drop-target [$ns set nullAgent_]
}
proc insert-loss pairs {
global ns n loss_module
set i 1
foreach p $pairs {
set src $n([lindex $p 0])
set dst $n([lindex $p 1])
$ns lossmodel $loss_module($i) $src $dst
incr i
}
}
#
# Insert a loss module on every link
#
insert-loss [lrange $pairs 1 [expr [llength $pairs] - 1]]
#
# Create Sender and set PGM win parameters
#
set src [new Agent/PGM/Sender]
$ns attach-agent $n(0) $src
$src set dst_ $group
$src set class_ 0
#
# Set PGM Window Parameters
# rate: 128Kbps (16KBps)
# txw: 160 packets, txw_adv: 80 packets
#
$src set txw_max_rate_ 131072
$src set txw_secs_ 10
$src set txw_adv_secs_ 5
$src set packetSize_ 1024
#
# Create PGM receivers
#
set i $rcvrNum
for {set k 0} {$k < $rcvrNum} {incr k} {
set rcv($k) [new Agent/PGM/Receiver]
$ns attach-agent $n($i) $rcv($k)
$ns at 0.01 "$n($i) join-group $rcv($k) $group"
$rcv($k) set class_ 3
incr i
}
$ns at 0.1 "$src pgm-setup"
$ns at 0.1 "$ns trace-annotate { PGM Setup}"
$ns at 0.5 "$src start"
$ns at 10.0 "$src stop"
$ns at 35.0 "finish"
proc finish {} {
global ns src rcv rcvrNum
for {set k 1} {$k < $rcvrNum} {incr k} {
$rcv($k) print-stats
}
puts -nonewline "Sender status:(odata/rdata)\t "
$src print-stats
flush stdout
puts -nonewline "\nRecovery Latency (avg/min/max):\t "
$rcv(0) print-all-stats
# puts "Simulation Finished"
exit 0
}
$ns run