LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
qbd_depproc_etaqa_ps.m
1%{ @file qbd_depproc_etaqa_ps.m
2 % @brief Constructs MAP departure process for MAP/MAP/1-PS via ETAQA truncation
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Builds a MAP approximation of the departure process for a MAP/MAP/1 PS queue
9 %
10 % @details
11 % This function constructs a finite-state MAP {D0, D1} representation of the
12 % departure process from a MAP/MAP/1 queue with Processor Sharing (PS)
13 % discipline, using ETAQA truncation at QBD level n.
14 %
15 % Compared to the FCFS variant (qbd_depproc_etaqa), the PS discipline splits
16 % service completions at level j into a departure component B*(1/j) and an
17 % internal transition component B*(1-1/j), reflecting the rate-dependent
18 % sharing of the server among j jobs. The tail approximation at level n uses
19 % Bbar and Bhat matrices weighted by 1/n and (n-1)/n respectively.
20 %
21 % @par Syntax:
22 % @code
23 % D = qbd_depproc_etaqa_ps(MAPa, MAPs, n)
24 % @endcode
25 %
26 % @par Parameters:
27 % <table>
28 % <tr><th>Name<th>Description
29 % <tr><td>MAPa<td>Arrival process in MAP format {D0, D1}
30 % <tr><td>MAPs<td>Service process in MAP format {D0, D1}
31 % <tr><td>n<td>Truncation level (number of QBD levels to represent explicitly)
32 % </table>
33 %
34 % @par Returns:
35 % <table>
36 % <tr><th>Name<th>Description
37 % <tr><td>D<td>Departure process in MAP format {D0, D1}
38 % </table>
39%}
40function [D]=qbd_depproc_etaqa_ps(MAPa,MAPs,n)
41
42na = length(MAPa{1});
43ns = length(MAPs{1});
44lvlsz = ns*na;
45
46F = kron(MAPa{2},eye(ns));
47L = krons(MAPa{1},MAPs{1});
48B = kron(eye(na),MAPs{2});
49L0 = kron(MAPa{1},eye(ns));
50
51[~,R,~] = QBD_CR(B,L,F);
52G = inv(-L-R*B)*B;
53Lhat = F+L;
54Bbar = B+F*G;
55Bhat = F*G;
56
57vn1 = ones(1,n-1);
58vn = zeros(1,n); vn(end)=1;
59
60D0=kron(diag([1,vn1]),L)+kron(diag(vn1,1),F);
61D0=[zeros(size(L0,1),size(D0,2)); D0];
62D0 = [zeros(size(D0,1),size(B,2)),D0];
63D0(1:size(L0,1),1:(size(L0,2)+size(F,2)))=[L0,F];
64D0(((n-1)*lvlsz+1):n*lvlsz,((n-1)*lvlsz+1):n*lvlsz)=Lhat;
65
66D0 = D0 + kron(diag(vn,-1),Bbar)+kron(diag([0,vn]),Bhat)*(n-1)/n;
67D1=kron(diag(vn,-1),Bbar)+kron(diag([0,vn]),Bhat)/n;
68for j=1:(n-1)
69 D0((j*lvlsz+1):(j+1)*lvlsz, ((j-1)*lvlsz+1):j*lvlsz)=B*(1-1/j);
70 D1((j*lvlsz+1):(j+1)*lvlsz, ((j-1)*lvlsz+1):j*lvlsz)=B*(1/j);
71end
72D={D0,D1};
73end