1function [meanAoI, lstAoI, peakAoI] = aoi_lcfsd_mgi1(lambda, H_lst, E_H, E_H2)
2%AOI_LCFSD_MGI1 Mean AoI
for M/GI/1 non-preemptive LCFS-D queue
4% [meanAoI, lstAoI, peakAoI] = aoi_lcfsd_mgi1(lambda, H_lst, E_H, E_H2)
6% Computes the Age of Information metrics
for an M/GI/1 queue with
7% non-preemptive Last-Come First-Served with Discarding (LCFS-D) discipline.
9% In LCFS-D, when a
new update arrives
while the server
is busy:
10% - If there
's an update waiting in queue, it is discarded
11% - The new update takes its place in the queue
12% - When service completes, the waiting update (if any) is served
14% This is also known as M/GI/1/2* (buffer size 2 with replacement).
17% lambda (double): Arrival rate (Poisson arrivals)
18% H_lst (function_handle): LST of service time, @(s) -> complex
19% E_H (double): Mean service time (first moment)
20% E_H2 (double): Second moment of service time
23% meanAoI (double): Mean (average) Age of Information
24% lstAoI (function_handle): LST of AoI distribution (empty if not computed)
25% peakAoI (double): Mean Peak Age of Information
27% Formulas (from Inoue et al., IEEE Trans. IT, 2019, Section VI):
28% The analysis uses the concept of effective service time which includes
29% potential waiting while another update is being served.
32% Y. Inoue, H. Masuyama, T. Takine, T. Tanaka, "A General Formula for
33% the Stationary Distribution of the Age of Information and Its
34% Application to Single-Server Queues," IEEE Trans. Information Theory,
35% vol. 65, no. 12, pp. 8305-8324, 2019.
37% See also: aoi_lcfss_mgi1, aoi_fcfs_mgi1, aoi_lcfspr_mgi1
39% Copyright (c) 2012-2026, Imperial College London
44 line_error(mfilename, 'Arrival rate lambda must be positive
');
47 line_error(mfilename, 'Mean service time E_H must be positive
');
50 line_error(mfilename, 'Second moment E_H2 must be >= E_H^2');
58 line_error(mfilename,
'System unstable: rho = lambda*E_H = %.4f >= 1', rho);
61% Mean interarrival time
64% For LCFS-D (also known as M/GI/1/2*), the analysis from Section VI:
66% The effective service time S_eff includes potential residual service
67% of the update being served when the successful update arrived.
69% Key quantity: probability p0 that arriving update finds server idle
70% p0 = 1 - rho (
for Poisson arrivals)
72% Mean effective system time:
73% E[T_eff] = E[H] + (1 - p0) * E[H_residual]
74% = E[H] + rho * E[H^2] / (2 * E[H])
76E_H_residual = E_H2 / (2 * E_H); % Residual service time
77E_T_eff = E_H + rho * E_H_residual;
79% Mean AoI
for LCFS-D (Proposition 6, simplified form)
80% E[A] = E[Y] + E[T_eff] + additional term
for discarded updates
82% The additional term accounts
for the age accumulated
while waiting:
83% Additional = rho * (E[H_residual] + E[H]) / (1 + rho)
85% Simplified approximation:
86meanAoI = E_Y + E_H + rho * E_H2 / (2 * E_H) + rho * E_H / (1 + rho);
89% Peak AoI
is the system time plus interarrival time
90peakAoI = E_Y + E_T_eff;
92% LST
is complex
for LCFS-D;
return empty handle