-
Notifications
You must be signed in to change notification settings - Fork 3
/
optimize_numberOfChannel_2.m
73 lines (65 loc) · 3.26 KB
/
optimize_numberOfChannel_2.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
function [Final_Load,Final_TP,Final_PLR,NumberOfChannel] = optimize_numberOfChannel_2(NumberOfUser,maxChannelNumber, randomAccessFrameLength,packetReadyProb,maxRepetitionRate)
%This function is almost same with the function
%"optimize_numberOfChannel.m", which gives the optimum number of channel with given number of
%Active Users, randomAccessFrameLength, and degree distribution under the
%constraints of maxChannelNumber and Packet Loss Rate of 0.1. This function
%gives the normalized Load, normalized Throughput and Packet Loss Rate as
%additional outputs when the optimum channel number is used. This function
%is written to take some insights about dynamics.
% +++ Inputs
% - NumberOfUser: Number of users
% - maxChannelNumber: maximum usable number of channels
% - randomAccessFrameLength: How many slots has one IRSA frame?
% - packetReadyProb: The probabiliy of a user being active in a frame
% - maxRepetitionRate: defines the degree distribution
% - 2.3: 0.7x^2 + 0.3x^3 defined by MG, CM
% - 3: x^3 defined by MG, CM
% - 4: 0.5102x^2 + 0.4898x^4 from G. Liva
% - 5: 0.5631x^2 + 0.0436x^3 + 0.3933x^5 from G. Liva
% - 6: 0.5465x^2 + 0.1623x^3 + 0.2912x^6 from G. Liva
% - 8: 0.5x^2 + 0.28x^3 + 0.22x^8 from G. Liva
% - otherwise: 0.4977x^2 + 0.2207x^3 + 0.0381x^4 + 0.0756x^5 + 0.0398x^6 ...
% + 0.0009x^7 + 0.0088x^8 + 0.0068x^9 + 0.0030x^11 + 0.0429x^14 + 0.0081x^15 + 0.0576x^16 from G. Liva
%
% +++ Outputs
% - Final_Load: The normalized Load found by the simulator by using optimum
% channel number
% - Final_TP: The normalized Throughput found by the simulator by using optimum
% channel number
% - Final_PLR: The Packet Loss Rate found by the simulator by using optimum
% channel number
% - NumberOfChannel: optimum number of channel which maximizes the
% normalized throughout under the constraint of Packet Loss Rate of 0.1
Load=zeros(1,maxChannelNumber);
Throughput=zeros(1,maxChannelNumber);
PLR=zeros(1,maxChannelNumber);
maxPLR=0.1; %Packet Loss Rate constraint
for c=1:maxChannelNumber
ExpectedUseronchannel = round(NumberOfUser/c); %Assume each channel has equal number of users like expectation
if(ExpectedUseronchannel < 3)
Load(c)=0;
Throughput(c)=0;
PLR(c)=0;
else
%It's better to make 50 consequent RAFs instead of just 1 RAF while
%calling the IRSA simulator, because one of extreme scenarios can
%happen in 1 RAF and our optimization can fail in the real scenario.
%But we can avoid these extreme cases by taking average of 50
%consequent RAFs.
[Load(c),Throughput(c),PLR(c)] = irsa(ExpectedUseronchannel,randomAccessFrameLength,packetReadyProb,maxRepetitionRate,50);
end
end
[~,NumberOfChannel]=max(Throughput);
%In real scenarios, we have packet loss rate constraint. Therefore, we
%should conside this constraint before finding the optimum channel number.
while(PLR(NumberOfChannel)>maxPLR)
NumberOfChannel=NumberOfChannel+1;
if( NumberOfChannel > maxChannelNumber)
NumberOfChannel = maxChannelNumber;
break
end
end
Final_Load=Load(NumberOfChannel);
Final_TP=Throughput(NumberOfChannel);
Final_PLR=PLR(NumberOfChannel);
end