How to code a arrival generator with a varying intensity rate

203 views Asked by At

This is for a simulation model:

Most questions I've come about deal with how to code an generator with exponential arrival times.

But I'm currently stuck on how to program a generator where the arrival rate can change within a discrete event simulation.

In particular I'm stuck with the following case: my generator has an input port which accepts an arrival rate (double). If this rate change arrives exactly when an entity is generated, I can simply create the entity, update the rate parameter for the distribution and sample a new arrival time.

But what should I do when the generator at time t1 receives a new rate input event and is already scheduled to create an entity in the future t2 -

Should I a) Abort the creation at t2 and schedule a new creation time using the new rate parameter or b) Just update the rate parameter, let the generator create the entity at t2, and then sample a new arrival time

1

There are 1 answers

3
pjs On BEST ANSWER

The answer is called "thinning," but requires you to know the global maximum arrival rate λmax. Generate arrivals at rate λmax, but for each generated arrival at time t, only execute the arrival event with probability λtmax. You can do this by generating a uniform(0,1) random number U for each potential arrival, and executing the arrival event if U ≤ λtmax.