⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dltx_time_domain.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
% #####################################################################
% ####   Matlab  function for simulating left and rigth GI          ###
% ####   insertion, IFFT computation, CP insertion are performed    ###
% ####   Usese fixed point MEX implementation for IFFT/FFt.         ###
% ####   The nput signal is the frequency-domain OFDM signal.       ###
% ####   Test vectors (16-bit precisions) are generated at          ###
% ####   each kernel.                                               ###
% #####################################################################

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: DLTx_Time_Domain.m.rca $
%  $Revision: 1.7 $
%  $Date: Fri Jan  5 16:20:29 2007 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-- Matlab files used by this file
% cp_insertion
% mGIInsertion
% mPreambleGen
% fpifft
%-- End of list

function [ifft512out_cp] = DLTx_Time_Domain(SubframeD,ZoneConfig,TPparam,d_v_freq_inp,TC)

addpath('../../../DL/SPKernel/InsertCP/matlab');
addpath('../../../DL/SPKernel/GuardInsertAndWrap/matlab');
addpath('../../../DL/SPKernel/PreambleGen/matlab');
addpath('../../../../CM/SPKernel/FFT/matlab');


% initialization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Read system parameters of desired test case
n_cp = TPparam.SizeCP;    %Cyclic Prefix length(number of elements)

% processing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%add DC carrier and guard bands, DC first -> guard insertion is put into TP
d_v_freq_inp_withGuard = mGIInsertion(d_v_freq_inp,ZoneConfig.NFFT,ZoneConfig.LGuard,ZoneConfig.RGuard);

% %preamble generation (int16) -> Taken into TP
d_v_freq_inp_withGuard = [int16(mPreambleGen(SubframeD)), d_v_freq_inp_withGuard];

% IFFT computation and calculation of OFDM symbol time samples
% uses fixed point MEX version
ifft512out = fpifft(double(d_v_freq_inp_withGuard),hex2dec('00008000'),1); %use of the fixed point function

% Insert cyclic prefix and transpose
ifft512out_cp_temp = cp_insertion(ifft512out,n_cp);

%concatenate all OFDM symbols in one column vector
[blksize,symbols] = size(ifft512out_cp_temp);
ifft512out_cp = reshape(ifft512out_cp_temp,blksize*symbols,1);

%test vector generation
%path to utilities
addpath('../../../../CM/matlab')
if TC
   %generate test vector directory
   TCstr=sprintf('TC%03d',TC);
   %SBX/SP/TP/DL/SPManager/vector/ref
   if ~exist(['../vector/ref/',TCstr],'dir')
      mkdir(['../vector/ref/',TCstr]);
   end
   %SBX/SP/TP/DL/SPKernel/IFFT(ref and in)
   if ~exist(['../../SPKernel/IFFT/vector/in/',TCstr],'dir')
      mkdir(['../../SPKernel/IFFT/vector/in/',TCstr]);
   end
   if ~exist(['../../SPKernel/IFFT/vector/ref/',TCstr],'dir')
      mkdir(['../../SPKernel/IFFT/vector/ref/',TCstr]);
   end
   %SBX/SP/TP/DL/SPKernel/InsertCP(ref and in)
   if ~exist(['../../SPKernel/InsertCP/vector/in/',TCstr],'dir')
      mkdir(['../../SPKernel/InsertCP/vector/in/',TCstr]);
   end
   if ~exist(['../../SPKernel/InsertCP/vector/ref/',TCstr],'dir')
      mkdir(['../../SPKernel/InsertCP/vector/ref/',TCstr]);
   end
   %SBX/SP/TP/DL/SPKernel/GIInsertion(ref and in)
   if ~exist(['../../SPKernel/GIInsertion/vector/in/',TCstr],'dir')
      mkdir(['../../SPKernel/GIInsertion/vector/in/',TCstr]);
   end
   if ~exist(['../../SPKernel/GIInsertion/vector/ref/',TCstr],'dir')
      mkdir(['../../SPKernel/GIInsertion/vector/ref/',TCstr]);
   end
   
   
  FN=0;%frame number and this should be changed with the support of multiple fram
  ZN=0;%zone number and this should be changed with the support of multiple zone
  AN=0;%antenna number and this should be changed with the support of multiple antenna
 
  n=size(ifft512out,2);
  %all demodulated OFDMA symbols after Guard insertion (IF3aTX)
  for sym=1:n
      %SBX/SP/TP/DL/SPManager/vector/ref
      mGenBin(double(d_v_freq_inp_withGuard(:,sym)),...
              sprintf('../vector/ref/%s/IF3aTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
      %SBX/SP/TP/DL/SPKernel/IFFT/in
      mGenBin(double(d_v_freq_inp_withGuard(:,sym)),...
              sprintf('../../SPKernel/IFFT/vector/in/%s/IF3aTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
     %SBX/SP/TP/DL/SPKernel/GIInsertion/ref
     mGenBin(double(d_v_freq_inp_withGuard(:,sym)),...
              sprintf('../../SPKernel/GIInsertion/vector/ref/%s/IF3aTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
  end
  %all OFDMA symbols after IFFT (IF3bTX)
  for sym=1:n
      %SBX/SP/TP/DL/SPManager/vector/ref
      mGenBin(double(ifft512out(:,sym)),...
              sprintf('../vector/ref/%s/IF3bTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
     %SBX/SP/TP/DL/SPKernel/InsertCP/in 
     mGenBin(double(ifft512out(:,sym)),...
              sprintf('../../SPKernel/InsertCP/vector/in/%s/IF3bTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
     %SBX/SP/TP/DL/SPKernel/IFFT/ref
     mGenBin(double(ifft512out(:,sym)),...
              sprintf('../../SPKernel/IFFT/vector/ref/%s/IF3bTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
  end 
  
  %IF4TX
  %all OFDMA symbols
  n=size(ifft512out_cp_temp,2); 
  for sym=1:n, 
      %at SBX/SP/TP/DL/SPManager/vector/ref
      mGenBin(double(ifft512out_cp_temp(:,sym)),... 
              sprintf('../vector/ref/%s/IF4TX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
     %at SBX\Manager\DL\CM\vector\ref
     mGenBin(double(ifft512out_cp_temp(:,sym)),... 
              sprintf('../../../../../Manager/DL/CM/vector/ref/%s/IF4TX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,sym-1,AN),...
              'int16','1R1I');
  end 
end

rmpath('../../../DL/SPKernel/GuardInsertAndWrap/matlab');
rmpath('../../../DL/SPKernel/InsertCP/matlab');
rmpath('../../../DL/SPKernel/PreambleGen/matlab');
rmpath('../../../../CM/SPKernel/FFT/matlab');
rmpath('../../../../CM/matlab')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -