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)
42% stabilize ensures that probabilities do not become negative
49Xs=zeros(R,prod(N+1)); % throughput for a model with station i less
50pi=ones(M,sum(N)+1,prod(N+1)); % marginal queue-length probabilities pi(k)
51n=pprod(N); % initialize the current population
60 WN(ist,s)=WN(ist,s)+(L(ist,s)/mu(ist,k))*k*pi(ist,(k-1)+1,hashpop(oner(n,s),N));
63 Xs(s,hashpop(n,N))=n(s)/(Z(s)+sum(WN(:,s)));
70 pi(ist,(k)+1,hashpop(n,N))=0;
75 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));
83 p0 = 1-sum(pi(ist,(1:sum(n))+1,hashpop(n,N)));
86 line_warning(mfilename,'MVA-LD
is numerically unstable on this model, LINE will force all probabilities to be non-negative.\n');
92 pi(ist,(0)+1,hashpop(n,N)) = eps;
94 pi(ist,(0)+1,hashpop(n,N)) = p0;
97 pi(ist,(0)+1,hashpop(n,N)) = p0;
101 last_nnz = find(n>0, 1, 'last' );
102 if sum(n(1:last_nnz-1)) == sum(N(1:last_nnz-1)) && sum(n((last_nnz+1):R))==0
103 logX = log(Xs(last_nnz,hashpop(n,N)));
106 lGN(end+1) = lGN(end) - logX;
110 n=pprod(n,N); % get the next population
114pi=pi(:,:,hashpop(N,N));
115QN = WN.*repmat(XN,M,1);
116%UN = repmat(XN,M,1) .* L;
118CN = N./XN - Z; % cycle time exclusive of think time
121function i=hashpop(n,N)
124i=1; % index of the empty population
126 i=i+prod(N(1:r-1)+1)*n(r);