def __init__(self, filename="/tmp/data.dat"): gr.top_block.__init__(self, "Such Samples, /tmp/data.dat Wow!") Qt.QWidget.__init__(self) self.setWindowTitle("Such Samples, /tmp/data.dat Wow!") 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", "such_samples") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.filename = filename ################################################## # Blocks ################################################## self.pyqt_range_input_0 = pyqt.range_input() self._pyqt_range_input_0_win = self.pyqt_range_input_0 self.top_layout.addWidget(self._pyqt_range_input_0_win) self.pyqt_file_message_souce_0 = pyqt.file_message_source( filename, "complex64") self.pyqt_ctime_plot_0 = pyqt.ctime_plot("Much Time") self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_layout.addWidget(self._pyqt_ctime_plot_0_win) self.pyqt_cpsd_plot_0 = pyqt.cpsd_plot("Very Frequency") self._pyqt_cpsd_plot_0_win = self.pyqt_cpsd_plot_0 self.top_layout.addWidget(self._pyqt_cpsd_plot_0_win) ################################################## # Connections ################################################## self.msg_connect((self.pyqt_file_message_souce_0, 'pdus'), (self.pyqt_cpsd_plot_0, 'cpdus')) self.msg_connect((self.pyqt_file_message_souce_0, 'pdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.pyqt_file_message_souce_0, 'file_range'), (self.pyqt_range_input_0, 'file_range')) self.msg_connect((self.pyqt_range_input_0, 'range'), (self.pyqt_file_message_souce_0, 'range'))
def __init__(self, filename="/tmp/data"): gr.top_block.__init__(self, "Such Samples, /tmp/data Wow!") Qt.QWidget.__init__(self) self.setWindowTitle("Such Samples, /tmp/data Wow!") 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", "such_samples") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.filename = filename ################################################## # Blocks ################################################## self.pyqt_range_input_0 = pyqt.range_input() self._pyqt_range_input_0_win = self.pyqt_range_input_0; self.top_layout.addWidget(self._pyqt_range_input_0_win) self.pyqt_file_message_souce_0 = pyqt.file_message_source(filename, "complex64") self.pyqt_ctime_plot_0 = pyqt.ctime_plot("Much Time") self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.top_layout.addWidget(self._pyqt_ctime_plot_0_win) self.pyqt_cpsd_plot_0 = pyqt.cpsd_plot("Very Frequency") self._pyqt_cpsd_plot_0_win = self.pyqt_cpsd_plot_0; self.top_layout.addWidget(self._pyqt_cpsd_plot_0_win) ################################################## # Connections ################################################## self.msg_connect((self.pyqt_file_message_souce_0, 'pdus'), (self.pyqt_cpsd_plot_0, 'cpdus')) self.msg_connect((self.pyqt_file_message_souce_0, 'pdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.pyqt_file_message_souce_0, 'file_range'), (self.pyqt_range_input_0, 'file_range')) self.msg_connect((self.pyqt_range_input_0, 'range'), (self.pyqt_file_message_souce_0, 'range'))
def __init__(self): gr.top_block.__init__(self, "Modes Uf Rx Sigmf V2") Qt.QWidget.__init__(self) self.setWindowTitle("Modes Uf Rx Sigmf V2") qtgui.util.check_set_qss() 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", "modes_uf_rx_sigmf_v2") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sps = sps = 2 self.samp_rate = samp_rate = 8000000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( 1, 1, 0.5, 0.4, 32) self.rms_alpha = rms_alpha = 1e-6 self.rf_gain = rf_gain = 45 self.qt_thresh = qt_thresh = 110 self.es_thresh = es_thresh = 110 self.det_mult = det_mult = 2 self.det_avg_len = det_avg_len = 20 self.cons_offset = cons_offset = 5 self.burst_length = burst_length = 600 self.bit_thresh = bit_thresh = 5 self.avg_len = avg_len = 20 ################################################## # Blocks ################################################## self._rms_alpha_tool_bar = Qt.QToolBar(self) self._rms_alpha_tool_bar.addWidget(Qt.QLabel("rms_alpha" + ": ")) self._rms_alpha_line_edit = Qt.QLineEdit(str(self.rms_alpha)) self._rms_alpha_tool_bar.addWidget(self._rms_alpha_line_edit) self._rms_alpha_line_edit.returnPressed.connect( lambda: self.set_rms_alpha( eng_notation.str_to_num( str(self._rms_alpha_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rms_alpha_tool_bar, 6, 3, 1, 1) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._qt_thresh_tool_bar = Qt.QToolBar(self) self._qt_thresh_tool_bar.addWidget(Qt.QLabel("qt_thresh" + ": ")) self._qt_thresh_line_edit = Qt.QLineEdit(str(self.qt_thresh)) self._qt_thresh_tool_bar.addWidget(self._qt_thresh_line_edit) self._qt_thresh_line_edit.returnPressed.connect( lambda: self.set_qt_thresh( eng_notation.str_to_num( str(self._qt_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._qt_thresh_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._es_thresh_tool_bar = Qt.QToolBar(self) self._es_thresh_tool_bar.addWidget(Qt.QLabel('ES Thresh' + ": ")) self._es_thresh_line_edit = Qt.QLineEdit(str(self.es_thresh)) self._es_thresh_tool_bar.addWidget(self._es_thresh_line_edit) self._es_thresh_line_edit.returnPressed.connect( lambda: self.set_es_thresh( eng_notation.str_to_num( str(self._es_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._es_thresh_tool_bar, 0, 5, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._det_mult_tool_bar = Qt.QToolBar(self) self._det_mult_tool_bar.addWidget(Qt.QLabel("det_mult" + ": ")) self._det_mult_line_edit = Qt.QLineEdit(str(self.det_mult)) self._det_mult_tool_bar.addWidget(self._det_mult_line_edit) self._det_mult_line_edit.returnPressed.connect( lambda: self.set_det_mult( eng_notation.str_to_num( str(self._det_mult_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_mult_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._det_avg_len_tool_bar = Qt.QToolBar(self) self._det_avg_len_tool_bar.addWidget(Qt.QLabel("det_avg_len" + ": ")) self._det_avg_len_line_edit = Qt.QLineEdit(str(self.det_avg_len)) self._det_avg_len_tool_bar.addWidget(self._det_avg_len_line_edit) self._det_avg_len_line_edit.returnPressed.connect( lambda: self.set_det_avg_len( int(str(self._det_avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_avg_len_tool_bar, 0, 9, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(9, 10): self.top_grid_layout.setColumnStretch(c, 1) self._cons_offset_tool_bar = Qt.QToolBar(self) self._cons_offset_tool_bar.addWidget(Qt.QLabel("cons_offset" + ": ")) self._cons_offset_line_edit = Qt.QLineEdit(str(self.cons_offset)) self._cons_offset_tool_bar.addWidget(self._cons_offset_line_edit) self._cons_offset_line_edit.returnPressed.connect( lambda: self.set_cons_offset( eng_notation.str_to_num( str(self._cons_offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._cons_offset_tool_bar, 0, 8, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 9): self.top_grid_layout.setColumnStretch(c, 1) self._avg_len_tool_bar = Qt.QToolBar(self) self._avg_len_tool_bar.addWidget(Qt.QLabel("avg_len" + ": ")) self._avg_len_line_edit = Qt.QLineEdit(str(self.avg_len)) self._avg_len_tool_bar.addWidget(self._avg_len_line_edit) self._avg_len_line_edit.returnPressed.connect(lambda: self.set_avg_len( eng_notation.str_to_num( str(self._avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._avg_len_tool_bar, 0, 4, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_es_tag_to_utc_0 = vcc.es_tag_to_utc(samp_rate) self.vcc_burst_snr_0 = vcc.burst_snr(25, 2) self.sigmf_source_0 = gr_sigmf.source( '/captures/adsb/20210127/MODE-S_2021-01-27T23:43:24.sigmf-data', "ci16" + ("_le" if sys.byteorder == "little" else "_be"), False) self._rf_gain_tool_bar = Qt.QToolBar(self) self._rf_gain_tool_bar.addWidget(Qt.QLabel("rf_gain" + ": ")) self._rf_gain_line_edit = Qt.QLineEdit(str(self.rf_gain)) self._rf_gain_tool_bar.addWidget(self._rf_gain_line_edit) self._rf_gain_line_edit.returnPressed.connect(lambda: self.set_rf_gain( eng_notation.str_to_num( str(self._rf_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( burst_length / 2, #size samp_rate, #samp_rate "", #name 3 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.010) self.qtgui_time_sink_x_1.set_y_axis(-5, 20) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_AUTO, qtgui.TRIG_SLOPE_POS, qt_thresh, 1.0 / samp_rate * 100, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(True) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1.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(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 0, 2, 4) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( burst_length / 2, #size samp_rate / 2, #samp_rate "soft chips", #name 3 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "es::event_type") self.qtgui_time_sink_x_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_1.enable_grid(False) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(False) self.qtgui_time_sink_x_0_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_1.disable_legend() labels = ['re', 'abs', 'mag', 'ph', '', '', '', '', '', ''] 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, 2, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, 0, -1, -1, -1, -1, -1, -1, -1] alphas = [1, 0.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_1_win, 3, 0, 3, 5) for r in range(3, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 5): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( samp_rate / 2, 20, 56, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_raster_sink_x_0_win, 3, 5, 3, 5) for r in range(3, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 10): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( burst_length / 2, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.010) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(True) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 8, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 10): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1, 4, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_const_plot_0 = pyqt.const_plot(label='') self._pyqt_const_plot_0_win = self.pyqt_const_plot_0 self.top_grid_layout.addWidget(self._pyqt_const_plot_0_win, 1, 6, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 4e6, 250e3, firdes.WIN_BLACKMAN, 6.76)) self.fosphor_glfw_sink_c_0 = fosphor.glfw_sink_c() self.fosphor_glfw_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_glfw_sink_c_0.set_frequency_range(0, samp_rate) self.es_trigger_edge_f_0 = es.trigger_edge_f(es_thresh, burst_length, burst_length / 3, gr.sizeof_gr_complex, 300) self.es_sink_0 = es.sink(1 * [gr.sizeof_gr_complex], 4, 64, 0, 2, 0) self.es_handler_pdu_0 = es.es_make_handler_pdu( es.es_handler_print.TYPE_C32) self.epy_block_1 = epy_block_1.uf_frame_sync(tag_name='sync', msg_len=112, samp_rate=samp_rate, sps=2) self.epy_block_0_0 = epy_block_0_0.uf_decode(msg_filter='All Messages', verbose=True) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( 2, math.pi / 200, (rrc_taps), 32, 16, 1.1, 1) self.digital_diff_phasor_cc_0 = digital.diff_phasor_cc() self.digital_costas_loop_cc_0 = digital.costas_loop_cc( math.pi / 50, 2, False) self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0 = digital.correlate_access_code_tag_bb( '00011111000111000001', 3, 'sync') self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * 2, True) self.blocks_sub_xx_2_0 = blocks.sub_ff(1) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float * 1, 1) self.blocks_rms_xx_1 = blocks.rms_cf(rms_alpha) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'est_len') (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(600) self.blocks_pdu_remove_0 = blocks.pdu_remove( pmt.intern("es::event_buffer")) self.blocks_multiply_const_xx_0 = blocks.multiply_const_cc(1.0 / 65536.0) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (-1 * det_mult, )) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff( int(det_avg_len), 1.0 / det_avg_len, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( int(avg_len), 1.0 / avg_len, 4000, 1) self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex( True, False) self.blocks_complex_to_real_1_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1 / 10.0) self.blocks_add_const_vxx_0 = blocks.add_const_vff((cons_offset, )) self.blocks_abs_xx_0 = blocks.abs_ff(1) self._bit_thresh_tool_bar = Qt.QToolBar(self) self._bit_thresh_tool_bar.addWidget(Qt.QLabel("bit_thresh" + ": ")) self._bit_thresh_line_edit = Qt.QLineEdit(str(self.bit_thresh)) self._bit_thresh_tool_bar.addWidget(self._bit_thresh_line_edit) self._bit_thresh_line_edit.returnPressed.connect( lambda: self.set_bit_thresh( eng_notation.str_to_num( str(self._bit_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bit_thresh_tool_bar, 6, 4, 1, 1) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.vcc_burst_snr_0, 'in')) self.msg_connect((self.epy_block_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.epy_block_1, 'out'), (self.epy_block_0_0, 'in')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.vcc_burst_snr_0, 'out'), (self.vcc_es_tag_to_utc_0, 'in')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.pyqt_const_plot_0, 'cpdus')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect( (self.ais_invert_0, 0), (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.analog_agc2_xx_0, 0), (self.fosphor_glfw_sink_c_0, 0)) self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_time_sink_x_1, 2)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_0_1, 2)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.qtgui_time_sink_x_1, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_real_1_0_0, 0), (self.blocks_sub_xx_2_0, 0)) self.connect((self.blocks_complex_to_real_1_0_0, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_interleaved_short_to_complex_0, 0), (self.blocks_multiply_const_xx_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.blocks_rms_xx_1, 0), (self.blocks_sub_xx_2_0, 1)) self.connect((self.blocks_rms_xx_1, 0), (self.qtgui_time_sink_x_0_1, 1)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0)) self.connect((self.blocks_sub_xx_2_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.ais_invert_0, 0)) self.connect( (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect( (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0), (self.epy_block_1, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_diff_phasor_cc_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_diff_phasor_cc_0, 0), (self.blocks_complex_to_real_1_0_0, 0)) self.connect((self.digital_diff_phasor_cc_0, 0), (self.blocks_rms_xx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.sigmf_source_0, 0), (self.blocks_interleaved_short_to_complex_0, 0))
def __init__(self): gr.top_block.__init__(self, "VCC Satellite Simulator") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Satellite Simulator") qtgui.util.check_set_qss() 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", "satsim_v1") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250000 self.tx_tune_sel = tx_tune_sel = 0 self.tx_offset = tx_offset = samp_rate/2 self.tx_gain = tx_gain = 40 self.tx_freq = tx_freq = 401.08e6 self.trigger_thresh = trigger_thresh = -2 self.rx_offset = rx_offset = samp_rate/2.0 self.rx_gain = rx_gain = 40 self.rx_freq = rx_freq = 401.08e6 self.rx_fine_tune = rx_fine_tune = 0 self.man_tune = man_tune = 0.0 self.interp_2 = interp_2 = 1 self.interp = interp = 48 self.fsk_dev = fsk_dev = 10000 self.decim_2 = decim_2 = 2 self.decim = decim = int(samp_rate/2000) self.chan_filt_trans = chan_filt_trans = 1000 self.chan_filt_cutoff = chan_filt_cutoff = 24000 self.bb_gain = bb_gain = .75 self.baud = baud = 9600 ################################################## # Blocks ################################################## self.main_tab = Qt.QTabWidget() self.main_tab_widget_0 = Qt.QWidget() self.main_tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_0) self.main_tab_grid_layout_0 = Qt.QGridLayout() self.main_tab_layout_0.addLayout(self.main_tab_grid_layout_0) self.main_tab.addTab(self.main_tab_widget_0, 'Full Band') self.main_tab_widget_1 = Qt.QWidget() self.main_tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_1) self.main_tab_grid_layout_1 = Qt.QGridLayout() self.main_tab_layout_1.addLayout(self.main_tab_grid_layout_1) self.main_tab.addTab(self.main_tab_widget_1, 'RX Channel') self.main_tab_widget_2 = Qt.QWidget() self.main_tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_2) self.main_tab_grid_layout_2 = Qt.QGridLayout() self.main_tab_layout_2.addLayout(self.main_tab_grid_layout_2) self.main_tab.addTab(self.main_tab_widget_2, 'TX Channel') self.top_grid_layout.addWidget(self.main_tab, 0, 0, 2, 8) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain'+": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect( lambda: self.set_tx_gain(eng_notation.str_to_num(str(self._tx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_gain_tool_bar, 2, 3, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(3, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_freq_tool_bar = Qt.QToolBar(self) self._tx_freq_tool_bar.addWidget(Qt.QLabel('TX Freq'+": ")) self._tx_freq_line_edit = Qt.QLineEdit(str(self.tx_freq)) self._tx_freq_tool_bar.addWidget(self._tx_freq_line_edit) self._tx_freq_line_edit.returnPressed.connect( lambda: self.set_tx_freq(eng_notation.str_to_num(str(self._tx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_freq_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._trigger_thresh_tool_bar = Qt.QToolBar(self) self._trigger_thresh_tool_bar.addWidget(Qt.QLabel('Trigger Thresh'+": ")) self._trigger_thresh_line_edit = Qt.QLineEdit(str(self.trigger_thresh)) self._trigger_thresh_tool_bar.addWidget(self._trigger_thresh_line_edit) self._trigger_thresh_line_edit.returnPressed.connect( lambda: self.set_trigger_thresh(eng_notation.str_to_num(str(self._trigger_thresh_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._trigger_thresh_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('RX Gain'+": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect( lambda: self.set_rx_gain(eng_notation.str_to_num(str(self._rx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('RX Freq'+": ")) self._rx_freq_line_edit = Qt.QLineEdit(str(self.rx_freq)) self._rx_freq_tool_bar.addWidget(self._rx_freq_line_edit) self._rx_freq_line_edit.returnPressed.connect( lambda: self.set_rx_freq(eng_notation.str_to_num(str(self._rx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_freq_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_fine_tune_tool_bar = Qt.QToolBar(self) self._rx_fine_tune_tool_bar.addWidget(Qt.QLabel('RX Fine Tune'+": ")) self._rx_fine_tune_line_edit = Qt.QLineEdit(str(self.rx_fine_tune)) self._rx_fine_tune_tool_bar.addWidget(self._rx_fine_tune_line_edit) self._rx_fine_tune_line_edit.returnPressed.connect( lambda: self.set_rx_fine_tune(eng_notation.str_to_num(str(self._rx_fine_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._rx_fine_tune_tool_bar, 3, 4, 1, 2) for r in range(3, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._man_tune_tool_bar = Qt.QToolBar(self) self._man_tune_tool_bar.addWidget(Qt.QLabel('TX Freq Offset'+": ")) self._man_tune_line_edit = Qt.QLineEdit(str(self.man_tune)) self._man_tune_tool_bar.addWidget(self._man_tune_line_edit) self._man_tune_line_edit.returnPressed.connect( lambda: self.set_man_tune(eng_notation.str_to_num(str(self._man_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._man_tune_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain'+": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect( lambda: self.set_bb_gain(eng_notation.str_to_num(str(self._bb_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._bb_gain_tool_bar, 2, 2, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 3): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx_0 = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_0_win = self.vcc_qt_hex_text_tx_0; self.main_tab_grid_layout_1.addWidget(self._vcc_qt_hex_text_tx_0_win, 5, 0, 2, 6) for r in range(5, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx; self.main_tab_grid_layout_2.addWidget(self._vcc_qt_hex_text_tx_win, 0, 0, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, rx_offset), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('TX/RX', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self._tx_tune_sel_options = (0, 1, ) self._tx_tune_sel_labels = ('Auto', 'Manual', ) self._tx_tune_sel_tool_bar = Qt.QToolBar(self) self._tx_tune_sel_tool_bar.addWidget(Qt.QLabel('TX Tune Mode'+": ")) self._tx_tune_sel_combo_box = Qt.QComboBox() self._tx_tune_sel_tool_bar.addWidget(self._tx_tune_sel_combo_box) for label in self._tx_tune_sel_labels: self._tx_tune_sel_combo_box.addItem(label) self._tx_tune_sel_callback = lambda i: Qt.QMetaObject.invokeMethod(self._tx_tune_sel_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._tx_tune_sel_options.index(i))) self._tx_tune_sel_callback(self.tx_tune_sel) self._tx_tune_sel_combo_box.currentIndexChanged.connect( lambda i: self.set_tx_tune_sel(self._tx_tune_sel_options[i])) self.main_tab_grid_layout_2.addWidget(self._tx_tune_sel_tool_bar, 3, 1, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.rational_resampler_xxx_4 = filter.rational_resampler_ccc( interpolation=interp/2, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.0010) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_waterfall_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-50, 50) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 0, 2, 4) for r in range(2, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1, 0, 1, 8) for r in range(1, 2): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "VCC RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_1.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0_1.set_y_axis(-150, -40) self.qtgui_freq_sink_x_1_0_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_1.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_1.enable_grid(True) self.qtgui_freq_sink_x_1_0_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_1.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_1_0_1_win, 0, 0, 1, 8) for r in range(0, 1): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/decim*interp/2, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 2, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "Narrow Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0.set_y_axis(-50, 50) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*interp/decim*interp_2/decim_2, #bw "Burst RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['orig', 'corr', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 4, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_meta_text_output_0_win, 3, 6, 4, 2) for r in range(3, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(6, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 1, 4) for r in range(2, 3): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp, chan_filt_cutoff, chan_filt_trans, firdes.WIN_HAMMING, 6.76)) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bb_gain=bb_gain, bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.25, samp_rate=samp_rate, ) self.gmsk_ax25_rx_hier_0 = gmsk_ax25_rx_hier( lpf_cutoff=7.2e3, lpf_trans=1e3, quad_demod_gain=(samp_rate/decim*interp/decim_2*interp_2)/(2*math.pi*fsk_dev/8.0), samp_rate=(samp_rate/decim*interp) / decim_2 * interp_2, samps_per_symb=(samp_rate/decim*interp / baud) / decim_2 * interp_2, ) self.fsk_burst_detector_0 = fsk_burst_detector( avg_len=100.0, cons_offset=3, decim=decim, fsk_dev=fsk_dev, interp=interp, samp_rate=samp_rate, ) self.burst_rx_es_hier_0 = burst_rx_es_hier( avg_len=100, baud=9600, samp_rate=samp_rate/decim*interp, samps_per_symb=samp_rate/decim*interp / baud, trigger_thresh=trigger_thresh, ) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8000', 1024, False) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * rx_fine_tune, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, man_tune, 1, 0) self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.burst_rx_es_hier_0, 'brst_corr'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.burst_rx_es_hier_0, 'meta'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.vcc_qt_hex_text_tx_0, 'pdus')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_4, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.burst_rx_es_hier_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.burst_rx_es_hier_0, 1), (self.rational_resampler_xxx_3, 0)) self.connect((self.fsk_burst_detector_0, 0), (self.burst_rx_es_hier_0, 1)) self.connect((self.gmsk_ax25_rx_hier_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.burst_rx_es_hier_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fsk_burst_detector_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_3, 0), (self.gmsk_ax25_rx_hier_0, 0)) self.connect((self.rational_resampler_xxx_4, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self, lpf_cutoff=24e3, lpf_cutoff_2=8e3, lpf_trans=1e3): gr.top_block.__init__(self, "Burst Detect Es6") Qt.QWidget.__init__(self) self.setWindowTitle("Burst Detect Es6") qtgui.util.check_set_qss() 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", "burst_detect_es6") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.lpf_cutoff = lpf_cutoff self.lpf_cutoff_2 = lpf_cutoff_2 self.lpf_trans = lpf_trans ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250000 self.interp = interp = 24*2 self.decim = decim = int(samp_rate/2000) self.baud = baud = 9600 self.samps_per_symb = samps_per_symb = int((samp_rate/decim*interp)/baud) self.offset = offset = 0 self.max_symbols = max_symbols = samps_per_symb*300*8 *2 self.interp_2 = interp_2 = 1 self.fsk_dev = fsk_dev = 10000 self.decim_2 = decim_2 = 2 self.avg_len_snr = avg_len_snr = 100.0 self.avg_len_det = avg_len_det = 100.0 ################################################## # Blocks ################################################## self._offset_tool_bar = Qt.QToolBar(self) self._offset_tool_bar.addWidget(Qt.QLabel("offset"+": ")) self._offset_line_edit = Qt.QLineEdit(str(self.offset)) self._offset_tool_bar.addWidget(self._offset_line_edit) self._offset_line_edit.returnPressed.connect( lambda: self.set_offset(eng_notation.str_to_num(str(self._offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._offset_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._avg_len_snr_tool_bar = Qt.QToolBar(self) self._avg_len_snr_tool_bar.addWidget(Qt.QLabel("avg_len_snr"+": ")) self._avg_len_snr_line_edit = Qt.QLineEdit(str(self.avg_len_snr)) self._avg_len_snr_tool_bar.addWidget(self._avg_len_snr_line_edit) self._avg_len_snr_line_edit.returnPressed.connect( lambda: self.set_avg_len_snr(eng_notation.str_to_num(str(self._avg_len_snr_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._avg_len_snr_tool_bar, 6, 4, 1, 2) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._avg_len_det_tool_bar = Qt.QToolBar(self) self._avg_len_det_tool_bar.addWidget(Qt.QLabel("avg_len_det"+": ")) self._avg_len_det_line_edit = Qt.QLineEdit(str(self.avg_len_det)) self._avg_len_det_tool_bar.addWidget(self._avg_len_det_line_edit) self._avg_len_det_line_edit.returnPressed.connect( lambda: self.set_avg_len_det(eng_notation.str_to_num(str(self._avg_len_det_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._avg_len_det_tool_bar, 5, 4, 1, 2) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_qt_hex_text_0 = vcc.qt_hex_text() self._vcc_qt_hex_text_0_win = self.vcc_qt_hex_text_0; self.top_grid_layout.addWidget(self._vcc_qt_hex_text_0_win, 4, 0, 3, 4) for r in range(4, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_burst_snr_0 = vcc.burst_snr(int(avg_len_snr)) self.vcc_burst_cfo_est_gmsk_0 = vcc.burst_cfo_est_gmsk(samp_rate * interp / decim) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp, #bw "RX Spectrum", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0, 4, 2, 4) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp, #bw "RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*interp/decim*interp_2/decim_2, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 2, 0, 2, 4) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.top_grid_layout.addWidget(self._pyqt_meta_text_output_0_win, 4, 6, 3, 2) for r in range(4, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 2, 4) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp / decim_2 *interp_2, lpf_cutoff_2, lpf_trans, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp, lpf_cutoff, lpf_trans, firdes.WIN_HAMMING, 6.76)) self.kiss_pdu_to_kiss_0 = kiss.pdu_to_kiss() self.kiss_nrzi_decode_0 = kiss.nrzi_decode() self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300) self.es_trigger_edge_f_0 = es.trigger_edge_f(-2,baud*samps_per_symb,int(avg_len_det*2),gr.sizeof_gr_complex,300) self.es_sink_0 = es.sink(1*[gr.sizeof_gr_complex],4,64,0,2,0) self.es_handler_pdu_0 = es.es_make_handler_pdu(es.es_handler_print.TYPE_C32) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samps_per_symb*(1+0.0) / decim_2, 0.25*0.175*0.175, 0.25, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.burst_length_detect_c_0 = burst.length_detect_c() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'est_len') (self.blocks_pdu_to_tagged_stream_0_0).set_min_output_buffer(96000) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'est_len') (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(96000) self.blocks_pdu_remove_0 = blocks.pdu_remove(pmt.intern("es::event_buffer")) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, )) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int(avg_len_det), 1/avg_len_det, 4000, 1) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/zleffke/captures/lithium_20180327/downlink_data_1.fc32', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_add_const_vxx_0 = blocks.add_const_vff((3, )) self.blocks_abs_xx_0 = blocks.abs_ff(1) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1*offset, 1, 0) self.analog_quadrature_demod_cf_1_0 = analog.quadrature_demod_cf((samp_rate/decim*interp/decim_2*interp_2)/(2*math.pi*fsk_dev/8.0)) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf((samp_rate/decim*interp)/(2*math.pi*fsk_dev/8.0)) self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.burst_length_detect_c_0, 'cpdus')) self.msg_connect((self.burst_length_detect_c_0, 'cpdus'), (self.vcc_burst_snr_0, 'in')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.kiss_pdu_to_kiss_0, 'in')) self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'), (self.vcc_qt_hex_text_0, 'pdus')) self.msg_connect((self.vcc_burst_cfo_est_gmsk_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.vcc_burst_cfo_est_gmsk_0, 'corrected'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.vcc_burst_cfo_est_gmsk_0, 'out'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.vcc_burst_cfo_est_gmsk_0, 'out'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.vcc_burst_snr_0, 'out'), (self.vcc_burst_cfo_est_gmsk_0, 'in')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.blocks_skiphead_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.analog_quadrature_demod_cf_1_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_nrzi_decode_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0)) self.connect((self.kiss_nrzi_decode_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_quadrature_demod_cf_1_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_freq_sink_x_1, 0))
def __init__(self, pre_bits=[ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0 ]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") qtgui.util.check_set_qss() 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", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 20e3 ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf( 2, firdes.root_raised_cosine(1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(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(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 8192, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0 self.top_grid_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0, 1, 3, 2])) self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random() * 1e-4, epsilon=1.0 + random.random() * 1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer( ([0, 14, 15]), ([1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_framer_0 = burst.framer(1024) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, '/tmp/psk_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))
def __init__(self, pre_bits=[0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") 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", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100e3 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make('/home/abraxas3d/goodies/share/gnuradio/fec/ldpc/271.127.3.112'); ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf(2, firdes.root_raised_cosine( 1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) 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(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) 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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,0,1,0) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 8192, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 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_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1,1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.top_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1,0) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0,1,3,2])) self.fec_async_encoder_0 = fec.async_encoder(ldpc_enc, False, True, True, 1500) self.es_source_0 = es.source(1*[gr.sizeof_gr_complex], 1, 2) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random()*1e-4, epsilon=1.0+random.random()*1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False ) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer(([0,14,15]), ([1,0,0,1,0,1,0,1,0,0,0,0,0,0,0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_padder_0 = burst.padder(144) self.burst_framer_0 = burst.framer(144) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256/2, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/tmp/psk_ldpc_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_padder_0, 'pdus')) self.msg_connect((self.burst_padder_0, 'pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.fec_async_encoder_0, 'in')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.fec_async_encoder_0, 'out'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))