4 % @brief Exact Mean Value Analysis (MVA)
for product-form queueing networks.
8function [XN,QN,UN,CN,lGN] = pfqn_mva(L,N,Z,mi)
11 % @brief Exact Mean Value Analysis (MVA)
for product-form queueing networks.
12 % @fn pfqn_mva(L, N, Z, mi)
13 % @param L Service demand matrix (M x R).
14 % @param N Population vector (1 x R).
15 % @param Z Think time vector (1 x R).
16 % @param mi (Optional) Server multiplicity vector (1 x M). Default: single servers.
17 % @
return XN System throughput (1 x R).
18 % @
return QN Mean queue length (M x R).
19 % @
return UN Utilization (M x R).
20 % @
return CN Residence time (M x R).
21 % @
return lGN Logarithm of the normalizing constant.
24% [XN,QN,UN,CN,LGN] = PFQN_MVA(L,N,Z,MI)
25% [XN,QN,UN,CN] = pfqn_mva(L,N,Z,mi)
36[M_original,R]=size(L); % M stations, R
classes
39 mi=ones(1,M_original);
41if nargin<3 || isempty(Z)
45% Station consolidation disabled: pfqn_unique merges stations with identical
46% demand rows, but this is incorrect for tandem (serial) networks where distinct
47% stations happen to have the same service demand. The consolidation treats them
48% as replicated (parallel) copies, producing wrong queue lengths and response times.
50mapping = 1:M_original;
52 %line_warning(mfilename,'closed populations are empty
');
57 line_error(mfilename,'demand matrix and population vector have different number of
classes');
69prods=zeros(1,R-1); % generate population indices
71 prods(1,w) = prod(ones(1,R-(w+1)+1)+N(1,w+1:R));
75while (N(firstnonempty)==0)
76 firstnonempty = firstnonempty-1;
86while ctr %
for each population
95 pos_n_1s = pos_n_1s + n(w)*prods(w);
104 CN(i,s)=Lis*(mi(i)+Q(1+pos_n_1s,i));
108 XN(s)=n(s)/(Z(s)+CNtot);
111 QN(i,s)=XN(s)*CN(i,s);
112 Q(currentpop,i)=Q(currentpop,i)+QN(i,s);
118 while s>0 && (n(1,s)==N(s)) || s>firstnonempty
121 % now compute the normalizing constant
122 last_nnz = find(n>0, 1,
'last' );
123 if sum(n(1:last_nnz-1)) == sum(N(1:last_nnz-1)) && sum(n((last_nnz+1):R))==0
124 logX = log(XN(last_nnz));
137 currentpop=currentpop+1;
141 UN(m,r)=XN(r)*L(m,r);
145% Expand results back to original dimensions
if stations were consolidated
147 [QN, UN, CN] = pfqn_expand(QN, UN, CN, mapping, M_original);