Skip to content

Instantly share code, notes, and snippets.

Total number of clients: 100000
Mean arrival rate: 0.25
Mean service rate: 1
***************************************
Mean time spent in queue: 0.3329325
// 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
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
@atamazian
atamazian / mm1inf_model.sce
Created November 14, 2014 16:09
M/M/Inf queue analysis.
// 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;
@atamazian
atamazian / mm1_model.sce
Created November 14, 2014 15:32
M/M/1 queue analysis.
// 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