LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
qsys_gigk_approx_cosmetatos.m
1function [W,rhohat]=qsys_gigk_approx_cosmetatos(lambda,mu,ca,cs,k)
2% [W,RHOHAT]=QSYS_GIGK_APPROX_COSMETATOS(LAMBDA,MU,CA,CS,K)
3%
4% GI/G/k approximation by interpolation of the M/M/k, M/D/k and D/M/k
5% queues (Cosmetatos 1982; Page 1982):
6% Wq = [ca^2*cs^2 + ca^2*(1-cs^2)*phi1/2 + (1-ca^2)*cs^2*phi3/2]*Wq(M/M/k)
7% where phi1 and phi3 are the Cosmetatos (1975) correction factors for
8% M/D/k and D/M/k, with the safeguards of Whitt (1993). The D/D/k corner
9% has Wq=0. The interpolation requires ca^2<=1 and cs^2<=1; outside this
10% region the Lee-Longton scaling Wq = ((ca^2+cs^2)/2)*Wq(M/M/k) is used.
11%
12% Inputs:
13% LAMBDA - Arrival rate
14% MU - Service rate per server
15% CA - Coefficient of variation of inter-arrival time
16% CS - Coefficient of variation of service time
17% K - Number of servers
18%
19% Returns:
20% W - Average time in system (response time)
21% RHOHAT - Modified utilization (so that M/M/1 formulas still hold)
22%
23% References: Cosmetatos, G.P. (1975). Approximate explicit formulae for
24% the average queueing time in the processes (M/D/r) and (D/M/r).
25% INFOR 13, 328-331. Page, E. (1982). Tables of waiting times for M/M/n,
26% M/D/n and D/M/n and their use to give approximate waiting times in more
27% general queues. J. Opl. Res. Soc. 33, 453-473.
28
29% Copyright (c) 2012-2026, Imperial College London
30% All rights reserved.
31
32ca2 = ca^2;
33cs2 = cs^2;
34rho = lambda / (k * mu);
35
36% Exact M/M/k baseline waiting time (Erlang-C based)
37W_mmk = qsys_mmk(lambda, mu, k);
38Wq_mmk = W_mmk - 1/mu;
39
40if ca2 <= 1 && cs2 <= 1
41 % Cosmetatos correction, as modified by Whitt (1993), eq. (2.17)
42 gamma = min(0.24, (1-rho)*(k-1)*(sqrt(4+5*k)-2)/(16*k*rho));
43 phi1 = 1 + gamma; % M/D/k factor
44 phi3 = (1 - 4*gamma) * exp(-2*(1-rho)/(3*rho)); % D/M/k factor
45 Wq = (ca2*cs2 + ca2*(1-cs2)*phi1/2 + (1-ca2)*cs2*phi3/2) * Wq_mmk;
46else
47 % Interpolation weights are invalid outside the unit box
48 Wq = ((ca2+cs2)/2) * Wq_mmk;
49end
50W = Wq + 1/mu;
51
52rhohat = W*lambda/(1+W*lambda); % so that M/M/1 formulas still hold
53
54end
Definition Station.m:245