diff --git a/workspace/Makefile b/workspace/Makefile new file mode 100644 index 0000000..70b2058 --- /dev/null +++ b/workspace/Makefile @@ -0,0 +1,6 @@ +all: + ./wifi_loopback_noGUI.py -n $(n) -c $(c) -s $(s) -o $(o) -e $(e) -i $(i) + tshark -r result/ofdm_n$(n)_s$(s)_e$(e)_i$(i).pcap > result/n$(n)_s$(s)_e$(e)_i$(i).log + + + diff --git a/workspace/parse.py b/workspace/parse.py new file mode 100755 index 0000000..559682e --- /dev/null +++ b/workspace/parse.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import glob, os, re +import matplotlib.pyplot as plt + +x= [] +y= [] + +path = "result/" + +for filename in glob.glob(os.path.join(path, "*.log")): + pat = re.search(r"s(\d+.\d+)", filename) + pat2 = re.search(r"n(\d+)", filename) + + if pat and pat2: + x.append(float(pat.group(1))) + + receive = sum(1 for line in open(filename)) + total = pat2.group(1) + + y.append(receive/float(total)) + +plt.ylabel("PDR") +plt.xlabel("SNR") +plt.plot(x, y) +plt.show() + diff --git a/workspace/run b/workspace/run new file mode 100755 index 0000000..71b015c --- /dev/null +++ b/workspace/run @@ -0,0 +1,5 @@ +#!/bin/bash +for s in 5.0 10.0 15.0 20.0 +do +make n=10 c=1 s=$s o=0 e=0 i=500 +done diff --git a/workspace/wifi_loopback_noGUI.grc b/workspace/wifi_loopback_noGUI.grc index a62c488..5a36680 100644 --- a/workspace/wifi_loopback_noGUI.grc +++ b/workspace/wifi_loopback_noGUI.grc @@ -128,7 +128,7 @@ file - /tmp/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap + result/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap _coordinate diff --git a/workspace/wifi_loopback_noGUI.py b/workspace/wifi_loopback_noGUI.py index f188853..1a55d3d 100755 --- a/workspace/wifi_loopback_noGUI.py +++ b/workspace/wifi_loopback_noGUI.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Wifi Loopback Nogui -# Generated: Tue Nov 3 19:25:31 2015 +# Generated: Wed Nov 4 13:47:34 2015 ################################################## import os @@ -66,7 +66,7 @@ class wifi_loopback_noGUI(gr.top_block): ) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(((10**(snr/10.0))**.5, )) - self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap", False) + self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "result/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap", False) self.blocks_file_sink_0_0.set_unbuffered(True) ################################################## @@ -95,8 +95,8 @@ class wifi_loopback_noGUI(gr.top_block): def set_encoding(self, encoding): self.encoding = encoding - self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") self.wifi_phy_hier_0.set_encoding(self.encoding) + self.blocks_file_sink_0_0.open("result/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") def get_freq_offset(self): return self.freq_offset @@ -110,22 +110,22 @@ class wifi_loopback_noGUI(gr.top_block): def set_interval(self, interval): self.interval = interval - self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") + self.blocks_file_sink_0_0.open("result/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") def get_nmessages(self): return self.nmessages def set_nmessages(self, nmessages): self.nmessages = nmessages - self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") + self.blocks_file_sink_0_0.open("result/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") def get_snr(self): return self.snr def set_snr(self, snr): self.snr = snr - self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") self.blocks_multiply_const_vxx_0.set_k(((10**(self.snr/10.0))**.5, )) + self.blocks_file_sink_0_0.open("result/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap") def get_out_buf_size(self): return self.out_buf_size