1function [lossprob_mg1k,rho]=qsys_mg1k_loss(lambda,svc_density,K)
2% Niu-Cooper, Transform-Free Analysis of M/G/1/K and Related Queues, Mathematics of Operations Research
3% Vol. 18, No. 2 (May, 1993), pp. 486-510 (25 pages)
5% mu=3; lambda=2; K=5; [lossprob_mg1k,rho]=qsys_mg1k_loss(lambda,@(t)mu.*exp(-mu.*t),K)
7%sigma
is the embedded probability seen immediately after the kth *service-start* epoch
9mu = 1/integral(@(t) t.*svc_density(t),0,tmax);
13 a(1+j)=integral(@(t)exp(-lambda*t).*((lambda*t).^j).*svc_density(t),0,tmax)/factj;
18% We model the number of customers waiting in the queue immediately
19% after the kth *service-start* epoch
22 P(1,1) = a(1+0)+a(1+1);
26 P(1+i,1+j) = a(1+(j+1-i));
30 P(1+i,1+(K-2)) = sum(a(1+((K-2+1-i)):end));
33 % traditional embedded process at departure
38 P(1,K-1)=1-sum(
P(1,:));
39 P(2,K-1)=1-sum(
P(2,:));
44 P(j,K-1)=1-sum(
P(j,1:K-2));
47P=dtmc_makestochastic(
P);
50lossprob_mg1k = 1-1/(sigma(1+0)*a(1+0)+rho);