-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrunMain.m
More file actions
73 lines (59 loc) · 3.36 KB
/
runMain.m
File metadata and controls
73 lines (59 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function runMain( map, sumo, BS, linkBudget )
%runMain The main function of the simulator - it is responsible for all the
% functionalities of the framework.
%
% Input :
% map : Structure containing all map settings (filename, path,
% simplification tolerance to be used, etc).
% sumo : Structure containing all the SUMO settings (maximum
% number of vehicles, start time, end time, etc.)
% BS : Structure to be filled with the basestation information
% linkBudget : Structure to be filled with the link budget information
%
% Copyright (c) 2019-2020, Ioannis Mavromatis
% email: ioan.mavromatis@bristol.ac.uk
% email: ioannis.mavromatis@toshiba-bril.com
global SIMULATOR
startTraci(sumo)
[ BS, linkBudget, map ] = loadRATs(BS,linkBudget,map);
outputMap = loadMap(map,sumo);
if isempty(outputMap)
fprintf('No network file was loaded! Something went wrong...\n')
error('Check the network file given by the user');
end
outputMap = mapSmallerAreas(outputMap,map);
outputMap = mapTiles(outputMap,map);
outputMap = alignToXY(outputMap);
outputMap = buildingCentres(outputMap);
% Assume that node-to-node communication will only take place using the
% femtocell communication plane
[ losIDsPerTile, nLosIDsPerTile,losNlosStatusPerTile, distancePerTile, sortedIndicesPerTile, ...
initialLosV2VRSS, initialNLosV2VRSS, initialRssAllV2V] = ...
perTileLosNLosCaching(outputMap,BS,linkBudget,map,'mmWaves');
potentialBSPos = potentialBSPositions(outputMap, BS, map,linkBudget);
[ losIDsPerRAT,nLosIDsPerRAT, losNlosStatusPerRAT, distancePerRAT, ...
sortedIndexesPerRat, initialLosTilesRSS, initialNLosTilesRSS, initialRssAll, ...
distanceBuildings, sortedIndexesBuildings, rssBuildings ] = ...
perRATTiles(outputMap,potentialBSPos,BS,map);
% Find the best positions to deploy a BS (works just for the femtocell
% technologies.
[ chosenRSUpos, tilesCovered, highestRSS ] = ...
bsPlacement(map,outputMap,BS,potentialBSPos,losIDsPerRAT,nLosIDsPerRAT,initialRssAll,sortedIndexesPerRat,losNlosStatusPerRAT);
if strcmp(SIMULATOR.scenario,'osm')
% Return empty arrays if the OSM functionality is chosen -- The
% vehicular and pedestrian mobilities will not be parsed.
vehicles = [];
pedestrians = [];
runOSM(map,BS,outputMap,potentialBSPos,distancePerRAT,sortedIndexesPerRat,losNlosStatusPerRAT,initialRssAll);
elseif strcmp(SIMULATOR.scenario,'sumo')
[ vehicles, pedestrians ] = runSUMO(sumo,map,BS,outputMap,potentialBSPos,chosenRSUpos, tilesCovered,distancePerRAT,sortedIndexesPerRat,losNlosStatusPerRAT,initialRssAll, distanceBuildings, sortedIndexesBuildings, rssBuildings);
elseif strcmp(SIMULATOR.scenario,'v2v')
[ vehicles, pedestrians ] = runV2V(sumo,map,BS,outputMap,distancePerTile,sortedIndicesPerTile,losNlosStatusPerTile,initialRssAllV2V);
else
fprintf('Wrong scenario name. Please check the chosen scenario in simSettings.m file.\n')
error('Wrong chosen scenario.');
end
[ vehiclesStruct, pedestriansStruct ] = parseMobility(sumo, vehicles, pedestrians);
printAnimate(sumo,vehiclesStruct,pedestriansStruct,outputMap)
traci.close();
end