forked from loggerboard/NetSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
66 lines (63 loc) · 2.17 KB
/
plot.py
File metadata and controls
66 lines (63 loc) · 2.17 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
from numpy import *
import matplotlib.pyplot as plt
b=[[],[],[]]
tp=[[],[],[]]
pdr=[[],[],[]]
aed=[[],[],[]]
co=[[],[],[]]
rp=['AODV', 'DSDV', 'DSR']
Bb={'p' : 'Pause Time', 'd' : 'Dimensionality', 'n' : 'Number of Nodes'}
B=raw_input('basis? : ')
for i,r in enumerate(rp):
f=open(r+'/'+r+'.txt', 'r')
for x in xrange(5):
b[i].append(float(f.readline().split('\t')[1][:-1]))
tp[i].append(float(f.readline().split('\t')[1][:-1]))
pdr[i].append(float(f.readline().split('\t')[1][:-1]))
aed[i].append(float(f.readline().split('\t')[1][:-1]))
co[i].append(float(f.readline().split('\t')[1][:-1]))
s=Bb[B]
plt.figure(1)
plt.plot(b[0],tp[0],'ro-', label=rp[0])
plt.plot(b[1],tp[1],'go-', label=rp[1])
plt.plot(b[2],tp[2],'bo-', label=rp[2])
plt.title('Throughput Vs '+s)
plt.xlabel(s)
plt.ylabel('Throughput')
art = []
lgd = plt.legend(loc=9, bbox_to_anchor=(0.5, -0.1), ncol=3)
art.append(lgd)
plt.savefig('plots/'+B+'/throughput.png', additional_artists=art, bbox_inches="tight")
plt.figure(2)
plt.plot(b[0],pdr[0],'ro-', label=rp[0])
plt.plot(b[1],pdr[1],'go-', label=rp[1])
plt.plot(b[2],pdr[2],'bo-', label=rp[2])
plt.title('Packet Delivery Ratio Vs '+s)
plt.xlabel(s)
plt.ylabel('Packet Delivery Ratio')
art = []
lgd = plt.legend(loc=9, bbox_to_anchor=(0.5, -0.1), ncol=3)
art.append(lgd)
plt.savefig('plots/'+B+'/pcktdlvryratio.png', additional_artists=art, bbox_inches="tight")
plt.figure(3)
plt.plot(b[0],aed[0],'ro-', label=rp[0])
plt.plot(b[1],aed[1],'go-', label=rp[1])
plt.plot(b[2],aed[2],'bo-', label=rp[2])
plt.title('Average End-to-End Delay Vs '+s)
plt.xlabel(s)
plt.ylabel('Average End-to-End Delay')
art = []
lgd = plt.legend(loc=9, bbox_to_anchor=(0.5, -0.1), ncol=3)
art.append(lgd)
plt.savefig('plots/'+B+'/e2edelay.png', additional_artists=art, bbox_inches="tight")
plt.figure(4)
plt.plot(b[0],co[0],'ro-', label=rp[0])
plt.plot(b[1],co[1],'go-', label=rp[1])
plt.plot(b[2],co[2],'bo-', label=rp[2])
plt.title('Control Overhead Vs '+s)
plt.xlabel(s)
plt.ylabel('Control Overhead')
art = []
lgd = plt.legend(loc=9, bbox_to_anchor=(0.5, -0.1), ncol=3)
art.append(lgd)
plt.savefig('plots/'+B+'/ctrloverhead.png', additional_artists=art, bbox_inches="tight")