Re: [ns] trouble with error model over wired links

2006-09-29 Thread Pedro Vale Estrela


Hi there,
This is another fine post to the ns-users mailing list. 
Good subject, good question overall == totally in line with
http://www.catb.org/~esr/faqs/smart-questions.html

the problem is that you are putting the loss-model in all 3 links; 
I report exactly the same tracea and NAM problems.

Instead, Try this:

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


pedro vale estrela
http://tagus.inesc-id.pt/~pestrela/ns2/




 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Abdul Jabbar
 Sent: sexta-feira, 29 de Setembro de 2006 17:45
 To: ns-users@ISI.EDU
 Subject: [ns] trouble with error model over wired links
 
 
 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 1thats 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





Re: [ns] trouble with error model over wired links

2006-09-29 Thread Abdul Jabbar

I was able to solve this problem. I would like to thank both Pedro and 
Alam for their response. The solution provided by Pedro: that is to 
apply the error to just one link does work. However, my intention was to 
simulate a network where every link has a certain error rate. The 
solution provided by Alam: that is to use a separate errorModel object 
for each link works exactly as I intended.

The mistake on my part was that after attaching the errorModel object to 
one link, I was trying to attach the same object to a second link. 
However, the response of ns was very confusing.

Thanks,
Abdul.


Abdul Jabbar wrote:
 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 1thats 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