Borrar filtros
Borrar filtros

Unexpected Bit Error Rate results when simulating IEEE 802.11p in Rayleigh and Rician channel using WLAN toolbox and Communications Toolbox

5 visualizaciones (últimos 30 días)
I'm trying to simulate the Bit Error rate of Vehicle to Vehicle communications using the IEEE 802.11p standard at it's different MCS's in an AWGN, Rician and Rayleigh channel as well as according to the nodes mobility. When running a monte carlo simulation with just the AWGN channel, the results appear as expected. However, when adding in a Rician or a Rayleigh channel, the results seem incorrect as shown below:
What i expect the results to look like is show below:
The code i used is shown below. The first code block is the one that does the monte carlo simulation and the second code block is the one that creates the channels as well as the WLAN signal and transmits it through each channel. I've tried various different configuration for the channel setup, however the results remain consistently unexpected.
clear all;
clc
rng(0, "combRecursive");
%% Define SNR range (dB) and total errors
snrRange = 0:2:30;
%% Preallocate arrays to store BER values for each SNR
berVehicle = zeros(8,length(snrRange));
%% Set the parameters
speedVehicle1 = 0; % in km/h
vehicleSpeed1 = speedVehicle1 / 3.6; % Speed of Vehicle 1 in m/s
carrierFrequency = 5.9e9; % WLAN carrier frequency in Hz
dopplerShift1 = (vehicleSpeed1 * carrierFrequency) / physconst('LightSpeed');
dopplerShift2 = (vehicleSpeed2 * carrierFrequency) / physconst('LightSpeed');
%% Monte Carlo Simulation
n=8;
parfor i = 1:length(snrRange)
for mcs = 1:n
berVehicle3(mcs,i) = BER_vs_SNR_draft_2(snrRange(i), dopplerShift1, mcs-1);
fprintf("SNR: %d\n", snrRange(i));
end
end
%% Plot BER vs SNR
figure;
markers = ["-o", "-+", "-*", "-x","-square","-^","-diamond","-pentagram"];
for i = 1:8
semilogy(snrRange, berVehicle3(i,:), markers(i));
hold on;
end
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('Bit Error Rate vs. SNR at ', speedVehicle1);
grid on;
legend("BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16 QAM 1/2", "16 QAM 3/4", "64 QAM 2/3", "64 QAM 3/4");
hold off;
function [BER] = BER_vs_SNR_draft_2(snrRange, dopplerShift1, mcs)
%% Create channel objects for each vehicle
%ricianchan = comm.RicianChannel(NormalizePathGains=true);
ricianchan = comm.RicianChannel();
ricianchan.SampleRate = 9000;
% ricianchan.PathDelays = [0 1.5e-6];
% ricianchan.AveragePathGains = [0 -3];
ricianchan.KFactor = 6;
% ricianchan.MaximumDopplerShift = dopplerShift1;
% ricianchan.DirectPathDopplerShift = dopplerShift1;
rayleighchan = comm.RayleighChannel();
rayleighchan.SampleRate = 12e9;
%rayleighchan.PathDelays = (0:5:15)*1e-6;
% rayleighchan.AveragePathGains = [0 -3 -6 -9];
% rayleighchan.KFactor = 4;
rayleighchan.MaximumDopplerShift = dopplerShift1;
% AWGN channel
awgnchan = comm.AWGNChannel("NoiseMethod", "Signal to noise ratio (SNR)");
%% Generate and transmit waveform from Vehicle
Errors = 0;
Loops = 0;
cfgNonHT1 = wlanNonHTConfig('ChannelBandwidth','CBW10', 'MCS', mcs, 'PSDULength', 512); % 400 bytes from a research paper
snr = snrRange;
awgnchan.SNR = snr;
field = 'NonHT-Data';
noiseVarEst = 10^(-snr/10);
dataVehicle1 = randi([0 1], 8*cfgNonHT1.PSDULength, 1); % multiplying by 8 to convert to bits
while Loops <= 2000
% Form and transmit packet
txWaveform1 = wlanWaveformGenerator(dataVehicle1, cfgNonHT1);
% Received signal
rxWaveform1 = awgnchan(txWaveform1);
rxWaveform1 = ricianchan(rxWaveform1);
% Recover data
ind = wlanFieldIndices(cfgNonHT1,field);
rx1 = rxWaveform1(ind(1):ind(2),:);
sym1 = wlanNonHTOFDMDemodulate(rx1,field,cfgNonHT1);
info = wlanNonHTOFDMInfo(field,cfgNonHT1);
sym1 = sym1(info.DataIndices,:,:);
rxDataBits1 = wlanNonHTDataBitRecover(sym1, noiseVarEst, cfgNonHT1);
% Calculate BER for vehicle
Errors = Errors + sum(dataVehicle1 ~= rxDataBits1);
fprintf("SNR: %d, Errors: %d, Loop: %d, MCS: %d\n", snr, Errors, Loops, mcs);
Loops = Loops + 1;
end
fprintf("Final Errors: %d, ", Errors);
Total_bits_tx = Loops * 8*cfgNonHT1.PSDULength;
BER = Errors / Total_bits_tx;
  2 comentarios
Matthew Main
Matthew Main el 27 de Sept. de 2023
So I don’t actually have a vehicleSpeed2, it was just there for testing purposes. The dopplerShift2 line can be ignored.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Test and Measurement en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by