Entity Queue not showing correct average waiting time and average queue length

11 views (last 30 days)
I am trying to simulate a very simple M/M/1 system.
When I use the following code in Entity Generation, average waiting time and average Queue length are shown as zero: dt=-3*log(1-rand());
However, when I use the following code, those "l" and "w" values are as expected:
persistent rngInit;
if isempty(rngInit)
seed = 12345;
rng(seed);
rngInit = true;
end
% Pattern: Exponential distribution
mu = 3;
dt = -mu * log(1 - rand());
Can someone please explain why?
I have also attached Bad and Good simulations based on version R2021a.

Answers (1)

Hornett
Hornett on 27 Oct 2023
Hi Amir,
I understand that you are facing an issue while building a simple M/M/1 system. I have reviewed your code, specifically the "Bad_Q.slx" file, and noticed that you have not seeded the random number generator. As a result, the entity server is serving requests faster than the entity generation, leading to zero values for "I" and "W" in "Bad_Q.slx".
To ensure accuracy and obtain consistent output from the random number generator, I recommend seeding the random value generator.

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!