Hello,

I am having unusual trouble getting a simple error model to work over 
wired links in ns2.29. I have checked the mailing list archives and 
could not find a similar problem/solution. Below is my tcl script which 
represents a simple network topology of 3 nodes connected in a chain 
using duplex-links. I have a CBR/UDP flow between the nodes 0 and 3. The 
flow path is 0-1-2-3.

If I don't use any error on the links, everything works fine as is 
confirmed by the trace file and the nam visualization.

However, if I include a simple error model and attach it to each of the 
three links, the whole simulation goes awry. In the trace file I see 
packets going from node 0 to node 1. There is no data flow between node 
2 and node 3 and there is a data flow between nodes 2 and 3. Basically 
the packets disappear  on node 1 and magically reappear at node 2.  In 
nam visualization, it is even worse...there is just one flow between 
nodes 0 and 1....thats it.....no other data flows. Changing the error 
rate does not help.

When I have a more complex topology ( like a mesh topology of 8x8 nodes) 
the whole simulation goes so bizarre, that it is even hard to trace what 
is going wrong. That's why I am using this simple 3 node topology to 
illustrate the problem.

I am hoping that there is some fundamental mistake on my part. Please 
point in the right direction.

Thanks,
Abdul.

Here's the TCL script
----------------------------------
set ns [new Simulator]
set tf [open simout.tr w]
$ns trace-all $tf
set nf [open simout.nam w]
$ns namtrace-all $nf
proc finish {} {
  global ns nf tf
  $ns flush-trace
  close $nf
  close $tf
  exec nam simout.nam &
  exit 0
}

for {set i 0} {$i < 4} {incr i} {
  set n($i) [$ns node]
}

$ns duplex-link $n(0) $n(1) 500Mb 10ms DropTail
$ns duplex-link $n(1) $n(2) 500Mb 10ms DropTail
$ns duplex-link $n(2) $n(3) 500Mb 10ms DropTail

set em [new ErrorModel]
$em unit pkt
$em set rate_ 0.01
$em ranvar [new RandomVariable/Uniform]
$em drop-target [new Agent/Null]

$ns link-lossmodel $em $n(0) $n(1)
$ns link-lossmodel $em $n(1) $n(2)
$ns link-lossmodel $em $n(2) $n(3)

set udp0 [new Agent/UDP]
$ns attach-agent $n(0) $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0

set null0 [new Agent/Null]
$ns attach-agent $n(3) $null0
$ns connect $udp0 $null0

$ns at 0.5 "$cbr0 start"
$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"

$ns run

Reply via email to