HE/parameter_fromUI.m

147 lines
6.3 KiB
Mathematica
Raw Normal View History

2024-03-30 16:35:40 +08:00
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
2024-03-31 01:44:24 +08:00
% if isempty(NumerologyNo)
2024-03-30 16:35:40 +08:00
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;
2024-03-31 01:44:24 +08:00
cfgUI.allocation = RU_index;%
2024-03-30 16:35:40 +08:00
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