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

Re: [ns] Problems with CBR traffic generator



wrong syntax.

>From: "Ermel Erwan" <[email protected]>
>To: <[email protected]>
>Subject: [ns] Problems with CBR traffic generator
>Date: Sun, 10 Sep 2000 01:24:33 +0200
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
>

>
>proc attach-expoo-traffic { node sink size burst idle rate } {
>          #Get an instance of the simulator
>          set ns [Simulator instance]
>          #Create a UDP agent and attach it to the node


>          set source [new Agent/CBR/UDP]

new Agent/UDP would be more appropriate. The rest is also kind of deprecated 
(old syntax). If you are using b6, try borsing the tcl code in tcl/lib, tcl/test 
tcl/ex for examples (some are old though).


Tarik.
>          $ns attach-agent $node $source
>          #Create an Expoo traffic agent and set its configuration
>parameters
>          set traffic [new Traffic/Expoo]
>          $traffic set packet-size $size
>          $traffic set burst-time $burst
>          $traffic set idle-time $idle
>          $traffic set rate $rate
>          #Attach the traffic agent to the traffic source
>          $source attach-traffic $traffic
>          #Connect the source and the sink
>          $ns connect $source $sink
>          return $source
>  }
>
>set sink0 [new Agent/LossMonitor]
>set sink1 [new Agent/LossMonitor]
>set sink2 [new Agent/LossMonitor]
>set sink3 [new Agent/LossMonitor]
>
>$ns attach-agent $d0 $sink0
>$ns attach-agent $d0 $sink1
>$ns attach-agent $d0 $sink2
>$ns attach-agent $d0 $sink3
>
># source 0 au node s0 : cbr
>set source0 [new Agent/RTP]
>$ns attach-agent $s0 $source0
>set source0agent [new Application/Traffic/CBR]
>$source0agent set packetSize_ 200
>$source0agent set rate 448k
>$source0agent attach-agent $source0
>$ns connect $source0 $sink0
>
># source 1 au node s1 : cbr
>set source1 [new Agent/RTP]
>$ns attach-agent $s1 $source1
>set source1agent [new Application/Traffic/CBR]
>$source1agent set packetSize_ 200
>$source1agent set rate 320k
>$source1agent attach-agent $source1
>$ns connect $source1 $sink1
>
># source 2 au node s2 : exp
>set source2 [attach-expoo-traffic $s2 $sink2 200 5s 10s 768k]
>
># source 3 au node s3 : exp
>set source3 [attach-expoo-traffic $s3 $sink3 200 10s 10s 1024k]
>
>set f0 [open res0.tr w]
>set f1 [open res1.tr w]
>set f2 [open res2.tr w]
>set f3 [open res3.tr w]
>
>proc finish {} {
>          global f0 f1 f2 f3
>          close $f0
>          close $f1
>          close $f2
>          close $f3
>          exit 0
>  }
>
>proc record {} {
>          global sink0 sink1 sink2 sink3 f0 f1 f2 f3
>
>          set ns [Simulator instance]
>
>          set time 30
>
>          set bw0 [$sink0 set bytes_]
>          set bw1 [$sink1 set bytes_]
>          set bw2 [$sink2 set bytes_]
>          set bw3 [$sink3 set bytes_]
>
>          set now [$ns now]
>
>          puts $f0 "$now [expr $bw0/$time*8]"
>          puts $f1 "$now [expr $bw1/$time*8]"
>          puts $f2 "$now [expr $bw2/$time*8]"
>          puts $f3 "$now [expr $bw3/$time*8]"
>
>          $sink0 set bytes_ 0
>          $sink1 set bytes_ 0
>          $sink2 set bytes_ 0
>          $sink3 set bytes_ 0
>
>          $ns at [expr $now+$time] "record"
>  }
>
>$ns at 0.0 "record"
>$ns at 0.0 "$source0agent start"
>$ns at 0.0 "$source1agent start"
>$ns at 0.0 "$source2 start"
>$ns at 0.0 "$source3 start"
>$ns at 600.1 "finish"
>
>$ns run
>

Tarik Alj

INRS-Telecommunications
Place Bonaventure
900 De La Gauchetierre Ouest
Niveau C, Case Postale 644
Montreal, Qc, H5A 1C6
Canada

514 875-1266 #2036 (email preferred)