This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Total number of clients: 100000 | |
| Mean arrival rate: 0.25 | |
| Mean service rate: 1 | |
| *************************************** | |
| Mean time spent in queue: 0.3329325 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // M/M/1 Queueing System Simulation | |
| // | |
| // Author: Araik Tamazian, 2015 | |
| // | |
| // Simulation parameters | |
| N = 1e+5 // total number of clients to simulate | |
| lambda = 0.25 // arrival rate | |
| mu = 1.0 // service rate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Wq = kingman(ti, ts) | |
| rho = mean(ts)/mean(ti); | |
| cva = stdev(ti)/mean(ti); | |
| cvs = stdev(ts)/mean(ts); | |
| Wq = (rho/(1 - rho))*((cva^2 + cvs^2)/2)*mean(ti); | |
| endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Perform M/M/Inf queue analysis | |
| // | |
| // Input: lambda - arrival rate | |
| // mu - service rate | |
| // Output: A - offered traffic, | |
| // L - mean number of customers in the system | |
| // W - mean time spent in system | |
| function [A, L, W]=qmodel_mminf(lambda, mu) | |
| A = lambda/mu; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Perform M/M/1 queue analysis | |
| // | |
| // Input: lambda - arrival rate | |
| // mu - service rate | |
| // Output: u - utilization, | |
| // L - mean number of customers in the system | |
| // W - mean sojourn time | |
| function [u, L, W]=qmodel_mm1(lambda, mu) | |
| if lambda < mu then |