1function [W,rhohat]=qsys_gigk_approx_whitt(lambda,mu,ca,cs,k)
2% [W,RHOHAT]=QSYS_GIGK_APPROX_WHITT(LAMBDA,MU,CA,CS,K)
4% GI/G/k approximation of Whitt (1993), eqs. (2.16)-(2.25):
5% Wq = phi(rho,ca^2,cs^2,k) * ((ca^2+cs^2)/2) * Wq(M/M/k)
6% where phi interpolates
the Cosmetatos M/D/k (phi1) and D/M/k (phi3)
7% correction factors. Exact
for M/M/k; reduces to
the Cosmetatos M/D/k
8% approximation
for cs=0. Implements eq. (2.25) as printed, which was
9% validated here against
the paper
's Tables 5-7 (New column).
12% LAMBDA - Arrival rate
13% MU - Service rate per server
14% CA - Coefficient of variation of inter-arrival time
15% CS - Coefficient of variation of service time
16% K - Number of servers
19% W - Average time in system (response time)
20% RHOHAT - Modified utilization (so that M/M/1 formulas still hold)
22% Reference: Whitt, W. (1993). Approximations for the GI/G/m queue.
23% Production and Operations Management 2(2), 114-161.
25% Copyright (c) 2012-2026, Imperial College London
30rho = lambda / (k * mu);
32% Exact M/M/k baseline (Erlang-C based)
33W_mmk = qsys_mmk(lambda, mu, k);
36% Cosmetatos correction, as modified by Whitt (1993), eq. (2.17)
37gamma = min(0.24, (1-rho)*(k-1)*(sqrt(4+5*k)-2)/(16*k*rho));
38phi1 = 1 + gamma; % M/D/k factor, eq. (2.16)
39phi2 = 1 - 4*gamma; % eq. (2.18)
40phi3 = phi2 * exp(-2*(1-rho)/(3*rho)); % D/M/k factor, eq. (2.20)
41phi4 = min(1, (phi1+phi3)/2); % eq. (2.21)
47 psi = phi4^(2*(1-c2));
50if abs(ca2-cs2) < 1e-12
51 phi = psi; % eq. (2.25) reduces to psi
53 phi = (4*(ca2-cs2)/(4*ca2-3*cs2))*phi1 + (cs2/(4*ca2-3*cs2))*psi;
55 phi = ((cs2-ca2)/(2*(ca2+cs2)))*phi3 + ((cs2+3*ca2)/(2*(ca2+cs2)))*psi;
58Wq = phi * c2 * Wq_mmk; % eq. (2.24)
60rhohat = W*lambda/(1+W*lambda); % so that M/M/1 formulas still hold