forked from kenny4uk/DSRC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linkadapt_plot.m
executable file
·107 lines (90 loc) · 4.62 KB
/
linkadapt_plot.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
% function plot_results
close all;
%% define the strings used for plot lines.
symbol_plot='sd^vph><+xo*sd^vph><+xo*sd^vph><+xo*'; %% one character represent one plot symbol;
len_symbol=length(symbol_plot);
style_plot='- --: -.'; %% two character represent one line style;
color_plot='k b g c m y r';
font_size=16; line_width=1.6;
for idx_period=1:sPeriodset
for idx_snr=1: sSnr
for idx_start=1:sStart
for idx_node=1:sNode
Sim.n=Sim.node_set(idx_node); % number of nodes in the BSS
Rate.start=Rate.set(ceil(rand(1,Sim.n)*sRset));
Phy.snr=Phy.snr_set(idx_snr);
Phy.snr_per= snr_per(Phy.snr, Phy.rate_mode);
Arf.sc_min=10; Arf.sc_max=50; Arf.sc_multi=2;
Onoe.ratedec_retthr=0.5; %1 default % variable for onoe, threshold to decrease rate based on retries per pk in a observation window.
Onoe.rateinc_creditthr=10; % variable for onoe, thresh on the credits to increase rate.
Onoe.creditinc_retthr=0.1; % variable for onoe, thresh on percentage of pks requiring retry to increase or decrease a credit.
Onoe.period=0.2; % observation time: 1 sec in defaul.
for idx_node=1:sNode
if Sim.cal_aarf
plot_thr_aarf(idx_node)=thr_aarf(idx_node, idx_snr, idx_period, idx_start);
plot_col_aarf(idx_node)=col_aarf(idx_node, idx_snr, idx_period, idx_start);
plot_suc_aarf(idx_node)=suc_aarf(idx_node, idx_snr, idx_period, idx_start);
plot_eneff_aarf(idx_node)=eneff_aarf(idx_node, idx_snr, idx_period, idx_start);
end
%
% if Sim.cal_onoe
% plot_thr_onoe(idx_node)=thr_onoe(idx_node, idx_snr, idx_period, idx_start);
% plot_col_onoe(idx_node)=col_onoe(idx_node, idx_snr, idx_period, idx_start);
% plot_suc_onoe(idx_node)=suc_onoe(idx_node, idx_snr, idx_period, idx_start);
% plot_eneff_onoe(idx_node)=eneff_onoe(idx_node, idx_snr, idx_period, idx_start);
% plot_pk_per_onoe(idx_node)=per_onoe(idx_node, idx_snr, idx_period, idx_start);
% end
if Sim.cal_sample
plot_thr_sample(idx_node)=thr_sample(idx_node, idx_snr, idx_period, idx_start);
plot_col_sample(idx_node)=col_sample(idx_node, idx_snr, idx_period, idx_start);
plot_suc_sample(idx_node)=suc_sample(idx_node, idx_snr, idx_period, idx_start);
% plot_pk_per_sample(idx_node)=per_sample(idx_node, idx_snr, idx_period, idx_start);
plot_eneff_sample(idx_node)=eneff_sample(idx_node, idx_snr, idx_period, idx_start);
end
end
% if Sim.cal_onoe
% fig_org=1;
% figure(fig_org+1+idx_start);
% plot(Sim.node_set, plot_thr_onoe, ['b' symbol_plot( rem(idx_snr, len_symbol) ) style_plot(1+(1-1)*2) style_plot(2+(1-1)*2)], 'LineWidth', line_width);
% hold on; grid on;
% xlabel('Number of nodes'); ylabel('Throughput');
% pause;
% % legend(['SNR: ' num2str(Phy.snr_set(1))] , ['SNR: ' num2str(Phy.snr_set(2))], ['SNR: ' num2str(Phy.snr_set(3))] , ['SNR: ' num2str(Phy.snr_set(4))]);
% end
% if Sim.cal_sample
% fig_org=100;
% figure(fig_org+1+idx_start);
% plot(Sim.node_set, plot_thr_aarf, ['g' symbol_plot( rem(idx_snr, len_symbol) ) style_plot(1+(1-1)*2) style_plot(2+(1-1)*2)], 'LineWidth', line_width);
% hold on; grid on;
% xlabel('Number of nodes'); ylabel('System throughput (bits/second)');
% % pause;
% legend(['SNR: ' num2str(Phy.snr_set(1))] , ['SNR: ' num2str(Phy.snr_set(2))], ['SNR: ' num2str(Phy.snr_set(3))] , ['SNR: ' num2str(Phy.snr_set(4))]);
% end
%
%
% x=Sim.node_set,thr_onoe;
% y=Sim.node_set,thr_aarf;
% plot(x,'rs-.');
%
% plot(y,'ms:');
% if Sim.cal_aarf
% fig_org=3;
% figure(fig_org+1+idx_start);
% plot(Sim.node_set, plot_thr_onoe, ['r' symbol_plot( rem(idx_snr, len_symbol) ) style_plot(1+(1-1)*2) style_plot(2+(1-1)*2)], 'LineWidth', line_width);
% hold on;
plot(Sim.node_set, plot_thr_aarf, ['b' symbol_plot( rem(idx_snr, len_symbol) ) style_plot(1+(1-1)*2) style_plot(2+(1-1)*2)], 'LineWidth', line_width);
hold on;
plot(Sim.node_set, plot_thr_sample, ['g' symbol_plot( rem(idx_snr, len_symbol) ) style_plot(1+(1-1)*2) style_plot(2+(1-1)*2)], 'LineWidth', line_width);
hold on; grid on;
% xlabel('Number of nodes');
% ylabel('Throughput');
% end
xlabel('Number of vehicles');
ylabel('System throughput (bits/second');
legend('AARF', 'SAMPLERATE');
hold on;
grid on;
end% for idx_node
end % for idx_start
end % for idx_snr
end % for idx_period