1function [meanAoI, varAoI, peakAoI] = aoi_fcfs_dm1(tau, mu)
2%AOI_FCFS_DM1 Mean, variance, and peak AoI
for D/M/1 FCFS queue
4% [meanAoI, varAoI, peakAoI] = aoi_fcfs_dm1(tau, mu)
6% Computes the Age of Information metrics
for a D/M/1 queue with
7% First-Come First-Served (FCFS) discipline.
9% D/M/1: Deterministic arrivals with interarrival time tau (rate 1/tau),
10% exponential service with rate mu.
13% tau (
double): Deterministic interarrival time
14% mu (double): Service rate (exponential service)
17% meanAoI (double): Mean (average) Age of Information
18% varAoI (double): Variance of Age of Information
19% peakAoI (double): Mean Peak Age of Information
21% Formulas (from Inoue et al., IEEE Trans. IT, 2019):
22% Uses GI/M/1 FCFS results with deterministic arrivals.
23% For D/M/1, the key parameter
is sigma, the root of:
24% sigma = exp(-mu*tau*(1-sigma))
25% which gives the probability an arriving customer finds system non-empty.
28% Y. Inoue, H. Masuyama, T. Takine, T. Tanaka,
"A General Formula for
29% the Stationary Distribution of the Age of Information and Its
30% Application to Single-Server Queues," IEEE Trans. Information Theory,
31% vol. 65, no. 12, pp. 8305-8324, 2019.
33% See also: aoi_fcfs_mm1, aoi_fcfs_gim1, aoi_lcfspr_dm1
35% Copyright (c) 2012-2026, Imperial College London
40 line_error(mfilename,
'Interarrival time tau must be positive');
43 line_error(mfilename,
'Service rate mu must be positive');
47% For D/M/1: lambda = 1/tau, so rho = 1/(tau*mu)
53 line_error(mfilename,
'System unstable: rho = 1/(tau*mu) = %.4f >= 1', rho);
56% Compute sigma: unique root in (0,1) of sigma = exp(-mu*tau*(1-sigma))
57% This
is the probability an arriving customer finds the server busy
58% Use fixed-point iteration or fzero
59sigma_func = @(s) exp(-mu * tau * (1 - s)) - s;
60sigma = fzero(sigma_func, [0.001, 0.999]);
62% For GI/M/1, the system delay (waiting + service) has LST:
63% D*(s) = (1-sigma)*mu / (mu - s) for s < mu
64% E[D] = 1/mu + sigma/(mu*(1-sigma)) = 1/(mu*(1-sigma))
66E_D = 1 / (mu * (1 - sigma));
68% Mean interarrival time (deterministic)
71% Mean AoI for GI/M/1 FCFS (from Theorem 3 / Proposition 2)
72% E[A] = E[Y] + E[D] + sigma*(1-sigma)/(mu*sigma_prime)
73% where sigma_prime = d/ds sigma(s)|_{s=0}
75% For deterministic arrivals,
using the formula from the paper:
76% E[A] = tau + 1/(mu*(1-sigma)) + sigma/(mu*(1-sigma)^2 * mu*tau)
78% Simplified formula
for D/M/1:
79% E[A] = tau + E[D] + sigma / (mu * (1-sigma))
80meanAoI = tau + E_D + sigma / (mu * (1 - sigma));
83% E[Apeak] = E[Y] + E[D] = tau + 1/(mu*(1-sigma))
87% For D/M/1, the variance depends on the system delay variance and
88% the deterministic interarrival (which contributes 0 variance).
89% E[D^2] = 2/(mu*(1-sigma))^2
for exponential service with GI/M/1 structure
90E_D2 = 2 / (mu * (1 - sigma))^2;
93% Var[Y] = 0 (deterministic)
94% Approximate variance of AoI (needs exact formula from paper)
95varAoI = Var_D + (sigma / (mu * (1-sigma)))^2;
97% Ensure non-negative variance (numerical safety)