📄 test_editmultiueparameter.m
字号:
end
% add the new part of MultiUEParameter.
MultiUEParameter( EnableUEClassIndex ) = EnableMultiUEParameter ;
% save the data in the figure .
setappdata( handles.EditMultiUEParameter, 'MultiUEParameter', MultiUEParameter ) ;
% refresh the display of the current UEClass's data .
init_FigureContent( h ) ;
% 重设UEClass百分比编辑框的活动状态。
link_ResetUEClassEditEnable( h ) ;
% --------------------------------------------------------------------------
function EditThroughputPercent_Callback( h )
handles = guidata( h ) ;
% get the data in the figure .
MultiUEParameter = getappdata( handles.EditMultiUEParameter, 'MultiUEParameter' ) ;
% get the index of Enable uicontrols .
EnableUEClassIndex = find( [MultiUEParameter.Enable] ) ;
% get the active part of MultiUEParameter.
EnableMultiUEParameter = MultiUEParameter( EnableUEClassIndex ) ;
% get the number of the enable UEClass .
UEClassNumber = length( EnableMultiUEParameter ) ;
TagIndex = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ;
% get the tag and the index .
UicontrolTag = get( h ,'Tag' ) ;
UEClassIndex = findstr( TagIndex, UicontrolTag(end) ) ;
% 修正UEClassIndex为其在EnableMultiUEParameter中的序号。
TempUEClassIndex = find( EnableUEClassIndex == UEClassIndex ) ;
if TempUEClassIndex == 1
MaxPercent = 1 * 100 ;
else
% 得到当前UEClass之前的所有UEClass的百分数构成的向量。
FrontalThroughputPercentArray = [EnableMultiUEParameter(1: (TempUEClassIndex - 1) ).ThroughputPercent];
% 计算前面UEClass已经占用的百分比。
FrontalThroughputPercentTotal = sum( FrontalThroughputPercentArray );
% 计算此UEClass最多可以达到的百分比。
MaxPercent = (1 - FrontalThroughputPercentTotal) * 100 ;
end
SoftLanguage = 'Chinese' ;
if strcmp( SoftLanguage, 'English' )
ParameterName = 'Throughput Percent [%]' ;
elseif strcmp( SoftLanguage, 'Chinese' )
ParameterName = '吞吐量百分数[%]' ;
else
return ;
end
% get the edit's string
EditValue = get( h, 'String' ) ;
EditValue = str2num( EditValue ) ;
% check the input .
EditValue = com_JudgeInputNumber( EditValue, 'limit', ParameterName, 0, MaxPercent ) ;
if isempty( EditValue )
return ;
else
end
% recaculate the oher data . 除以100即为其真实的百分比。
EnableMultiUEParameter(TempUEClassIndex).ThroughputPercent = EditValue / 100 ;
% 计算剩下的百分比。
LeaveUEClassPercent = MaxPercent - EditValue ;
if TempUEClassIndex + 1 <= UEClassNumber
% 将剩下的百分比全部分配给下一个UEClass。 除以100即为其真实的百分比。
EnableMultiUEParameter(TempUEClassIndex + 1).ThroughputPercent = LeaveUEClassPercent / 100 ;
end
if (TempUEClassIndex + 2) <= UEClassNumber
% 清楚后面所有UEClass的分布。
for num = (TempUEClassIndex + 2) : UEClassNumber
EnableMultiUEParameter(num).ThroughputPercent = 0 ;
end
end
% 数学原理:
% ∑(TotalUENumer * UENumberPercent * DataRate * ActivityFactor) = TotalThroughput ; % 此行暂时不用。
% 推理如下:
% ∑(TotalThroughput * ThroughputPercent / DataRate / ActivityFactor) = TotalUENumer ;
% 假设TotalThroughput = 1;
% 即∑(ThroughputPercent / DataRate) = TotalUENumer ;
% 采用归一算法即可得到每一UEClass的UENumberPercent。
%
ThroughputPercentArray = [EnableMultiUEParameter.ThroughputPercent] ;
DataRateArray = [EnableMultiUEParameter.DataRate] ;
ActivityFactorArray = [EnableMultiUEParameter.ActivityFactor] ;
UENumberPercentArray = ThroughputPercentArray ./ ( DataRateArray .* ActivityFactorArray );
% 计算总的UE个数。
TotalUENumber = sum(UENumberPercentArray) ;
% 重新计算每一类UEClass的UE个数的百分比。
UENumberPercentArray = UENumberPercentArray / TotalUENumber ;
for num = 1: UEClassNumber
EnableMultiUEParameter(num).UENumberPercent = UENumberPercentArray(num) ;
end
% add the new part of MultiUEParameter.
MultiUEParameter( EnableUEClassIndex ) = EnableMultiUEParameter ;
% save the data in the figure .
setappdata( handles.EditMultiUEParameter, 'MultiUEParameter', MultiUEParameter ) ;
% refresh the display of the current UEClass's data .
init_FigureContent( h ) ;
% 重设UEClass百分比编辑框的活动状态。
link_ResetUEClassEditEnable( h ) ;
% ------------------------------------------------------------------
function link_ResetUEClassEditEnable( h ) ;
handles = guidata( h ) ;
% get the data in the figure .
MultiUEParameter = getappdata( handles.EditMultiUEParameter, 'MultiUEParameter' ) ;
% get the index of Enable uicontrols .
EnableUEClassIndex = find( [MultiUEParameter.Enable] ) ;
% get the active part of MultiUEParameter.
EnableMultiUEParameter = MultiUEParameter( EnableUEClassIndex ) ;
% get the number of the enable UEClass .
UEClassNumber = length( EnableMultiUEParameter ) ;
% get the percent array of all enable UEClass .
UENumberPercentArray = [EnableMultiUEParameter.UENumberPercent] ;
% call the function to set the states of the uicontrols .
UENumberPercentValue = get( handles.UENumberPercent, 'Value' ) ;
TagIndex = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ;
for num = 1: length( EnableUEClassIndex )
% get the UEClassPercent of the current UEClass of the current clutter .
CurrentUENumberPercent = EnableMultiUEParameter(num).UENumberPercent ;
% 得到其最大能够分配的百分比。
if num == 1
MaxPercent = 1 ;
else
% 得到当前UEClass之前的所有UEClass的百分数构成的向量。
FrontalUENumberPercentArray = [EnableMultiUEParameter(1: (num - 1) ).UENumberPercent] ;
% 计算前面UEClass已经占用的百分比。
FrontalUENumberPercentTotal = sum( FrontalUENumberPercentArray );
% 计算此UEClass最多可以达到的百分比。
MaxPercent = (1 - FrontalUENumberPercentTotal) ;
end
% get the handles of the text and the popupmenu .
UENumberPercentEditHandle = getfield( handles, ...
['UENumberPercentEdit', TagIndex( EnableUEClassIndex(num) )] ) ;
ThroughputPercentEditHandle = getfield( handles, ...
['ThroughputPercentEdit', TagIndex( EnableUEClassIndex(num) )] ) ;
if ((CurrentUENumberPercent <= MaxPercent) | (CurrentUENumberPercent - MaxPercent) < 0.0001) ...
& (MaxPercent > 0) ...
& (num < UEClassNumber ) % 最后一个UEClass不能再变化其百分比。
if (UENumberPercentValue == 1)
% 可以重新设置其百分比 .
set( UENumberPercentEditHandle, 'Enable', 'on' ) ;
set( ThroughputPercentEditHandle, 'Enable', 'off' ) ;
else
% 可以重新设置其百分比 .
set( UENumberPercentEditHandle, 'Enable', 'off' ) ;
set( ThroughputPercentEditHandle, 'Enable', 'on' ) ;
end
else
% 可以重新设置其百分比 .
set( UENumberPercentEditHandle, 'Enable', 'off' ) ;
set( ThroughputPercentEditHandle, 'Enable', 'off' ) ;
end
end
% --------------------------------------------------------------------------
function EditUEParameter_Callback( h )
handles = guidata( h ) ;
% get the data in the figure .
MultiUEParameter = getappdata( handles.EditMultiUEParameter, 'MultiUEParameter' ) ;
TagIndex = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ;
% get the tag and the index .
UicontrolTag = get( h ,'Tag' ) ;
UEClassIndex = findstr( TagIndex, UicontrolTag(end) ) ;
DialogName = MultiUEParameter(UEClassIndex).DataRateName ;
DisplayItemNumber = length( MultiUEParameter(UEClassIndex).InputParaKanaName ) ;
% edit the propagation model parameters .
MultiUEParameter(UEClassIndex) = com_InputParameterBox( {'OnlyInput'}, {'NonFigure'; DialogName}, ...
{1; ' '}, MultiUEParameter(UEClassIndex), ...
{DisplayItemNumber; MultiUEParameter(UEClassIndex).InputParaKanaName; ...
MultiUEParameter(UEClassIndex).InputParaName; } ) ;
% 一旦修改了激活因子ActivityFactor,应该重新计算吞吐量的比例。
% ---------------------------------------------------------------------------
% 数学原理:
% ∑(TotalThroughput * ThroughputPercent / DataRate / ActivityFactor) = TotalUENumer ; % 此行暂时不用。
% 推理如下:
% ∑(TotalUENumer * UENumberPercent * DataRate * ActivityFactor) = TotalThroughput ;
% 假设TotalUENumer = 1;
% 即∑(UENumberPercent * DataRate) = TotalThroughput ;
% 采用归一算法即可得到每一UEClass的ThroughputPercent。
%
UENumberPercentArray = [MultiUEParameter.UENumberPercent] ;
DataRateArray = [MultiUEParameter.DataRate] ;
ActivityFactorArray = [MultiUEParameter.ActivityFactor] ;
ThroughputPercentArray = UENumberPercentArray .* DataRateArray .* ActivityFactorArray ;
% 计算总的吞吐量。
TotalThroughput = sum(ThroughputPercentArray) ;
% 重新计算每一类UEClass的吞吐量的百分比。
ThroughputPercentArray = ThroughputPercentArray / TotalThroughput ;
for num = 1: length( MultiUEParameter )
MultiUEParameter(num).ThroughputPercent = ThroughputPercentArray(num) ;
end
% save the data in the figure .
setappdata( handles.EditMultiUEParameter, 'MultiUEParameter', MultiUEParameter ) ;
% update the strings of the edits .
link_DisplayUEClassInformation( h, MultiUEParameter ) ;
% --------------------------------------------------------------------------
function OKButton_Callback( h )
% restore the data and close the figure .
handles = guidata( h ) ;
% get the data in the figure .
MultiUEParameter = getappdata( handles.EditMultiUEParameter, 'MultiUEParameter' ) ;
% save the aim data in the special place .
setappdata( handles.EditMultiUEParameter, 'NewMultiUEParameter', MultiUEParameter ) ;
% close the figure and return result .
set( handles.EditMultiUEParameter, 'Selected', 'on' ) ;
% ------------------------------------------------------------------------------
function MultiUEParameter = get_DefaultMultiUEParameter ;
% get the default data .
% define the UE parameter .
SoftLanguage = 'Chinese' ;
if strcmp( SoftLanguage, 'English' )
MultiUEParameter(1).InputParaKanaName = { 'Target SIR [dB]'; ...
'Activity Factor'; ...
'Other/Own Factor'; ...
'Orthogonality Factor'; } ;
MultiUEParameter(1).TooltipString = { 'TR25.942 value: 6.1 dB.'; ...
'TR25.942 value: 0.67.'; ...
'TR25.942 value: 0.55.'; ...
'TR25.942 value: 0.55.'; } ;
elseif strcmp( SoftLanguage, 'Chinese' )
MultiUEParameter(1).InputParaKanaName = { '语音/数据业务目标信噪比 [dB]'; ...
'激活因子'; ...
'邻区干扰比例因子'; ...
'正交因子'; } ;
MultiUEParameter(1).TooltipString = { 'TR25.942 值: 6.1 dB.'; ...
'TR25.942 值: 0.67.'; ...
'TR25.942 值: 0.55.'; ...
'TR25.942 值: 0.55.'; } ;
else
return ;
end
MultiUEParameter(1).InputParaName = { 'TargetSIR'; 'ActivityFactor'; ...
'OtherVSOwnFactor'; 'OrthogonalityFactor' } ;
% define the parameters of 12.2 k .
% -------------------------------------------------------------------
MultiUEParameter(1).DataRateName = '12.2 k' ;
MultiUEParameter(1).Enable = 1 ;
MultiUEParameter(1).DataRate = 12.2 ;
MultiUEParameter(1).UENumberPercent = 1 ;
MultiUEParameter(1).ThroughputPercent = 1 ;
MultiUEParameter(1).SelectedPercent = 'UENumberPercent' ; % only save a marker .
MultiUEParameter(1).TargetSIR = 6.1 ;
MultiUEParameter(1).ActivityFactor = 0.67 ;
MultiUEParameter(1).OtherVSOwnFactor = 0.55 ;
MultiUEParameter(1).OrthogonalityFactor = 0.55 ;
% define the parameters of 144 k .
% -------------------------------------------------------------------
MultiUEParameter(2) = MultiUEParameter(1) ;
MultiUEParameter(2).DataRateName = '144 k' ;
MultiUEParameter(2).Enable = 0 ;
MultiUEParameter(2).DataRate = 144 ;
MultiUEParameter(2).UENumberPercent = 0 ;
MultiUEParameter(2).ThroughputPercent = 0 ;
MultiUEParameter(2).TargetSIR = 6.1 ;
MultiUEParameter(2).ActivityFactor = 0.1 ;
MultiUEParameter(2).OtherVSOwnFactor = 0.55 ;
MultiUEParameter(2).OrthogonalityFactor = 0.55 ;
% define the parameters of 384 k .
% -------------------------------------------------------------------
MultiUEParameter(3) = MultiUEParameter(1) ;
MultiUEParameter(3).DataRateName = '384 k' ;
MultiUEParameter(3).Enable = 0 ;
MultiUEParameter(3).DataRate = 384 ;
MultiUEParameter(3).UENumberPercent = 0 ;
MultiUEParameter(3).ThroughputPercent = 0 ;
MultiUEParameter(3).TargetSIR = 6.1 ;
MultiUEParameter(3).ActivityFactor = 0.1 ;
MultiUEParameter(3).OtherVSOwnFactor = 0.55 ;
MultiUEParameter(3).OrthogonalityFactor = 0.55 ;
% define the parameters of other k .
% -------------------------------------------------------------------
MultiUEParameter(4) = MultiUEParameter(1) ;
SoftLanguage = 'Chinese' ;
if strcmp( SoftLanguage, 'English' )
MultiUEParameter(4).DataRateName = 'Other Traffic' ;
MultiUEParameter(4).InputParaKanaName = { 'Data Rate [kbps]'; ...
'Target SIR [dB]'; ...
'Activity Factor'; ...
'Other/Own Factor'; ...
'Orthogonality Factor'; } ;
elseif strcmp( SoftLanguage, 'Chinese' )
MultiUEParameter(4).DataRateName = '其它业务' ;
MultiUEParameter(4).InputParaKanaName = { '业务速率 [kbps]'; ...
'语音/数据业务目标信噪比 [dB]'; ...
'激活因子'; ...
'邻区干扰比例因子'; ...
'正交因子'; } ;
else
return ;
end
MultiUEParameter(4).InputParaName = { 'DataRate'; 'TargetSIR'; 'ActivityFactor'; ...
'OtherVSOwnFactor'; 'OrthogonalityFactor' } ;
MultiUEParameter(4).Enable = 0 ;
MultiUEParameter(4).DataRate = 2000 ;
MultiUEParameter(4).UENumberPercent = 0 ;
MultiUEParameter(4).ThroughputPercent = 0 ;
MultiUEParameter(4).TargetSIR = 6.1 ;
MultiUEParameter(4).ActivityFactor = 0.1 ;
MultiUEParameter(4).OtherVSOwnFactor = 0.55 ;
MultiUEParameter(4).OrthogonalityFactor = 0.55 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -