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

📄 initconfig.m

📁 基于OFDM的无线宽带系统仿真It contains mainly two parts, i.e. link-level simulator and system-level simulator.
💻 M
📖 第 1 页 / 共 2 页
字号:
%__________________________________________________________________________
% Type:                 :   File Header
% File name             :   initConfig
% File Description      :   Holds the data structure with initial values
%                           for variables that are used in the simulation
%__________________________________________________________________________




%__________________________________________________________________________
% Type                  :   Variable Header
% Variable Type         :   Structure
% Description           :   Contains initial values of important
%                           configuration variables
%__________________________________________________________________________




%choice of scheduling algorithm
% 0 fixed modulation with round robin scheduling with
% equal number of sub carriers allocated to each
% user
% 1, Round robin scheduling, equal number of sub carriers, SFN, fix power,
% only rate adaptation with FER constraint, throughput maximization
% 2, Round Robin scheduling, equal number of sub carriers, SFN, fix power,
% only rate adaptation, no FER constraint, therefore look up table from the
% Throughput curves... for rate decision....

switch test_resource_allocation
    case 'RR'
        SchedulingAlgoChoice=2;
    case 'MAXCI'
        SchedulingAlgoChoice=4;
    case 'PF'
        SchedulingAlgoChoice=5;
     case 'PF2'
        SchedulingAlgoChoice=6;
   otherwise
        sprintf(' resource allocation algorithm is not set propertly \n')
        break
end




%-------------------------------------------------------------------------%
%                                                                         %
%                   .-------------------------------.                     %
%                   | SETTINGS ON THE SYSTEM LEVEL  |                     %
%                   '-------------------------------'                     %
%                                                                         %
%-------------------------------------------------------------------------%





%G factor calculation Method
% 'nofsf' does not use frequency selective fading information.
% 'fsf' uses frequency selective fading channel for measurement
% this parameter is used in the ofdm_simulator....to call the appropriate update_mobiles..... function so that
% If g factor is to be measured, normal simulation won't run
st_initConfig.measure_g_factorFlg=test_g_factor_flg;%'no';% 'yes'
switch st_initConfig.measure_g_factorFlg
    case 'yes'
        % If the above is 'yes' then the next one is used otherwise not
        st_initConfig.g_factor_calculation_methodFlg='nofsf';%'fsf'
        %Handoff to be used or not
        % 'handoff' to be used to indicate users will be distributed across the whole area and
        % wrap-around model will be used in the path gain calculations
        % 'nohandoff' to be used in main simulations mostly, when wrap around model will NOT be used
        % users will be located in the central cell.
        st_initConfig.handOffFlg='handoff';
    case 'no'
        st_initConfig.handOffFlg='nohandoff';
    otherwise
        sprintf('measure_g_factorFlg not set correctly \n')
        break
end



% Cellular configuration
% 'macro1' means large cell with ISD of 500 m
% 'macro3' means large cell with ISD of 1732 m
% 'micro1' means small cell with ISD of 130 m
% most important to note here is that the path loss model will change accordingly
% the correlation, number of sector will depend on this as well.
st_initConfig.scenarioLabel=test_scenario;%'macro1';%'micro1';%'macro1';%'micro1';%'macro';%'micro';%'macro';%'micro'

% Frequency planning and power distribution
% This is to be used while calculating the received SINR
% The link budget needs to be done
%'fractionalSFNannular';% SFN + fractional reuse in annular cellular format
%'fractionalSFN';% each cell uses only a
%fraction of the total bandwidth, but the total
%bandwidth is accesible
st_baseStation.FreqPlan =  test_FRF;% 'SFN' ; % single frequency network


% channel estimation error inclusion method.
% It can take the values 'predefined' or 'runtime'
% in case of 'predefined' a fixed noise variance will be added to the
% channel estimation, i.e. sinr estimated at the receiver. On the other
% hand, the value 'runtime' indicates the true SINR is used to add an
% equivalent amount of noise in the sinr estimate at the recevier, which is
% used for finding the modulation and coding level.
st_initConfig.channelEstErrRxMethod='runtime';%'predefined';'runtime'

switch st_initConfig.channelEstErrRxMethod
    case 'runtime'
    case 'predefined'
        st_initConfig.channelEstErrRxValdB=10;%
    otherwise
        sprintf('channelEstErrRxMethod is not configured properly \n')
        break
end


% Head Margin for power control in Downlink OFDMA
% The value is in dB will indicate how much is the power level below the maximum power level to be used in general cases
% This will leave space for downlink power control.
st_initConfig.headPowMargindB=0;

% Number of mobiles to be used in the simulation run
NumberActiveMobiles = test_nu_active_users;%2; % [2 4 8 16 32 64]

% The average velocity of the users
fixVeloUnderTestkmph = test_avg_velo_kmph;%30; % velocity in kmph

% File size that each user needs to transmit
st_initConfig.MaxFileSz = test_file_size_per_user_bits;%0.05*1024*8;%2*1024*8;%2e6; % maximum file size for each mobile

% Values to be used in case of fixed modulation tests
FixMod='qpsk';%'qam16'; % not much important, Used to compare against fixed modulations
FixRate='1/2'; %'1/3';'1/2';'2/3'



%Time counter 
st_initConfig.currTimeinSec=0;

% The sub frame size to be used in the simulations, the value to be used is
% in seconds
% This is the test duration of the minimum frame in seconds
% FEC block is of this duration.

st_initConfig.subFramePeriod = Comm_conf.Tf;
%%
% The frame period in seconds,
% which consists of several sub frames
% The modulation and coding may be kept fixed during this period. while
% power control may be varied at a different rate.
% The scheduling allocation period can be controlled accordingly
st_initConfig.FramePeriod =test_F_LA*st_initConfig.subFramePeriod;%0.5e-3;% [0.5e-3 1e-3 2e-3 5e-3 10e-3 20e-3 40e-3]
%st_initConfig.FrameToSubTimeFrameRatio=test_F_LA;%st_initConfig.FramePeriod/st_initConfig.subFramePeriod;
%The maximum duration of the frame in seconds
% This is done to keep a cross check
%% define as the current frame period,,, not needed
st_initConfig.maxFramePeriod = st_initConfig.FramePeriod;
%%
% The simulation must run for as many seconds as specified below
st_initConfig.simulationPeriod = test_simulation_period_factor*st_initConfig.subFramePeriod; % This time is in seconds

% Total number of Frames transmitted in the simulation period.
st_initConfig.nusubFrames = test_simulation_period_factor;%floor(st_initConfig.simulationPeriod/st_initConfig.subFramePeriod);%2;1e1;1e2;1e3;1e4;1e5;10;%50;%125;%10;%150;%200;%15000;


% Carrier Frequency
st_initConfig.cf = Comm_conf.cf;%3.5e9;
% System Bandwidth
st_initConfig.bw = Comm_conf.BW;
st_initConfig.nuFFT = Comm_conf.N;
% Sampling frequency used is slightly higher than the bandwidth, while
% guard bands are used at both ends and hence a good filter can be designed
% easily while the frequency efficiency can be made very high
st_initConfig.samplingFreq = Comm_conf.sampling_rate*st_initConfig.bw;

% System Sampling Period
st_initConfig.tSample = 1/st_initConfig.samplingFreq;

%Number of points in the FFT
switch st_initConfig.bw
    case {5e6}
        %st_initConfig.nuFFT = 512;
        st_initConfig.nuSubCarr = 301;
    case {10e6}
        %st_initConfig.nuFFT = 1024;
        st_initConfig.nuSubCarr = 601;
    otherwise
        sprintf(' Bandwidth not set correctly \n')
        break;
end


% The number of non zero sub carriers.
% Currently all are considered for data transmission while later pilots
% will be considered. Now the overhead calculations will take care of the
% pilot sub carriers.

% the sub carrier indices
st_initConfig.sub_cars = 1:st_initConfig.nuSubCarr;%find(st_baseStation.allocation==1);%lp_nmob);

% Sub carrier bandwidth / spacing
st_initConfig.subCarrBw = st_initConfig.samplingFreq/st_initConfig.nuFFT;

% Number of data sub carriers
st_initConfig.nuDataSubCarr = st_initConfig.nuSubCarr;

% OFDM symbol Duration % T_f
st_initConfig.tf = 1/st_initConfig.subCarrBw;

%Guard Period / Cyclic Prefix duration
% currently being taken as 25% of the OFDM symbol duration
st_initConfig.tg = Comm_conf.cp_l/st_initConfig.nuFFT*st_initConfig.tf;

% symbol Duration =Data Duration + Guard Period, T_s = T_f+T_g
st_initConfig.tSymb  = st_initConfig.tf + st_initConfig.tg;

%Number of OFDM symbols in a sub frame
st_initConfig.nuOfdmSymbPerSubFrame= Comm_conf.Nsymbol;%round(st_initConfig.subFramePeriod/st_initConfig.tSymb) ;%4; % for debugging purpose only!


% Parameters needed for pathgain initialization. Eg
% Calculate the gain between bases and mobiles
switch st_initConfig.scenarioLabel
    case 'micro1'
        st_initConfig.isd = 130;%1732;%1732;%500;% inter site distance
        st_initConfig.maxPowBSdBm=35+6-st_initConfig.headPowMargindB;% 38+6-st_initConfig.headPowMargindB;
        st_initConfig.dmin=10;%in m, min distance between BS and UE
        st_initConfig.attConst=-7;%-128;%-21;
        st_initConfig.alpha=5.6;
        st_initConfig.sigma=10;%4;
        % st_initConfig.sigma_y=0;%4; % This is for rms delay spread
        st_initConfig.raa=0;%0.5;
        st_initConfig.corrDist=25;%110; % correlation distance
        st_initConfig.sps=1;% sectors per site:  1 for micro cell, 3 for macro cell
        st_initConfig.km=2;%2;%1; % parameter for rohmbus,
        st_initConfig.lm=3;%3;%2; % parameter for rohmbus,
        st_initConfig.nuCluster=1 ;

    case 'macro1'
        st_initConfig.isd = 1732;%500;%1732;%;%1732;%500;%1732;%500;%1732;%500;%1732;%500;%1732;%1732;%500;% inter site distance
        st_initConfig.maxPowBSdBm=43+14-st_initConfig.headPowMargindB; % 38 dBm for 10MHz
        st_initConfig.dmin=35;
        scaleFac=10.5;
        st_initConfig.attConst=-35.3;%-15.3;%-35.3;%-15.3;%-35.3;%-15.3;%-35.3;%900 7.2;%-35.3;%2ghz 15.3;%-35.3;%-128;%-21;
        st_initConfig.alpha=3.76;
        st_initConfig.sigma=8;%4;
        % st_initConfig.sigma_y=0;%4; % This is for rms delay spread
        st_initConfig.raa=0.5;
        st_initConfig.corrDist=50;%110; % correlation distance
        st_initConfig.sps=3;% 1 for micro cell, 3 for macro cell
        st_initConfig.km=2;%2;%1; % parameter for rohmbus,
        st_initConfig.lm=3;%3;%2; % parameter for rohmbus,
        st_initConfig.nuCluster=1 ;
    % what's the difference between macro2 and macro3?
    case 'macro3'
        st_initConfig.isd = 1732;%500;%1732;%;%1732;%500;%1732;%500;%1732;%500;%1732;%500;%1732;%1732;%500;% inter site distance
        st_initConfig.maxPowBSdBm=43+14-st_initConfig.headPowMargindB; % 38 dBm for 10MHz
        st_initConfig.dmin=35;
        scaleFac=10.5;
        st_initConfig.attConst=-35.3;%-15.3;%-35.3;%-15.3;%-35.3;%-15.3;%-35.3;%900 7.2;%-35.3;%2ghz 15.3;%-35.3;%-128;%-21;
        st_initConfig.alpha=3.76;
        st_initConfig.sigma=8;%4;
        % st_initConfig.sigma_y=0;%4; % This is for rms delay spread
        st_initConfig.raa=0.5;
        st_initConfig.corrDist=50;%110; % correlation distance
        st_initConfig.sps=3;% 1 for micro cell, 3 for macro cell
        st_initConfig.km=2;%2;%1; % parameter for rohmbus,
        st_initConfig.lm=3;%3;%2; % parameter for rohmbus,            
        st_initConfig.nuCluster=1 ;

    otherwise
        sprintf('scenario setting not configured properly \n')
        break
end
% Configure the antenna angular gain vector at the sector BS
theta=[0:180 -179:-1];%[-180:179];%[0:180 -179:-1];%[0:180 -179:-1];% [-180:179];%[0:180 -179:-1];%[-180:179];%;%[0:180 -179:-1];%[-180:179];%[0:180 -179:-1];%-180:179;
switch st_initConfig.sps
            case {3}
                st_initConfig.cellRadius=st_initConfig.isd/3; % Cell radius on meters
                thetaThreeDb=70; % degrees
                Am=20; %dB
                st_initConfig.lobeVector = -min(12*((theta/thetaThreeDb).^2),Am);               
            case {1}
                st_initConfig.cellRadius=st_initConfig.isd/1.732; % Cell radius on meters
                st_initConfig.lobeVector = zeros(360,1); % omnidirectional antenna;
    otherwise
        sprintf('Number of sectors not defined properly\n')
        break;
end


st_initConfig.ncell_per_cluster = st_initConfig.km^2+ st_initConfig.lm^2+st_initConfig.km*st_initConfig.lm;

% identify the desired Base station for the simulation case
switch st_initConfig.ncell_per_cluster
    case 7
        st_initConfig.desiredBsIdx=2;    
        st_initConfig.scaleFactor=7;
    case 19
        st_initConfig.desiredBsIdx=5;
        st_initConfig.scaleFactor=9;
    case 37
        st_initConfig.desiredBsIdx=10;
        st_initConfig.scaleFactor=15;

⌨️ 快捷键说明

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