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% Detect and consolidate replicated stations
46[L, ~, ~, mi_unique, mapping] = pfqn_unique(L);
49% Combine user-provided mi with detected multiplicity
50% For each unique station j, sum the mi values of all original stations mapping to it
51mi_combined = zeros(1, M);
53 mi_combined(mapping(i)) = mi_combined(mapping(i)) + mi(i);
57 %line_warning(mfilename,'closed populations are empty
');
62 line_error(mfilename,'demand matrix and population vector have different number of
classes');
74prods=zeros(1,R-1); % generate population indices
76 prods(1,w) = prod(ones(1,R-(w+1)+1)+N(1,w+1:R));
80while (N(firstnonempty)==0)
81 firstnonempty = firstnonempty-1;
91while ctr %
for each population
100 pos_n_1s = pos_n_1s + n(w)*prods(w);
109 CN(i,s)=Lis*(mi(i)+Q(1+pos_n_1s,i));
113 XN(s)=n(s)/(Z(s)+CNtot);
116 QN(i,s)=XN(s)*CN(i,s);
117 Q(currentpop,i)=Q(currentpop,i)+QN(i,s);
123 while s>0 && (n(1,s)==N(s)) || s>firstnonempty
126 % now compute the normalizing constant
127 last_nnz = find(n>0, 1,
'last' );
128 if sum(n(1:last_nnz-1)) == sum(N(1:last_nnz-1)) && sum(n((last_nnz+1):R))==0
129 logX = log(XN(last_nnz));
142 currentpop=currentpop+1;
146 UN(m,r)=XN(r)*L(m,r);
150% Expand results back to original dimensions
if stations were consolidated
152 [QN, UN, CN] = pfqn_expand(QN, UN, CN, mapping, M_original);