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

📄 sys_link_simu_func.m

📁 基于OFDM的无线宽带系统仿真It contains mainly two parts, i.e. link-level simulator and system-level simulator.
💻 M
字号:
% top-level simulation file% 1. initialize parameters% 2. if necessary, do link-level simulation%    a. find threshold%    b. find additional margin% 3. system-level simulation% 4. result analyse%% yy, 01-july-2007%clear all;close all;clcfunction a = sys_link_simu_func(F_LA,F_PA)Root_path = [pwd,'/..'];P = path;%% test casetest_case = 1;switch test_case    case 1        cf = 2e9; % carrier frequency        velo = 30; % average UE velocity in kmph        fd = round(velo * 5/18 / 3e8 * cf); % Doppler frequency in Hz        t_rms = 0.5; % Delay spread in us        %F_LA = 1; % LA per frame        %F_PA = 1; % LA per frame        BO_dB = 0; % Power BackOff        use_HPA_flg = 0; % power amplifyer        flg_offset = 0; % Carrier frequency offset        flg_csi_err = 0; % CSI estimation error        BW = 5e6; % Bandwidth        N = 512; % FFT size        subN = 16; % sub-channel size        cp_l = 128; % CP length in terms of sub-carriers        Nsymbol = 6; % No. of symbols per frame        state = 1; % 1 SISO; 2 MRC; 3 Alt2x1; 4 EGC (not used); 5 AS2x1; 6 Alt2x2; 7 AS 2x2;        targetFER = 0.05; % target Block Error Rate        chnums = 1000; % No. of channel realizations        sampling_rate = 1.536; % over-sampling factor        DELAY = 4; % Feedback Delay in terms of OFDM symbols        Ts = (N + cp_l) / (BW * sampling_rate);        Tf = Ts * Nsymbol;%    otherwise        disp('Unknown test case')endComm_conf = ...    comm_config(fd,t_rms,F_LA,F_PA,BO_dB,use_HPA_flg,flg_offset,flg_csi_err,BW,cf,N,subN,cp_l,Nsymbol,state,targetFER,chnums,sampling_rate,DELAY,Ts,Tf);%% exist link-lv result or notallow_load_oldtab = 1;filename = ['table_','s',num2str(Comm_conf.state),'_f',num2str(Comm_conf.fd),'_t',num2str(Comm_conf.t_rms),'_N',num2str(Comm_conf.subN),'_L',num2str(Comm_conf.F_LA),...    '_E',num2str(Comm_conf.flg_csi_err),...    'c',num2str(Comm_conf.flg_offset),'D',num2str(Comm_conf.DELAY),'BO',num2str(Comm_conf.BO_dB),'HPA',num2str(Comm_conf.use_HPA_flg),'_BLER',num2str(Comm_conf.targetFER),'.mat'];filepath = [Root_path,'/sys_link_result/link_lv_result','/',filename];if allow_load_oldtab && exist(filepath,'file'),    load(filepath); % exist link-level result, load itelse    % link-level simulation first    setpath(P,Root_path,1);    path(path,[Root_path,'/comm_funcs']);    [LA_thres, BLER_SINR_map] = func_link_lv_simu(Comm_conf,Root_path,allow_load_oldtab);end%% do if LA rate ~= PA rateif Comm_conf.F_LA ~= Comm_conf.F_PA    LA_thres_store = LA_thres;    BLER_SINR_map_store = BLER_SINR_map;    F_LA_store = Comm_conf.F_LA;    Comm_conf.F_LA = Comm_conf.F_PA;    filename = ['table_','s',num2str(Comm_conf.state),'_f',num2str(Comm_conf.fd),'_t',num2str(Comm_conf.t_rms),'_N',num2str(Comm_conf.subN),'_L',num2str(Comm_conf.F_LA),...        '_E',num2str(Comm_conf.flg_csi_err),...        'c',num2str(Comm_conf.flg_offset),'D',num2str(Comm_conf.DELAY),'BO',num2str(Comm_conf.BO_dB),'HPA',num2str(Comm_conf.use_HPA_flg),'_BLER',num2str(Comm_conf.targetFER),'.mat'];    filepath = [Root_path,'/sys_link_result/link_lv_result','/',filename];    if allow_load_oldtab && exist(filepath,'file'),        load(filepath); % exist link-level result, load it    else        % link-level simulation first        setpath(P,Root_path,1);        path(path,[Root_path,'/comm_funcs']);        [LA_thres, BLER_SINR_map] = func_link_lv_simu(Comm_conf,Root_path,allow_load_oldtab);    end    Comm_conf.F_LA = F_LA_store;    LA_thres(:,1) = 1/2 * LA_thres(:,1) + 1/2 * LA_thres_store(:,1);    %BLER_SINR_map(:,2:end-1) = 1/2 * BLER_SINR_map(:,2:end-1) + 1/2 * BLER_SINR_map_store(:,2:end-1);end%% init LUTst_initConfig = init_tables(LA_thres,BLER_SINR_map);%% sys-lv simulationsetpath(P,Root_path,2);path(path,[Root_path,'/comm_funcs']);sys_test_case = 1;switch sys_test_case    case 1        test_possible_user_numbers = 4; % No. of active UEs        test_possible_user_velocities = velo; % UE velocity in kmph, should consider Doppler and Carrier frequency        scenario_ix = 1; % 1 micro; 2 macro1; 3 macro3;        RA_ix = 2; % RA index. 1 RR; 2 PF; 3 MX; 4 PF2;        start_Drop = 1; % start index for Drops        end_Drop = 6;   % end index for Dropsendfunc_sys_lv_simu(test_possible_user_numbers,test_possible_user_velocities,scenario_ix,RA_ix,Root_path,st_initConfig,Comm_conf,start_Drop,end_Drop);%% analyse resultpath(P,[Root_path,'/analyse_result']);MaxSaveIndex = 90; % consider the total simulation duration in test_definationsave_info_factor = 1000; % refer to test_definationloaddir=[Root_path,'/sys_link_result/sys_lv_result/'];savedir = [Root_path,'/sys_link_result/sys_lv_result_anls/'];overwrite_old = 1;if Comm_conf.state == 1,    MIMO = 'SISO';elseif Comm_conf.state == 2,    MIMO = 'MRC';else    disp('not implemented');endUE = test_possible_user_numbers;load_part2(RA_ix,UE,MIMO,loaddir,savedir,start_Drop,end_Drop,overwrite_old,MaxSaveIndex,save_info_factor,Comm_conf)loaddir=[Root_path,'/sys_link_result/sys_lv_result_anls'];av_factor = 20;result = []; fileidx = 0;% each time run only one of the followings[a,b] = res_bler_NoUEOUT(RA_ix,UE,MIMO,loaddir,result,fileidx,Comm_conf)% res_bs_powerad(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_bs_sinr(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_cdf_instTP(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_cdf_of_uetp(RA_ix,UE,MIMO,loaddir,result,fileidx,Comm_conf);% res_corr(RA_ix,UE,MIMO,loaddir,result,fileidx,Comm_conf)% res_fair(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_tp_vs_sinr(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_ue_alive(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf)% res_ue_sinr(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);% res_ue_sinr_CDF(RA_ix,UE,MIMO,loaddir,result,fileidx,av_factor,Comm_conf);

⌨️ 快捷键说明

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