forked from Sonohi/monster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
74 lines (59 loc) · 1.76 KB
/
main.m
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
73
74
% MAIN
%
% Simulation Parameters
% reset -> resets the paths and refreshes them
% schRounds -> overall length of the simulation
% numSubFramesMacro -> bandwidth of macro cell
% (100 subframes = 20 MHz bandwidth)
% numSubFramesMicro -> bandwidth of micro cell
% numMacro -> number of macro cells
% numMicro -> number of micro cells
% seed -> seed for channel
% buildings -> file path for coordinates of Manhattan grid
% velocity -> velocity of Users
% numUsers -> number of Users
% utilLoThr -> lower threshold of utilisation
% utilHiThr -> upper threshold of utilisation
% Channel.mode -> channel model to be used
clearvars;
clc;
close all;
% Load parameters
initParam;
% Set Log level
setpref('sonohiLog','logLevel',4)
validateParam(Param);
sonohi(Param.reset);
% Disable warnings about casting classes to struct
w = warning('off', 'all');
% Create Stations and Users
[Stations, Param.AreaPlot] = createBaseStations(Param);
Users = createUsers(Param);
% Create Channel scenario
Channel = ChBulk_v2(Param);
% Create channel estimator
ChannelEstimator = createChannelEstimator();
% Utilisation ranges
utilLo = 1:Param.utilLoThr;
utilHi = Param.utilHiThr:100;
% Create struct to pass data to the simulation function
simData = struct('trSource', trSource, 'Stations', Stations, 'Users', Users,...
'Channel', Channel, 'ChannelEstimator', ChannelEstimator);
% if set, clean the results folder
if Param.rmResults
removeResults();
end
% create status mapping
status = [
"active", ...
"overload", ...
"underload", ...
"shutdown", ...
"inactive", ...
"boot"];
% Main loop
for iUtilLo = 1: length(utilLo)
for iUtilHi = 1:length(utilHi)
simulate(Param, simData, utilLo(iUtilLo), utilHi(iUtilHi));
end
end