function [cfgHE,RU_index,cfgUI] = parameter_fromUI(cfgUI) if cfgUI.numTx == 1 addpath('.\WaveAdp'); NumerologySel = [cfgUI.user1.FFTSize,eval(cfgUI.user1.CPLength),cfgUI.user1.pilotInterval]; load NumerologySet.mat NumerologySet for jj =1 :length(NumerologySet) if isequal(NumerologySel,NumerologySet(jj,:)) NumerologyNo = jj; break; end end PacketSize = cfgUI.user1.APEPlength; [MCS, MCS_no] = MCS_sel(cfgUI.user1.ModulationMode,cfgUI.user1.CodeRate); [~,WaveformPara] = WaveformNumerologyCal(PacketSize,NumerologySel,MCS_no); RU_index = 192; cfgHE = WaveformPara; cfgHE.MCS = MCS; cfgHE.ChannelCoding = cfgUI.user1.ChannelCode; cfgHE.NumTransmitAntennas = 1; cfgHE.NumerologyNo = NumerologyNo; else if strcmp(cfgUI.UserMode,'SU') % HE-SU RU_index = 192; % 对RU_index赋值,防止报错------------zjd 3.21修改 %*********************************lql03.21修改********************************* cfgUI.allocation = RU_index; %*********************************lql03.21修改********************************* cfgHE = wlanHESUConfig; cfgHE.ChannelBandwidth = cfgUI.ChannelBandwidth; % Channel bandwidth cfgHE.NumSpaceTimeStreams = cfgUI.user1.s; % Number of space-time streams cfgHE.NumTransmitAntennas = cfgUI.numTx; % Number of transmit antennas cfgHE.ExtendedRange = false; % Do not use extended range format cfgHE.Upper106ToneRU = false; % Do not use upper 106 tone RU cfgHE.PreHESpatialMapping = false; % Spatial mapping of pre-HE fields switch cfgUI.user1.CPLength case '1/16' cfgHE.GuardInterval = 0.8; % Guard interval duration cfgHE.HELTFType = 1;% defualt case '1/8' cfgHE.GuardInterval = 1.6; % Guard interval duration cfgHE.HELTFType = 2; case '1/4' cfgHE.GuardInterval = 3.2; % Guard interval duration cfgHE.HELTFType = 4; end % cfgHE.HELTFType = 4; % HE-LTF compression mode cfgHE.ChannelCoding = cfgUI.user1.ChannelCode; % Channel coding cfgHE.MCS = MCS_sel(cfgUI.user1.ModulationMode,cfgUI.user1.CodeRate); % cfgHE.MCS = 4; % Modulation and coding scheme %---------------------------------zjd03.21修改----------------------------------- ??? % if cfgUI.numTx == cfgUI.numRx % cfgHE.SpatialMapping = 'Direct'; % else % cfgHE.SpatialMapping = 'Hadamard'; % end cfgHE.NumSpaceTimeStreams = cfgUI.user1.s; % 配置空时流数 cfgHE.SpatialMapping = cfgUI.user1.SpatialMapping; % 配置映射方式 if strcmp(cfgUI.user1.MultiAntennaMode,'STBC') % STBC使能 cfgHE.STBC = 1; cfgHE.NumSpaceTimeStreams = 2; else cfgHE.STBC = 0; end if strcmp(cfgHE.SpatialMapping,'Direct') cfgHE.NumSpaceTimeStreams = cfgUI.numTx; % 'Direct'要求空时流数=发射天线数 end %------------------------------------------------------------------------------ cfgHE.APEPLength = cfgUI.user1.APEPlength; % Payload length in bytes elseif strcmp(cfgUI.UserMode,'MU') % HE-MU % 首先进行资源分配配置 RU_index = RU_alloc(cfgUI); cfgUI.allocation = RU_index;% 为什么要回传? cfgHE = wlanHEMUConfig(RU_index); disp('Allocation info:') disp(ruInfo(cfgHE)) % Configure per user parameters for unum = 1 : cfgUI.numUsers userf = eval(['cfgUI.user' num2str(unum) '.f']); numsubRU = sum(userf); switch numsubRU case 1 switch RU_index case {112,16} %0 eval(['user' num2str(unum) '=' num2str(find(userf ==1)) ]); case 24 %-1 eval(['user' num2str(unum) '=' num2str(find(userf ==1)) '-1']); end case 2 switch RU_index case 96 % 上下两个 cfgHE.RU{1}.SpatialMapping = 'Custom'; cfgHE.RU{2}.SpatialMapping = 'Custom'; if (sum(find(userf == 1)) == 3) eval(['user' num2str(unum) '=' num2str(1)]); elseif (sum(find(userf == 1)) == 7) eval(['user' num2str(unum) '=' num2str(2) ]); end case 100 % 第一个106 eval(['user' num2str(unum) '=' num2str(unum) ]); case 97 % 第二个106 +1 eval(['user' num2str(unum) '=' num2str(unum) '+1']); case 24 eval(['user' num2str(unum) '=' num2str(1) ]); case 16 eval(['user' num2str(unum) '=' num2str(3) ]); end case 4 cfgHE.RU{1}.SpatialMapping = 'Custom'; eval(['user' num2str(unum) '=' num2str(unum) ]); end end % STA #1 cfgHE.User{1}.NumSpaceTimeStreams = 1; cfgHE.User{1}.MCS = MCS_sel(cfgUI.user1.ModulationMode,cfgUI.user1.CodeRate); cfgHE.User{1}.APEPLength = cfgUI.user1.APEPlength; cfgHE.User{1}.STAID = 1; cfgHE.User{1}.ChannelCoding = cfgUI.user1.ChannelCode; if length(cfgHE.User)>1 % STA #2 cfgHE.User{2}.NumSpaceTimeStreams = 1; cfgHE.User{2}.MCS = MCS_sel(cfgUI.user2.ModulationMode,cfgUI.user2.CodeRate); cfgHE.User{2}.APEPLength = cfgUI.user2.APEPlength; cfgHE.User{2}.STAID = 2; cfgHE.User{2}.ChannelCoding = cfgUI.user2.ChannelCode; end % Configure common parameters for all users cfgHE.NumTransmitAntennas = cfgUI.numTx; switch cfgUI.user1.CPLength case '1/16' cfgHE.GuardInterval = 0.8; % Guard interval duration case '1/8' cfgHE.GuardInterval = 1.6; % Guard interval duration case '1/4' cfgHE.GuardInterval = 3.2; % Guard interval duration end end end end