Entity Queue not showing correct average waiting time and average queue length
11 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Hornett
2023-10-27
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete-Event Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!