1function [ql]=Q_RAP_RAP_1(C0,C1,D0,D1,varargin)
2% [ql]=Q_RAP_RAP_1(C0,C1,D0,D1) computes the Queue-length distribution
3% of a RAP(C0,C1)/RAP(D0,D1)/1/FCFS queue
6% * RAP(C0,C1) arrival process (with mA states)
8% * RAP(D0,D1) service process (with mS states)
11% * Queue length distribution,
12% ql(i) = Prob[(i-1) customers in the queue]
15% Mode: The underlying function to compute the R matrix of the
16% underlying QBD can be selected using the following
17% parameter values (default:
'CR')
18%
'CR' : Cyclic Reduction [Bini, Meini]
19%
'FI' : Functional Iterations [Neuts]
20%
'IS' : Invariant Subspace [Akar, Sohraby]
21%
'LR' : Logaritmic Reduction [Latouche, Ramaswami]
22%
'NI' : Newton Iteration
24% MaxNumComp: Maximum number of components for the vectors containig
25% the performance measure.
27% Verbose: When set to 1, the progress of the computation
is printed
30% Optfname: Optional parameters for the underlying function fname.
31% These parameters are included in a cell with one entry holding
32% the name of the parameter and the next entry the parameter
33% value. In this function, fname can be equal to:
34%
'QBD_CR' : Options for Cyclic Reduction [Bini, Meini]
35%
'QBD_FI' : Options for Functional Iterations [Neuts]
36%
'QBD_IS' : Options for Invariant Subspace [Akar, Sohraby]
37%
'QBD_LR' : Options for Logaritmic Reduction [Latouche, Ramaswami]
38%
'QBD_NI' : Options for Newton Iteration
40% USES: QBD Solver and QBD_pi of the SMCSolver tool
70for i=1:size(OptionNames,1)
71 options.(deblank(OptionNames(i,:)))=[];
76options.MaxNumComp = 50;
78options.OptQBD_CR=cell(0);
79options.OptQBD_FI=cell(0);
80options.OptQBD_IS=cell(0);
81options.OptQBD_LR=cell(0);
82options.OptQBD_NI=cell(0);
85Q_RAP_ParsePara(C0,'C0',C1,'C1')
86Q_RAP_ParsePara(D0,'D0',D1,'D1')
88% Parse Optional Parameters
89options=Q_ParseOptPara(options,OptionNames,OptionTypes,OptionValues,varargin);
90% Check for unused parameter
91Q_CheckUnusedParaQBD(options)
97% Test the load of the queue
98pi_a = stat(C0+C1+eye(mA));
99pi_s = stat(D0+D1+eye(mS));
100lambda = sum(pi_a*C1);
105 error('MATLAB:Q_RAP_RAP_1:LoadExceedsOne',...
106 'The load %d of the system exceeds one',load);
109% Compute QBD blocks A0, A1 and A2
111A1=kron(C0,eye(mS))+kron(eye(mA),D0);
117if (strfind(options.Mode,'FI')>0)
118 [G,R]=QBD_FI(A0,A1,A2,options.OptQBD_FI{:},
'RAPComp',1);
119elseif (strfind(options.Mode,
'LR')>0)
120 [G,R]=QBD_LR(A0,A1,A2,options.OptQBD_LR{:},
'RAPComp',1);
121elseif (strfind(options.Mode,
'IS')>0)
122 [G,R]=QBD_IS(A0,A1,A2,options.OptQBD_IS{:},
'RAPComp',1);
123elseif (strfind(options.Mode,
'NI')>0)
124 [G,R]=QBD_NI(A0,A1,A2,options.OptQBD_NI{:},
'RAPComp',1);
126 [G,R]=QBD_CR(A0,A1,A2,options.OptQBD_CR{:},
'RAPComp',1);
129pi = QBD_pi(B0,B1,R,
'MaxNumComp',options.MaxNumComp,
'Verbose',options.Verbose,
'RAPComp',1);
132% compute queue length
133ql = zeros(1, size(pi, 2)/(mA*mS));
134for i = 1:size(pi,2)/(mA*mS)
135 ql(i) =sum(pi((i-1)*mA*mS+1:i*mA*mS));