Spatial Reuse example: different frequency operation

6 views (last 30 days)
I have been following this tutorial: Link to spatial Reuse example
I have already made many changes to the model to meet my need and run the simulation using a script to dynamically change the parameters after each run and compare the plots. However as a Baseline Simulation I wanted to have all the four BSS on different Frequency channels so that they do not interfere with each other.
I went through the channelBlocks.m file as well as generateChannels.m file but I am unable to find any solution ti my problem. I am guessing the classdef in channelBlocks.m is not even used in the main simulation while main simulation is making use of hAbstractChannel.m for the purpose where the "chan" parameters are completely different.
It would be very helpful if someone can tell me a way to dynamically change the parameters.
The code as of now:
I want to make use of channelFrequencies variable to run my simulation and allocate nodes with the channelFrequencies.
%Some initial parameters for the simulation to run
% Network wide params
obss_pd_levels=[-82];
offeredLoads=[40];
bssPositions = [0 0 0, 5 0 0, 160 10 0, 165 10 0, 330 0 0, 335 0 0, 480 10 0, 485 10 0];
NetworkTransmissionStatus = [1 0 0 0 0 0 0 0];
% PHY-based params
channelFrequencies = [5.18e9, 5.18e9, 5.18e9, 5.18e9];
% Simulation time
networkSimTime = 0.1;
% File Storage
resultStorePath = "D:\\Arista\\Simulations\\Spatial_resuse";
subdirectoryName = "BaseLineSimul\\hopa";
mkdir(resultStorePath+"\\"+subdirectoryName); % create the directory if not existing
% Setting the App states of the devices
for i=1:NumberOfNodes
PropertyModulePath = ModelName+"/Node"+i+"/Application Traffic Generator";
propertyName = "ApplicationState";
transmissionStatus = "Off";
if NetworkTransmissionStatus(i)==1
transmissionStatus="On";
end
set_param(PropertyModulePath,propertyName,transmissionStatus);
end
% Throughput results for OBSS PD thresholds
throughputs = zeros(3,5);
for i=1:length(obss_pd_levels)
OBSS_PD_level=obss_pd_levels(i);
for j=1:length(offeredLoads)
offeredLoad=offeredLoads(j);
PacketSizeBytes=offeredLoad*12.5;
sim('SpatialReuse80211axUsingBSSColoringModel.slx',networkSimTime);
filename=sprintf("%s\\%s\\offeredLoad_%d_obss_%d.mat",resultStorePath,subdirectoryName,offeredLoad,OBSS_PD_level);
copyfile('statistics.mat',filename);
graphfile=sprintf("%s\\%s\\offeredLoad_%d_obss_%d.png",resultStorePath,subdirectoryName,offeredLoad,OBSS_PD_level);
saveGraphToFile(graphfile);
graphfile=sprintf("%s\\%s\\offeredLoad_%d_obss_%d_simulation.png",resultStorePath,subdirectoryName,offeredLoad,OBSS_PD_level);
saveGraphToFile(graphfile);
load statistics.mat
throughputs(i,j)=sum(statisticsTable.Throughput)/sum(NetworkTransmissionStatus);
end
end
filename=sprintf("%s\\%s\\throughputs.mat",resultStorePath,subdirectoryName);
save(filename,'throughputs');
function saveGraphToFile(graphfile)
saveas(gcf,graphfile);
close;
end

Answers (0)

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!