开发者

Poisson variates, λ and arrival rate connection, Java network simulation

开发者 https://www.devze.com 2023-04-10 23:21 出处:网络
I\'m developing a network simulator in which events for packet arrivals and transmission attempts are following a Poisson distribution. I have an adaptation of Knuth\'s algorithm:

I'm developing a network simulator in which events for packet arrivals and transmission attempts are following a Poisson distribution. I have an adaptation of Knuth's algorithm:

public class Poisson {

    private double λ;
    private Random rand;

    /** Creates a variable with a given mean. */
    public Poisson(double λ) {
        this.λ = λ;
        rand = new Random();
    }

    public int next() {
        double L = Math.exp(-λ);
        double p = 1.0;
        int k = 0;

        do {
            k++;
            p *= rand.nextDouble();
        } while (p > L);

        return k - 1;

    }
}

My specs state that nodes reschedule floors randomly with a Poisson process. The average interarrival time is exponentially distributed with mean of Ts = 2.5ms. Am I correct in using λ = 2.5?

When I want to make an new arrival event I do something like:

Event evt = new Event(EventType.ARRIVAL_EVENT,
    MasterClock.getTime + poisson.next());
eventList.add(evt);

The simulat开发者_运维技巧or is supposedly running several times, every time with increased load to measure performance. At first I thought that the arrival rate equals λ but the bigger the λ the less packets per second I get. What is the relationship between arrival rate and λ? I am sorry for the very long post but I am really frustrated by searching in lots of university books and all over the internet without a valid source for network simulation...

Thank you in advance for your help.


It might seem weird, but for your Poisson process, you don't need the Poisson distribution but the exponential distribution. Look on wikipedia.

The inter-arrival times, which you are simulating in your code, follow the exponential distribution of parameter lambda = 1 / 2.5 (lambda is the inverse of the mean). You can easily get a random exponential variate with -Math.log(1.0 - rand.nextDouble()) / lambda.

There are two views of the Poisson process: The view described above keeps the number of events fixed (1) and the time interval varies. The other view keeps the time interval fixed, but the number of events in that interval is the random variate (and follows the Poisson distribution).


Ts = 2.5ms. Am I correct in using λ = 2.5

No. Ts is a time. λ is the arrival rate, in items per second. See William Stallings, Queueing Analysis.

0

精彩评论

暂无评论...
验证码 换一张
取 消