802.11ah PER performance
6 views (last 30 days)
Show older comments
I want to compute PER at different SNR when the tgahChannel.LargeScaleFadingEffect = 'Pathloss and shadowing' & tgahChannel.TransmitReceiveDistance = 50;
also PER at different DISTANCE when SNR is 30, can't get reasonable PER result. LOOKING FORWARD TO YOUR ADVICE!!! REALLY APPRECIATE!!!
% Create S1G configuration object for single user S1G short preamble
% transmission with 2 transmit antennas and 2 space-time streams
cfgS1G = wlanS1GConfig;
cfgS1G.ChannelBandwidth = 'CBW2'; % 2 MHz channel bandwidth
cfgS1G.Preamble = 'Short'; % Short preamble
cfgS1G.NumTransmitAntennas = 2; % 2 transmit antennas
cfgS1G.NumSpaceTimeStreams = 2; % 2 space-time streams
cfgS1G.APEPLength = 256; % APEP length in bytes
cfgS1G.MCS = 3;
% Create and configure the TGah channel
tgahChannel = wlanTGahChannel;
tgahChannel.DelayProfile = 'Model-F';
tgahChannel.NumTransmitAntennas = cfgS1G.NumTransmitAntennas;
tgahChannel.NumReceiveAntennas = 2;
tgahChannel.TransmitReceiveDistance = 50;
tgahChannel.ChannelBandwidth = cfgS1G.ChannelBandwidth;
tgahChannel.LargeScaleFadingEffect = 'Pathloss and shadowing';
snr = 20:5:40;
maxNumPackets = 5e2; % Maximum number of packets at an SNR point
% Indices for accessing each field within the time-domain packet
fieldInd = wlanFieldIndices(cfgS1G);
% OFDM information
ofdmInfo = wlanS1GOFDMInfo('S1G-Data',cfgS1G);
% Set the sampling rate of the channel
tgahChannel.SampleRate = wlanSampleRate(cfgS1G);
if ~strcmp(packetFormat(cfgS1G),'S1G-Short')
error('This example only supports the S1G-Short packet format');
end
packetErrorRate = zeros(numel(snr),1);
for i = 1:numel(snr) % Use 'for' to debug the simulation
% Set random substream index per iteration to ensure that each
% iteration uses a repeatable set of random numbers
stream = RandStream('combRecursive','Seed',0);
stream.Substream = i;
RandStream.setGlobalStream(stream);
% Create an instance of the AWGN channel per SNR point simulated
awgnChannel = comm.AWGNChannel;
awgnChannel.NoiseMethod = 'Signal to noise ratio (SNR)';
% Account for energy in nulls
awgnChannel.SNR = snr(i)-10*log10(ofdmInfo.FFTLength/ofdmInfo.NumTones);
% Loop to simulate multiple packets
numPacketErrors = 0;
numPkt = 1; % Index of packet transmitted
while numPkt<=maxNumPackets
% Generate a packet for 802.11ah short preamble
txPSDU = randi([0 1],cfgS1G.PSDULength*8,1);
txWaveform = wlanWaveformGenerator(txPSDU,cfgS1G);
% Add trailing zeros to allow for channel delay
tx = [txWaveform; zeros(50,cfgS1G.NumTransmitAntennas)];
preChSigPwr_dB = 10*log10(mean(abs(tx)));
sigPwr1 = 10^((preChSigPwr_dB(1)-tgahChannel.info.Pathloss)/10);
sigPwr2 = 10^((preChSigPwr_dB(2)-tgahChannel.info.Pathloss)/10);
sigPwr=[sigPwr1,sigPwr2];
awgnChannel.SignalPower = sigPwr;
% Pass through fading indoor TGah channel
reset(tgahChannel); % Reset channel for different realization
rx = tgahChannel(tx);
% Add noise
rx = awgnChannel(rx);
% Synchronize
% The received signal is synchronized to the start of the packet by
% compensating for a known delay and the default OFDM demodulation
% symbol sampling offset.
delay = 4;
rxSync = rx(delay+1:end,:);
% LTF demodulation and channel estimation
% Demodulate S1G-LTF1
rxLTF1 = rxSync(fieldInd.S1GLTF1(1):fieldInd.S1GLTF1(2),:);
demodLTF1 = wlanS1GDemodulate(rxLTF1,'S1G-LTF1',cfgS1G);
% If required, demodulate S1G-LTF2N, and perform channel estimation
if cfgS1G.NumSpaceTimeStreams>1
% Use S1G-LTF1 and S1G-LTF2N for channel estimation
rxLTF2N = rxSync(fieldInd.S1GLTF2N(1):fieldInd.S1GLTF2N(2),:);
demodLTF2N = wlanS1GDemodulate(rxLTF2N,'S1G-LTF2N',cfgS1G);
chanEst = s1gLTFChannelEstimate([demodLTF1 demodLTF2N],cfgS1G);
else
% Use only S1G-LTF1 for channel estimation
chanEst = s1gLTFChannelEstimate(demodLTF1,cfgS1G);
end
% Noise variance estimate from S1G-LTF1 demodulated symbols
noiseVarEst = helperNoiseEstimate(demodLTF1);
% Extract S1G-Data field
rxData = rxSync(fieldInd.S1GData(1):fieldInd.S1GData(2),:);
% OFDM demodulation
demodSym = wlanS1GDemodulate(rxData,'S1G-Data',cfgS1G);
% Extract data subcarriers from demodulated symbols and channel
% estimate
demodDataSym = demodSym(ofdmInfo.DataIndices,:,:);
chanEstData = chanEst(ofdmInfo.DataIndices,:,:);
% MMSE frequency domain equalization
[eqDataSym,csi] = helperSymbolEqualize(demodDataSym,chanEstData,noiseVarEst);
% Recover PSDU bits
rxPSDU = s1gDataBitRecover(eqDataSym,noiseVarEst,csi,cfgS1G);
% Determine if any bits are in error, i.e. a packet error
packetError = any(biterr(txPSDU,rxPSDU));
numPacketErrors = numPacketErrors+packetError;
numPkt = numPkt+1;
end
% Compute PER for this SNR point
packetErrorRate(i) = numPacketErrors/(numPkt-1);
disp(['SNR ' num2str(snr(i))...
' completed after ' num2str(numPkt-1) ' packets,'...
' PER: ' num2str(packetErrorRate(i))]);
disp( num2str(tgahChannel.TransmitReceiveDistance))
disp(num2str(tgahChannel.DelayProfile))
end
0 Comments
Answers (0)
See Also
Categories
Find more on Propagation Channel Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!