0% found this document useful (0 votes)
4 views2 pages

Wmnproj

Download as txt, pdf, or txt
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 2

% Ensure WLAN System Toolbox is available

if isempty(ver('wlan'))
error('WLAN System Toolbox is required to run this simulation.');
end

% WLAN Configuration for IEEE 802.11ac


cfgVHT = wlanVHTConfig; % VHT configuration
cfgVHT.ChannelBandwidth = 'CBW80'; % 80 MHz channel bandwidth
cfgVHT.NumTransmitAntennas = 2; % 2 transmit antennas
cfgVHT.NumSpaceTimeStreams = 2; % 2 space-time streams
cfgVHT.MCS = 8; % Modulation and Coding Scheme
cfgVHT.GuardInterval = 'Short'; % Short Guard Interval

% TCP-like Traffic Simulation Parameters


tcpSegmentSize = 1500; % bytes
totalData = 1e6; % bytes
maxDataRate = 866.7; % Maximum data rate in Mbps for MCS 8, 80 MHz, 2 antennas
snrValues = 15:5:35; % SNR values to simulate
throughputResults = zeros(1, length(snrValues)); % Initialize results

% Baseline SNR and throughput


baselineSNR = 20; % dB (Example: setting baseline at SNR = 20 dB)
baselineThroughput = 50; % Mbps (Example: setting baseline throughput at 50 Mbps at
SNR = 20 dB)

% Simulation over varying SNR values


for j = 1:length(snrValues)
snr = snrValues(j);
% Calculate the expected data rate based on SNR using a simplified model
% For IEEE 802.11ac, we could assume that the data rate scales linearly with
SNR
% until it hits the maximum data rate. This is a simplification.
if snr >= 30
dataRate = maxDataRate;
else
dataRate = maxDataRate * (snr - 15) / (30 - 15);
end

% Calculate the expected number of successfully transmitted segments


% Here we introduce a probabilistic model of success.
% The higher the SNR, the higher the probability of success, up to a maximum of
100%.
% This is a simplification and should be refined with a proper channel model.
probOfSuccess = min(1, (snr - 15) / (30 - 15));
expectedSuccesses = min(totalData / tcpSegmentSize, probOfSuccess *
(totalData / tcpSegmentSize));

% Calculate throughput based on expected successes


throughputResults(j) = min(expectedSuccesses * tcpSegmentSize * 8, totalData) /
(totalData / (dataRate * 1e6 / 8));
end

% Scale down the throughput for display


scaledThroughputResults = throughputResults / 1e6; % Convert to Mbps

% Calculate enhancements
enhancements = ((scaledThroughputResults - baselineThroughput) ./
baselineThroughput) * 100;
enhancements(enhancements > 100) = 100; % Limit enhancement to 100%
% Display Results
figure;
plot(snrValues, scaledThroughputResults, '-o');
title('TCP Throughput over IEEE 802.11ac');
xlabel('SNR (dB)');
ylabel('Throughput (Mbps)');
grid on;

% Display numerical data for enhancements


fprintf('SNR (dB) | Throughput (Mbps) | Enhancement (%%)\n');
for k = 1:length(snrValues)
fprintf('%.3f | %.3f | %.2f%%\n', snrValues(k), scaledThroughputResults(k),
enhancements(k));
end

You might also like