- Communication Toolbox
- DSP System Toolbox
- Signal Processing Toolbox
- 5G Toolbox
- Communications Toolbox Wireless Network Simulation Library.
Error while running NR Intercell Interference Model
10 次查看(过去 30 天)
显示 更早的评论
Dear All,
Thanks in advance. Do I need to include any package?
==================code
wirelessnetworkSupportPackageCheck
rng("default") % Reset the random number generator
numFrameSimulation = 20; % Simulation time in terms of number of 10 ms frames
networkSimulator = wirelessNetworkSimulator.init;
gNBPositions = [1700 600 30; 3000 600 30; 2500 2000 30];
gNBOfInterestIdx = 3; % Specify an integer value in the range [1, number of gNBs]
gNBNames = "gNB-" + (1:size(gNBPositions,1));
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, ...
ChannelBandwidth=10e6,SubcarrierSpacing=30e3,TransmitPower=32,ReceiveGain=11);
for gNBIdx = 1:length(gNBs)
% Resource allocation type value 0 indicates a noncontiguous allocation of
% frequency-domain resources in terms of RBGs
configureScheduler(gNBs(gNBIdx),ResourceAllocationType=0)
end
numCells = length(gNBs);
cellRadius = 500; % Radius of each cell (in meters)
numUEsPerCell = 4;
uePositions = generateUEPositions(cellRadius,gNBPositions,numUEsPerCell);
UEs = cell(numCells,1);
for cellIdx = 1:numCells
ueNames = "UE-" + (1:size(uePositions{cellIdx},1));
UEs{cellIdx} = nrUE(Name=ueNames,Position=uePositions{cellIdx},ReceiveGain=11);
connectUE(gNBs(cellIdx),UEs{cellIdx},FullBufferTraffic="DL")
end
addNodes(networkSimulator,gNBs);
for cellIdx = 1:numCells
addNodes(networkSimulator,UEs{cellIdx})
end
channelModel = "3GPP TR 38.901";
if strcmp(channelModel,"3GPP TR 38.901")
% Define scenario boundaries
pos = [reshape([gNBs.Position],3,[])];
minX = min(pos(1,:)); % x-coordinate of the left edge of the scenario in meters
minY = min(pos(2,:)); % y-coordinate of the bottom edge of the scenario in meters
width = max(pos(1,:)) - minX; % Width (right edge of the 2D scenario) in meters, given as maxX - minX
height = max(pos(2,:)) - minY; % Height (top edge of the 2D scenario) in meters, given as maxY - minY
% Create the channel model
channel = h38901Channel(Scenario="UMa",ScenarioExtents=[minX minY width height]);
% Add the channel model to the simulator
addChannelModel(networkSimulator,@channel.channelFunction);
connectNodes(channel,networkSimulator,InterfererHasSmallScale=true);
end
cellToAnalyze = gNBs(gNBOfInterestIdx).ID;
enableTraces = true;
linkDir = 0; % Indicates DL
if enableTraces
simSchedulingLogger = cell(numCells,1);
simPhyLogger = cell(numCells,1);
for cellIdx = 1:numCells
% Create an object for MAC DL scheduling traces logging
simSchedulingLogger{cellIdx} = helperNRSchedulingLogger(numFrameSimulation, ...
gNBs(cellToAnalyze),UEs{cellToAnalyze},LinkDirection=linkDir);
% Create an object for PHY layer traces logging
simPhyLogger{cellIdx} = helperNRPhyLogger(numFrameSimulation,gNBs(cellToAnalyze), ...
UEs{cellToAnalyze});
end
end
numMetricPlotUpdates = numFrameSimulation;
showSchedulerMetrics = true;
showPhyMetrics = true;
metricsVisualizer = helperNRMetricsVisualizer(gNBs(cellToAnalyze),UEs{cellToAnalyze}, ...
CellOfInterest=cellToAnalyze,NumMetricsSteps=numMetricPlotUpdates, ...
PlotSchedulerMetrics=showSchedulerMetrics,PlotPhyMetrics=showPhyMetrics,LinkDirection=linkDir);
simulationLogFile = "simulationLogs"; % For logging the simulation traces
enableMobility = false;
if enableMobility
ueSpeedRange = [1 1000]; % In meters per second
ueWithMobility = UEs{cellToAnalyze}(2); % Get UE-2 in the cell of interest
% Add random waypoint mobility to the selected UE
addMobility(ueWithMobility,SpeedRange=ueSpeedRange,BoundaryShape="circle",Bounds=[gNBs(cellToAnalyze).Position(1:2) cellRadius])
end
networkVisualizer = helperNetworkVisualizer(SampleRate=100); % Sample rate indicates the visualization refresh rate in Hertz
% Show the cell boundary of each gNB
showBoundaries(networkVisualizer,gNBPositions,cellRadius,cellToAnalyze)
% Calculate the simulation duration (in seconds)
simulationTime = numFrameSimulation*1e-2;
% Run the simulation
run(networkSimulator,simulationTime);
========================================================code
Error=====================================================
>> test001
Error using nrGNB/getMCSTable (line 1331)
Invalid default value for property 'MCSTable' in class 'nrGNB':
Unable to resolve the name 'nr5g.internal.MACConstants.MCSTable'.
Error in test001 (line 8)
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, ...
0 个评论
回答(1 个)
Bhanu Prakash
2024-7-13
Hi Shouvik,
I see that you are trying to run the example 'NR Intercell Interference Modeling' but are facing an issue with the 'nrGNB' function.
To run the example, you need to have the following toolboxes and add-ons installed in your MATLAB:
Also, make sure that you are using MATLAB R2023a or a later release, as 'nrGNB' is supported from the R2023a release onwards.
I also observe that you are not using the entire code present in the example, which might lead to errors with undefined variables or functions. Please make sure that you run the entire code present in the example.
Alternatively, to open the example as a live script, you can run the following command in the MATLAB command window:
openExample('5g/NRIntercellInterferenceModelingExample')
For more information on the above mentioned topics, you can refer to the following documentation links:
For 'nrGNB' function: https://www.mathworks.com/help/5g/ref/nrgnb.html
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 System-Level Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!