Using Dynamic Rate Control Simulation with DMG instead of VHT

2 visualizaciones (últimos 30 días)
Caetano Melone
Caetano Melone el 28 de Jun. de 2018
Comentada: Caetano Melone el 10 de Jul. de 2018
Hi there, I am doing some research with 802.11ad, and I stumbled upon "802.11 Dynamic Rate Control Simulation" in the MATLAB documentation. The example is geared towards 802.11ac
I set it up on my MATLAB installation, and it worked perfectly. The only thing is that when I try to replace all instanced of VHT (802.11ac) with DMG (802.11ac) I get this error:
Unrecognized property 'ChannelBandwidth' for class 'wlanDMGConfig'.
Error in dynamicRateControlSim (line 18)
cfgDMG.ChannelBandwidth = 'CBW40'; % 40 MHz channel bandwidth
I would appreciate any help, thank you,
Here is the code that I am using:
%%802.11 Dynamic Rate Control Simulation
% This example shows dynamic rate control by varying the
% Modulation and Coding scheme (MCS) of successive packets transmitted
% over a frequency selective multipath fading channel.
% https://www.mathworks.com/help/wlan/examples/802-11-dynamic-rate-control-simulation.html
clear all;
tic;
% #ok<UNRCH supresses warnings about unreachable code
% Do not remove
%%Waveform Configuration
cfgVHT = wlanVHTConfig;
cfgVHT.ChannelBandwidth = 'CBW160'; % 40 MHz channel bandwidth
cfg.MCS = 1; % QPSK rate-1/2
cfgVHT.APEPLength = 4096; % APEP length in bytes
% Set random stream for repeatability of results
s = rng(21);
%%Channel Configuration
tgacChannel = wlanTGacChannel;
tgacChannel.DelayProfile = 'Model-D';
tgacChannel.ChannelBandwidth = cfgVHT.ChannelBandwidth;
tgacChannel.NumTransmitAntennas = 1;
tgacChannel.NumReceiveAntennas = 1;
tgacChannel.TransmitReceiveDistance = 20; % Distance in meters for NLOS
tgacChannel.RandomStream = 'mt19937ar with seed';
tgacChannel.Seed = 10;
% Set the sampling rate for the channel
sr = wlanSampleRate(cfgVHT);
tgacChannel.SampleRate = sr;
%%Rate Control Algorithm Parameters
rcaAttack = 1; % Control the sensitivity when MCS is increasing
rcaRelease = 0; % Control the sensitivity when MCS is decreasing
threshold = [11 14 19 20 25 28 30 31 35];
snrUp = [threshold inf] + rcaAttack;
snrDown = [-inf threshold] - rcaRelease;
snrInd = cfgVHT.MCS; % Store the start MCS value
%%Simulation Parameters
numPackets = 100; % Number of packets transmitted during the simulation
walkSNR = true;
% Select SNR for the simulation
if walkSNR
meanSNR = 22; % Mean SNR
amplitude = 14; % Variation in SNR around the average mean SNR value
% Generate varying SNR values for each transmitted packet
baseSNR = sin(linspace(1,10,numPackets)) * amplitude + meanSNR;
snrWalk = baseSNR(1); % Set the initial SNR value
% The maxJump controls the maximum SNR difference between one
% packet and the next
maxJump = 0.5;
else
% Fixed mean SNR value for each transmitted packet. All the variability
% in SNR comes from a time varying radio channel
snrWalk = 22; %#ok<UNRCH>
end
% To plot the equalized constellation for each spatial stream set
% displayConstellation to true
displayConstellation = false;
if displayConstellation
ConstellationDiagram = comm.ConstellationDiagram; %#ok<UNRCH>
ConstellationDiagram.ShowGrid = true;
ConstellationDiagram.Name = 'Equalized data symbols';
end
% Define simulation variables
snrMeasured = zeros(1,numPackets);
MCS = zeros(1,numPackets);
ber = zeros(1,numPackets);
packetLength = zeros(1,numPackets);
%%Processing Chain
for numPkt = 1:numPackets
if walkSNR
% Generate SNR value per packet using random walk algorithm biased
% towards the mean SNR
snrWalk = 0.9 * snrWalk + 0.1 * baseSNR(numPkt) + rand(1) * maxJump * 2 - maxJump;
end
% Generate a single packet waveform
txPSDU = randi([0,1],8 * cfgVHT.PSDULength,1,'int8');
txWave = wlanWaveformGenerator(txPSDU,cfgVHT,'IdleTime',5e-4);
% Receive processing, including SNR estimation
y = processPacket(txWave,snrWalk,tgacChannel,cfgVHT);
% Plot equalized symbols of data carrying subcarriers
if displayConstellation && ~isempty(y.EstimatedSNR)
release(ConstellationDiagram);
ConstellationDiagram.ReferenceConstellation = helperReferenceSymbols(cfgVHT);
ConstellationDiagram.Title = ['Packet ' int2str(numPkt)];
ConstellationDiagram(y.EqDataSym(:));
drawnow
end
% Store estimated SNR value for each packet
if isempty(y.EstimatedSNR)
snrMeasured(1,numPkt) = NaN;
else
snrMeasured(1,numPkt) = y.EstimatedSNR;
end
% Determine the length of the packet in seconds including idle time
packetLength(numPkt) = y.RxWaveformLength/sr;
% Calculate packet error rate (PER)
if isempty(y.RxPSDU)
% Set the PER of an undetected packet to NaN
ber(numPkt) = NaN;
else
[~,ber(numPkt)] = biterr(y.RxPSDU,txPSDU);
end
% Compare the estimated SNR to the threshold, and adjust the MCS value
% used for the next packet
MCS(numPkt) = cfgVHT.MCS; % Store current MCS value
increaseMCS = (mean(y.EstimatedSNR) > snrUp((snrInd==0)+snrInd));
decreaseMCS = (mean(y.EstimatedSNR) <= snrDown((snrInd==0)+snrInd));
snrInd = snrInd+increaseMCS-decreaseMCS;
cfgVHT.MCS = snrInd-1;
end
%%Display and Plot Simulation Results
disp(['Overall data rate: ' num2str(8*cfgVHT.APEPLength*(numPackets-numel(find(ber)))/sum(packetLength)/1e6) ' Mbps']);
disp(['Overall packet error rate: ' num2str(numel(find(ber))/numPackets)]);
plotResults(ber,packetLength,snrMeasured,MCS,cfgVHT);
% Restore default stream
rng(s);
toc;
  2 comentarios
Jan
Jan el 10 de Jul. de 2018
According to the documentation (link) and the error message, a wlanDMGConfig object does not have a ChannelBandwidth property. So please post the code, which shows, what you are exactly doing.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 802.11n/ac (Wi-Fi 4 and Wi-Fi 5) en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by