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

📄 fpdltxharness.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%***************************************************************************
%  802.16-2004 OFDMA PHY - mFPDLTxHarness Downlink function
%
%    Description: Main function for the downlink Frequency Domain
%    processing in OFDMA (8.4) of IEEE802.16e standard
%
%       [NFFToutToTP] = FPDLTxHarness_PUSC(ZoneConfig, AsyncPhyControl,...
%                                        DlCarrierMap, PRBS, ...
%                                        PayLoadFromUP, SymbolIndex,testcase)
%
%    Input:
%           ZoneConfig: Data Structure that contains zone configuration
%                       params, including number of carriers, number of
%                       used carriers, maximum number of subchanels, etc.
%                       For details please see WiMAX Integration Framework
%                       Specification document
%           AsyncPhyControl:Asynchronous PHY control data structure
%                       contains info such as DlPremableBase IdCell, etc.
%           PayLoadFromUP: Information elemnts recieved from the User
%                       Processing, organized as a slots vector, with Nx48
%                       datums. N depends on the FFT size. This info
%                       vector is mapped into 2 OFDMA symbols.
%           SymbolIndex: Symbol index within frame of the first OFDMA symbol to
%                       be output.
%
%    Output:
%           NFFToutToTP: Output 2 OFDMA symbols for data or a single
%                       Premable symbol. In each case the output is a full FFT sized.
%
%    Functions:
%                N/A
%
%    Data Files:
%                N/A
%
%***************************************************************************

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: FPDLTxHarness.m.rca $
%  $Revision: 1.1 $
%  $Date: Mon Jan 15 06:59:24 2007 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [NFFToutToTP] = FPDLTxHarness_PUSC(ZoneConfig, AsyncPhyControl,...
    DlCarrierMap, PRBS, ...
    PayLoadFromUP, SymbolIndexO,testcase)

%path is relative to the FP/*/SPManager/matlab folder
addpath('../../../DL/SPKernel/SbcRandomizer/matlab/');
addpath('../../../DL/SPKernel/SbcPermutation/matlab/');

%Initial values before STC
NumOfAnts=1;
[SubCarrier Symbol]=size(PayLoadFromUP);
SymbolIndex=SymbolIndexO;

%STC encoding
if ZoneConfig.STC==1
    addpath('../../../DL/SPKernel/StcEncoder/matlab/');
    [ant_syms] = mStcEncoder(PayLoadFromUP,ZoneConfig,2,'A_Matrix');
    [NumOfAnts SubCarrier Symbol]=size(ant_syms);
    rmpath('../../../DL/SPKernel/StcEncoder/matlab/');
end

NFFToutToTP=[];

for ant=1:NumOfAnts

    for sym=1:Symbol

        if ZoneConfig.STC==1 
            PayLoadFromUP=reshape(ant_syms(ant,:,sym),SubCarrier,1);
            SymbolIndex=SymbolIndexO+sym-1;
        end
        %Subcarrier permutation and pilot insertion
        ScrambledPayLoadPilots = mSbcPermutation(PayLoadFromUP,ZoneConfig,DlCarrierMap,AsyncPhyControl,SymbolIndex,ant);

        %add DC ... modulate data, pilots and DC
        ModPayLoadToTP          = mSbcRandomizer(ScrambledPayLoadPilots, PRBS, SymbolIndex);

        %test vector generation
        if testcase
            FN=0;%Frame number, Zone number and Segment number are concidered as 0 for time being
            ZN=0;%Frame number, Zone number and Segment number are concidered as 0 for time being
            SGN=0;%Frame number, Zone number and Segment number are concidered as 0 for time being
            TCstr=sprintf('TC%03d',testcase);


            %IF2bTX
            if ~exist(['../../SPKernel/StcEncoder/vector/ref/',TCstr],'dir')
                mkdir(['../../SPKernel/StcEncoder/vector/ref/',TCstr]);
            end
            if ~exist(['../../SPKernel/SbcPermutation/vector/in/',TCstr],'dir')
                mkdir(['../../SPKernel/SbcPermutation/vector/in/',TCstr]);
            end
            if ZoneConfig.STC==1
%             temp=reshape(ant_syms(ant,:,:),[],1);
            temp=reshape(PayLoadFromUP(:,:),[],1);
            mGenBin(double(temp),...
                sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex/ZoneConfig.ZoneType,ant-1),...
                'int16','1R1I');
            
            mGenBin(double(temp),...
                sprintf('../../SPKernel/SbcPermutation/vector/in/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex/ZoneConfig.ZoneType,ant-1),...
                'int16','1R1I');
            end
            %End Temporary (untill stc is ready)

            %IF2cTX
            %test vector is saved by slot vector basis. (one OFDMA symbol follwoing by the other)
            [m,n]=size(ScrambledPayLoadPilots);
            temp=reshape(ScrambledPayLoadPilots,m*n,1);
            if ~exist(['../vector/ref/',TCstr],'dir')
                mkdir(['../vector/ref/',TCstr]);
            end
            mGenBin(temp,...
                sprintf('../vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex/ZoneConfig.ZoneType,ant-1),...
                'int16','1R1I');
            if ~exist(['../../SPKernel/SbcRandomizer/vector/in/',TCstr],'dir')
                mkdir(['../../SPKernel/SbcRandomizer/vector/in/',TCstr]);
            end
            mGenBin(temp,...
                sprintf('../../SPKernel/SbcRandomizer/vector/in/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex/ZoneConfig.ZoneType),ant-1),...
                'int16','1R1I');
            if ~exist(['../../SPKernel/SbcPermutation/vector/ref/',TCstr],'dir')
                mkdir(['../../SPKernel/SbcPermutation/vector/ref/',TCstr]);
            end
            mGenBin(temp,...
                sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex/ZoneConfig.ZoneType),ant-1),...
                'int16','1R1I');

            %IF3TX
            %test vector is saved by slot vector basis. (one OFDMA symbol follwoing by the other)
            [m,n]=size(ModPayLoadToTP);
            temp=reshape(ModPayLoadToTP,m*n,1);
            if ~exist(['../../SPKernel/SbcRandomizer/vector/ref/',TCstr],'dir')
                mkdir(['../../SPKernel/SbcRandomizer/vector/ref/',TCstr]);
            end
            mGenBin(temp,...
                sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex/ZoneConfig.ZoneType),ant-1),...
                'int16','1R1I');
            
            %TC073 and TC071 contains two FUSC symbols (Slotvectors) in one file)
            if testcase==71 || testcase==73
%             if testcase==993 || testcase==996
                if sym==2
                   %IF2bTX
                    filename=sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex-1),ant-1);
                    Out0=reshape(mGetBin(filename,'int16','1R1I','b'),[],1);
                    filename=sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);
                    Out1=reshape(mGetBin(filename,'int16','1R1I','b'),[],1);
                    %delete unnecessary stuff
                    filename=sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);%IF2b ref
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/in/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);%IF2b in
                    delete(filename);
                    filename=sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex-1,ant-1);%IF2b ref
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/in/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex-1,ant-1);%IF2b in
                    delete(filename);
                    
                    temp=[Out0;Out1];
                    mGenBin(double(temp),...
                        sprintf('../../SPKernel/StcEncoder/vector/ref/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndexO)/2,ant-1),...
                        'int16','1R1I');
                    mGenBin(double(temp),...
                        sprintf('../../SPKernel/SbcPermutation/vector/in/%s/IF2bTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndexO)/2,ant-1),...
                        'int16','1R1I');
                    %IF2c
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex-1),ant-1);
                    Out0=reshape(mGetBin(filename,'int16','1R1I','b'),[],1);
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);
                    Out1=reshape(mGetBin(filename,'int16','1R1I','b'),[],1); 
                    %delete unnecessary stuff
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);%IF2c ref
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/in/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);%IF2c in
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex-1,ant-1);%IF2c ref
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/in/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex-1,ant-1);%IF2c in
                    delete(filename);
                    
                    temp=[Out0;Out1];
                    mGenBin(double(temp),...
                        sprintf('../../SPKernel/SbcPermutation/vector/ref/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndexO)/2,ant-1),...
                        'int16','1R1I');
                    mGenBin(double(temp),...
                        sprintf('../../SPKernel/SbcRandomizer/vector/in/%s/IF2cTX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndexO)/2,ant-1),...
                        'int16','1R1I');
                    %IF3
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndex-1),ant-1);
                    Out0=reshape(mGetBin(filename,'int16','1R1I','b'),[],1);
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);
                    Out1=reshape(mGetBin(filename,'int16','1R1I','b'),[],1);
                    %delete unnecessary stuff
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex,ant-1);%IF3 ref
                    delete(filename);
                    filename=sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,SymbolIndex-1,ant-1);%IF3 ref
                    delete(filename);
                    
                    temp=[Out0;Out1];
                    mGenBin(double(temp),...
                        sprintf('../../SPKernel/SbcRandomizer/vector/ref/%s/IF3TX_%02d_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,SGN,(SymbolIndexO)/2,ant-1),...
                        'int16','1R1I');
                end
            end
            
        end
    end
    NFFToutToTP = [NFFToutToTP;ModPayLoadToTP];
end
% NFFToutToTP = ModPayLoadToTP;

⌨️ 快捷键说明

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