%% Simulation Configuration
NFrames = 1; % Number of frames to simulate at each SNR
SNRIn = [-4.1, -2.0, 0.1]; % SNR points to simulate
%% UE Configuration
ue.TotSubframes = 1; % Total number of subframes to generate a waveform for
ue.NCellID = 10; % Cell identity
ue.RC = 'A3-2'; % FRC number
%% Propagation Channel Model Configuration
chcfg.NRxAnts = 2; % Number of receive antenna
chcfg.DelayProfile = 'EPA'; % Delay profile
chcfg.DopplerFreq = 5.0; % Doppler frequency
chcfg.MIMOCorrelation = 'Low'; % MIMO correlation
chcfg.Seed = 100; % Channel seed
chcfg.NTerms = 16; % Oscillators used in fading model
chcfg.ModelType = 'GMEDS'; % Rayleigh fading model type
chcfg.InitPhase = 'Random'; % Random initial phases
chcfg.NormalizePathGains = 'On'; % Normalize delay profile power
chcfg.NormalizeTxAnts = 'On'; % Normalize for transmit antennas
%% Channel Estimator Configuration
cec.PilotAverage = 'UserDefined'; % Type of pilot averaging
cec.FreqWindow = 13; % Frequency averaging windows in REs
cec.TimeWindow = 1; % Time averaging windows in REs
cec.InterpType = 'cubic'; % Interpolation type
cec.Reference = 'Antennas'; % Reference for channel estimation
%% Uplink RMC Configuration
% Generate FRC configuration structure for A3-2
frc = lteRMCUL(ue);
rvSeq = frc.PUSCH.RVSeq;
% Transport block sizes for each subframe within a frame
trBlkSizes = frc.PUSCH.TrBlkSizes;
codedTrBlkSizes = frc.PUSCH.CodedTrBlkSizes;
%% Setup HARQ Processes
% Generate HARQ process table
noHarqProcesses = 8;
harqTable = mod(0:noHarqProcesses-1, noHarqProcesses)+1;
%% Set Propagation Channel Model Sampling Rate
info = lteSCFDMAInfo(frc);
chcfg.SamplingRate = info.SamplingRate;
%% Processing Loop
% Initialize variables used in the simulation and analysis
totalBLKCRC = zeros(numel(SNRIn), NFrames*10); % Total block CRC vector
bitThroughput = zeros(numel(SNRIn), NFrames*10); % Total throughput vector
resultIndex = 1; % Initialize frame counter index
for SNRdB = SNRIn
fprintf('\nSimulating at %g dB SNR for a total %d Frame(s)', ...
SNRdB, NFrames);
% Calculate required AWGN channel noise
SNR = 10^(SNRdB/20);
N = 1/(SNR*sqrt(double(info.Nfft)))/sqrt(2.0);
rng('default');
% Store results for every subframe at SNR point
bitTp = zeros(1, NFrames*10); % Intermediate bit throughput vector
blkCRC = zeros(1, NFrames*10); % Intermediate block CRC vector
% Initialize state of all HARQ processes
for i = 1:8
harqProc(i) = hPUSCHNewHARQProcess( ...
trBlkSizes(i), codedTrBlkSizes(i), rvSeq); %#ok
end
offsetused = 0;
for subframeNo = 0:(NFrames*10-1)
% Update subframe number
frc.NSubframe = subframeNo;
% Get HARQ index for given subframe from HARQ index table
harqIdx = harqTable(mod(subframeNo, length(harqTable))+1);
% Update current HARQ process
harqProc(harqIdx) = hPUSCHHARQScheduling(harqProc(harqIdx));
frc.PUSCH.RV = harqProc(harqIdx).rvSeq(harqProc(harqIdx).rvIdx);
frc.PUSCH.RVSeq = harqProc(harqIdx).rvSeq(harqProc(harqIdx).rvIdx);
% Create an SC-FDMA modulated waveform
[txWaveform, txSubframe] = lteRMCULTool( ...
frc, harqProc(harqIdx).ulschTransportBlk);
% Transmit an additional 25 samples at the end of the waveform to
% cover the range of delays expected from the channel modeling
txWaveform = [txWaveform; zeros(25, 1)]; %#ok
% The initialization time for channel modeling is set each subframe
% to simulate a continuously varying channel
chcfg.InitTime = subframeNo/1000;
% Pass data through channel model
rxWaveform = lteFadingChannel(chcfg, txWaveform);
% Add noise at the receiver
v = N*complex(randn(size(rxWaveform)), randn(size(rxWaveform)));
rxWaveform = rxWaveform+v;
% Calculate synchronization offset
offset = lteULFrameOffset(frc, frc.PUSCH, rxWaveform);
if (offset < 25)
offsetused = offset;
end
% SC-FDMA demodulation
rxSubframe = lteSCFDMADemodulate(frc, ...
rxWaveform(1+offsetused:end, :));
% Channel and noise power spectral density estimation
[estChannelGrid, noiseEst] = lteULChannelEstimate(frc, ...
frc.PUSCH, cec, rxSubframe);
% Extract REs corresponding to the PUSCH from the given subframe
% across all receive antennas and channel estimates
puschIndices = ltePUSCHIndices(frc, frc.PUSCH);
[puschRx, puschEstCh] = lteExtractResources( ...
puschIndices, rxSubframe, estChannelGrid);
% MMSE equalization
rxSymbols = lteEqualizeMMSE(puschRx, puschEstCh, noiseEst);
% Update frc.PUSCH to carry complete information of the UL-SCH
% coding configuration
frc.PUSCH = lteULSCHInfo(frc, ...
frc.PUSCH, harqProc(harqIdx).trBlkSize, 'chsconcat');
% Decode the PUSCH
rxEncodedBits = ltePUSCHDecode(frc, frc.PUSCH, rxSymbols);
% Decode the UL-SCH channel and store the block CRC error for given
% HARQ process harqIdx
trBlkSize = trBlkSizes(mod(subframeNo, 10)+1);
[rxDecodedBits, harqProc(harqIdx).crc, ...
harqProc(harqIdx).decState] = lteULSCHDecode(...
frc, frc.PUSCH, trBlkSize, ...
rxEncodedBits, harqProc(harqIdx).decState);
% Store the CRC calculation and total number of bits per subframe
% successfully decoded
blkCRC(subframeNo+1) = harqProc(harqIdx).crc;
bitTp(subframeNo+1) = ...
harqProc(harqIdx).trBlkSize.*(1-harqProc(harqIdx).crc);
end
% Record the block CRC error and bit throughput for the total number of
% frames simulated at a particular SNR
totalBLKCRC(resultIndex, :) = blkCRC;
bitThroughput(resultIndex, :) = bitTp;
resultIndex = resultIndex + 1;
end
%% Display Throughput Results
% Throughput calculation as a percentage
throughput = 100*(1-mean(totalBLKCRC, 2)).';
hPUSCHResults(SNRIn, NFrames, trBlkSizes, throughput, bitThroughput)
lte.rar_LTE_LTE PHY_LTE downlink_downlink lte_sim active
版权申诉
47 浏览量
2022-09-20
23:19:40
上传
评论
收藏 1.28MB RAR 举报
我虽横行却不霸道
- 粉丝: 75
- 资源: 1万+
最新资源
- hdmi in视频采集,输出到hdmi out, 支持HDMI指令控制,支持TFTP远程下载图片
- 批量word文件内容替换工具1.0 (批量实现多个 Word 文档文件文字替换利器).exe
- Cartoon GUI Pack 1.2.zip
- 【数据集和代码】基于加速度传感器的步态识别行人分类实验(可做步态识别)
- 我分享个魔兽内存修改器
- Python毕业设计基于Django的网易云数据分析可视化大屏系统的设计与实现+使用说明+全部资料(优秀项目).zip
- mp3 idv2,idv1,frame分析工具
- 鹈鹕优化算法POA MATLAB源码, 应用案例为函数极值求解以及优化svm进行分类,代码注释详细,可结合自身需求进行应用
- Python毕业设计基于Django的网易云数据分析可视化大屏系统的设计与实现+使用说明+全部资料(高分项目).zip
- 蛇优化算法SO MATLAB源码, 应用案例为函数极值求解以及优化svm进行分类,代码注释详细,可结合自身需求进行应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈