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

Re: [ns] Random flows



this is what i use to randomize start times (between 0 and 1 seconds)in my 
scripts:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# generate random start times for the telnet apps
# (proc borrowed from test-rlm.tcl)
proc uniform01 {} {
        return [expr double(([ns-random] % 10000000) + 1) / 1e7]
}
...
# randomize start times for the apps
set st0 [uniform01]
set st1 [uniform01]
...
# and finally...
$ns_ at $st0 "$ftp0 start"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

you can trivially modify uniform01{} to get times in a different range. hope 
that answers some of your questions.

-neeraj

>From: "Leyla TOUMI" <[email protected]>
>To: <[email protected]>
>Subject: [ns] Random flows
>Date: Mon, 2 Oct 2000 15:28:52 +0200
>
>Hi all !
>I have a problem to simulate a network. I would like to simulate a network
>with TCP/FTP and RTP or UDP flows, but the constraint i have is that I HAVE
>TO simulate non-deterministic flows : with that, I mean that I want to have
>flows which can start at random times, finish at random times, and which
>have random parameters ( different number of packets  for two TCP/FTP
>sources, different max_pkts, etc...)  I've seen that we can have heuristic
>flows, but I don't know how to use that.
>For example, in the following code, HOWand WHERE can I specify the 
>heuristic
>behavior ?
>
>I REALLY NEED YOUR HELP !!! THANKS A LOT IN ADVANCE ....WISHING YOU BEST
>TIMES !
>Sincerely,
>Leyla
>
>**************************************
>set ns [new Simulator]
>
>set n0 [$ns node]
>set n1 [$ns node]
>set n2 [$ns node]
>set n3 [$ns node]
>set n4 [$ns node]
>set n5 [$ns node]
>set n6 [$ns node]
>
>Queue set limit_ 5
>
>$ns duplex-link $n0 $n2 10Mb 20ms DropTail
>$ns duplex-link $n1 $n2 10Mb 20ms DropTail
>$ns duplex-link $n6 $n2 10Mb 20ms DropTail
>
>$ns duplex-link $n2 $n3 1Mb 70ms RED
>$ns duplex-link $n3 $n2 1Mb 70ms RED
>
>$ns duplex-link $n3 $n4 10Mb 20ms DropTail
>$ns duplex-link $n3 $n5 10Mb 20ms DropTail
>
>set udp0 [new Agent/RTP]
>$ns attach-agent $n0 $udp0
>$udp0 set classe 1
>set cbr0 [new Application/Traffic/CBR]
>$cbr0 attach-agent $udp0
>set null0 [new Agent/Null]
>$ns attach-agent $n4 $null0
>$ns connect $udp0 $null0
>$ns at 0.0 "$cbr0 start"
>
>
>set tcp0 [new Agent/TCP]
>set sink [new Agent/TCPSink]
>$ns attach-agent $n1 $tcp0
>$ns attach-agent $n5 $sink
>$tcp0 set classe 2
>$ns connect $tcp0 $sink
>set ftp0 [new Application/FTP]
>$ftp0 attach-agent $tcp0
>$ns at 0.0 "$ftp0 start"
>
>set tcp1 [new Agent/TCP]
>$ns attach-agent $n6 $tcp1
>$tcp1 set classe 3
>$ns connect $tcp1 $sink
>set ftp1 [new Application/FTP]
>$ftp1 attach-agent $tcp1
>$ns at 0.0 "$ftp1 start"
>
>$ns at 5.0 "finish"
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Neeraj Poojary
Center for Wireless Communications, UC San Diego
email: [email protected]

I'm not afraid of death. I just don't want to be there when
it happens.
-Woody Allen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.