def __init__(self, chan_est=0): gr.top_block.__init__(self, "Top Block Waveforms") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block Waveforms") 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_waveforms") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chan_est = chan_est ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e5 self.period = period = 1000 self.pdu_length = pdu_length = 1000 self.out_buf_size = out_buf_size = 96000 self.freq_sin = freq_sin = 1000 self.freq = freq = 943e6 self.decimation = decimation = 40 ################################################## # Blocks ################################################## self._period_range = Range(1, 10000, 1, 1000, 200) self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float) self.top_layout.addWidget(self._period_win) self._pdu_length_range = Range(10, 1500, 1, 1000, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int) self.top_layout.addWidget(self._pdu_length_win) self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.050) self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0_1.set_y_label("Received Samples", "") self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode( qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.05, 5e-3, 0, "encoding") self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1.disable_legend() labels = [ "correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", "" ] 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(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0_0_0_1.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255])) self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200) self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float) self.top_layout.addWidget(self._freq_sin_win) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.01, 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, 5e5, True) self.blocks_message_strobe_0_0 = blocks.message_strobe( pmt.intern("Hola __" + "".join("x" for i in range(pdu_length)) + "1234"), period) self.COWN_tx_valve3_0 = COWN.tx_valve3() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.connect((self.COWN_tx_valve3_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0_0_0_1, 0))
def __init__(self, chan_est=0): gr.top_block.__init__(self, "Top Block Waveforms") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block Waveforms") 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_waveforms") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chan_est = chan_est ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e5 self.period = period = 1000 self.pdu_length = pdu_length = 1000 self.out_buf_size = out_buf_size = 96000 self.freq_sin = freq_sin = 1000 self.freq = freq = 943e6 self.decimation = decimation = 40 ################################################## # Blocks ################################################## self._period_range = Range(1, 10000, 1, 1000, 200) self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float) self.top_layout.addWidget(self._period_win) self._pdu_length_range = Range(10, 1500, 1, 1000, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int) self.top_layout.addWidget(self._pdu_length_win) self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.050) self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0_1.set_y_label("Received Samples", "") self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.05, 5e-3, 0, "encoding") self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1.disable_legend() labels = ["correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", ""] 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(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255])) self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200) self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float) self.top_layout.addWidget(self._freq_sin_win) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.01, 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, 5e5,True) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("Hola __" +"".join("x" for i in range(pdu_length)) + "1234"), period) self.COWN_tx_valve3_0 = COWN.tx_valve3() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.connect((self.COWN_tx_valve3_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0_0_0_1, 0))