From 676963604ff34a04e6a8d21b0de92e77c1650f06 Mon Sep 17 00:00:00 2001 From: theano Date: Mon, 16 Nov 2015 14:07:11 -0800 Subject: [PATCH] power evaluation --- workspace/power.grc | 775 ++++++++++++++++++++++++ workspace/power_noise_tofile.grc | 406 +++++++++++++ workspace/power_signal_tofile.grc | 971 ++++++++++++++++++++++++++++++ workspace/top_block.py | 170 ++++++ 4 files changed, 2322 insertions(+) create mode 100644 workspace/power.grc create mode 100644 workspace/power_noise_tofile.grc create mode 100644 workspace/power_signal_tofile.grc create mode 100755 workspace/top_block.py diff --git a/workspace/power.grc b/workspace/power.grc new file mode 100644 index 0000000..f4f8868 --- /dev/null +++ b/workspace/power.grc @@ -0,0 +1,775 @@ + + + + Mon Nov 16 10:30:50 2015 + + options + + author + + + + window_size + + + + category + Custom + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + qt_gui + + + id + top_block + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 160) + + + _rotation + 0 + + + id + samp_rate + + + value + 32000 + + + + analog_sig_source_x + + amp + 0 + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + freq + 1000 + + + _coordinate + (128, 99) + + + _rotation + 0 + + + id + analog_sig_source_x_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + 0 + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_COS_WAVE + + + + blocks_complex_to_mag_squared + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (728, 137) + + + _rotation + 0 + + + id + blocks_complex_to_mag_squared_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_moving_average_xx + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (512, 379) + + + _rotation + 0 + + + id + blocks_moving_average_xx_0 + + + length + 1000 + + + max_iter + 4000 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + scale + 1.0/1000 + + + type + float + + + + blocks_throttle + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (328, 131) + + + _rotation + 0 + + + id + blocks_throttle_0 + + + ignoretag + True + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + samples_per_second + samp_rate + + + type + complex + + + vlen + 1 + + + + channels_channel_model + + alias + + + + block_tags + False + + + comment + + + + affinity + + + + _enabled + True + + + epsilon + 1.0 + + + freq_offset + 0 + + + _coordinate + (496, 99) + + + _rotation + 0 + + + id + channels_channel_model_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + noise_voltage + .5**.5 + + + seed + 0 + + + taps + 1.0 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + True + + + _coordinate + (696, 379) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + float + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + analog_sig_source_x_0 + blocks_throttle_0 + 0 + 0 + + + blocks_complex_to_mag_squared_0 + blocks_moving_average_xx_0 + 0 + 0 + + + blocks_moving_average_xx_0 + qtgui_time_sink_x_0 + 0 + 0 + + + blocks_throttle_0 + channels_channel_model_0 + 0 + 0 + + + channels_channel_model_0 + blocks_complex_to_mag_squared_0 + 0 + 0 + + diff --git a/workspace/power_noise_tofile.grc b/workspace/power_noise_tofile.grc new file mode 100644 index 0000000..ec541f9 --- /dev/null +++ b/workspace/power_noise_tofile.grc @@ -0,0 +1,406 @@ + + + + Mon Nov 16 10:30:50 2015 + + options + + author + + + + window_size + + + + category + Custom + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + qt_gui + + + id + top_block + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (176, 11) + + + _rotation + 0 + + + id + samp_rate + + + value + 32000 + + + + analog_sig_source_x + + amp + 0 + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + freq + 1000 + + + _coordinate + (128, 99) + + + _rotation + 0 + + + id + analog_sig_source_x_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + 0 + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_COS_WAVE + + + + blocks_complex_to_mag_squared + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (728, 137) + + + _rotation + 0 + + + id + blocks_complex_to_mag_squared_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_throttle + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (328, 131) + + + _rotation + 0 + + + id + blocks_throttle_0 + + + ignoretag + True + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + samples_per_second + samp_rate + + + type + complex + + + vlen + 1 + + + + channels_channel_model + + alias + + + + block_tags + False + + + comment + + + + affinity + + + + _enabled + True + + + epsilon + 1.0 + + + freq_offset + 0 + + + _coordinate + (496, 99) + + + _rotation + 0 + + + id + channels_channel_model_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + noise_voltage + .5**.5 + + + seed + 0 + + + taps + 1.0 + + + + blocks_file_sink + + append + False + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + file + + + + _coordinate + (920, 115) + + + _rotation + 0 + + + id + power_noise + + + type + float + + + unbuffered + False + + + vlen + 1 + + + + analog_sig_source_x_0 + blocks_throttle_0 + 0 + 0 + + + blocks_complex_to_mag_squared_0 + power_noise + 0 + 0 + + + blocks_throttle_0 + channels_channel_model_0 + 0 + 0 + + + channels_channel_model_0 + blocks_complex_to_mag_squared_0 + 0 + 0 + + diff --git a/workspace/power_signal_tofile.grc b/workspace/power_signal_tofile.grc new file mode 100644 index 0000000..5250238 --- /dev/null +++ b/workspace/power_signal_tofile.grc @@ -0,0 +1,971 @@ + + + + Mon Nov 16 13:30:39 2015 + + options + + author + + + + window_size + + + + category + Custom + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + qt_gui + + + id + top_block + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + run + + + run + True + + + thread_safe_setters + + + + title + + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 160) + + + _rotation + 0 + + + id + samp_rate + + + value + 32000 + + + + blocks_complex_to_mag_squared + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (288, 265) + + + _rotation + 180 + + + id + blocks_complex_to_mag_squared_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_moving_average_xx + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (56, 243) + + + _rotation + 180 + + + id + blocks_moving_average_xx_0_0 + + + length + 1000 + + + max_iter + 4000 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + scale + 1.0/1000 + + + type + float + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (288, 209) + + + _rotation + 180 + + + id + blocks_null_sink_0 + + + type + complex + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (160, 153) + + + _rotation + 180 + + + id + blocks_null_sink_0_0 + + + type + byte + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_null_source + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (792, 225) + + + _rotation + 180 + + + id + blocks_null_source_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_outputs + 1 + + + type + complex + + + vlen + 1 + + + + foo_periodic_msg_source + + alias + + + + comment + + + + affinity + + + + debug + False + + + _enabled + True + + + _coordinate + (296, 19) + + + _rotation + 0 + + + id + foo_periodic_msg_source_0 + + + maxoutbuf + 0 + + + msg + pmt.intern("Hello World!") + + + minoutbuf + 0 + + + num + 100 + + + interval + 100 + + + quit + True + + + + foo_wireshark_connector + + alias + + + + comment + + + + affinity + + + + debug + False + + + _enabled + True + + + _coordinate + (296, 139) + + + _rotation + 180 + + + id + foo_wireshark_connector_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + tech + 127 + + + + ieee802_11_ofdm_mac + + bss_mac + [0xff, 0xff, 0xff, 0xff, 0xff, 0xff] + + + alias + + + + comment + + + + affinity + + + + dst_mac + [0x42, 0x42, 0x42, 0x42, 0x42, 0x42] + + + _enabled + True + + + _coordinate + (576, 59) + + + _rotation + 0 + + + id + ieee802_11_ofdm_mac_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + src_mac + [0x23, 0x23, 0x23, 0x23, 0x23, 0x23] + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + True + + + _coordinate + (160, 331) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + float + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + wifi_phy_hier + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (608, 169) + + + _rotation + 180 + + + id + wifi_phy_hier_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + chan_est + 1 + + + encoding + 0 + + + + blocks_complex_to_mag_squared_0 + blocks_moving_average_xx_0_0 + 0 + 0 + + + blocks_moving_average_xx_0_0 + qtgui_time_sink_x_0 + 0 + 0 + + + blocks_null_source_0 + wifi_phy_hier_0 + 0 + 0 + + + foo_periodic_msg_source_0 + ieee802_11_ofdm_mac_0 + out + app in + + + foo_wireshark_connector_0 + blocks_null_sink_0_0 + 0 + 0 + + + ieee802_11_ofdm_mac_0 + wifi_phy_hier_0 + phy out + mac_in + + + wifi_phy_hier_0 + blocks_null_sink_0 + 1 + 0 + + + wifi_phy_hier_0 + foo_wireshark_connector_0 + mac_out + in + + + wifi_phy_hier_0 + blocks_complex_to_mag_squared_0 + 0 + 0 + + diff --git a/workspace/top_block.py b/workspace/top_block.py new file mode 100755 index 0000000..bb6ac4c --- /dev/null +++ b/workspace/top_block.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: Top Block +# Generated: Mon Nov 16 14:00:46 2015 +################################################## + +if __name__ == '__main__': + import ctypes + import sys + if sys.platform.startswith('linux'): + try: + x11 = ctypes.cdll.LoadLibrary('libX11.so') + x11.XInitThreads() + except: + print "Warning: failed to XInitThreads()" + +from PyQt4 import Qt +from gnuradio import analog +from gnuradio import blocks +from gnuradio import channels +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import qtgui +from gnuradio.eng_option import eng_option +from gnuradio.filter import firdes +from optparse import OptionParser +import sip +import sys + + +class top_block(gr.top_block, Qt.QWidget): + + def __init__(self): + gr.top_block.__init__(self, "Top Block") + Qt.QWidget.__init__(self) + self.setWindowTitle("Top Block") + try: + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + except: + pass + self.top_scroll_layout = Qt.QVBoxLayout() + self.setLayout(self.top_scroll_layout) + self.top_scroll = Qt.QScrollArea() + self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) + self.top_scroll_layout.addWidget(self.top_scroll) + self.top_scroll.setWidgetResizable(True) + self.top_widget = Qt.QWidget() + self.top_scroll.setWidget(self.top_widget) + self.top_layout = Qt.QVBoxLayout(self.top_widget) + self.top_grid_layout = Qt.QGridLayout() + self.top_layout.addLayout(self.top_grid_layout) + + self.settings = Qt.QSettings("GNU Radio", "top_block") + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate = 32000 + + ################################################## + # Blocks + ################################################## + self.qtgui_time_sink_x_0 = qtgui.time_sink_f( + 1024, #size + samp_rate, #samp_rate + "", #name + 1 #number of inputs + ) + self.qtgui_time_sink_x_0.set_update_time(0.10) + self.qtgui_time_sink_x_0.set_y_axis(-1, 1) + + self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") + + self.qtgui_time_sink_x_0.enable_tags(-1, True) + self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") + self.qtgui_time_sink_x_0.enable_autoscale(False) + self.qtgui_time_sink_x_0.enable_grid(False) + self.qtgui_time_sink_x_0.enable_control_panel(False) + + if not True: + self.qtgui_time_sink_x_0.disable_legend() + + labels = ["", "", "", "", "", + "", "", "", "", ""] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ["blue", "red", "green", "black", "cyan", + "magenta", "yellow", "dark red", "dark green", "blue"] + styles = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + markers = [-1, -1, -1, -1, -1, + -1, -1, -1, -1, -1] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in xrange(1): + if len(labels[i]) == 0: + self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) + else: + self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) + self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) + self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) + self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) + self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) + self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) + + self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) + self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) + self.channels_channel_model_0 = channels.channel_model( + noise_voltage=.5**.5, + frequency_offset=0, + epsilon=1.0, + taps=(1.0, ), + noise_seed=0, + block_tags=False + ) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) + self.blocks_moving_average_xx_0 = blocks.moving_average_ff(1000, 1.0/1000, 4000) + self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) + self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1000, 0, 0) + + ################################################## + # Connections + ################################################## + self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) + self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) + self.connect((self.channels_channel_model_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) + + def closeEvent(self, event): + self.settings = Qt.QSettings("GNU Radio", "top_block") + self.settings.setValue("geometry", self.saveGeometry()) + event.accept() + + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) + self.blocks_throttle_0.set_sample_rate(self.samp_rate) + self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) + + +def main(top_block_cls=top_block, options=None): + + from distutils.version import StrictVersion + if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): + style = gr.prefs().get_string('qtgui', 'style', 'raster') + Qt.QApplication.setGraphicsSystem(style) + qapp = Qt.QApplication(sys.argv) + + tb = top_block_cls() + tb.start() + tb.show() + + def quitting(): + tb.stop() + tb.wait() + qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + qapp.exec_() + + +if __name__ == '__main__': + main()