I am dumbfounded why I am not able to simulate a simple queue system correctly.
The system is as follows:
Influx Poisson stream (exponential distribution) with a rate of 1 agent per 2 minutes.
A queue with capacity 2.
Two (2) servers with a service rate of 1 agent per 3 minutes each.
If the system is full (both servers and the two places in the queue are occupied) new agents will not enter the system but are destroyed.
In Anylogic I have modeled the system like so: Model
The source element is specified with interarrival time '2' and the agents are destroyed when they are not able to enter the system (because the queue is full). source EDIT: As pointed out by Felipe it should be "exponential(0.5)" instead of simply "2"; Nevertheless this does not solve the problem. The measurements are still wrong: The queue has now an average length of 0.55 vs. 0.413 (should be), the system has now an average number of agents of 1.92 vs. 1.727 (should be) and the average loss rate is 8.67 % vs. 12.4 % (should be).
The queue is specified with capacity '2' and FIFO mechanism. queue
The delay element is specified with capacity '2' and a delay duration of 'exponential(1.0/3.0)' minutes. delay
The sink is plain vanilla. sink
Now, queue theory tells us that we expect to observe a limit mean number of agents in the system of 1.727. And a limit mean number of agents in the queue of 0.413. And an average loss rate (agents destroyed) of 12.4 %.
But when i simulate the system with Anylogic i get different results. Oddly enough the mean of the agents in the queue is correct with 0.413. But the average loss rate in the anylogic simulations is about 1.7 % and the mean of the agents in the system is something like 1.83.
The loss rate can be easily caculated via 'On Discard' action in the 'source' element: "CountLost++;" ('CountLost' being a variable i have created) Then i can compare the 'CountLost' variable against the complete number of agents created.
Whats my mistake?
Thank you very much for your help! Martin
EDIT2: Felipe asked for the calculation: Calculation