1function [meanAoI, varAoI, peakAoI] = aoi_fcfs_md1(lambda, d)
2%AOI_FCFS_MD1 Mean, variance, and peak AoI
for M/D/1 FCFS queue
4% [meanAoI, varAoI, peakAoI] = aoi_fcfs_md1(lambda, d)
6% Computes
the Age of Information metrics
for an M/D/1 queue with
7% First-Come First-Served (FCFS) discipline.
9% M/D/1: Poisson arrivals with rate lambda, deterministic service time d.
12% lambda (
double): Arrival rate (Poisson arrivals)
13% d (double): Deterministic service time
16% meanAoI (double): Mean (average) Age of Information
17% varAoI (double): Variance of Age of Information
18% peakAoI (double): Mean Peak Age of Information
20% Formulas (from Inoue et al., IEEE Trans. IT, 2019):
21% Uses M/GI/1 FCFS results with deterministic service.
23% E[H] = d, E[H^2] = d^2 (deterministic)
25% E[W] = lambda * d^2 / (2*(1-rho)) (Pollaczek-Khinchine)
27% E[A] = d*(1/2 + 1/(2*(1-rho)) + ((1-rho)/rho)*exp(rho)) (exact)
30% Y. Inoue, H. Masuyama, T. Takine, T. Tanaka,
"A General Formula for
31% the Stationary Distribution of the Age of Information and Its
32% Application to Single-Server Queues," IEEE Trans. Information Theory,
33% vol. 65, no. 12, pp. 8305-8324, 2019.
35% See also: aoi_fcfs_mm1, aoi_fcfs_mgi1, aoi_lcfspr_md1
37% Copyright (c) 2012-2026, Imperial College London
42 line_error(mfilename,
'Arrival rate lambda must be positive');
45 line_error(mfilename,
'Service time d must be positive');
53 line_error(mfilename,
'System unstable: rho = lambda*d = %.4f >= 1', rho);
56% Service time moments (deterministic)
60% Mean waiting time (Pollaczek-Khinchine
for M/G/1)
61% E[W] = lambda * E[H^2] / (2 * (1 - rho))
62E_W = lambda * E_H2 / (2 * (1 - rho));
64% Mean system time (sojourn time)
67% Mean interarrival time
70% Mean AoI
for M/D/1 FCFS (exact, Inoue et al. 2019)
71% E[A] = d * (1/2 + 1/(2*(1-rho)) + ((1-rho)/rho) * exp(rho))
72% accounts
for the negative correlation between interarrival and waiting
73% times (validated against simulation)
74meanAoI = d * (0.5 + 1 / (2 * (1 - rho)) + ((1 - rho) / rho) * exp(rho));
77% E[Apeak] = E[T] + E[Y]
81% For M/D/1,
the variance depends on
the second moment of AoI.
82% Using
the general M/G/1 result with deterministic service:
83% Var[A] can be computed from LST derivatives, but
for deterministic
85% Var[Y] = 1/lambda^2 (exponential interarrival)
86% Var[H] = 0 (deterministic service)
88% A simpler approximation
for variance:
89% For now, compute
using the relationship with second moments
90% This
is an approximation; exact formula
requires LST analysis
91E_Y2 = 2 / lambda^2; % Second moment of exponential
92E_T2 = E_H2 + 2*E_H*E_W + E_W^2 + lambda * E_H2 / (1 - rho); % Approx
94% Use relationship: E[A^2] approx from paper results
95% For deterministic service, variance
is lower than exponential
case
96varAoI = E_Y2 - E_Y^2 + 2*E_W*E_H / (1-rho) + E_H2 * rho / (1-rho)^2;
98% Ensure non-negative variance (numerical safety)