📄 mpilotinsert.m
字号:
%***************************************************************************
% 802.16-2004 OFDMA PHY - mPilotInsert downlink function
%
% ScrambledPayLoadPilots = mPilotInsert(ZoneConfig,
% AsyncPhyControl,ScrambledPayLoad)
%
% Description: This functions inserts the pilots into clusetrs, within
% the two OFDMA symbols at input. It outputs the two OFDMA
% symbols with the pilots inside. Supports both PUSC and
% FUSC. But only FFT size =512 and 1024 in FUSC
%
% 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.
% ScrambledPayLoad: The output is two OFDMA symbols conaining
% only data carriers which are organized in physical
% carrier order.
% Output:
% ScrambledPayLoadPilots: The output is structured similary to
% the ScrambledPayLoad input, with addition of the
% pilots in the appropriate locations within the
% clusters
%
% Functions:
% N/A
%
% Data Files:
% N/A
%
%***************************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mPilotInsert.m.rca $
% $Revision: 1.6 $
% $Date: Fri Jan 12 09:27:46 2007 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ScrambledPayLoadPilots = mPilotInsert(ZoneConfig, AsyncPhyControl,ScrambledPayLoad,SymbolIndex,ant)
% Input assumed as: matrix of two column vectors, one per OFDMA symbol
% Output is matrix of two vectors, each with OFDMA symbol related pilots
% and data values.
%PUSC
if (ZoneConfig.ZoneType==2)
N = ZoneConfig.NCluster;
pilot = AsyncPhyControl.PilotAmpl; %pilot is real value
if ZoneConfig.STC==0%STC off
%insert pilots for even symbol
temp = reshape(ScrambledPayLoad(:,1),12,N);
temp = [temp(1:4,:); pilot*ones(1,N); temp(5:7,:); pilot*ones(1,N); temp(8:12,:)];
ScrambledPayLoadPilots = reshape(temp,N*14,1);
%insert pilots for odd symbol
temp = reshape(ScrambledPayLoad(:,2),12,N);
temp = [pilot*ones(1,N); temp(1:11,:); pilot*ones(1,N); temp(12,:)];
ScrambledPayLoadPilots = [ScrambledPayLoadPilots, reshape(temp,N*14,1)];
elseif ZoneConfig.STC==1%with STC
if mod(SymbolIndex,4)==0
if ant==1
%insert pilots for even symbol
temp = reshape(ScrambledPayLoad(:,1),12,N);
temp = [temp(1:4,:); zeros(1,N); temp(5:7,:); pilot*ones(1,N); temp(8:12,:)];
ScrambledPayLoadPilots = reshape(temp,N*14,1);
%insert pilots for odd symbol
temp = reshape(ScrambledPayLoad(:,2),12,N);
temp = [temp(1:4,:); pilot*ones(1,N); temp(5:7,:); zeros(1,N); temp(8:12,:)];
ScrambledPayLoadPilots = [ScrambledPayLoadPilots, reshape(temp,N*14,1)];
elseif ant==2
%insert pilots for even symbol
temp = reshape(ScrambledPayLoad(:,1),12,N);
temp = [temp(1:4,:); pilot*ones(1,N); temp(5:7,:); zeros(1,N); temp(8:12,:)];
ScrambledPayLoadPilots = reshape(temp,N*14,1);
%insert pilots for odd symbol
temp = reshape(ScrambledPayLoad(:,2),12,N);
temp = [temp(1:4,:); zeros(1,N); temp(5:7,:); pilot*ones(1,N); temp(8:12,:)];
ScrambledPayLoadPilots = [ScrambledPayLoadPilots, reshape(temp,N*14,1)];
else
disp('Pilot insertion supports only upto 2 antennas');
end
elseif mod(SymbolIndex,4)==2
if ant==1
%insert pilots for even symbol
temp = reshape(ScrambledPayLoad(:,1),12,N);
temp = [zeros(1,N); temp(1:11,:); pilot*ones(1,N); temp(12,:)];
ScrambledPayLoadPilots = reshape(temp,N*14,1);
%insert pilots for odd symbol
temp = reshape(ScrambledPayLoad(:,2),12,N);
temp = [pilot*ones(1,N); temp(1:11,:); zeros(1,N); temp(12,:)];
ScrambledPayLoadPilots = [ScrambledPayLoadPilots, reshape(temp,N*14,1)];
elseif ant==2
%insert pilots for even symbol
temp = reshape(ScrambledPayLoad(:,1),12,N);
temp = [pilot*ones(1,N); temp(1:11,:); zeros(1,N); temp(12,:)];
ScrambledPayLoadPilots = reshape(temp,N*14,1);
%insert pilots for odd symbol
temp = reshape(ScrambledPayLoad(:,2),12,N);
temp = [zeros(1,N); temp(1:11,:); pilot*ones(1,N); temp(12,:)];
ScrambledPayLoadPilots = [ScrambledPayLoadPilots, reshape(temp,N*14,1)];
else
disp('Pilot insertion supports only upto 2 antennas');
end
else
disp('unsupported symbol index in pilot insert');
end
else
disp('Unsuported STC type');
end
%FUSC
elseif (ZoneConfig.ZoneType==1)
switch ZoneConfig.NFFT
case 512
VarialbleSet0=((0:24:408)+1).';
VarialbleSet1=((12:24:420)+1).';
ConstantSet0=((72*(2*(0:2))+9)+1).';
ConstantSet1=((72*(2*(0:2)+1)+9)+1).';
case 1024
VarialbleSet0=((0:24:840)+1).';
VarialbleSet1=((12:24:828)+1).';
ConstantSet0=((72*(2*(0:5))+9)+1).';
ConstantSet1=((72*(2*(0:4)+1)+9)+1).';
otherwise
disp(sprintf('FFT size %d is not supported by pilot insertion',ZoneConfig.NFFT));
end
pilot = AsyncPhyControl.PilotAmpl; %pilot is real value
if ZoneConfig.STC==0%STC off
PilotLocation=[];
Vset0=VarialbleSet0+(mod((SymbolIndex),2))*6;
Vset1=VarialbleSet1+(mod((SymbolIndex),2))*6;
%ceil(ZoneConfig.NFFTUsed/2) is dumy DC carrier
PilotLocation = [PilotLocation [ConstantSet0 ;ConstantSet1; Vset0; Vset1; ceil(ZoneConfig.NFFTUsed/2)]];
PilotLocation=sort(PilotLocation);
ScrambledPayLoadPilots_temp=int16(zeros(ZoneConfig.NFFTUsed,size(ScrambledPayLoad,2)));%with DC
ScrambledPayLoadPilots_temp(1:size(ScrambledPayLoad,1),:)=ScrambledPayLoad;
for pil=1:size(PilotLocation,1)
ScrambledPayLoadPilots_temp(PilotLocation(pil,1)+1:end,1)=ScrambledPayLoadPilots_temp(PilotLocation(pil,1):end-1,1);
ScrambledPayLoadPilots_temp(PilotLocation(pil,1),1)=pilot;
end
%Remove dumy DC carrier
ScrambledPayLoadPilots=[ScrambledPayLoadPilots_temp(1:floor(ZoneConfig.NFFTUsed/2),:) ; ScrambledPayLoadPilots_temp((ceil(ZoneConfig.NFFTUsed/2)+1):end,:)];
elseif ZoneConfig.STC==1%STC on
PilotLocation=[];
DummyPilotLocation=[];
Vset0=VarialbleSet0+(mod(floor(SymbolIndex/2),2))*6;
Vset1=VarialbleSet1+(mod(floor(SymbolIndex/2),2))*6;
%ceil(ZoneConfig.NFFTUsed/2) is dumy DC carrier
if ant==1 && mod(SymbolIndex,2)==0 %Ant 1 even symbol
PilotLocation = [PilotLocation [ConstantSet0 ; Vset0; ceil(ZoneConfig.NFFTUsed/2)]];
DummyPilotLocation = [ConstantSet1;Vset1];
elseif ant==1 && mod(SymbolIndex,2)==1 %Ant 1 odd symbol
PilotLocation = [PilotLocation [ConstantSet0 ; Vset1; ceil(ZoneConfig.NFFTUsed/2)]];
DummyPilotLocation = [ConstantSet1;Vset0];
elseif ant==2 && mod(SymbolIndex,2)==0 %Ant 2 even symbol
PilotLocation = [PilotLocation [ConstantSet1 ; Vset1; ceil(ZoneConfig.NFFTUsed/2)]];
DummyPilotLocation = [ConstantSet0;Vset0];
elseif ant==2 && mod(SymbolIndex,2)==1 %Ant 2 odd symbol
PilotLocation = [PilotLocation [ConstantSet1 ; Vset0; ceil(ZoneConfig.NFFTUsed/2)]];
DummyPilotLocation = [ConstantSet0;Vset1];
end
% PilotLocation = [PilotLocation [ConstantSet0 ;ConstantSet1; Vset0; Vset1; ceil(ZoneConfig.NFFTUsed/2)]];
PilotValues(PilotLocation)=pilot;
PilotValues(DummyPilotLocation)=zeros(1,1);
PilotLocation=sort([PilotLocation;DummyPilotLocation]);
% DummyPilotLocation=sort(DummyPilotLocation);
ScrambledPayLoadPilots_temp=int16(zeros(ZoneConfig.NFFTUsed,size(ScrambledPayLoad,2)));%with DC
ScrambledPayLoadPilots_temp(1:size(ScrambledPayLoad,1),:)=ScrambledPayLoad;
for pil=1:size(PilotLocation,1)
ScrambledPayLoadPilots_temp(PilotLocation(pil,1)+1:end,1)=ScrambledPayLoadPilots_temp(PilotLocation(pil,1):end-1,1);
ScrambledPayLoadPilots_temp(PilotLocation(pil,1),1)=PilotValues(PilotLocation(pil));
end
%Remove dumy DC carrier
ScrambledPayLoadPilots=[ScrambledPayLoadPilots_temp(1:floor(ZoneConfig.NFFTUsed/2),:) ; ScrambledPayLoadPilots_temp((ceil(ZoneConfig.NFFTUsed/2)+1):end,:)];
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -