4 % @brief AMVA-QD load and queue-dependent scaling function.
10 % @brief AMVA-QD load and queue-dependent scaling function.
11 % @fn pfqn_lldfun(n, lldscaling, nservers)
12 % @param n Queue population vector.
13 % @param lldscaling Load-dependent scaling matrix.
14 % @param nservers Number of servers per station.
15 % @
return r Scaling
factor vector.
18function r = pfqn_lldfun(n,lldscaling, nservers)
19% R = PFQN_LLDFUN(N,MU,C)
21% AMVA-QD queue-dependence function
23% Copyright (c) 2012-2026, Imperial College London
28smax = size(lldscaling,2);
29alpha = 20; % softmin parameter
33 if isinf(nservers(i)) % delay server
34 r(i) = 1; %1 / n(i); % handled in
the main code differently so not needed
36 r(i) = r(i) / softmin(n(i),nservers(i),alpha);
37 if isnan(r(i)) %
if numerical problems in soft-min
38 r(i) = 1 / min(n(i),nservers(i));
43 if ~isempty(lldscaling) && range(lldscaling(i,:))>0
44 % Clamped LINEAR interpolation of
the lattice at
the fractional queue
45 % length. The lattice alpha(n)
is only defined at integer n; AMVA-QD
46 % evaluates it at
the interpolated mean queue length, so a rule
is
47 % needed. Linear
is exact
for the piecewise-linear min(1:N,c) lattice
48 % that load dependence
is overwhelmingly used to express, whereas a
49 % cubic spline overshoots between
the knots (at n=1.44 on min(n,2):
50 % spline 1.6444 vs
the exact 1.4400), granting more capacity than
the
51 % model declares. Clamping at n=smax mirrors
the state-space
52 % convention (State.afterEventStation.m uses lldscaling(ist,min(ni,
53 % lldlimit))):
the last lattice entry
is the saturated rate. It also
54 % removes
the spline extrapolation, which returned NEGATIVE rates past
55 %
the lattice (alpha(5) = -1 on min(1:3,2)) for unbounded open queues.
56 r(i) = r(i) / interp1(1:smax, lldscaling(i,1:smax), min(max(n(i),1),smax),
'linear');