This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplots_fire_rings.py
80 lines (58 loc) · 2.61 KB
/
plots_fire_rings.py
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
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#
# Generated Delivered - Time
#
Up = 6.4
fig1, ax1 = plt.subplots()
ax1.grid(zorder=0)
df = pd.read_csv('generated_delivered_v=' + str(Up) + 'ms_n=13741.csv', ';')
time = df['time' + str(Up)].to_list()
pkts_gen = df['#pkts_gen' + str(Up)].to_list()
pkts_sent = df['#pkts_sent' + str(Up)].to_list()
color = 'orange'
plt.plot(time, pkts_gen, c=color, linestyle='solid', label='Generated v=' + str(Up) + 'm/s', zorder=3)
plt.plot(time, pkts_sent, c=color, linestyle='dashed', label='Delivered v=' + str(Up) + 'm/s', zorder=3)
plt.legend(loc='upper left', edgecolor='black', prop={'size': 9}).get_frame().set_alpha(None)
ax1.set_xlabel('Time (s)')
ax1.set_ylabel('Number of packets')
# plt.savefig('generated_delivered_fire_rings_700km2.svg', bbox_inches='tight', pad_inches=0.05)
# plt.savefig('generated_delivered_fire_rings_700km2.pdf', bbox_inches='tight', pad_inches=0.05)
#
# Node densities - Packet delivery ratio (PDR)
#
# nodes = [700, 1500, 2300]
nodes = [700]
# regular = [0.9024, 0.8318, 0.7286]
regular = [0.9024]
no_ring_groups_event = [0.5766] # PDR
ring_groups_event_sf_only = [0.6525] # PDR
ring_groups_event_sf_channel = [0.73] # PDR
# x = np.arange(len(nodes)) # the label locations
x = 1 # the label locations
width = 0.005 # the width of the bars
fig2, ax2 = plt.subplots()
ax2.grid(zorder=0, which='minor', axis='y', alpha=0.3)
ax2.grid(zorder=0, which='major', axis='y', alpha=0.8)
ax2.minorticks_on()
ax2.set_yticks(ticks=np.arange(0, max(regular) + 1, 0.10))
ax2.set_yticks(np.arange(0, max(regular) + 1, 0.010), minor=True)
ax2.yaxis.set_tick_params(labelsize=12)
# ax2.set_yticklabels()
rects1 = ax2.bar(x - 3 / 2 * width - 0.002, regular, width, label='Regular traffic', zorder=3)
rects2 = ax2.bar(x + 1 / 2 * width + 0.00, ring_groups_event_sf_only, width,
label='$V_{p}$ = 6.4 m/s (ring groups - sf only)', zorder=3)
rects3 = ax2.bar(x - 1 / 2 * width - 0.001, ring_groups_event_sf_channel, width,
label='$V_{p}$ = 6.4 m/s (ring groups - sf & channel)', zorder=3)
rects4 = ax2.bar(x + 3 / 2 * width + 0.001, no_ring_groups_event, width,
label='$V_{p}$ = 6.4 m/s (no ring groups - LoRaWAN)', zorder=3)
# Add some text for labels, title and custom x-axis tick labels, etc.
# ax2.set_xlabel('Node density (per sq. km.)')
ax2.set_ylabel('Packet delivery rate (PDR)')
# ax2.set_xticklabels(nodes)
ax2.set_xticklabels(' ')
ax2.legend()
fig2.tight_layout()
# plt.savefig('pdr-node_den.svg', bbox_inches='tight', pad_inches=0.05)
# plt.savefig('pdr-node_den.pdf', bbox_inches='tight', pad_inches=0.05)