- WLAN Toolbox: https://www.mathworks.com/help/wlan/index.html
- 802.11ax Multinode System-Level Simulation of Residential Scenario: https://www.mathworks.com/help/wlan/ug/802-11ax-multinode-system-level-simulation-of-residential-scenario-using-matlab.html
- Communications Toolbox Wireless Network Simulation Library: https://www.mathworks.com/matlabcentral/fileexchange/119923-communications-toolbox-wireless-network-simulation-library
How to perform a system level simulation for mobile nodes without having to create them every time
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I need to perform an 802.11ax system level simulation for an outdoor mobile scenario. Right now, I am doing this by creating nodes at every iteration using the hCreateWLANNodes helper function, based on the 802.11ax Multinode System-Level Simulation of Residential Scenario example for a very large single room (ScenarioParameters.BuildingLayout = [1 1 1]). First, I would like to know if this approach is effective regarding captured statistics (even though it might not be the most efficient). Second, I would like to know if it is possible to do the same by modifying the nodes' parameters without having to create them from scratch at every iteration. Besides node position (which I already tried modifying with negative results), what other parameters should be modified?
Also, the state transitions are being plotted on a different figure at each iteration. Is it possible to visualize each iteration on the same figure?
I am attaching the base code, considering that apPositions are updated every iteration in a different part which is not included. staPositions remain fixed.
Thank you.
% Configuration Parameters
rng(1, 'simdTwister'); % Seed for random number generator
runnetsim = true; % Run wlan sim
showLiveStateTransitionPlot = true; % Show live state transition plot for all nodes
displayStatistics = true; % Display statistics at the end of the simulation
gridsize = 1000;
MaxHeight = 120;
ptIdx = 1;
N = 6;
n = 10;
% Add the folder to the path for access to all helper files
addpath(genpath(fullfile(pwd, 'mlWLANSystemSimulation')));
ScenarioParameters = struct;
% Number of rooms in [x,y,z] directions
ScenarioParameters.BuildingLayout = [1 1 1];
% Size of each room in meters [x,y,z]
ScenarioParameters.RoomSize = [gridsize gridsize MaxHeight+100];
% Number of STAs per room
ScenarioParameters.NumRxPerRoom = n;
% Drop nodes
staPositions = hDropNodes(n, gridsize);
interm = permute(pos_array(1,1:3,:),[3 2 1]);
apPositions = interm(:,:,1);
% Create triangulation object for TGax propagation model
tri = hTGaxResidentialTriangulation(ScenarioParameters);
% Set propagation model
propModel = hTGaxResidentialPathLoss('Triangulation',tri,'ShadowSigma',0,'FacesPerWall',1);
% Node parameters
% Get the IDs, positions, and traffic configurations of each node
[nodeConfigs, trafficConfigs] = hLoadConfiguration(N, n, apPositions, staPositions);
% Set abstraction level
MACFrameAbstraction = true;
PHYAbstractionType = "TGax Evaluation Methodology Appendix 1";
% Initialize WiFi visualization parameters
visualizationInfo = struct;
disablenames = true;
statsLogger = hWLANStatsLogger.empty;
networkSimulator = hWirelessNetworkSimulator.empty;
statistics = cell(0);
pl = zeros(N+n,N+n,size(pos_array, 1));
while ptIdx < 50
interm = permute(motion(ptIdx,1:3,:),[3 2 1]);
apPositions = interm(:,:,1);
if ptIdx > 1
for platcount = 1:N
nodeConfigs(platcount).NodePosition = apPositions(platcount,:);
end
end
% Create transmitter and receiver sites
[txs,rxs] = hCreateSitesFromNodes(nodeConfigs);
% Visualize the scenario
hVisualizeScenarioGUI(tri,ax,txs,rxs,apPositions,"DisableNames",disablenames);
[pl(:,:,ptIdx),tgaxIndoorPLFn] = hCreatePathlossTable(txs,rxs,propModel);
% Create nodes
wlanNodes = hCreateWLANNodes(nodeConfigs, trafficConfigs, ...
'CustomPathLoss', tgaxIndoorPLFn, 'MACFrameAbstraction', MACFrameAbstraction, 'PHYAbstractionType', PHYAbstractionType);
% WiFi visualization parameters
visualizationInfo.Nodes = wlanNodes;
if runnetsim
%statsLogger = hWLANStatsLogger(visualizationInfo);
statsLogger{1,1,ptIdx} = hWLANStatsLogger(visualizationInfo);
% Configure state transition visualization
if showLiveStateTransitionPlot
hPlotStateTransition(visualizationInfo);
end
% Initialize wireless network simulator
networkSimulator(1,1,ptIdx) = hWirelessNetworkSimulator(wlanNodes);
% When you run the script from the MATLAB command prompt, pause the
% execution to refresh visualization after every 5 milliseconds
scheduleEvent(networkSimulator(1,1,ptIdx), @() pause(0.001), [], 0, 5);
run(networkSimulator(1,1,ptIdx), (1/updateRate)*1000);
% Retrieve the statistics
statistics{1,1,ptIdx} = getStatistics(statsLogger{1,1,ptIdx}, displayStatistics);
% Plot the throughput, packet loss ratio, and average packet latency at each node
%hPlotNetworkStats(statistics{1,1,ptIdx}, wlanNodes);
end
ptIdx = ptIdx + 1;
end
0 个评论
回答(1 个)
Riya
2023-12-13
Hello William,
As per my understanding, you are performing 802.11ax system level simulation for an outdoor mobile scenario by creating nodes at every iteration using the ‘hCreateWLANNodes’ helper function.
Please note that it is difficult to say whether your approach is effective without knowing your specific requirements and performance metrics. However, creating nodes at every iteration can be computationally expensive and may not be the most efficient approach. You may want to consider modifying the node parameters instead of creating them from scratch at every iteration.
Yes, it is possible to modify the node parameters without creating them from scratch at every iteration. In your code, you can modify the ‘nodeConfigs’ struct to change the node parameters. For example, to change the position of the access points, you can modify the ‘NodePosition’ field of the corresponding ‘nodeConfigs’ struct.
To visualize each iteration on the same figure, you can create a new figure outside the loop and update it at every iteration using the hold on and plot functions. For example:
% Create a new figure
figure;
for ptIdx = 1:50
% Your simulation code here
% Plot the state transitions on the same figure
hold on;
hPlotStateTransition(visualizationInfo);
end
For more information you can refer following articles:
I hope it helps!
0 个评论
另请参阅
类别
在 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!