LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_lldfun.m
1%{
2%{
3 % @file pfqn_lldfun.m
4 % @brief AMVA-QD load and queue-dependent scaling function.
5%}
6%}
7
8%{
9%{
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.
16%}
17%}
18function r = pfqn_lldfun(n,lldscaling, nservers)
19% R = PFQN_LLDFUN(N,MU,C)
20
21% AMVA-QD queue-dependence function
22
23% Copyright (c) 2012-2026, Imperial College London
24% All rights reserved.
25
26M = length(n);
27r = ones(M,1);
28smax = size(lldscaling,2);
29alpha = 20; % softmin parameter
30for i = 1:M
31 %% handle servers
32 if nargin>=3
33 if isinf(nservers(i)) % delay server
34 r(i) = 1; %1 / n(i); % handled in the main code differently so not needed
35 else
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));
39 end
40 end
41 end
42 %% handle generic lld
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');
57 end
58end
59end
Definition Station.m:245