[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trace-{topo|tree} functional?



I'm having trouble with the code in sections 16.1 and 16.1.1 on page
115 of the ns docs, edition of 31 Aug 1998. 

I've had to make some obvious alterations: in 16.1, period_ is set
to 0.02, but the comment and output file format say it is really
0.03;  the code creates node0 and node1, but then erroneously refers
to $n0 and $n1 when setting up the duplex link. 

I've tested the code with both ns 2.1b3 and a very recent daily snapshot.
Using $mcastmonitor trace-tree _almost_ works -

0.029999999999999999 0 0 0 0 _o46 1073741824
0.059999999999999998 0 0 0 0 _o46 1073741824

the _o46 suggests that it's not picking up on the udp source properly,
but I'm not sure why. (What would I connect the udp source agent to?)

When trace-topo is used instead of trace-tree, I get the following
more serious error-from-the-same-problem with both versions of ns:

can't read "prune_(_o46:1073741824:1:0)": no such element in array
    while executing
"incr prune $prune_($source:$group:$from:$to)"
    (procedure "_o48" line 11)
    (McastMonitor print-trace line 11)
    invoked from within
"$self print-trace $source $group"
    (procedure "_o48" line 8)
    (McastMonitor trace-topo line 8)
    invoked from within
"$mcastmonitor trace-topo $src $group"
    (file "testmcast.tcl" line 32)


Any ideas or obvious pointers? I'm stumped. My version of the code is
below.


Also, if I disable Node expandaddr as probably not needed here
for a single group: 

0.029999999999999999 0 0 0 0 _o43 0x8000

group output switches to hex? Is Node expandaddr mandatory for
multicast?

thanks,

L.

<http://www.ee.surrey.ac.uk/Personal/L.Wood/>PGP<[email protected]>
------------->8-------------------

set ns [new Simulator] 
Simulator set EnableMcast_ 1       ;# enable multicast routing
Node expandaddr                    ;# probably not needed here?
 
set group [Node allocaddr]         ;# allocate a multicast address
set node0 [$ns node]               ;# create multicast-capable nodes
set node1 [$ns node]
Simulator set NumberInterfaces_ 1  ;# number of interfaces for all links
$ns duplex-link $node0 $node1 1.5Mb 10ms DropTail
                                   ;# create links with interfaces
set mproto dynamicDM               ;# configure multicast protocol
set mrthandle [$ns mrtproto $mproto {}]
 ;# if an empty list is given, all nodes will contain multicast
  # protocol agents
 
set udp [new Agent/UDP]           ;# create a udp source agent
set src [new Application/Traffic/CBR]
$src attach-agent $udp
$udp set dst_ $group

$ns attach-agent $node0 $udp      ;# and attach it to node 0
 
set rcvr [new Agent/LossMonitor] ;# create a receiver agent at node 1 
$ns attach-agent $node1 $rcvr
$ns at 0.3 "$node1 join-group $rcvr $group"
 ;# join the group at simulation time 0.3 (sec)

set mcastmonitor [$ns McastMonitor]
$mcastmonitor set period_ 0.03  ;# default 0.03 (sec)
 
# trace-tree almost works
# $mcastmonitor trace-tree $src $group
 
# but the alternative trace-topo fails entirely!
$mcastmonitor trace-topo $src $group
 
$ns run