Exemple #1
0
    def __init__(self):
        gr.top_block.__init__(self, "Gotenna Rx Usrp")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000000
        self.fsk_deviation_hz = fsk_deviation_hz = 12500
        self.chan_spacing = chan_spacing = 500000
        self.baud_rate = baud_rate = 24000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", '')),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=list(range(0,1)),
            ),
        )
        self.uhd_usrp_source_0.set_center_freq(915000000, 0)
        self.uhd_usrp_source_0.set_gain(5, 0)
        self.uhd_usrp_source_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec())
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None)
        self.gotenna_sink = gotenna_sink.blk()
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_DANDREA_AND_MENGALI_GEN_MSK,
            float(chan_spacing) / baud_rate / 4,
            0.05,
            1.5,
            1.0,
            0.001 * float(chan_spacing) / baud_rate / 4,
            1,
            digital.constellation_bpsk().base(),
            digital.IR_MMSE_8TAP,
            128,
            [])
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, samp_rate // chan_spacing)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(chan_spacing/(2*math.pi*fsk_deviation_hz))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.gotenna_sink, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_keep_one_in_n_0, 0))
Exemple #2
0
    def __init__(self):
        gr.top_block.__init__(self, "Gotenna Rx Hackrf")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 500000
        self.fsk_deviation_hz = fsk_deviation_hz = 12500
        self.chan_spacing = chan_spacing = 500000
        self.baud_rate = baud_rate = 24000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + ''
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(915000000, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_gain(1, 0)
        self.osmosdr_source_0.set_if_gain(16, 0)
        self.osmosdr_source_0.set_bb_gain(1, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(26000000, 0)
        self.gotenna_sink = gotenna_sink.blk()
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_DANDREA_AND_MENGALI_GEN_MSK,
            float(chan_spacing) / baud_rate / 4,
            0.05,
            1.5,
            1.0,
            0.001 * float(chan_spacing) / baud_rate / 4,
            1,
            digital.constellation_bpsk().base(),
            digital.IR_MMSE_8TAP,
            128,
            [])
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(512, True)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(chan_spacing/(2*math.pi*fsk_deviation_hz))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.gotenna_sink, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_symbol_sync_xx_0, 0))
Exemple #3
0
    def __init__(self, MTU=1500):
        gr.top_block.__init__(self, "Telemetry Rx Final")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Telemetry Rx Final")
        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", "telemetry_rx_final")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.MTU = MTU

        ##################################################
        # Variables
        ##################################################
        self.symb_rate = symb_rate = 44643
        self.sec_dec = sec_dec = 10
        self.samp_per_symb = samp_per_symb = 10
        self.rate = rate = 2
        self.polys = polys = [109, 79]
        self.k = k = 7
        self.first_dec = first_dec = 1
        self.ss_ted_gain_range = ss_ted_gain_range = 100
        self.ss_loopbw_range = ss_loopbw_range = 0.4
        self.ss_damping_factor_range = ss_damping_factor_range = 0.5
        self.source_option = source_option = False
        self.pll_loopbw_range = pll_loopbw_range = 0.4
        self.doppler = doppler = 10000


        self.dec_cc = dec_cc = fec.cc_decoder.make(MTU*8, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False)

        self.channel_bw = channel_bw = 1200000
        self.ad_samp_rate = ad_samp_rate = symb_rate*first_dec*sec_dec*samp_per_symb

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Frequency Plot')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Control Tab')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Time')
        self.tab_widget_3 = Qt.QWidget()
        self.tab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_3)
        self.tab_grid_layout_3 = Qt.QGridLayout()
        self.tab_layout_3.addLayout(self.tab_grid_layout_3)
        self.tab.addTab(self.tab_widget_3, 'Demoded Bits')
        self.tab_widget_4 = Qt.QWidget()
        self.tab_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_4)
        self.tab_grid_layout_4 = Qt.QGridLayout()
        self.tab_layout_4.addLayout(self.tab_grid_layout_4)
        self.tab.addTab(self.tab_widget_4, 'Decoded Data')
        self.tab_widget_5 = Qt.QWidget()
        self.tab_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_5)
        self.tab_grid_layout_5 = Qt.QGridLayout()
        self.tab_layout_5.addLayout(self.tab_grid_layout_5)
        self.tab.addTab(self.tab_widget_5, 'Decrypted Data')
        self.top_grid_layout.addWidget(self.tab, 0, 0, 4, 4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._ss_ted_gain_range_range = Range(1, 1000, 1, 100, 10000)
        self._ss_ted_gain_range_win = RangeWidget(self._ss_ted_gain_range_range, self.set_ss_ted_gain_range, 'Symbol Sync TED gain', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_ted_gain_range_win, 1, 2, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(2, 3):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._ss_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._ss_loopbw_range_win = RangeWidget(self._ss_loopbw_range_range, self.set_ss_loopbw_range, 'Symbol Sync LBW', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_loopbw_range_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._ss_damping_factor_range_range = Range(0.001, 2, 0.001, 0.5, 10000)
        self._ss_damping_factor_range_win = RangeWidget(self._ss_damping_factor_range_range, self.set_ss_damping_factor_range, 'Symbol Sync DF', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_damping_factor_range_win, 1, 1, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(1, 2):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._source_option_options = (True, False, )
        self._source_option_labels = ('AD9361', 'File', )
        self._source_option_group_box = Qt.QGroupBox('Source From')
        self._source_option_box = Qt.QHBoxLayout()
        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)
            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)
        self._source_option_button_group = variable_chooser_button_group()
        self._source_option_group_box.setLayout(self._source_option_box)
        for i, label in enumerate(self._source_option_labels):
        	radio_button = Qt.QRadioButton(label)
        	self._source_option_box.addWidget(radio_button)
        	self._source_option_button_group.addButton(radio_button, i)
        self._source_option_callback = lambda i: Qt.QMetaObject.invokeMethod(self._source_option_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._source_option_options.index(i)))
        self._source_option_callback(self.source_option)
        self._source_option_button_group.buttonClicked[int].connect(
        	lambda i: self.set_source_option(self._source_option_options[i]))
        self.tab_grid_layout_1.addWidget(self._source_option_group_box, 2, 0, 1, 1)
        for r in range(2, 3):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._pll_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._pll_loopbw_range_win = RangeWidget(self._pll_loopbw_range_range, self.set_pll_loopbw_range, 'PLL LBW', "dial", float)
        self.tab_grid_layout_1.addWidget(self._pll_loopbw_range_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._doppler_range = Range(-50000, 50000, 1, 10000, 10000)
        self._doppler_win = RangeWidget(self._doppler_range, self.set_doppler, 'Doppler', "dial", int)
        self.tab_grid_layout_1.addWidget(self._doppler_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(1, 2):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self.satellites_decode_rs_general_0 = satellites.decode_rs_general(285, 0, 1, 32, False, True)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=first_dec,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	ad_samp_rate/first_dec, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(True)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not False:
          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.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0 = qtgui.time_sink_f(
        	203, #size
        	1, #samp_rate
        	"GCM-AES Decryptor Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_y_axis(-10, 300)

        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "frm_len")
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_1_0_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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_5.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_0_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_5.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_5.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1_0 = qtgui.time_sink_f(
        	255, #size
        	1, #samp_rate
        	"Viterbi Decoder Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_y_axis(-10, 300)

        self.qtgui_time_sink_x_0_0_0_0_1_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_1_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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_4.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_4.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1 = qtgui.time_sink_f(
        	223, #size
        	1, #samp_rate
        	"Reed-Solomon Decoder Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1.set_y_axis(-10, 300)

        self.qtgui_time_sink_x_0_0_0_0_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_1.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_4.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_4.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
        	4144, #size
        	ad_samp_rate/first_dec/sec_dec/samp_per_symb, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1, 2)

        self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	ad_samp_rate/first_dec/sec_dec/samp_per_symb, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-20, 20)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0, 2, 2)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 2):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	ad_samp_rate/first_dec/sec_dec, #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(-20, 20)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not False:
          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 = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_0_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_NONE,
            1
        )
        self.qtgui_number_sink_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0.set_title("Decrypted Frame Counter")

        labels = ['Counter', 'Rate', '', '', '',
                  '', '', '', '', '']
        units = ['', '', '', '', '',
                 '', '', '', '', '']
        colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")]
        factor = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0_0.set_min(i, -1)
            self.qtgui_number_sink_0_0.set_max(i, 1)
            self.qtgui_number_sink_0_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0.set_label(i, labels[i])
            self.qtgui_number_sink_0_0.set_unit(i, units[i])
            self.qtgui_number_sink_0_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_win = sip.wrapinstance(self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_number_sink_0_0_win, 0, 3, 2, 1)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(3, 4):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_number_sink_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_NONE,
            2
        )
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("Received Frame Counter")

        labels = ['Counter', 'Rate', '', '', '',
                  '', '', '', '', '']
        units = ['', '', '', '', '',
                 '', '', '', '', '']
        colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")]
        factor = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        for i in xrange(2):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_number_sink_0_win, 0, 2, 2, 1)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(2, 3):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	ad_samp_rate/first_dec, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-160, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_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_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_0.setColumnStretch(c, 1)
        self.low_pass_filter_0 = filter.fir_filter_ccf(sec_dec, firdes.low_pass(
        	1, ad_samp_rate/first_dec, channel_bw, channel_bw/10, firdes.WIN_HAMMING, 6.76))
        self.iustsat_zafar_telemetry_frame_extractor_1 = iustsat.zafar_telemetry_frame_extractor("pkt_len")
        self.iustsat_zafar_telemetry_derand_0 = iustsat.zafar_telemetry_derand("pkt_len")
        self.iustsat_tag_counter_0 = iustsat.tag_counter('pkt_len')
        self.iustsat_synch_detect_tag_1_0 = iustsat.synch_detect_tag(60,'pkt_len',259*2*8)
        self.iustsat_synch_detect_tag_1 = iustsat.synch_detect_tag(60,'pkt_len',259*2*8)
        self.iustsat_rs_to_decrypt_0_0 = iustsat.rs_to_decrypt('iv', ([0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, 0xDE, 0xCA, 0xF8, 0x88]), 'aad', 'auth_tag')
        self.iustsat_pdu_to_message_0 = iustsat.pdu_to_message('frm_len')
        self.iustsat_frame_analysis_0 = iustsat.frame_analysis('frm_len')
        self.iio_fmcomms2_source_0 = iio.fmcomms2_source_f32c('192.168.1.10', 436500000+doppler, ad_samp_rate, channel_bw, True, False, 0x8000, True, True, True, "fast_attack", 64.0, "manual", 64.0, "A_BALANCED", '', True)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1]))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.fec_async_decoder_0 = fec.async_decoder(dec_cc, True, False, MTU)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(digital.TED_GARDNER, samp_per_symb, ss_loopbw_range, ss_damping_factor_range, ss_ted_gain_range, 1, 1, digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128, ([]))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(100000, True)
        self.crypto_auth_dec_aes_gcm_0_0 = crypto.auth_dec_aes_gcm(([0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08]), 16, 96)
        self.blocks_uchar_to_float_1_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_1 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, ad_samp_rate,True)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_pdu_to_tagged_stream_0_0_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'pkt_len')
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'pkt_len')
        self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vcc((source_option, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc(((not source_option), ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((0.066666667, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(samp_per_symb, 10, 4000, 1)
        self.blocks_message_debug_0_0 = blocks.message_debug()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/iust/Documents/zafar_prj/gr-iustsat/examples/Records/REC7_GMSK.bin', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float*1, 63)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 63)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((0, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(pll_loopbw_range, 700000*6.28/(ad_samp_rate/first_dec/sec_dec), 300000*6.28/(ad_samp_rate/first_dec/sec_dec))



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_frame_analysis_0, 'in'))
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_pdu_to_message_0, 'in'))
        self.msg_connect((self.fec_async_decoder_0, 'out'), (self.iustsat_zafar_telemetry_derand_0, 'in'))
        self.msg_connect((self.iustsat_frame_analysis_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_pdu_to_message_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_rs_to_decrypt_0_0, 'out'), (self.crypto_auth_dec_aes_gcm_0_0, 'pdus'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'), (self.satellites_decode_rs_general_0, 'in'))
        self.msg_connect((self.iustsat_zafar_telemetry_frame_extractor_1, 'out'), (self.fec_async_decoder_0, 'in'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.blocks_message_debug_0_0, 'print_pdu'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.iustsat_rs_to_decrypt_0_0, 'in'))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.iustsat_synch_detect_tag_1, 0))
        self.connect((self.blocks_delay_0_0, 0), (self.iustsat_synch_detect_tag_1_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_add_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_2_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_uchar_to_float_1, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.blocks_uchar_to_float_1_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.qtgui_number_sink_0_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_0, 0), (self.qtgui_time_sink_x_0_0_0_0_1_0_0, 0))
        self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_const_vxx_2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_uchar_to_float_1, 0), (self.qtgui_time_sink_x_0_0_0_0_1, 0))
        self.connect((self.blocks_uchar_to_float_1_0, 0), (self.qtgui_time_sink_x_0_0_0_0_1_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_uchar_to_float_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.iustsat_synch_detect_tag_1, 1))
        self.connect((self.fir_filter_xxx_0, 0), (self.iustsat_synch_detect_tag_1_0, 1))
        self.connect((self.iio_fmcomms2_source_0, 0), (self.blocks_tag_gate_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_tag_counter_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_zafar_telemetry_frame_extractor_1, 0))
        self.connect((self.iustsat_synch_detect_tag_1_0, 0), (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.iustsat_tag_counter_0, 0), (self.qtgui_number_sink_0, 0))
        self.connect((self.iustsat_tag_counter_0, 1), (self.qtgui_number_sink_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
Exemple #4
0
    def __init__(self,
                 baudrate,
                 samp_rate,
                 iq,
                 deviation=None,
                 subaudio=False,
                 dc_block=True,
                 dump_path=None,
                 options=None):
        gr.hier_block2.__init__(
            self, 'fsk_demodulator',
            gr.io_signature(1, 1,
                            gr.sizeof_gr_complex if iq else gr.sizeof_float),
            gr.io_signature(1, 1, gr.sizeof_float))
        options_block.__init__(self, options)

        use_agc = self.options.use_agc or not iq
        if self.options.disable_dc_block:
            dc_block = False

        if dump_path is not None:
            dump_path = pathlib.Path(dump_path)

        if deviation is not None:
            _deviation = deviation
        else:
            _deviation = self.options.deviation

        # Prevent problems due to baudrate too high
        if baudrate >= samp_rate:
            print(
                f'Sample rate {samp_rate} sps insufficient for {baudrate} '
                'baud FSK demodulation. Demodulator will not work.',
                file=sys.stderr)
            baudrate = samp_rate / 2

        if iq:
            # Cut to Carson's bandwidth rule before quadrature demod.
            # Note that _deviation can be negative to encode that the
            # low tone corresponds to the symbol 1 and the high tone
            # corresponds to the symbol 0.
            carson_cutoff = abs(_deviation) + baudrate / 2
            self.demod = analog.quadrature_demod_cf(samp_rate /
                                                    (2 * pi * _deviation))
            if carson_cutoff >= samp_rate / 2:
                # Sample rate is already narrower than Carson's
                # bandwidth. Do not filter
                self.connect(self, self.demod)
            else:
                # Sample rate is wider than Carson's bandwidth.
                # Lowpass filter before demod.
                fir_taps = firdes.low_pass(1, samp_rate, carson_cutoff,
                                           0.1 * carson_cutoff)
                self.demod_filter = filter.fir_filter_ccf(1, fir_taps)
                self.connect(self, self.demod_filter, self.demod)
        else:
            self.demod = self

        sps = samp_rate / baudrate
        max_sps = 10
        if sps > max_sps:
            decimation = ceil(sps / max_sps)
        else:
            decimation = 1
        sps /= decimation

        if subaudio:
            # some not-so-bad filter parameters for subaudio processing
            subaudio_cutoff = 2.0 / 3.0 * baudrate
            subaudio_transition = subaudio_cutoff / 4.0
            subaudio_taps = firdes.low_pass(1, samp_rate, subaudio_cutoff,
                                            subaudio_transition)
            self.subaudio_lowpass = filter.fir_filter_fff(1, subaudio_taps)

        # square pulse filter
        sqfilter_len = int(samp_rate / baudrate)
        taps = np.ones(sqfilter_len) / sqfilter_len
        self.lowpass = filter.fir_filter_fff(decimation, taps)

        if dc_block:
            self.dcblock = filter.dc_blocker_ff(ceil(sps * 32), True)
        else:
            self.dcblock = self.lowpass  # to simplify connections below

        if use_agc:
            # This gives a time constant of 50 symbols
            agc_constant = 2e-2 / sps
            self.agc = rms_agc_f(agc_constant, 1)

        if dump_path is not None:
            self.waveform = blocks.file_sink(gr.sizeof_float,
                                             str(dump_path / 'waveform.f32'))

        # "Eempiric" formula for TED gain of Gardner detector
        # 1.47 symbol^{-1}
        ted_gain = 1.47
        damping = 1.0
        self.clock_recovery = digital.symbol_sync_ff(
            digital.TED_GARDNER, sps, self.options.clk_bw, damping, ted_gain,
            self.options.clk_limit * sps, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF)

        if dump_path is not None:
            self.clock_recovery_out = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_out.f32'),
                False)
            self.clock_recovery_err = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_err.f32'),
                False)
            self.clock_recovery_T_inst = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_inst.f32'),
                False)
            self.clock_recovery_T_avg = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_avg.f32'),
                False)
            self.connect(self.clock_recovery, self.clock_recovery_out)
            self.connect((self.clock_recovery, 1), self.clock_recovery_err)
            self.connect((self.clock_recovery, 2), self.clock_recovery_T_inst)
            self.connect((self.clock_recovery, 3), self.clock_recovery_T_avg)

        conns = [self.demod]
        if subaudio:
            conns.append(self.subaudio_lowpass)
        conns.append(self.lowpass)
        if dc_block:
            conns.append(self.dcblock)
        self.connect(*conns)
        if use_agc:
            self.connect(self.dcblock, self.agc, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.agc, self.waveform)
        else:
            self.connect(self.dcblock, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.dcblock, self.waveform)
        self.connect(self.clock_recovery, self)
Exemple #5
0
    def __init__(self):
        gr.top_block.__init__(self, "Symbol Sync Test (Float)")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Symbol Sync Test (Float)")
        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", "symbol_sync_test_float")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.zeta = zeta = 1.0
        self.omega_n_norm = omega_n_norm = 0.125
        self.ted_gain = ted_gain = 0.28365
        self.omega_d_norm = omega_d_norm = omega_n_norm * math.sqrt(
            (zeta * zeta - 1.0) if zeta > 1.0 else (1.0 - zeta * zeta))
        self.proportional_gain = proportional_gain = 2.0 / ted_gain * math.exp(
            -zeta * omega_n_norm) * math.sinh(zeta * omega_n_norm)
        self.integral_gain = integral_gain = 2.0 / ted_gain * (
            1.0 - math.exp(-zeta * omega_n_norm) *
            (math.sinh(zeta * omega_n_norm) +
             (math.cosh(omega_d_norm)
              if zeta > 1.0 else math.cos(omega_d_norm))))
        self.sps = sps = 7
        self.proportional_gain_label = proportional_gain_label = "%8.6f" % proportional_gain
        self.packet_time_est_tag = packet_time_est_tag = gr.tag_utils.python_to_tag(
            (9, pmt.intern("test"), pmt.from_double(0.0),
             pmt.intern("packet_vector_source")))
        self.osps = osps = 1
        self.integral_gain_label = integral_gain_label = "%8.6f" % integral_gain
        self.data_src = data_src = (0, 0, 0, 0, 1)
        self.baud_rate = baud_rate = 1200.0

        ##################################################
        # Blocks
        ##################################################
        self._zeta_range = Range(0.1, 5.0, 0.1, 1.0, 200)
        self._zeta_win = RangeWidget(self._zeta_range, self.set_zeta,
                                     'Damping Factor', "counter_slider", float)
        self.top_grid_layout.addWidget(self._zeta_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._ted_gain_range = Range(0.05, 5.0, 0.01, 0.28365, 200)
        self._ted_gain_win = RangeWidget(self._ted_gain_range,
                                         self.set_ted_gain,
                                         'Expected TED Gain', "counter_slider",
                                         float)
        self.top_grid_layout.addWidget(self._ted_gain_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._omega_n_norm_range = Range(0.0, 2.0 * math.pi * 0.25, 0.001,
                                         0.125, 200)
        self._omega_n_norm_win = RangeWidget(self._omega_n_norm_range,
                                             self.set_omega_n_norm,
                                             'Normalized Bandwidth',
                                             "counter_slider", float)
        self.top_grid_layout.addWidget(self._omega_n_norm_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._data_src_options = (
            (1, 0, 0, 0, 0),
            (0, 1, 0, 0, 0),
            (0, 0, 1, 0, 0),
            (0, 0, 0, 1, 0),
            (0, 0, 0, 0, 1),
        )
        self._data_src_labels = (
            'Random',
            'Low freq',
            'Dot Pattern',
            'Pulse',
            'Packets',
        )
        self._data_src_tool_bar = Qt.QToolBar(self)
        self._data_src_tool_bar.addWidget(Qt.QLabel('Data Source' + ": "))
        self._data_src_combo_box = Qt.QComboBox()
        self._data_src_tool_bar.addWidget(self._data_src_combo_box)
        for label in self._data_src_labels:
            self._data_src_combo_box.addItem(label)
        self._data_src_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._data_src_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._data_src_options.index(i)))
        self._data_src_callback(self.data_src)
        self._data_src_combo_box.currentIndexChanged.connect(
            lambda i: self.set_data_src(self._data_src_options[i]))
        self.top_grid_layout.addWidget(self._data_src_tool_bar, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=10,
            decimation=21,
            taps=None,
            fractional_bw=0.45,
        )
        self.qtgui_time_sink_x_0_1_0 = qtgui.time_sink_f(
            1024 * 3,  #size
            baud_rate * sps,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_1_0.set_y_axis(-1.5, 1.5)

        self.qtgui_time_sink_x_0_1_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_1_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.1, 0.01, 0, '')
        self.qtgui_time_sink_x_0_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_1_0.enable_grid(True)
        self.qtgui_time_sink_x_0_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_1_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_1_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_1_0.disable_legend()

        labels = ['', '', '', '', 'Baseband', 'Abs(Corr)', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "dark green", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_1_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_1_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_1_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_1_0_win, 3, 0,
                                       1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
            256 * osps,  #size
            baud_rate * osps,  #samp_rate
            'Symbol Synched Output and Debug',  #name
            4  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.1)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1.5, sps + 2)

        self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.1, 0.01, 0,
            "time_est")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0_0_0.disable_legend()

        labels = [
            'Soft Bits', 'Error', 'Instantaneous Period', 'Average Period', '',
            '', '', '', '', ''
        ]
        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 = [0, -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(4):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win,
                                       3, 1, 1, 2)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._proportional_gain_label_tool_bar = Qt.QToolBar(self)

        if None:
            self._proportional_gain_label_formatter = None
        else:
            self._proportional_gain_label_formatter = lambda x: str(x)

        self._proportional_gain_label_tool_bar.addWidget(
            Qt.QLabel('Proportional Gain' + ": "))
        self._proportional_gain_label_label = Qt.QLabel(
            str(
                self._proportional_gain_label_formatter(
                    self.proportional_gain_label)))
        self._proportional_gain_label_tool_bar.addWidget(
            self._proportional_gain_label_label)
        self.top_grid_layout.addWidget(self._proportional_gain_label_tool_bar,
                                       1, 2, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._integral_gain_label_tool_bar = Qt.QToolBar(self)

        if None:
            self._integral_gain_label_formatter = None
        else:
            self._integral_gain_label_formatter = lambda x: str(x)

        self._integral_gain_label_tool_bar.addWidget(
            Qt.QLabel('Integral Gain' + ": "))
        self._integral_gain_label_label = Qt.QLabel(
            str(self._integral_gain_label_formatter(self.integral_gain_label)))
        self._integral_gain_label_tool_bar.addWidget(
            self._integral_gain_label_label)
        self.top_grid_layout.addWidget(self._integral_gain_label_tool_bar, 0,
                                       2, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.fir_filter_xxx_0_1_0_0_0 = filter.fir_filter_fff(
            1, ([1.0 / float(sps)] * sps))
        self.fir_filter_xxx_0_1_0_0_0.declare_sample_delay(
            int((sps - 1.0) / 2.0) + 4)
        self.epy_block_0 = epy_block_0.ConstMap()
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_MUELLER_AND_MULLER, sps, omega_n_norm, zeta, ted_gain,
            1.5, osps,
            digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128,
            ([]))
        self.blocks_vector_source_x_0_0_1_0 = blocks.vector_source_f(
            [1, 0] * (4 * 12 * 0) + [1, 1, 0, 1, 0, 1, 0, 1] * 12 +
            [1, 0, 1, 1, 1, 1, 1, 0, 0, 1] + [1, 1, 1, 1, 0, 1, 1, 0, 0, 1] +
            [1, 0, 1, 1, 1, 1, 1, 0, 0, 1] + [0, 1, 1, 1, 0, 1, 1, 0, 1, 0] +
            [0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0] +
            [2] * 128, True, 1, [packet_time_est_tag])
        self.blocks_vector_source_x_0_0_1 = blocks.vector_source_f(
            [1] + [0] * 7, True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(
            (0, 0, 0, 0, 1, 1, 1, 1), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_f(
            (0, 1, 0, 1, 0, 1, 0, 1), True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 baud_rate * 10, True)
        self.blocks_short_to_float_1 = blocks.short_to_float(1, 1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1, sps * 2)
        self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_ff(
            (data_src, ), gr.TPP_ALL_TO_ALL)
        self.analog_random_source_x_0 = blocks.vector_source_s(
            map(int, numpy.random.randint(0, 2, 16384)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_short_to_float_1, 0))
        self.connect((self.blocks_multiply_matrix_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_repeat_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_short_to_float_1, 0),
                     (self.blocks_multiply_matrix_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.epy_block_0, 0))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 2))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_1, 0),
                     (self.blocks_multiply_matrix_xx_0, 3))
        self.connect((self.blocks_vector_source_x_0_0_1_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 4))
        self.connect((self.digital_symbol_sync_xx_0, 3),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 3))
        self.connect((self.digital_symbol_sync_xx_0, 2),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 2))
        self.connect((self.digital_symbol_sync_xx_0, 1),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 1))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.epy_block_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.fir_filter_xxx_0_1_0_0_0, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.fir_filter_xxx_0_1_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_1_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.fir_filter_xxx_0_1_0_0_0, 0))
Exemple #6
0
    def __init__(self,
                 baudrate,
                 samp_rate,
                 iq,
                 deviation=None,
                 subaudio=False,
                 dc_block=True,
                 dump_path=None,
                 options=None):
        gr.hier_block2.__init__(
            self, "fsk_demodulator",
            gr.io_signature(1, 1,
                            gr.sizeof_gr_complex if iq else gr.sizeof_float),
            gr.io_signature(1, 1, gr.sizeof_float))
        options_block.__init__(self, options)

        use_agc = self.options.use_agc or not iq

        if dump_path is not None:
            dump_path = pathlib.Path(dump_path)

        if deviation is not None:
            _deviation = deviation
        else:
            _deviation = self.options.deviation
        if iq:
            self.demod = analog.quadrature_demod_cf(samp_rate /
                                                    (2 * pi * _deviation))
            self.connect(self, self.demod)
        else:
            self.demod = self

        sps = samp_rate / baudrate
        max_sps = 10
        if sps > max_sps:
            decimation = ceil(sps / max_sps)
        else:
            decimation = 1
        sps /= decimation

        if subaudio:
            # some not-so-bad filter parameters for subaudio processing
            subaudio_cutoff = 2.0 / 3.0 * baudrate
            subaudio_transition = subaudio_cutoff / 4.0
            subaudio_taps = firdes.low_pass(1, samp_rate, subaudio_cutoff,
                                            subaudio_transition)
            self.subaudio_lowpass = filter.fir_filter_fff(1, subaudio_taps)

        # square pulse filter
        sqfilter_len = int(samp_rate / baudrate)
        taps = np.ones(sqfilter_len) / sqfilter_len
        self.lowpass = filter.fir_filter_fff(decimation, taps)

        if dc_block:
            self.dcblock = filter.dc_blocker_ff(ceil(sps * 32), True)
        else:
            self.dcblock = self.lowpass  # to simplify connections below

        if use_agc:
            agc_constant = 2e-2 / sps  # This gives a time constant of 50 symbols
            self.agc = rms_agc_f(agc_constant, 1)

        if dump_path is not None:
            self.waveform = blocks.file_sink(gr.sizeof_float,
                                             str(dump_path / 'waveform.f32'))

        ted_gain = 1.47  # "empiric" formula for TED gain of Gardner detector 1.47 symbol^{-1}
        damping = 1.0
        self.clock_recovery = digital.symbol_sync_ff(
            digital.TED_GARDNER, sps, self.options.clk_bw, damping, ted_gain,
            self.options.clk_limit, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF)

        if dump_path is not None:
            self.clock_recovery_out = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_out.f32'),
                False)
            self.clock_recovery_err = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_err.f32'),
                False)
            self.clock_recovery_T_inst = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_inst.f32'),
                False)
            self.clock_recovery_T_avg = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_avg.f32'),
                False)
            self.connect(self.clock_recovery, self.clock_recovery_out)
            self.connect((self.clock_recovery, 1), self.clock_recovery_err)
            self.connect((self.clock_recovery, 2), self.clock_recovery_T_inst)
            self.connect((self.clock_recovery, 3), self.clock_recovery_T_avg)

        conns = [self.demod]
        if subaudio:
            conns.append(self.subaudio_lowpass)
        conns.append(self.lowpass)
        if dc_block:
            conns.append(self.dcblock)
        self.connect(*conns)
        if use_agc:
            self.connect(self.dcblock, self.agc, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.agc, self.waveform)
        else:
            self.connect(self.dcblock, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.dcblock, self.waveform)
        self.connect(self.clock_recovery, self)
Exemple #7
0
    def __init__(self, cl_loop_bandwidth, cl_order, cl_freq_sub, ss_sps,
                 ss_loop_bandwidth, ss_ted_gain, ss_damping, ss_max_dev,
                 ss_out_ss, ss_interpolatin, ss_ted_type, ss_nfilter,
                 ss_pfb_mf_taps, sel_costas, sel_spl, samp_rate):
        gr.hier_block2.__init__(
            self,
            "demodulator",
            gr.io_signature(1, 1, gr.sizeof_float),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_char))  # Output signature

        ##################################################
        # Variables
        ##################################################
        self.cl_loop_bandwidth = cl_loop_bandwidth
        self.cl_order = cl_order
        self.cl_freq_sub = cl_freq_sub

        self.ss_sps = ss_sps
        self.ss_loop_bandwidth = ss_loop_bandwidth
        self.ss_ted_gain = ss_ted_gain
        self.ss_damping = fec.ss_damping
        self.ss_max_dev = ss_max_dev
        self.ss_out_ss = ss_out_ss
        self.ss_interpolatin = ss_interpolatin
        self.ss_ted_type = ss_ted_type
        self.ss_nfilter = ss_nfilter
        self.ss_pfb_mf_taps = ss_pfb_mf_taps

        self.sel_costas = sel_costas
        self.sel_spl = sel_spl

        ##################################################
        # Blocks
        ##################################################

        self.digital_sync = digital.symbol_sync_ff(
            self.ss_ted_type, self.ss_sps, self.ss_loop_bandwidth,
            self.ss_damping, self.ss_ted_gain, self.ss_max_dev, self.ss_out_ss,
            self.ss_interpolatin, digital.IR_PFB_MF, self.ss_nfilter,
            (self.ss_pfb_mf_taps))

        self.spl_dencoder = ecss.spl_dencoder()

        self.costas_loop_cc = digital.costas_loop_cc(self.cl_loop_bandwidth,
                                                     self.cl_order, False)
        self.signal_gen = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE,
                                              self.cl_freq_sub, 1, 0)
        self.multiply = blocks.multiply_vcc(1)

        self.hilbert = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.null_complex = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.null_float = blocks.null_sink(gr.sizeof_float * 1)
        self.to_char = blocks.float_to_uchar()
        self.unpack = blocks.unpack_k_bits_bb()

        ##################################################
        # Connections
        ##################################################

        if (sel_costas == 0):
            # if (type == 0):
            #     self.connect(self, (self.multiply, 0))
            # else:
            self.connect(self, self.hilbert, (self.multiply, 0))

            self.connect(self.signal_gen, (self.multiply, 1))
            self.connect(self.multiply, self.costas_loop_cc)
            self.connect((self.costas_loop_cc, 0), self.null_complex)
            self.connect((self.costas_loop_cc, 1), self.null_float)
            self.connect((self.costas_loop_cc, 2), self.digital_sync)
        else:
            self.connect(self, self.digital_sync)

        if (sel_spl == 0):
            self.connect(self.digital_sync, self.to_char, self.unpack,
                         self.spl_dencoder, self)
        else:
            self.connect(self.digital_sync, self.to_char, self.unpack, self)
    def __init__(self):
        gr.top_block.__init__(self, "Decode Signal")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Decode Signal")
        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", "decode_signal")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.baseband_freq = baseband_freq = 676
        self.samples_per_symbol = samples_per_symbol = int(samp_rate /
                                                           baseband_freq)
        self.carrier_freq = carrier_freq = 432.867e6

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(True)
        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(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_SIGNAL_TIMES_SLOPE_ML, samples_per_symbol / 4, 0.045,
            1.0, 1.0, 1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128,
            ([]))
        self.digital_map_bb_0_1 = digital.map_bb(
            ([10, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 49, 0]))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/afonsonf/sandbox/repos/rcm/rcm-trabalho/signal.wav', False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(4)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/home/afonsonf/sandbox/repos/rcm/rcm-trabalho/out_bin.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_uchar_0, 0),
                     (self.blocks_pack_k_bits_bb_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_0, 0),
                     (self.digital_map_bb_0_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_map_bb_0_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.blocks_float_to_uchar_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
Exemple #9
0
    def __init__(self):
        gr.top_block.__init__(self, "Telemetry Rx Hp")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Telemetry Rx Hp")
        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", "telemetry_rx_hp")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.symb_rate = symb_rate = 52083
        self.samp_per_symb = samp_per_symb = 6
        self.sec_dec = sec_dec = 4
        self.rate = rate = 2
        self.polys = polys = [109, 79]
        self.k = k = 7
        self.channel_bw = channel_bw = symb_rate * samp_per_symb / 2
        self.MTU = MTU = 1500
        self.waterfall_per = waterfall_per = 0.1
        self.ss_ted_gain_range = ss_ted_gain_range = 100
        self.ss_loopbw_range = ss_loopbw_range = 0.4
        self.ss_damping_factor_range = ss_damping_factor_range = 0.5
        self.source_option = source_option = (1, 0)
        self.pll_loopbw_range = pll_loopbw_range = 0.3
        self.gain_before_tr = gain_before_tr = 30
        self.f_if = f_if = 75000
        self.doppler = doppler = 0

        self.dec_cc = dec_cc = fec.cc_decoder.make(MTU * 8, k, rate, (polys),
                                                   0, -1, fec.CC_TERMINATED,
                                                   False)

        self.ad_samp_rate = ad_samp_rate = symb_rate * sec_dec * samp_per_symb
        self.ad_channel_bw = ad_channel_bw = channel_bw * 5
        self.ad9361_lo_freq = ad9361_lo_freq = 437000000

        ##################################################
        # Blocks
        ##################################################
        self.tab_control = Qt.QTabWidget()
        self.tab_control_widget_0 = Qt.QWidget()
        self.tab_control_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                                  self.tab_control_widget_0)
        self.tab_control_grid_layout_0 = Qt.QGridLayout()
        self.tab_control_layout_0.addLayout(self.tab_control_grid_layout_0)
        self.tab_control.addTab(self.tab_control_widget_0, 'General')
        self.tab_control_widget_1 = Qt.QWidget()
        self.tab_control_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                                  self.tab_control_widget_1)
        self.tab_control_grid_layout_1 = Qt.QGridLayout()
        self.tab_control_layout_1.addLayout(self.tab_control_grid_layout_1)
        self.tab_control.addTab(self.tab_control_widget_1, 'GMSK Demodulator')
        self.tab_control_widget_2 = Qt.QWidget()
        self.tab_control_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                                  self.tab_control_widget_2)
        self.tab_control_grid_layout_2 = Qt.QGridLayout()
        self.tab_control_layout_2.addLayout(self.tab_control_grid_layout_2)
        self.tab_control.addTab(self.tab_control_widget_2,
                                'Gardner Timing Recovery')
        self.top_grid_layout.addWidget(self.tab_control, 0, 0, 3, 1)
        for r in range(0, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._waterfall_per_tool_bar = Qt.QToolBar(self)
        self._waterfall_per_tool_bar.addWidget(
            Qt.QLabel('Waterfall Plot Period' + ": "))
        self._waterfall_per_line_edit = Qt.QLineEdit(str(self.waterfall_per))
        self._waterfall_per_tool_bar.addWidget(self._waterfall_per_line_edit)
        self._waterfall_per_line_edit.returnPressed.connect(
            lambda: self.set_waterfall_per(
                eng_notation.str_to_num(
                    str(self._waterfall_per_line_edit.text().toAscii()))))
        self.tab_control_grid_layout_0.addWidget(self._waterfall_per_tool_bar,
                                                 3, 0, 1, 4)
        for r in range(3, 4):
            self.tab_control_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_0.setColumnStretch(c, 1)
        self.tab_stat = Qt.QTabWidget()
        self.tab_stat_widget_0 = Qt.QWidget()
        self.tab_stat_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_stat_widget_0)
        self.tab_stat_grid_layout_0 = Qt.QGridLayout()
        self.tab_stat_layout_0.addLayout(self.tab_stat_grid_layout_0)
        self.tab_stat.addTab(self.tab_stat_widget_0, 'General')
        self.top_grid_layout.addWidget(self.tab_stat, 3, 0, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.tab_plot = Qt.QTabWidget()
        self.tab_plot_widget_0 = Qt.QWidget()
        self.tab_plot_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_0)
        self.tab_plot_grid_layout_0 = Qt.QGridLayout()
        self.tab_plot_layout_0.addLayout(self.tab_plot_grid_layout_0)
        self.tab_plot.addTab(self.tab_plot_widget_0, 'Frequency Plot')
        self.tab_plot_widget_1 = Qt.QWidget()
        self.tab_plot_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_1)
        self.tab_plot_grid_layout_1 = Qt.QGridLayout()
        self.tab_plot_layout_1.addLayout(self.tab_plot_grid_layout_1)
        self.tab_plot.addTab(self.tab_plot_widget_1, 'Time Plot')
        self.tab_plot_widget_2 = Qt.QWidget()
        self.tab_plot_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_2)
        self.tab_plot_grid_layout_2 = Qt.QGridLayout()
        self.tab_plot_layout_2.addLayout(self.tab_plot_grid_layout_2)
        self.tab_plot.addTab(self.tab_plot_widget_2, 'Demoded Bits 1')
        self.tab_plot_widget_3 = Qt.QWidget()
        self.tab_plot_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_3)
        self.tab_plot_grid_layout_3 = Qt.QGridLayout()
        self.tab_plot_layout_3.addLayout(self.tab_plot_grid_layout_3)
        self.tab_plot.addTab(self.tab_plot_widget_3, 'Demoded Bits 2')
        self.tab_plot_widget_4 = Qt.QWidget()
        self.tab_plot_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_4)
        self.tab_plot_grid_layout_4 = Qt.QGridLayout()
        self.tab_plot_layout_4.addLayout(self.tab_plot_grid_layout_4)
        self.tab_plot.addTab(self.tab_plot_widget_4, 'Decoded Data (Viterbi)')
        self.tab_plot_widget_5 = Qt.QWidget()
        self.tab_plot_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_5)
        self.tab_plot_grid_layout_5 = Qt.QGridLayout()
        self.tab_plot_layout_5.addLayout(self.tab_plot_grid_layout_5)
        self.tab_plot.addTab(self.tab_plot_widget_5, 'Decoded Data (RS)')
        self.tab_plot_widget_6 = Qt.QWidget()
        self.tab_plot_layout_6 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tab_plot_widget_6)
        self.tab_plot_grid_layout_6 = Qt.QGridLayout()
        self.tab_plot_layout_6.addLayout(self.tab_plot_grid_layout_6)
        self.tab_plot.addTab(self.tab_plot_widget_6, 'Decrypted Data')
        self.top_grid_layout.addWidget(self.tab_plot, 0, 1, 4, 3)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._ss_ted_gain_range_range = Range(1, 1000, 1, 100, 10000)
        self._ss_ted_gain_range_win = RangeWidget(
            self._ss_ted_gain_range_range, self.set_ss_ted_gain_range,
            'Symbol Sync TED gain', "slider", float)
        self.tab_control_grid_layout_2.addWidget(self._ss_ted_gain_range_win,
                                                 1, 0, 1, 4)
        for r in range(1, 2):
            self.tab_control_grid_layout_2.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_2.setColumnStretch(c, 1)
        self._ss_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._ss_loopbw_range_win = RangeWidget(self._ss_loopbw_range_range,
                                                self.set_ss_loopbw_range,
                                                'Symbol Sync LBW', "slider",
                                                float)
        self.tab_control_grid_layout_2.addWidget(self._ss_loopbw_range_win, 0,
                                                 0, 1, 4)
        for r in range(0, 1):
            self.tab_control_grid_layout_2.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_2.setColumnStretch(c, 1)
        self._ss_damping_factor_range_range = Range(0.001, 2, 0.001, 0.5,
                                                    10000)
        self._ss_damping_factor_range_win = RangeWidget(
            self._ss_damping_factor_range_range,
            self.set_ss_damping_factor_range, 'Symbol Sync DF', "slider",
            float)
        self.tab_control_grid_layout_2.addWidget(
            self._ss_damping_factor_range_win, 2, 0, 1, 4)
        for r in range(2, 3):
            self.tab_control_grid_layout_2.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_2.setColumnStretch(c, 1)
        self._source_option_options = (
            (1, 0),
            (0, 1),
        )
        self._source_option_labels = (
            'AD9361',
            'File',
        )
        self._source_option_tool_bar = Qt.QToolBar(self)
        self._source_option_tool_bar.addWidget(Qt.QLabel('Source From' + ": "))
        self._source_option_combo_box = Qt.QComboBox()
        self._source_option_tool_bar.addWidget(self._source_option_combo_box)
        for label in self._source_option_labels:
            self._source_option_combo_box.addItem(label)
        self._source_option_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._source_option_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._source_option_options.index(i)))
        self._source_option_callback(self.source_option)
        self._source_option_combo_box.currentIndexChanged.connect(
            lambda i: self.set_source_option(self._source_option_options[i]))
        self.tab_control_grid_layout_0.addWidget(self._source_option_tool_bar,
                                                 2, 0, 1, 4)
        for r in range(2, 3):
            self.tab_control_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_0.setColumnStretch(c, 1)
        self._pll_loopbw_range_range = Range(0.001, 2, 0.001, 0.3, 10000)
        self._pll_loopbw_range_win = RangeWidget(self._pll_loopbw_range_range,
                                                 self.set_pll_loopbw_range,
                                                 'PLL LBW', "slider", float)
        self.tab_control_grid_layout_1.addWidget(self._pll_loopbw_range_win, 0,
                                                 0, 1, 4)
        for r in range(0, 1):
            self.tab_control_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_1.setColumnStretch(c, 1)
        self._gain_before_tr_range = Range(0.1, 100, 0.1, 30, 1000)
        self._gain_before_tr_win = RangeWidget(self._gain_before_tr_range,
                                               self.set_gain_before_tr, 'Gain',
                                               "slider", float)
        self.tab_control_grid_layout_1.addWidget(self._gain_before_tr_win, 1,
                                                 0, 1, 4)
        for r in range(1, 2):
            self.tab_control_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_1.setColumnStretch(c, 1)
        self._f_if_tool_bar = Qt.QToolBar(self)
        self._f_if_tool_bar.addWidget(Qt.QLabel('IF Frequency' + ": "))
        self._f_if_line_edit = Qt.QLineEdit(str(self.f_if))
        self._f_if_tool_bar.addWidget(self._f_if_line_edit)
        self._f_if_line_edit.returnPressed.connect(lambda: self.set_f_if(
            int(str(self._f_if_line_edit.text().toAscii()))))
        self.tab_control_grid_layout_0.addWidget(self._f_if_tool_bar, 1, 0, 1,
                                                 2)
        for r in range(1, 2):
            self.tab_control_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 2):
            self.tab_control_grid_layout_0.setColumnStretch(c, 1)
        self._doppler_tool_bar = Qt.QToolBar(self)
        self._doppler_tool_bar.addWidget(Qt.QLabel('Doppler' + ": "))
        self._doppler_line_edit = Qt.QLineEdit(str(self.doppler))
        self._doppler_tool_bar.addWidget(self._doppler_line_edit)
        self._doppler_line_edit.returnPressed.connect(lambda: self.set_doppler(
            int(str(self._doppler_line_edit.text().toAscii()))))
        self.tab_control_grid_layout_0.addWidget(self._doppler_tool_bar, 1, 2,
                                                 1, 2)
        for r in range(1, 2):
            self.tab_control_grid_layout_0.setRowStretch(r, 1)
        for c in range(2, 4):
            self.tab_control_grid_layout_0.setColumnStretch(c, 1)
        self._ad9361_lo_freq_tool_bar = Qt.QToolBar(self)
        self._ad9361_lo_freq_tool_bar.addWidget(
            Qt.QLabel('AD9361 LO Frequency' + ": "))
        self._ad9361_lo_freq_line_edit = Qt.QLineEdit(str(self.ad9361_lo_freq))
        self._ad9361_lo_freq_tool_bar.addWidget(self._ad9361_lo_freq_line_edit)
        self._ad9361_lo_freq_line_edit.returnPressed.connect(
            lambda: self.set_ad9361_lo_freq(
                int(str(self._ad9361_lo_freq_line_edit.text().toAscii()))))
        self.tab_control_grid_layout_0.addWidget(self._ad9361_lo_freq_tool_bar,
                                                 0, 0, 1, 4)
        for r in range(0, 1):
            self.tab_control_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_control_grid_layout_0.setColumnStretch(c, 1)
        self.satellites_decode_rs_general_0 = satellites.decode_rs_general(
            285, 0, 1, 32, False, False)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            symb_rate * samp_per_symb,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(waterfall_per)
        self.qtgui_waterfall_sink_x_0.enable_grid(True)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not False:
            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.tab_plot_grid_layout_0.addWidget(
            self._qtgui_waterfall_sink_x_0_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_plot_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_plot_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
            4144,  #size
            symb_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1, 2)

        self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        if not False:
            self.qtgui_time_sink_x_0_0_0_0_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 = [2, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_plot_grid_layout_3.addWidget(
            self._qtgui_time_sink_x_0_0_0_0_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_plot_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_plot_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            symb_rate * samp_per_symb,  #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(-20, 20)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not False:
            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 = [2, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_plot_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_0_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                       qtgui.NUM_GRAPH_NONE, 2)
        self.qtgui_number_sink_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0.set_title("Decrypted Frame Counter")

        labels = ['Counter', 'Rate (bps)', '', '', '', '', '', '', '', '']
        units = ['', '', '', '', '', '', '', '', '', '']
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(2):
            self.qtgui_number_sink_0_0.set_min(i, -1)
            self.qtgui_number_sink_0_0.set_max(i, 1)
            self.qtgui_number_sink_0_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0.set_label(i, labels[i])
            self.qtgui_number_sink_0_0.set_unit(i, units[i])
            self.qtgui_number_sink_0_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget)
        self.tab_stat_grid_layout_0.addWidget(self._qtgui_number_sink_0_0_win,
                                              0, 3, 2, 1)
        for r in range(0, 2):
            self.tab_stat_grid_layout_0.setRowStretch(r, 1)
        for c in range(3, 4):
            self.tab_stat_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_NONE, 2)
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("Received Frame Counter")

        labels = ['Counter', 'Rate (bps)', '', '', '', '', '', '', '', '']
        units = ['', '', '', '', '', '', '', '', '', '']
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(2):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.tab_stat_grid_layout_0.addWidget(self._qtgui_number_sink_0_win, 0,
                                              2, 2, 1)
        for r in range(0, 2):
            self.tab_stat_grid_layout_0.setRowStretch(r, 1)
        for c in range(2, 3):
            self.tab_stat_grid_layout_0.setColumnStretch(c, 1)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            sec_dec,
            firdes.low_pass(1, symb_rate * samp_per_symb * sec_dec, channel_bw,
                            channel_bw / 20, firdes.WIN_HAMMING, 6.76))
        self.iustsat_zafar_telemetry_frame_extractor_1 = iustsat.zafar_telemetry_frame_extractor(
            "pkt_len")
        self.iustsat_zafar_telemetry_derand_0 = iustsat.zafar_telemetry_derand(
            "pkt_len")
        self.iustsat_tag_counter_0 = iustsat.tag_counter('pkt_len')
        self.iustsat_synch_detect_tag_1 = iustsat.synch_detect_tag(
            60, 'pkt_len', 259 * 2 * 8)
        self.iustsat_rs_to_decrypt_0_0 = iustsat.rs_to_decrypt(
            'iv', ([
                0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, 0xDE, 0xCA,
                0xF8, 0x88
            ]), 'aad', 'auth_tag')
        self.iustsat_pdu_to_message_0 = iustsat.pdu_to_message('frm_len')
        self.iustsat_pdu_debug_0_0 = iustsat.pdu_debug('auth_tag')
        self.iustsat_frame_analysis_0 = iustsat.frame_analysis('frm_len')
        self.iio_fmcomms2_source_0 = iio.fmcomms2_source_f32c(
            '192.168.1.10', ad9361_lo_freq - (f_if + doppler), ad_samp_rate,
            ad_channel_bw, True, False, 0x8000, True, True, True,
            "fast_attack", 64.0, "manual", 64.0, "A_BALANCED", '', True)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([
            1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1,
            -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1,
            1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1,
            -1, -1, -1, -1, -1, -1
        ]))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.fec_async_decoder_0 = fec.async_decoder(dec_cc, True, False, MTU)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_GARDNER, samp_per_symb, ss_loopbw_range,
            ss_damping_factor_range, ss_ted_gain_range, 2, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128,
            ([]))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(65536, True)
        self.crypto_auth_dec_aes_gcm_0_0 = crypto.auth_dec_aes_gcm(([
            0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F,
            0x94, 0x67, 0x30, 0x83, 0x08
        ]), 16, 96)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                 False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_pdu_to_tagged_stream_0_0_0_1 = blocks.pdu_to_tagged_stream(
            blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0_0_0 = blocks.pdu_to_tagged_stream(
            blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream(
            blocks.float_t, 'frm_len')
        self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_cc(
            (source_option, ), gr.TPP_ALL_TO_ALL)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(
            (0.066666667, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_multiply_const = blocks.multiply_const_vff(
            (gain_before_tr, ))
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/iust/Documents/zafar_prj/gr-iustsat/examples/Records/REC7_GMSK.bin',
            True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/home/iust/Documents/zafar_prj/gr-iustsat/examples/ReceivedData/TelemetryReceivedData.bin',
            False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 63)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(
            pll_loopbw_range, 200000 * 6.28 / (ad_samp_rate / sec_dec),
            -200000 * 6.28 / (ad_samp_rate / sec_dec))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'),
                         (self.iustsat_frame_analysis_0, 'in'))
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'),
                         (self.iustsat_pdu_debug_0_0, 'pdu_in'))
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'),
                         (self.iustsat_pdu_to_message_0, 'in'))
        self.msg_connect((self.fec_async_decoder_0, 'out'),
                         (self.iustsat_zafar_telemetry_derand_0, 'in'))
        self.msg_connect((self.iustsat_frame_analysis_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_frame_analysis_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0_0_0_1, 'pdus'))
        self.msg_connect((self.iustsat_pdu_to_message_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_rs_to_decrypt_0_0, 'out'),
                         (self.crypto_auth_dec_aes_gcm_0_0, 'pdus'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'),
                         (self.satellites_decode_rs_general_0, 'in'))
        self.msg_connect(
            (self.iustsat_zafar_telemetry_frame_extractor_1, 'out'),
            (self.fec_async_decoder_0, 'in'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'),
                         (self.iustsat_rs_to_decrypt_0_0, 'in'))
        self.connect((self.analog_pll_freqdet_cf_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.iustsat_synch_detect_tag_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 1))
        self.connect((self.blocks_float_to_uchar_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_multiply_const, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.blocks_multiply_matrix_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0),
                     (self.qtgui_number_sink_0_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_0, 0),
                     (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_1, 0),
                     (self.qtgui_number_sink_0_0, 1))
        self.connect((self.blocks_tag_gate_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_multiply_const, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.iustsat_synch_detect_tag_1, 1))
        self.connect((self.iio_fmcomms2_source_0, 0),
                     (self.blocks_tag_gate_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0),
                     (self.iustsat_tag_counter_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0),
                     (self.iustsat_zafar_telemetry_frame_extractor_1, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.iustsat_tag_counter_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.iustsat_tag_counter_0, 1),
                     (self.qtgui_number_sink_0, 1))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
Exemple #10
0
    def __init__(self):
        gr.top_block.__init__(self, "RKE Analyzer")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("RKE Analyzer")
        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", "garage")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps1 = sps1 = 1
        self.sdr_rate = sdr_rate = 2e6
        self.my_seq = my_seq = 0
        self.my_encoder = my_encoder = 0
        self.freqdetectada = freqdetectada = 292e6
        self.decim = decim = 20
        self.variable_qtgui_label_0_2 = variable_qtgui_label_0_2 = freqdetectada
        self.variable_qtgui_label_0_1_0 = variable_qtgui_label_0_1_0 = my_seq
        self.variable_qtgui_label_0_1 = variable_qtgui_label_0_1 = my_encoder
        self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = sps1
        self.sps = sps = 44
        self.samp_rate = samp_rate = sdr_rate / decim
        self.gain = gain = 0.01
        self.freq_list = freq_list = (292000000, 299000000, 315000000, 434000000)
        self.freq = freq = 0
        self.fft_n = fft_n = 2048
        self.encoder_length = encoder_length = ((12,"HT12E - M1E-N"),(28,"HT6P20B"),(9,"HT6026 - MC145026"))
        self.encoder_code = encoder_code = ((([((0,0,0,0,0,0,0,1), 'P'), ((0,1,1), 0), ((0,0,1), 1)])),(([((0,0,0,0,0,0,0,1), 'P'), ((0,1,1), 0), ((0,0,1), 1)])),(([((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 'P'),((0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), 1),((0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), 0),((0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0), "Z")])))

        ##################################################
        # Blocks
        ##################################################
        self.sumx = sumx.summ(limiar_db=25, freq_list=freq_list, sample_rate=sdr_rate, len_fft=fft_n)
        self.crossing = crossing.crossing(sample_rate=samp_rate, threshold=10)

        def _sps_probe():
            while True:
                val = self.crossing.retorna_sps()
                try:
                    self.set_sps(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _sps_thread = threading.Thread(target=_sps_probe)
        _sps_thread.daemon = True
        _sps_thread.start()


        def _freqdetectada_probe():
            while True:
                val = self.sumx.freq_detectada()
                try:
                    self.set_freqdetectada(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _freqdetectada_thread = threading.Thread(target=_freqdetectada_probe)
        _freqdetectada_thread.daemon = True
        _freqdetectada_thread.start()


        def _freq_probe():
            while True:
                val = self.sumx.freq_ativa()
                try:
                    self.set_freq(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _freq_thread = threading.Thread(target=_freq_probe)
        _freq_thread.daemon = True
        _freq_thread.start()

        self.detectorx = detectorx.blkfinal(decoders_list=encoder_code, decoders_length=encoder_length)
        self._variable_qtgui_label_0_2_tool_bar = Qt.QToolBar(self)

        if None:
          self._variable_qtgui_label_0_2_formatter = None
        else:
          self._variable_qtgui_label_0_2_formatter = lambda x: eng_notation.num_to_str(x)

        self._variable_qtgui_label_0_2_tool_bar.addWidget(Qt.QLabel('Frequencia Detectada'+": "))
        self._variable_qtgui_label_0_2_label = Qt.QLabel(str(self._variable_qtgui_label_0_2_formatter(self.variable_qtgui_label_0_2)))
        self._variable_qtgui_label_0_2_tool_bar.addWidget(self._variable_qtgui_label_0_2_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_2_tool_bar)
        self._variable_qtgui_label_0_1_0_tool_bar = Qt.QToolBar(self)

        if None:
          self._variable_qtgui_label_0_1_0_formatter = None
        else:
          self._variable_qtgui_label_0_1_0_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_1_0_tool_bar.addWidget(Qt.QLabel('Quadro'+": "))
        self._variable_qtgui_label_0_1_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_1_0_formatter(self.variable_qtgui_label_0_1_0)))
        self._variable_qtgui_label_0_1_0_tool_bar.addWidget(self._variable_qtgui_label_0_1_0_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_1_0_tool_bar)
        self._variable_qtgui_label_0_1_tool_bar = Qt.QToolBar(self)

        if None:
          self._variable_qtgui_label_0_1_formatter = None
        else:
          self._variable_qtgui_label_0_1_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_1_tool_bar.addWidget(Qt.QLabel('Codificador'+": "))
        self._variable_qtgui_label_0_1_label = Qt.QLabel(str(self._variable_qtgui_label_0_1_formatter(self.variable_qtgui_label_0_1)))
        self._variable_qtgui_label_0_1_tool_bar.addWidget(self._variable_qtgui_label_0_1_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_1_tool_bar)
        self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self)

        if None:
          self._variable_qtgui_label_0_0_formatter = None
        else:
          self._variable_qtgui_label_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_tool_bar.addWidget(Qt.QLabel('Frequencia do clock'+": "))
        self._variable_qtgui_label_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_formatter(self.variable_qtgui_label_0_0)))
        self._variable_qtgui_label_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_tool_bar)

        def _sps1_probe():
            while True:
                val = self.crossing.retorna_freq()
                try:
                    self.set_sps1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _sps1_thread = threading.Thread(target=_sps1_probe)
        _sps1_thread.daemon = True
        _sps1_thread.start()

        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(sdr_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(20, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('00', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	sdr_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_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_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.probe = blocks.probe_signal_i()

        def _my_seq_probe():
            while True:
                val = self.detectorx.retorna_sequencia_detectada()
                try:
                    self.set_my_seq(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _my_seq_thread = threading.Thread(target=_my_seq_probe)
        _my_seq_thread.daemon = True
        _my_seq_thread.start()


        def _my_encoder_probe():
            while True:
                val = self.detectorx.retorna_codificador_detectado()
                try:
                    self.set_my_encoder(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _my_encoder_thread = threading.Thread(target=_my_encoder_probe)
        _my_encoder_thread.daemon = True
        _my_encoder_thread.start()

        self.insert_tag = insert_tag.clock_reset(sps=sps)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(decim, (1, ), freqdetectada - freq, sdr_rate)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(1, (np.ones(sps) / (sps)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.fft = fft.fft_vcc(fft_n, True, (window.blackmanharris(fft_n)), True, 1)
        self.divide = divide.divide(threshold=0.1)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(digital.TED_ZERO_CROSSING, 40, 0.1, 1.0, gain, 35, 1, digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128, ([]))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_n)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_float_to_int_0 = blocks.float_to_int(1, 1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_n)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0), (self.divide, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.sumx, 0))
        self.connect((self.blocks_float_to_int_0, 0), (self.probe, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.detectorx, 0))
        self.connect((self.digital_symbol_sync_xx_0, 3), (self.blocks_float_to_int_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 2), (self.blocks_null_sink_0, 1))
        self.connect((self.digital_symbol_sync_xx_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.divide, 0), (self.crossing, 0))
        self.connect((self.divide, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.fft, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.insert_tag, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.insert_tag, 0), (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
Exemple #11
0
    def __init__(self):
        gr.top_block.__init__(self, "Telecommand Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Telecommand Rx")
        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", "telecommand_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.ss_ted_gain_range = ss_ted_gain_range = 100
        self.ss_loopbw_range = ss_loopbw_range = 0.25
        self.ss_damping_factor_range = ss_damping_factor_range = 0.5
        self.samp_per_symb = samp_per_symb = 10
        self.pll_loopbw_range = pll_loopbw_range = 0.4
        self.lpf_dec = lpf_dec = 8
        self.f_if = f_if = 30000
        self.doppler = doppler = 0
        self.bit_rate = bit_rate = 12019
        self.ad9361_lo_freq = ad9361_lo_freq = 144100000

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Tab 0')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Tab 1')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Tab 2')
        self.tab_widget_3 = Qt.QWidget()
        self.tab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_3)
        self.tab_grid_layout_3 = Qt.QGridLayout()
        self.tab_layout_3.addLayout(self.tab_grid_layout_3)
        self.tab.addTab(self.tab_widget_3, 'Tab 3')
        self.tab_widget_4 = Qt.QWidget()
        self.tab_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_4)
        self.tab_grid_layout_4 = Qt.QGridLayout()
        self.tab_layout_4.addLayout(self.tab_grid_layout_4)
        self.tab.addTab(self.tab_widget_4, 'Tab 4')
        self.top_grid_layout.addWidget(self.tab)
        self._ss_ted_gain_range_range = Range(1, 1000, 1, 100, 10000)
        self._ss_ted_gain_range_win = RangeWidget(
            self._ss_ted_gain_range_range, self.set_ss_ted_gain_range,
            'Symbol Sync TED gain', "slider", float)
        self.tab_grid_layout_0.addWidget(self._ss_ted_gain_range_win)
        self._ss_loopbw_range_range = Range(0.001, 2, 0.001, 0.25, 10000)
        self._ss_loopbw_range_win = RangeWidget(self._ss_loopbw_range_range,
                                                self.set_ss_loopbw_range,
                                                'Symbol Sync LBW', "slider",
                                                float)
        self.tab_grid_layout_0.addWidget(self._ss_loopbw_range_win)
        self._ss_damping_factor_range_range = Range(0.001, 2, 0.001, 0.5,
                                                    10000)
        self._ss_damping_factor_range_win = RangeWidget(
            self._ss_damping_factor_range_range,
            self.set_ss_damping_factor_range, 'Symbol Sync DF', "slider",
            float)
        self.tab_grid_layout_0.addWidget(self._ss_damping_factor_range_win)
        self._pll_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._pll_loopbw_range_win = RangeWidget(self._pll_loopbw_range_range,
                                                 self.set_pll_loopbw_range,
                                                 'PLL LBW', "slider", float)
        self.tab_grid_layout_0.addWidget(self._pll_loopbw_range_win)
        self._f_if_tool_bar = Qt.QToolBar(self)
        self._f_if_tool_bar.addWidget(Qt.QLabel('IF Frequency' + ": "))
        self._f_if_line_edit = Qt.QLineEdit(str(self.f_if))
        self._f_if_tool_bar.addWidget(self._f_if_line_edit)
        self._f_if_line_edit.returnPressed.connect(lambda: self.set_f_if(
            int(str(self._f_if_line_edit.text().toAscii()))))
        self.tab_grid_layout_0.addWidget(self._f_if_tool_bar)
        self._doppler_tool_bar = Qt.QToolBar(self)
        self._doppler_tool_bar.addWidget(Qt.QLabel('Doppler' + ": "))
        self._doppler_line_edit = Qt.QLineEdit(str(self.doppler))
        self._doppler_tool_bar.addWidget(self._doppler_line_edit)
        self._doppler_line_edit.returnPressed.connect(lambda: self.set_doppler(
            int(str(self._doppler_line_edit.text().toAscii()))))
        self.tab_grid_layout_0.addWidget(self._doppler_tool_bar)
        self._ad9361_lo_freq_tool_bar = Qt.QToolBar(self)
        self._ad9361_lo_freq_tool_bar.addWidget(
            Qt.QLabel('AD9361 LO Frequency' + ": "))
        self._ad9361_lo_freq_line_edit = Qt.QLineEdit(str(self.ad9361_lo_freq))
        self._ad9361_lo_freq_tool_bar.addWidget(self._ad9361_lo_freq_line_edit)
        self._ad9361_lo_freq_line_edit.returnPressed.connect(
            lambda: self.set_ad9361_lo_freq(
                int(str(self._ad9361_lo_freq_line_edit.text().toAscii()))))
        self.tab_grid_layout_0.addWidget(self._ad9361_lo_freq_tool_bar)
        self.root_raised_cosine_filter_0 = filter.fir_filter_fff(
            1,
            firdes.root_raised_cosine(1, bit_rate * samp_per_symb, bit_rate,
                                      0.7, 1000))
        self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            bit_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0.enable_stem_plot(False)

        if not False:
            self.qtgui_time_sink_x_0_0_0_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 = [2, 2, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_win)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            bit_rate * samp_per_symb,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        if not False:
            self.qtgui_time_sink_x_0_0_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 = [2, 2, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_0_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            bit_rate * samp_per_symb,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not False:
            self.qtgui_time_sink_x_0_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 = [2, 2, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            bit_rate * samp_per_symb,  #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(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not False:
            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 = [2, 2, -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.tab_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            bit_rate * samp_per_symb,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_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_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            lpf_dec,
            firdes.low_pass(1, bit_rate * samp_per_symb * lpf_dec,
                            bit_rate * samp_per_symb / 2,
                            bit_rate * samp_per_symb / 20, firdes.WIN_HAMMING,
                            6.76))
        self.iio_fmcomms2_source_0 = iio.fmcomms2_source_f32c(
            '192.168.1.10', ad9361_lo_freq - (f_if + doppler),
            bit_rate * samp_per_symb * lpf_dec, 1000000, False, True, 0x8000,
            True, True, True, "manual", 64.0, "fast_attack", 64.0,
            "A_BALANCED", '', True)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_GARDNER, samp_per_symb, ss_loopbw_range,
            ss_damping_factor_range, ss_ted_gain_range, 2, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128,
            ([]))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(60000, True)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                 False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((30, ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(
            pll_loopbw_range, 50000 * 6.28 / (bit_rate * samp_per_symb),
            0 * 6.28 / (bit_rate * samp_per_symb))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_pll_freqdet_cf_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.blocks_tag_gate_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0, 0))
        self.connect((self.iio_fmcomms2_source_0, 0),
                     (self.blocks_tag_gate_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
Exemple #12
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.symbol_width = symbol_width = 100e-6
        self.samp_rate = samp_rate = 2000000
        self.baud = baud = int(1.0 / symbol_width)
        self.sps = sps = int(samp_rate / baud)
        self.freq = freq = 433.92e6
        self.cutoff = cutoff = 20000

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_gain(48, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
        self.reveng_pattern_dump_0 = reveng.pattern_dump(
            [1] * 4 + [0] * 4 + [1] * 4 + [0] * 4 + [1] * 7 + [0], 112,
            '%[bits]', False, '', False)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            int(baud),  #size
            int(baud),  #samp_rate
            'Symbols',  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-.2, 2)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                    qtgui.TRIG_SLOPE_POS, 0.5,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        labels = ['Decimated', 'Synced', '', '', '', '', '', '', '', '']
        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]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [3, 4, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            int(samp_rate / 5),  #size
            samp_rate,  #samp_rate
            'Signal',  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-.2, 2)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                  qtgui.TRIG_SLOPE_POS, 0.5, 0,
                                                  0, "trigger")
        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(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Source', 'Thresh,,ZC', 'Decimated', '', '', '', '', '', '', ''
        ]
        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]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.low_pass_filter_1 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, cutoff, cutoff * 2,
                            firdes.WIN_HAMMING, 6.76))
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_ZERO_CROSSING, sps, 0.045, 1.0, 1.0, 1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128, [])
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_threshold_ff_0 = blocks.threshold_ff(.05, .150, 0)
        self.blocks_message_debug_0 = blocks.message_debug()
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_float * 1, sps)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_ff(-0.5)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.reveng_pattern_dump_0, 'out'),
                         (self.blocks_message_debug_0, 'print'))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_char_to_float_0_1, 0),
                     (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.blocks_char_to_float_0_1, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.reveng_pattern_dump_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_1, 0))
Exemple #13
0
    def __init__(self):
        gr.top_block.__init__(self, "Decode ")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Decode ")
        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", "decode_")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.baseband_freq = baseband_freq = 676
        self.samples_per_symbol = samples_per_symbol = int(samp_rate /
                                                           baseband_freq)
        self.carrier_freq = carrier_freq = 432.867e6

        ##################################################
        # Blocks
        ##################################################
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_SIGNAL_TIMES_SLOPE_ML, samples_per_symbol / 4, 0.045,
            1.0, 1.0, 1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128,
            ([]))
        self.digital_map_bb_0_1 = digital.map_bb(
            ([10, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 49, 0]))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/afonsonf/sandbox/repos/rcm/rcm-trabalho/signal.wav', False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(4)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/home/afonsonf/sandbox/repos/rcm/rcm-trabalho/out_bin.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_uchar_0, 0),
                     (self.blocks_pack_k_bits_bb_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_0, 0),
                     (self.digital_map_bb_0_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_map_bb_0_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0),
                     (self.blocks_float_to_uchar_0, 0))
Exemple #14
0
    def __init__(self):
        gr.top_block.__init__(self, "Not titled yet")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Not titled yet")
        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", "somfy_receiver")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.zeta = zeta = 1.0
        self.ted_gain = ted_gain = 1
        self.samp_rate = samp_rate = 2.4e6
        self.samp_per_sym = samp_per_sym = 5
        self.omega_n_norm = omega_n_norm = 0.045
        self.ofile = ofile = "/Users/kesenheimer/Documents/Basteln/SDR/gnuRadio_projects/Somfy/payloads/out"
        self.ifile = ifile = "/Users/kesenheimer/Documents/Basteln/SDR/gnuRadio_projects/Somfy/records/somfy_868.949MHz_2.4Mss.complex"
        self.fmid = fmid = 868.949e6
        self.dfctr3 = dfctr3 = 0
        self.dfctr2 = dfctr2 = -19.2e3
        self.dfctr1 = dfctr1 = 19.2e3
        self.baud_rate = baud_rate = 4800 * 4

        ##################################################
        # Blocks
        ##################################################
        self._zeta_range = Range(0.1, 5.0, 0.1, 1.0, 200)
        self._zeta_win = RangeWidget(self._zeta_range, self.set_zeta,
                                     'Damping Factor', "counter_slider", float)
        self.top_grid_layout.addWidget(self._zeta_win, 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._ted_gain_range = Range(0.05, 5.0, 0.01, 1, 200)
        self._ted_gain_win = RangeWidget(self._ted_gain_range,
                                         self.set_ted_gain,
                                         'Expected TED Gain', "counter_slider",
                                         float)
        self.top_grid_layout.addWidget(self._ted_gain_win, 2, 0, 1, 2)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._omega_n_norm_range = Range(0.0, 2.0 * math.pi * 0.25, 0.001,
                                         0.045, 200)
        self._omega_n_norm_win = RangeWidget(self._omega_n_norm_range,
                                             self.set_omega_n_norm,
                                             'Normalized Bandwidth',
                                             "counter_slider", float)
        self.top_grid_layout.addWidget(self._omega_n_norm_win, 1, 0, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(fmid, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(True, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
            256,  #size
            baud_rate,  #samp_rate
            'Symbol Synced Output and Debug',  #name
            4  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.1)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1.5, samp_per_sym + 2)

        self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.1, 0.01, 0,
            "time_est")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        labels = [
            'Soft Bits', 'Error', 'Instantaneous Period', 'Average Period', '',
            '', '', '', '', ''
        ]
        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]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(4):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win,
                                       3, 1, 1, 2)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            3)
        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(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        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)

        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 range(3):
            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, 3, 0, 1,
                                       1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.fir_filter_xxx_0_1_0_0_0_0_0 = filter.fir_filter_fff(
            1, [1.0 / float(samp_per_sym)] * samp_per_sym)
        self.fir_filter_xxx_0_1_0_0_0_0_0.declare_sample_delay(
            int((samp_per_sym - 1.0) / 2.0) + 4)
        self.fir_filter_xxx_0_1_0_0_0_0 = filter.fir_filter_fff(
            1, [1.0 / float(samp_per_sym)] * samp_per_sym)
        self.fir_filter_xxx_0_1_0_0_0_0.declare_sample_delay(
            int((samp_per_sym - 1.0) / 2.0) + 4)
        self.fir_filter_xxx_0_1_0_0_0 = filter.fir_filter_fff(
            1, [1.0 / float(samp_per_sym)] * samp_per_sym)
        self.fir_filter_xxx_0_1_0_0_0.declare_sample_delay(
            int((samp_per_sym - 1.0) / 2.0) + 4)
        self.extract_payload_0_0_0 = extract_payload.extract_payload(
            (1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), 40 * 8,
            40 * 8)
        self.extract_payload_0_0 = extract_payload.extract_payload(
            (1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), 40 * 8,
            40 * 8)
        self.extract_payload_0 = extract_payload.extract_payload(
            (1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), 40 * 8,
            40 * 8)
        self.digital_symbol_sync_xx_0_0_0_0 = digital.symbol_sync_ff(
            digital.TED_GARDNER, samp_per_sym, omega_n_norm, zeta, ted_gain,
            1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128, [])
        self.digital_symbol_sync_xx_0_0_0 = digital.symbol_sync_ff(
            digital.TED_GARDNER, samp_per_sym, omega_n_norm, zeta, ted_gain,
            1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128, [])
        self.digital_symbol_sync_xx_0_0 = digital.symbol_sync_ff(
            digital.TED_GARDNER, samp_per_sym, omega_n_norm, zeta, ted_gain,
            1.5, 1,
            digital.constellation_bpsk().base(), digital.IR_MMSE_8TAP, 128, [])
        self.blocks_threshold_ff_0_0_0 = blocks.threshold_ff(-0.2, 0.2, 0)
        self.blocks_threshold_ff_0_0 = blocks.threshold_ff(-0.2, 0.2, 0)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.2, 0.2, 0)
        self.blocks_repack_bits_bb_0_0_0 = blocks.repack_bits_bb(
            1, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(
            1, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(
            1, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_float_to_char_0_0_0 = blocks.float_to_char(1, 1)
        self.blocks_float_to_char_0_0 = blocks.float_to_char(1, 1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_file_sink_0_0_0_0_0_1_0 = blocks.file_sink(
            gr.sizeof_char * 1, ofile + "_chn2.bin", False)
        self.blocks_file_sink_0_0_0_0_0_1_0.set_unbuffered(True)
        self.blocks_file_sink_0_0_0_0_0_1 = blocks.file_sink(
            gr.sizeof_char * 1, ofile + "_chn3.bin", False)
        self.blocks_file_sink_0_0_0_0_0_1.set_unbuffered(True)
        self.blocks_file_sink_0_0_0_0_0 = blocks.file_sink(
            gr.sizeof_char * 1, ofile + "_chn1.bin", False)
        self.blocks_file_sink_0_0_0_0_0.set_unbuffered(True)
        self.OOK_demodulator_improved_0_1 = OOK_demodulator_improved(
            fbaud=baud_rate,
            freq=dfctr2,
            offset=0.5,
            re_samp_rate=96000,
            samp_rate=samp_rate,
        )
        self.OOK_demodulator_improved_0_0 = OOK_demodulator_improved(
            fbaud=baud_rate,
            freq=dfctr3,
            offset=-0.01,
            re_samp_rate=96000,
            samp_rate=samp_rate,
        )
        self.OOK_demodulator_improved_0 = OOK_demodulator_improved(
            fbaud=baud_rate,
            freq=dfctr1,
            offset=-0.5,
            re_samp_rate=96000,
            samp_rate=samp_rate,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.OOK_demodulator_improved_0, 0),
                     (self.fir_filter_xxx_0_1_0_0_0, 0))
        self.connect((self.OOK_demodulator_improved_0, 2),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.OOK_demodulator_improved_0_0, 0),
                     (self.fir_filter_xxx_0_1_0_0_0_0, 0))
        self.connect((self.OOK_demodulator_improved_0_0, 2),
                     (self.qtgui_freq_sink_x_1, 1))
        self.connect((self.OOK_demodulator_improved_0_1, 0),
                     (self.fir_filter_xxx_0_1_0_0_0_0_0, 0))
        self.connect((self.OOK_demodulator_improved_0_1, 2),
                     (self.qtgui_freq_sink_x_1, 2))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.extract_payload_0, 0))
        self.connect((self.blocks_float_to_char_0_0, 0),
                     (self.extract_payload_0_0, 0))
        self.connect((self.blocks_float_to_char_0_0_0, 0),
                     (self.extract_payload_0_0_0, 0))
        self.connect((self.blocks_repack_bits_bb_0, 0),
                     (self.blocks_file_sink_0_0_0_0_0, 0))
        self.connect((self.blocks_repack_bits_bb_0_0, 0),
                     (self.blocks_file_sink_0_0_0_0_0_1, 0))
        self.connect((self.blocks_repack_bits_bb_0_0_0, 0),
                     (self.blocks_file_sink_0_0_0_0_0_1_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_threshold_ff_0_0, 0),
                     (self.blocks_float_to_char_0_0, 0))
        self.connect((self.blocks_threshold_ff_0_0_0, 0),
                     (self.blocks_float_to_char_0_0_0, 0))
        self.connect((self.digital_symbol_sync_xx_0_0, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.digital_symbol_sync_xx_0_0, 2),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 2))
        self.connect((self.digital_symbol_sync_xx_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.digital_symbol_sync_xx_0_0, 1),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 1))
        self.connect((self.digital_symbol_sync_xx_0_0, 3),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 3))
        self.connect((self.digital_symbol_sync_xx_0_0_0, 0),
                     (self.blocks_threshold_ff_0_0, 0))
        self.connect((self.digital_symbol_sync_xx_0_0_0_0, 0),
                     (self.blocks_threshold_ff_0_0_0, 0))
        self.connect((self.extract_payload_0, 0),
                     (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.extract_payload_0_0, 0),
                     (self.blocks_repack_bits_bb_0_0, 0))
        self.connect((self.extract_payload_0_0_0, 0),
                     (self.blocks_repack_bits_bb_0_0_0, 0))
        self.connect((self.fir_filter_xxx_0_1_0_0_0, 0),
                     (self.digital_symbol_sync_xx_0_0, 0))
        self.connect((self.fir_filter_xxx_0_1_0_0_0_0, 0),
                     (self.digital_symbol_sync_xx_0_0_0, 0))
        self.connect((self.fir_filter_xxx_0_1_0_0_0_0_0, 0),
                     (self.digital_symbol_sync_xx_0_0_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.OOK_demodulator_improved_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.OOK_demodulator_improved_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.OOK_demodulator_improved_0_1, 0))