function U = ax_common_scenario(N, seed)
% Same underlying 802.11ax HE-SU scenario for all models
% 1 AP -> 1 STA, CBW20

if nargin < 1, N = 3000; end
if nargin < 2, seed = 1; end
rng(seed);

U.systemName = '802.11ax HE-SU, 1 AP -> 1 STA, CBW20';
U.channelBandwidth = 'CBW20';
U.delayProfile = 'Model-B';
U.maxRetries = 3;

% Same packet-size trace
U.packetBytes = randi([200 1200], N, 1);

% Same contention/load trace
U.nStations = zeros(N,1);
U.busyRatio = zeros(N,1);
U.nStations(1) = 8;
U.busyRatio(1) = 0.35;

for i = 2:N
    U.nStations(i) = round(min(max(0.95*U.nStations(i-1) + 0.8*randn + 0.4, 2), 32));
    U.busyRatio(i) = min(max(0.92*U.busyRatio(i-1) + ...
        0.08*(0.10 + 0.02*U.nStations(i) + 0.04*randn), 0.05), 0.98);
end

% Same arrival trace
U.arrivalGapMs = zeros(N,1);
for i = 1:N
    muGap = max(0.05, 1.8 - 1.1*U.busyRatio(i));
    U.arrivalGapMs(i) = -muGap * log(max(rand,1e-12));
end
U.arrivalTimeMs = cumsum(U.arrivalGapMs);

% Same SNR trace
U.snrDb = zeros(N,1);
U.snrDb(1) = 24;
for i = 2:N
    U.snrDb(i) = min(max(0.95*U.snrDb(i-1) + ...
        0.05*(26 - 6*U.busyRatio(i) + 2.5*randn), 3), 38);
end

% Same MCS trace derived from SNR
th = [4 6 8 11 14 17 20 23 26 29 32 35];
U.mcs = zeros(N,1);
for i = 1:N
    U.mcs(i) = sum(U.snrDb(i) > th);
    U.mcs(i) = min(max(U.mcs(i),0),11);
end
end
