4 % @brief Exact MVA
for load-dependent closed queueing networks.
10 % @brief Exact MVA
for load-dependent closed queueing networks.
11 % @fn pfqn_mvald(L, N, Z, mu, stabilize)
12 % @param L Service demand matrix.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param mu Load-dependent rate matrix (MxNt).
16 % @param stabilize Force non-negative probabilities (
default: true).
17 % @return XN System throughput.
18 % @return QN Mean queue lengths.
19 % @return UN Utilization.
20 % @return CN Cycle times.
21 % @return lGN Logarithm of normalizing constant evolution.
22 % @return isNumStable Numerical stability flag.
23 % @return pi Marginal queue-length probabilities.
26function [XN,QN,UN,CN,lGN,isNumStable,pi]=pfqn_mvald(L,N,Z,mu,stabilize)
27% [XN,QN,UN,CN,LGN]=PFQN_MVALD(L,N,Z,MU)
29[M,R]=size(L); % get number of queues (M) and
classes (R)
43% stabilize ensures that probabilities do not become negative
50Xs=zeros(R,prod(N+1)); % throughput for a model with station i less
51pi=ones(M,sum(N)+1,prod(N+1)); % marginal queue-length probabilities pi(k)
52n=pprod(N); % initialize the current population
53numLGTerms = sum(N) + 1;
54lGN = zeros(1, numLGTerms);
63 WN(ist,s)=WN(ist,s)+(L(ist,s)/mu(ist,k))*k*pi(ist,(k-1)+1,hashpop(oner(n,s),N));
66 Xs(s,hashpop(n,N))=n(s)/(Z(s)+sum(WN(:,s)));
73 pi(ist,(k)+1,hashpop(n,N))=0;
78 pi(ist,(k)+1,hashpop(n,N)) = pi(ist,(k)+1,hashpop(n,N)) + (L(ist,s)/mu(ist,k))*Xs(s,hashpop(n,N))*pi(ist,(k-1)+1,hashpop(oner(n,s),N));
86 p0 = 1-sum(pi(ist,(1:sum(n))+1,hashpop(n,N)));
89 line_warning(mfilename,'MVA-LD
is numerically unstable on this model, LINE will force all probabilities to be non-negative.\n');
95 pi(ist,(0)+1,hashpop(n,N)) = eps;
97 pi(ist,(0)+1,hashpop(n,N)) = p0;
100 pi(ist,(0)+1,hashpop(n,N)) = p0;
104 last_nnz = last_nonzero_index(n);
105 if last_nnz > 0 && sum(n(1:last_nnz-1)) == sum(N(1:last_nnz-1)) && sum(n((last_nnz+1):R))==0
106 logX = log(Xs(last_nnz,hashpop(n,N)));
108 lGN(lgIdx) = lGN(lgIdx-1) - logX;
111 n=pprod(n,N); % get the next population
116pi=pi(:,:,hashpop(N,N));
117QN = WN.*repmat(XN,M,1);
118%UN = repmat(XN,M,1) .* L;
120CN = N./XN - Z; % cycle time exclusive of think time
123function i=hashpop(n,N)
126i=1; % index of the empty population
128 i=i+prod(N(1:r-1)+1)*n(r);
132function idx = last_nonzero_index(v)
134for i = length(v):-1:1