[ns] Poisson arrival of calls...

Marcos "Locksmith" Portnoi mportnoi@ieee.org
Mon, 1 Oct 2001 11:59:42 -0300


This is a multi-part message in MIME format.

------=_NextPart_000_0056_01C14A70.8DEB86A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Take a look at this example, taken from The Akaroa Project (from an
university in New Zealand, but I don't have the URL).

Focus on the way this script generates the poisson arrivals, using
exponential distribution.

Portnoi

----- Original Message -----
From: "Ignacio Más Ivars" <nacho@it.kth.se>
To: <ns-users@ISI.EDU>
Sent: Monday, 1 de October de 2001 06:54
Subject: [ns] Poisson arrival of calls...


>
> Hi, everybody!
>
> I have been looking through the archive but I have not found anything
> relating to this. The question is that I want to emulate a Poisson arrival
of
> calls, or flows... I know that using a exponential traffic generator gives
you
> a poissonian arrival of packets, but the question is that I would like to
> create and destroy sources dynamically, so that I get a poissonian arrival
of
> sources to the system, like if there were new telephony sources
arriving...
> Each of the sources should be independent and I should be able to monitor
each
> one of them... I guess that you need to fiddle with OTcl to make this, but
I
> am not that good at it, and I do not see the way to do it just in Tcl...
Any
> help or pointer to where to look for help would be greatly appreciated!!
>
> Please, Cc your answer to my mail, as I am not subscribed to the list
right
> now...
>
> Thanks in advance!!
>
> /Nacho
>
>
>
> --
> Department of Microelectronics and Information Technology
> Royal Institute of Technology
> http://www.it.kth.se/~nacho/    Tf:+46 (0)8 752 1497
>
>
>
>

------=_NextPart_000_0056_01C14A70.8DEB86A0
Content-Type: application/octet-stream;
	name="mm1.tcl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="mm1.tcl"

set ns [new Simulator]=0A=
set nf [open out.nam w] =0A=
set tr [open out.tr w] =0A=
#set ak [new Akaroa]=0A=
$ns namtrace-all $nf =0A=
set expo1 [new RandomVariable/Exponential]=0A=
$expo1 set avg_ 1=0A=
set expo2 [new RandomVariable/Exponential]=0A=
$expo2 set avg_ 98=0A=
set node1 [$ns node]=0A=
set node2 [$ns node]=0A=
set link [$ns simplex-link $node1 $node2 1kb 0ms DropTail]=0A=
set qu  [$link queue]=0A=
$qu set limit_ 10000000 =0A=
$ns simplex-link-op $node1 $node2 queuePos 0.5=0A=
#$link trace $ns $tr =0A=
set src [new Agent/UDP]=0A=
$ns attach-agent $node1 $src=0A=
set qmon [$ns monitor-queue $node1 $node2 ""]=0A=
set number 0=0A=
#$ak AkDeclareParameters 2=0A=
=0A=
proc finish {} {=0A=
    global ns number nf tr=0A=
    $ns flush-trace =0A=
    puts "[expr $number/[$ns now]]"=0A=
    close $nf=0A=
    close $tr=0A=
    exit 0 =0A=
} =0A=
=0A=
proc sendpacket {} {=0A=
    global ns ak number src expo1 expo2 =0A=
    set then [$ns now]=0A=
    $ns at [expr $then + [$expo1 value]] "sendpacket"=0A=
    set bytes [expr round ([$expo2 value])]=0A=
#    $ak AkObservation 1 $bytes=0A=
    #puts "$bytes"=0A=
    set number [expr $number + $bytes]=0A=
    $src send $bytes=0A=
    #puts "[expr $number/[$ns now]]"=0A=
}=0A=
=0A=
proc observe {} {=0A=
    global ns qmon ak link=0A=
    #puts "[$link sample-queue-size]"=0A=
    set now [$ns now]=0A=
    set pkt [$qmon set pkts_]=0A=
    #puts "$now $pkt"=0A=
    $ns at [expr $now + 1] "observe"=0A=
#    $ak AkObservation 2 $pkt=0A=
}=0A=
=0A=
set sink [new Agent/Null]=0A=
$ns attach-agent $node2 $sink=0A=
$ns connect $src $sink=0A=
$ns at 0.00001 "sendpacket"=0A=
$ns at 0.00001 "observe"=0A=
$ns at 100000.0 "finish"=0A=
=0A=
$ns run=0A=
=0A=

------=_NextPart_000_0056_01C14A70.8DEB86A0--