?? ofdma_sfn_cellular_la_dl_simulator.m
字號:
%function [cnt_meas,st_channelGrid,st_initConfig,st_mobileStations,st_baseStation,st_measurement] = ofdma_sfn_Cellular_la_dl_simulator(st_channelGrid, st_initConfig,st_baseStation,st_measurement,st_mobileStations)
function st_initConfig = ofdma_sfn_Cellular_la_dl_simulator(st_channelGrid, st_initConfig,st_baseStation,st_measurement,st_mobileStations)
%__________________________________________________________________________
% Type: : File Header
% File name : ofdma_sfn_Cellular_la_dl_simulator
% File Description : contains the function to simulate OFDMA signle
% frequency cellular link adapted downlink
% simulator
%__________________________________________________________________________
%
%__________________________________________________________________________
% Type: : Function Header
% Function name : ofdma_sfn_Cellular_la_dl_simulator
% input : st_channelGrid,st_initConfig,st_mobileStations,st_baseStations
% output : st_channelGrid,st_initConfig,st_mobileStations,st_baseStations
% :
% calling functions : input_config
% called functions :
% Function Description : Algorithm to be put in here: As of now refer to
% design document:simulate OFDMA signle
% frequency cellular link adapted downlink
% simulator
%__________________________________________________________________________
cnt_meas=0; % counter for measurement module
% For as many frames as required
% figure(1);plothex(st_initConfig.locBS,st_initConfig.fib);
% title('Cell Layout')
MobileIdCnt =0;%counter for mobile identifier number
warning('off','all')
% pre-allocate the user-info to be saved.
user_velocity = uint8(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor));
user_distance = uint16(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor));
user_ActiveCnt = uint16(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor));
user_sinr = int8(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor,st_baseStation.nuSubChannels));
user_sinr_noFeedBackErr = int8(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor,st_baseStation.nuSubChannels));
user_mobID = uint16(zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor));
user_fair = (zeros(st_initConfig.nuMob,st_initConfig.saveUserInfo_factor));
for lp_nFrames=1:st_initConfig.nusubFrames % This has to be changed to run for number fo seconds
% where users die and are born
% until the simulation time is over
%INCLUDE ONE MORE LEVEL OF LOGIC, WHERE USERS ARE GENERATED ONLY AT
%THE 2/5/10/20 MS BOARDER
% This assumes that for the 2 ms frame , one user gets the same set of
% sub carriers continuously. i.e. there is no Time Frequency
% scheduling. Only Frequency domain scheduling.
% THIS HAS TO CHANGE LATER ON TO PER 0.5 MS, SO THAT TIME FREQUENCY
% SCHEDULING CAN BE VERIFIED. THIS CAN BE DONE VERY EASILY BY JUST
% CHANGING THE DEFINITION OF 'st_initConfig.nuOfdmSymbPerFrame' IN THE
% TEST CONFIG FILE , AS OF NOW THERE IS NO 2 MS, ALL ARE 0.5 MS .
% WHEN THAT CHANGE WILL BE DONE, THEN THE SCHEDULER HAS TO BE UPDATED
% SO THAT A MATRIX IS MADE WHICH IS HAVING TIME FREQUENCY DIMENSION,
% WHERE MOBILE INDEXS WILL BE STORED WHICH WILL IDENTIFY THE TIME
% FREQUENCY RESOURCE TO BE ALLOCATED TO THE MOBILE. THIS INFORMATION
% HAS TO BE UPDATED EVERY 2/5/10/20 MS, WHERE AS THIS MATRIX SHOULD BE
% READ EVERY 0.5 MS FOR SUB CARRIER ALLOCATION
st_initConfig.nFrmCnt=lp_nFrames;
st_initConfig.nFrmCntSlot=mod(lp_nFrames-1,st_initConfig.nuFrmPerSlot)+1;
save_UserInfor_times = ceil(lp_nFrames/st_initConfig.saveUserInfo_factor); % how many times has been saved
save_UserInforCnt = mod(lp_nFrames-1,st_initConfig.saveUserInfo_factor) + 1;
% as of now this function will create a random drop of users this will be
% changed very soon where users who have finished trasmitting will quit the
% system while new users will join
switch st_initConfig.measure_g_factorFlg
case 'yes'
% do not use the frequency selective fading and do not consider
% handover
need correction
[st_channelGrid,st_initConfig,st_mobileStations,MobileIdCnt,st_baseStation,st_measurement]=update_mobile_structres_before_frame_g_fac_no_fsf(st_initConfig,st_channelGrid,st_mobileStations,MobileIdCnt,st_baseStation,st_measurement);
switch st_initConfig.handOffFlg
case 'handoff'
need correction
[cnt_meas,st_measurement,st_mobileStations] = measurementGfactor(cnt_meas,st_channelGrid,st_measurement,st_baseStation,st_mobileStations,st_initConfig);
case 'nofsfnohandoff'
need correction
[cnt_meas,st_measurement,st_mobileStations] = measurementGfactorNoHandOff(cnt_meas,st_channelGrid,st_measurement,st_baseStation,st_mobileStations,st_initConfig);
end
case 'no'
% use frequency selective fading
% as of now this function will create a random drop of users and update
% user locations and users who have finished trasmitting will quit the
% system while new users will join
[st_channelGrid,st_initConfig,st_mobileStations,MobileIdCnt,st_baseStation,st_measurement]= update_mobile_structres_before_frame2(st_initConfig,st_channelGrid,st_mobileStations,MobileIdCnt,st_baseStation,st_measurement);
%-----------------------------
% Get Feedback and adjust for feedback delay
%-----------------------------
% There can be several factors for feedback, for example
% average SINR, in each sub band (for sub carrier allocation)
% average rms delay spread and average Doppler Condition
% only average path loss parameter
% As of now, since the first version will include only random sub
% carrier allocation, therefore there is no need to feedback detailed
% CSI.
% 1. Measure the SINR per sub channel of each mobile
% 2. Store in each mobile station structure
[st_mobileStations,st_channelGrid] = measureMobileSinr2(st_initConfig,st_baseStation,st_channelGrid,st_mobileStations);
%end
if mod(st_initConfig.nFrmCnt-1,st_initConfig.F_LA)==0
%-----------------------------
% CALL LINK ADAPTATION ALGORITHM THEN
% CALL SCHEDULING ALGORITHM : THESE ARE FOR TESTING LA PERFORMANCE
%-----------------------------
% Store the suitable rate, per mobile, per sub carrier, considering
% 1. power adaptation is not done
% 2.
% scheduler will take this information and allocate only a few resource
% units to one user, though the user measures the performance of all
% resource units
[st_baseStation,st_mobileStations,st_measurement] = link_adaptation(st_initConfig,st_baseStation,st_channelGrid,st_mobileStations,st_measurement);
%-----------------------------
% allocates resources (time frequency chunks) to users
% TO call the RA block only once per FRAME, which is the unit
% for AMC, though power control can be done at a faster rate
[st_baseStation] = resource_alloc(st_baseStation, st_mobileStations, st_initConfig);
% OR
% CALL JOINT LINK ADAPTATION + SCHEDULING ALGORITHM: THIS IS THE NEW
% ALGORITHMS THAT ARE TO COME OUT
elseif mod(st_initConfig.nFrmCnt-1,st_initConfig.F_PA)==0
% power control algorithm function call
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -