资源简介
LTE系统级仿真中的轮询调度代码,可以植入其他的系统级仿真中
代码片段和文件信息
function [userAllocationInfo RBAllocate_macro RBAllocate_pico] = process_RR_schedule(userAllocationInfo common_par)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% process_RR_schedule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 创建人:曹玉
% 日期:2013.3.6
% 函数功能:对用户进行轮询调度
% 输入:userAllocationInfo 用户分配信息
% common_par 输入参数
% 输出:userAllocationInfo 用户分配信息
% RBAllocate_macro macro用户RB分配信息
% RBAllocate_pico pico用户RB分配信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global M_USER_NUM
global M_USER_MAPPING
global P_USER_NUM
global P_USER_MAPPING
global RB_ALLOCATION_STATISTIC
global T_INDEX
USER_TOTAL_NUM = common_par.USER_TOTAL_NUM;
layer_NUM = common_par.layer_NUM;
SUBB_NUM = common_par.SUBB_NUM;
SECTOR_NUM = common_par.SECTOR_NUM;
PICO_CELL_NUM_PER_MACRO = common_par.PICO_CELL_NUM_PER_MACRO;
RBused_macro = zeros(SECTOR_NUM SUBB_NUM);
RBAllocate_macro = zeros(SECTOR_NUM SUBB_NUM);
RBused_pico = zeros(SECTOR_NUM * PICO_CELL_NUM_PER_MACRO SUBB_NUM);
RBAllocate_pico = zeros(SECTOR_NUM * PICO_CELL_NUM_PER_MACRO SUBB_NUM);
%% 初始化用户分配信息
for i_userID = 1 : USER_TOTAL_NUM
for i_layerNum = 1 : layer_NUM
blockSize = userAllocationInfo(i_userID i_layerNum).allocateRBNum;
if (blockSize ~= 0)
userAllocationInfo(i_userID i_layerNum).RBNO(1 : blockSize) = -1;
userAllocationInfo(i_userID i_layerNum).allocateRBNum = 0;
end
end
end
%% Macro用户资源调度
for i_sectorNum = 1 : SECTOR_NUM
% 找到新包用户放入新包数组中
countnum = 0;
num = M_USER_NUM(i_sectorNum); %该扇区下的用户数
newpakageUserID = zeros(1 num);
for i_RelativeuserID = 1 : num %轮询该扇区下的所有宏用户
userID = M_USER_MAPPING(i_sectorNum i_RelativeuserID);
newpakageUserID(countnum + 1) = userID; %记录该扇区下所有宏用户的绝对用户号
countnum = countnum + 1;
end
% if((num > 0) && (countnum < num))
% newpakageUserID(countnum + 1: end) = [];
% end
temp = find(RBused_macro(i_sectorNum :) == 0 1); %找到未被占用的初始位置
if isempty(temp)
continue;
else
unAllocateRBNum = temp;
if (countnum ~= 0)
begin = ceil(rand() * countnum); %随机找到轮询调度的初始用户号
for RBId = unAllocateRBNum : SUBB_NUM
userID = newpakageUserID(begin); %得到初始调度的绝对用户号
blockSize = user
评论
共有 条评论