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

Odp: [ns] How to generate Possion traffic?



Here's a trick a used to generate Poisson traffic without modyfing NS code.
The trick is to create a CBR source and start it for a moment, just to send
one packet. Then you ganerate new packet size and new start time with
exponential distribution, and schedule the START event of a source with AT
command.

Maybe it's not an elegant and optimal solution, it results in an error when
a new packet's duration time is shorter then 0.00000001, but it could be
sufficient in some simulations.

$ns at 1.0 "poisson $source 500 0.002"

# mpack - mean packet size, mnext - mean interarrival time
proc poisson {source mpack mnext} {
 global rng ns
 set pack [$rng exponential]
 set pack [expr $pack*$mpack+1]
 set now [$ns now]
 $source set packetSize_ $pack
 $source start
 $ns at [expr $now+0.00000001] "$source stop"
 set nextt [$rng exponential]
 set nextt [expr $now+$nextt*$mnext]
 $ns at $nextt "poisson $source $mpack $mnext"

}


Best Regards.

Marek



----- Wiadomoo� oryginalna -----
Od: Kenny Pounds <[email protected]>
Do: xwhong <[email protected]>; <[email protected]>
Wys�ano: 9 marca 2000 07:29
Temat: Re: [ns] How to generate Possion traffic?


> EXPOO model in NS is for fixed interval of packet generation with ON time
is
> exponential distri. You mean Possion traffic is of exponential interval.
> In my point of view, traffic model in NS is limited, especially for source
> with variable packet interval.
>
> You may want to develop your own one. pktsize/lambda is the mean interval,
> use exp distri and return an interval_. cbrtraffic.cc can be a good
template for
> Poisson model.
>
> Regards.
>
> On Wed, 31 Dec 1969, xwhong wrote:
> > Hi,
> >
> > Can anyone tell me how to generate Possion Traffic?
> >
> > I found ns-2 can generate ON-OFF traffic. Can I use ON-OFF model to
> > generate Possion traffic with lamda(with 0 mean ON time and lamda mean
OFF time)?
> >
> >
> > Thanks!
> > xwhong
> >
> >
> >
> > ______________________________________
> >
> >