LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
solveBufferless.m
1function [AoI_g,AoI_A,AoI_h,AoI_mean,AoI_var,PAoI_g,PAoI_A,PAoI_h,PAoI_mean,PAoI_var]=solveBufferless(tau,T,sigma,S,p)
2% solveBufferless calculates parameters for the distributions of AoI and
3% pAoI and their first and second moments with the means of MFQ for bufferless systems.
4%
5% Original source: aoi-fluid toolbox
6% Copyright (c) 2020, Ozancan Dogan, Nail Akar, Eray Unsal Atay
7% BSD 2-Clause License
8%
9% Integrated into LINE solver for Age of Information analysis.
10
11% Inputs:
12% tau,T : infitesimal generator and initial probability vector
13% of the arrival process
14% sigma,S : infitesimal generator and initial probability vector
15% of the service process
16% p : packet preemption probability
17
18% Outputs:
19% AoI_g,AoI_A,AoI_h : matrix exponential parameters of AoI
20% PAoI_g,PAoI_A,PAoI_h : matrix exponential parameters of pAoI
21% AoI_mean,AoI_var : mean and variance of AoI
22% PAoI_mean,PAoI_var : mean and variance of pAoI
23
24k = size(T,2); % size of the arrival matrix
25l = size(S,2); % size of the service matrix
26kappa = -T*ones(k,1);
27nu = -S*ones(l,1);
28z = 2*k*l+k+1; % z is the system size
29a = 1; % a is the number of negative drift states
30b = z-1; % b is the number of positive drift states
31% construction of the matrix Q in Eqn (13)
32Q11 = kron(eye(k),S) + kron(T, eye(l)) + (1-p)*kron(kron(kappa,tau),eye(l));
33Q33 = Q11 + p*kron(kappa,kron(ones(l,1),kron(tau,sigma)));
34Q = [Q11,kron(eye(k), nu),zeros(k*l,k*l),p*kron(kappa,ones(l,1)); ...
35 zeros(k,k*l),T,kron(kappa,kron(tau,sigma)),zeros(k,1);...
36 zeros(k*l,k*l),zeros(k*l,k),Q33,kron(ones(k,1),nu);
37 zeros(1,z)];
38% construction of the drift matrix R in Eqn (13)
39R = eye(z);
40R(z,z) = -1;
41% Qtilde Construction in Eqn (13)
42Qtilde = Q;
43Qtilde(z,1:k*l) = kron(tau,sigma);
44Qtilde(z,z) = -1;
45% construction of the orthogonal matrix P in Line 2 of Alg. 1
46QR = Q/R;
47u1 = [ones(z-1,1);-1];
48u2 = [1;zeros(z-1,1)];
49u = u1-norm(u1,2)*u2;
50P = eye(z)-(2*(u)*(u'))/(u'*u);
51% construction of the matrices A, H, and Qtildestar in Line 3 of Alg. 1
52Ae = P'*QR*P;
53A = Ae(a+1:z,a+1:z);
54H = P(1:z,a+1:z)';
55Qtildestar = Qtilde(b+1:z,1:z);
56%solve for the vectors g and d in Line 4 of Alg. 1
57EqnMatrix = [H*R,-inv(A)*H*ones(z,1);-Qtildestar ones(a,1)];
58RightHandSide = [zeros(1,z) 1];
59Solution = mldivide(EqnMatrix',RightHandSide')';
60g = Solution(1:b);
61d = Solution(b+1:z);
62% We now have the ME representation in Eqn (8) for the MFQ X(t)
63% For AoI, restrict to states in Phases 2 and 3 only
64SelectedStates = [zeros(k*l,1);ones(k*l+k,1);0];
65AoI_h = H*SelectedStates;
66NormConstant = -g/A*AoI_h;
67AoI_g = g/NormConstant;
68AoI_A = A;
69% now we have the general form in Eqn (4)for the AoI distribution
70AoI_mean = AoI_g/(AoI_A^2)*AoI_h; % the moment expressions in Eqn (4)
71AoI_var = -2*AoI_g/(AoI_A^3)*AoI_h-AoI_mean^2;
72% For PAoI, restrict to states in Phase 3 scaled suitably by the entries of nu
73SelectedStates = [zeros(k*l+k,1);kron(ones(k,1),nu);0];
74PAoI_h = H*SelectedStates;
75NormConstant = -g/A*PAoI_h;
76PAoI_g = g/NormConstant;
77PAoI_A = A;
78% now we have the general form in Eqn (4)for the AoI distribution
79PAoI_mean = PAoI_g/(PAoI_A^2)*PAoI_h; % the moment expressions again in Eqn (4)
80PAoI_var = -2*PAoI_g/(PAoI_A^3)*PAoI_h-PAoI_mean^2;
81end