Пример #1
0
 def transform(self, src_data, rate, freq):
     src = blocks.vector_source_f(src_data, False)
     dft = fft.goertzel_fc(rate, rate, freq)
     dst = blocks.vector_sink_c()
     self.tb.connect(src, dft, dst)
     self.tb.run()
     return dst.data()
Пример #2
0
 def transform(self, src_data, rate, freq):
     src = blocks.vector_source_f(src_data, False)
     dft = fft.goertzel_fc(rate, rate, freq)
     dst = blocks.vector_sink_c()
     self.tb.connect(src, dft, dst)
     self.tb.run()
     return dst.data()
Пример #3
0
    def __init__(self, mode='VOR', zero_point=59, **kwargs):
        self.channel_rate = channel_rate = 40000
        internal_audio_rate = 20000  # TODO over spec'd
        self.zero_point = zero_point

        transition = 5000
        SimpleAudioDemodulator.__init__(self,
                                        mode=mode,
                                        audio_rate=internal_audio_rate,
                                        demod_rate=channel_rate,
                                        band_filter=fm_subcarrier * 1.25 +
                                        fm_deviation + transition / 2,
                                        band_filter_transition=transition,
                                        **kwargs)

        self.dir_rate = dir_rate = 10

        if internal_audio_rate % dir_rate != 0:
            raise ValueError(
                'Audio rate %s is not a multiple of direction-finding rate %s'
                % (internal_audio_rate, dir_rate))
        self.dir_scale = dir_scale = internal_audio_rate // dir_rate
        self.audio_scale = audio_scale = channel_rate // internal_audio_rate

        self.zeroer = blocks.add_const_vff((zero_point * (math.pi / 180), ))

        self.dir_vector_filter = grfilter.fir_filter_ccf(
            1, firdes.low_pass(1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.am_channel_filter_block = grfilter.fir_filter_ccf(
            1,
            firdes.low_pass(1, channel_rate, 5000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.goertzel_fm = fft.goertzel_fc(channel_rate,
                                           dir_scale * audio_scale, 30)
        self.goertzel_am = fft.goertzel_fc(internal_audio_rate, dir_scale, 30)
        self.fm_channel_filter_block = grfilter.freq_xlating_fir_filter_ccc(
            1, (firdes.low_pass(1.0, channel_rate, fm_subcarrier / 2,
                                fm_subcarrier / 2, firdes.WIN_HAMMING)),
            fm_subcarrier, channel_rate)
        self.multiply_conjugate_block = blocks.multiply_conjugate_cc(1)
        self.complex_to_arg_block = blocks.complex_to_arg(1)
        self.am_agc_block = analog.feedforward_agc_cc(1024, 1.0)
        self.am_demod_block = analog.am_demod_cf(
            channel_rate=channel_rate,
            audio_decim=audio_scale,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.fm_demod_block = analog.quadrature_demod_cf(1)
        self.phase_agc_fm = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.phase_agc_am = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)

        self.probe = blocks.probe_signal_f()

        self.audio_filter_block = grfilter.fir_filter_fff(
            1, design_lofi_audio_filter(internal_audio_rate, False))

        ##################################################
        # Connections
        ##################################################
        # Input
        self.connect(self, self.band_filter_block)
        # AM chain
        self.connect(self.band_filter_block, self.am_channel_filter_block,
                     self.am_agc_block, self.am_demod_block)
        # AM audio
        self.connect(
            self.am_demod_block,
            blocks.multiply_const_ff(1.0 / audio_modulation_index * 0.5),
            self.audio_filter_block)
        self.connect_audio_output(self.audio_filter_block)

        # AM phase
        self.connect(self.am_demod_block, self.goertzel_am, self.phase_agc_am,
                     (self.multiply_conjugate_block, 0))
        # FM phase
        self.connect(self.band_filter_block, self.fm_channel_filter_block,
                     self.fm_demod_block, self.goertzel_fm, self.phase_agc_fm,
                     (self.multiply_conjugate_block, 1))
        # Phase comparison and output
        self.connect(
            self.multiply_conjugate_block,
            self.dir_vector_filter,
            self.complex_to_arg_block,
            blocks.multiply_const_ff(-1),  # opposite angle conventions
            self.zeroer,
            self.probe)
Пример #4
0
    def __init__(self,
                 antenna="TX/RX",
                 vor_freq_1=111e6,
                 com_freq_1=135.275e6,
                 vor_freq_2=111e6,
                 rx_gain=30,
                 gain=20):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.vor_freq_1 = vor_freq_1
        self.com_freq_1 = com_freq_1
        self.vor_freq_2 = vor_freq_2
        self.rx_gain = rx_gain
        self.gain = gain

        ##################################################
        # Variables
        ##################################################
        self.obs_decimation = obs_decimation = 25
        self.ils_decimation = ils_decimation = 50
        self.am_sample_rate = am_sample_rate = 12.5e3
        self.vor_samp_rate = vor_samp_rate = 250e3
        self.vor_freq_entry_2 = vor_freq_entry_2 = vor_freq_2
        self.vor_freq_entry_1 = vor_freq_entry_1 = vor_freq_1
        self.vor_center_freq_0 = vor_center_freq_0 = (117.95e6 -
                                                      108.00e6) / 2 + 117.95e6
        self.vor_center_freq = vor_center_freq = (117.95e6 -
                                                  108.00e6) / 2 + 117.95e6
        self.squelch_slider = squelch_slider = -110
        self.rxgain = rxgain = 15
        self.phase_correction = phase_correction = 5
        self.obs_sample_rate = obs_sample_rate = am_sample_rate / obs_decimation
        self.ils_sample_rate = ils_sample_rate = am_sample_rate / ils_decimation
        self.gain_slider = gain_slider = gain
        self.com_freq_entry_1 = com_freq_entry_1 = com_freq_1
        self.band_center_freq = band_center_freq = (136.975e6 -
                                                    108.0e6) / 2 + 108.0e6
        self.audio_select = audio_select = 0
        self.audio_sample_rate = audio_sample_rate = 48e3
        self.am_decimation = am_decimation = 1

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "RF Analyzer")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Channel FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Demod Audio FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Ref and Phase Scope")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Manipulated Ref and Phase")
        self.Add(self.notebook_0)
        self._vor_freq_entry_1_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.vor_freq_entry_1,
            callback=self.set_vor_freq_entry_1,
            label='vor_freq_entry_1',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_1_text_box)
        _gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_slider_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            label='gain_slider',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider_slider = forms.slider(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            minimum=0,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_gain_slider_sizer)
        self._com_freq_entry_1_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.com_freq_entry_1,
            callback=self.set_com_freq_entry_1,
            label='com_freq_entry_1',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._com_freq_entry_1_text_box)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=10e3,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="Units",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=10,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="Number Plot",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=12.5e3,
            fft_size=1024,
            fft_rate=5,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self._vor_freq_entry_2_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.vor_freq_entry_2,
            callback=self.set_vor_freq_entry_2,
            label='vor_freq_entry_2',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_2_text_box)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(2),
            ),
        )
        self.uhd_usrp_source_0.set_subdev_spec("A:0 A:0", 0)
        self.uhd_usrp_source_0.set_samp_rate(vor_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(
            uhd.tune_request(com_freq_entry_1,
                             rf_freq=band_center_freq,
                             rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain_slider, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_center_freq(
            uhd.tune_request(vor_freq_entry_1,
                             rf_freq=band_center_freq,
                             rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 1)
        self.uhd_usrp_source_0.set_gain(gain_slider, 1)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 1)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(250e3)
        self.uhd_usrp_sink_0.set_center_freq(
            uhd.tune_request(com_freq_entry_1, 20e6), 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        _squelch_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_slider_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_squelch_slider_sizer,
            value=self.squelch_slider,
            callback=self.set_squelch_slider,
            label='squelch_slider',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._squelch_slider_slider = forms.slider(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_squelch_slider_sizer,
            value=self.squelch_slider,
            callback=self.set_squelch_slider,
            minimum=-110,
            maximum=0,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_squelch_slider_sizer)
        self.squelch = analog.pwr_squelch_cc(squelch_slider, 0.01, 20, True)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
            interpolation=250,
            decimation=48,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=480,
            decimation=125,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=4,
            decimation=5,
            taps=None,
            fractional_bw=None,
        )
        self.openavionics_joystick_interface_0 = openavionics.joystick_interface(
        )
        self.openavionics_audio_ptt_0 = openavionics.audio_ptt()
        self.null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.multiply_xx_0_0 = blocks.multiply_vff(1)
        self.low_pass_filter_3 = filter.fir_filter_ccf(
            1, firdes.low_pass(1, 10e3, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0_0 = filter.fir_filter_ccf(
            5, firdes.low_pass(1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0 = filter.fir_filter_ccf(
            5, firdes.low_pass(1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.fir_filter_ccf(
            5,
            firdes.low_pass(1, vor_samp_rate, 15e3, 5e3, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_1 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, 12.5e3, 3e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(250e3 / 12.5e3),
            firdes.low_pass(1, vor_samp_rate, 10e3, 1e3, firdes.WIN_HAMMING,
                            6.76))
        self.goertzel_fc_0_0 = fft.goertzel_fc(10000, 1000, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(40000, 4000, 30)
        self.float_to_complex_0_0 = blocks.float_to_complex(1)
        self.const_source_x_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE,
                                                      0, 0, 0.550)
        self.const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0,
                                                    0, 0.450)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-87.2665e-3, ))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(
            4, firdes.band_pass(1, 40e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.band_pass(1, 10e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(int(audio_sample_rate), "", True)
        self._audio_select_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.audio_select,
            callback=self.set_audio_select,
            label='audio_select',
            choices=[0, 1],
            labels=['AM Voice', 'VOR Subcarrier'],
        )
        self.Add(self._audio_select_chooser)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            40e3, analog.GR_COS_WAVE, -9.96e3, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=40e3,
            audio_decim=4,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.analog_agc2_xx_0_1_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1_0.set_max_gain(100)
        self.analog_agc2_xx_0_1 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1.set_max_gain(100)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_0.set_max_gain(100)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(100)
        self.am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=am_sample_rate,
            audio_decim=am_decimation,
            audio_pass=3e3,
            audio_stop=4e3,
        )
        self.agc2_xx_0 = analog.agc2_cc(1, 1, 0.75, 1.0)
        self.agc2_xx_0.set_max_gain(0.0)
        self.add_xx_0_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.agc2_xx_0, 0), (self.am_demod_cf_0, 0))
        self.connect((self.am_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.agc2_xx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.multiply_xx_0_0, 0), (self.add_xx_0_0, 0))
        self.connect((self.const_source_x_0, 0), (self.multiply_xx_0_0, 1))
        self.connect((self.const_source_x_0_0, 0), (self.add_xx_0_0, 1))
        self.connect((self.multiply_xx_0_0_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 1))
        self.connect((self.float_to_complex_0_0, 0),
                     (self.multiply_xx_0_0_0, 0))
        self.connect((self.const_source_x_0_0_0, 0),
                     (self.multiply_xx_0_0_0, 1))
        self.connect((self.uhd_usrp_source_0, 0), (self.null_sink_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.analog_agc2_xx_0_1_0, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.analog_agc2_xx_0_1, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.analog_agc2_xx_0_1, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.analog_agc2_xx_0_1_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.goertzel_fc_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_3, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.low_pass_filter_3, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.analog_agc2_xx_0_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.low_pass_filter_2_0_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.low_pass_filter_2_0_0, 0))
        self.connect((self.low_pass_filter_2_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 1), (self.null_sink_0_0, 0))
        self.connect((self.low_pass_filter_2, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.openavionics_audio_ptt_0, 0))
        self.connect((self.openavionics_audio_ptt_0, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.multiply_xx_0_0, 0))
        self.connect((self.squelch, 0), (self.agc2_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.squelch, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_2, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.openavionics_joystick_interface_0, "out",
                         self.openavionics_audio_ptt_0, "in2")
Пример #5
0
    def __init__(self, mode='VOR', zero_point=59, **kwargs):
        self.channel_rate = channel_rate = 40000
        internal_audio_rate = 20000  # TODO over spec'd
        self.zero_point = zero_point

        transition = 5000
        SimpleAudioDemodulator.__init__(self,
            mode=mode,
            audio_rate=internal_audio_rate,
            demod_rate=channel_rate,
            band_filter=fm_subcarrier * 1.25 + fm_deviation + transition / 2,
            band_filter_transition=transition,
            **kwargs)

        self.dir_rate = dir_rate = 10

        if internal_audio_rate % dir_rate != 0:
            raise ValueError('Audio rate %s is not a multiple of direction-finding rate %s' % (internal_audio_rate, dir_rate))
        self.dir_scale = dir_scale = internal_audio_rate // dir_rate
        self.audio_scale = audio_scale = channel_rate // internal_audio_rate

        self.zeroer = blocks.add_const_vff((zero_point * (math.pi / 180), ))
        
        self.dir_vector_filter = grfilter.fir_filter_ccf(1, firdes.low_pass(
            1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.am_channel_filter_block = grfilter.fir_filter_ccf(1, firdes.low_pass(
            1, channel_rate, 5000, 5000, firdes.WIN_HAMMING, 6.76))
        self.goertzel_fm = fft.goertzel_fc(channel_rate, dir_scale * audio_scale, 30)
        self.goertzel_am = fft.goertzel_fc(internal_audio_rate, dir_scale, 30)
        self.fm_channel_filter_block = grfilter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1.0, channel_rate, fm_subcarrier / 2, fm_subcarrier / 2, firdes.WIN_HAMMING)), fm_subcarrier, channel_rate)
        self.multiply_conjugate_block = blocks.multiply_conjugate_cc(1)
        self.complex_to_arg_block = blocks.complex_to_arg(1)
        self.am_agc_block = analog.feedforward_agc_cc(1024, 1.0)
        self.am_demod_block = analog.am_demod_cf(
            channel_rate=channel_rate,
            audio_decim=audio_scale,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.fm_demod_block = analog.quadrature_demod_cf(1)
        self.phase_agc_fm = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.phase_agc_am = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        
        self.probe = blocks.probe_signal_f()
        
        self.audio_filter_block = grfilter.fir_filter_fff(1, design_lofi_audio_filter(internal_audio_rate, False))

        ##################################################
        # Connections
        ##################################################
        # Input
        self.connect(
            self,
            self.band_filter_block)
        # AM chain
        self.connect(
            self.band_filter_block,
            self.am_channel_filter_block,
            self.am_agc_block,
            self.am_demod_block)
        # AM audio
        self.connect(
            self.am_demod_block,
            blocks.multiply_const_ff(1.0 / audio_modulation_index * 0.5),
            self.audio_filter_block)
        self.connect_audio_output(self.audio_filter_block)
        
        # AM phase
        self.connect(
            self.am_demod_block,
            self.goertzel_am,
            self.phase_agc_am,
            (self.multiply_conjugate_block, 0))
        # FM phase
        self.connect(
            self.band_filter_block,
            self.fm_channel_filter_block,
            self.fm_demod_block,
            self.goertzel_fm,
            self.phase_agc_fm,
            (self.multiply_conjugate_block, 1))
        # Phase comparison and output
        self.connect(
            self.multiply_conjugate_block,
            self.dir_vector_filter,
            self.complex_to_arg_block,
            blocks.multiply_const_ff(-1),  # opposite angle conventions
            self.zeroer,
            self.probe)
Пример #6
0
    def __init__(self):
        gr.top_block.__init__(self, "VLP Research")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("VLP Research")
        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", "vlp_sink_03")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.z_rx = z_rx = 0
        self.y = y = 0
        self.x = x = 0
        self.samp_rate = samp_rate = 2000000
        self.lamb_order = lamb_order = 0.88
        self.fft_size = fft_size = 2000
        self.cpc_gain = cpc_gain = 1
        self.Trx_filter = Trx_filter = 1
        self.TX_height = TX_height = 1.375
        self.TX_ampl = TX_ampl = 0.7
        self.TX4_location = TX4_location = 1.1, .450, 1.375
        self.TX4_f = TX4_f = 400000
        self.TX3_location = TX3_location = .50, .45, 1.375
        self.TX3_f = TX3_f = 200000
        self.TX2_location = TX2_location = .50, .275, 1.375
        self.TX2_f = TX2_f = 300000
        self.TX1_location = TX1_location = 1.1, .275, 1.375
        self.TX1_f = TX1_f = 100000
        self.RX_area = RX_area = 1
        self.G_filter = G_filter = 1
        self.FOV_RX = FOV_RX = 90
        self.CrxCtx4 = CrxCtx4 = 1.21686524
        self.CrxCtx3 = CrxCtx3 = 1.42731873
        self.CrxCtx2 = CrxCtx2 = 1.37229190
        self.CrxCtx1 = CrxCtx1 = 1.37567074

        ##################################################
        # Blocks
        ##################################################
        self._z_rx_range = Range(-.6, 1.2, .3, 0, 200)
        self._z_rx_win = RangeWidget(self._z_rx_range, self.set_z_rx, "z_rx", "counter_slider", float)
        self.top_layout.addWidget(self._z_rx_win)
        self._y_range = Range(0, 2, 0.01, 0, 200)
        self._y_win = RangeWidget(self._y_range, self.set_y, "y", "counter_slider", float)
        self.top_layout.addWidget(self._y_win)
        self._x_range = Range(0, 2, 0.01, 0, 200)
        self._x_win = RangeWidget(self._x_range, self.set_x, "x", "counter_slider", float)
        self.top_layout.addWidget(self._x_win)
        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, "2D Position")
        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, "(x, y, z) values")
        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+Freq")
        self.top_layout.addWidget(self.tab)
        self.vlp_trilat_fixed_4in_ff_0 = vlp.trilat_fixed_4in_ff((TX1_location), (TX2_location), (TX3_location), (TX4_location))
        self.vlp_proto_distance_ff_0_2 = vlp.proto_distance_ff(lamb_order, RX_area, FOV_RX, TX_ampl, CrxCtx4, TX_height, Trx_filter, cpc_gain, z_rx)
        self.vlp_proto_distance_ff_0_1 = vlp.proto_distance_ff(lamb_order, RX_area, FOV_RX, TX_ampl, CrxCtx3, TX_height, Trx_filter, cpc_gain, z_rx)
        self.vlp_proto_distance_ff_0_0 = vlp.proto_distance_ff(lamb_order, RX_area, FOV_RX, TX_ampl, CrxCtx2, TX_height, Trx_filter, cpc_gain, z_rx)
        self.vlp_proto_distance_ff_0 = vlp.proto_distance_ff(lamb_order, RX_area, FOV_RX, TX_ampl, CrxCtx1, TX_height, Trx_filter, cpc_gain, z_rx)
        self.uhd_usrp_source_0_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0_0.set_center_freq(0, 0)
        self.uhd_usrp_source_0_0.set_gain(0, 0)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	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(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_HORIZ,
            3
        )
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("Trilateration Output")
        
        labels = ["x", "y", "z", "", "",
                  "", "", "", "", ""]
        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(3):
            self.qtgui_number_sink_0.set_min(i, -2)
            self.qtgui_number_sink_0.set_max(i, 2)
            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_layout_1.addWidget(self._qtgui_number_sink_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_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(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_layout_2.addWidget(self._qtgui_freq_sink_x_0_win)
        self.goertzel_fc_0_2 = fft.goertzel_fc(samp_rate, fft_size, TX2_f)
        self.goertzel_fc_0_1 = fft.goertzel_fc(samp_rate, fft_size, TX3_f)
        self.goertzel_fc_0_0 = fft.goertzel_fc(samp_rate, fft_size, TX4_f)
        self.goertzel_fc_0 = fft.goertzel_fc(samp_rate, fft_size, TX1_f)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0_2 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0_1 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.analog_const_source_x_2 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, x)
        self.analog_const_source_x_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, y)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, z_rx)
        self.Position = qtgui.const_sink_c(
        	1024, #size
        	"Receiver (2D) Position", #name
        	2 #number of inputs
        )
        self.Position.set_update_time(0.10)
        self.Position.set_y_axis(0, 1.37)
        self.Position.set_x_axis(0, 1.45)
        self.Position.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.Position.enable_autoscale(False)
        self.Position.enable_grid(True)
        self.Position.enable_axis_labels(True)
        
        if not True:
          self.Position.disable_legend()
        
        labels = ["X position", "Y position", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.Position.set_line_label(i, "Data {0}".format(i))
            else:
                self.Position.set_line_label(i, labels[i])
            self.Position.set_line_width(i, widths[i])
            self.Position.set_line_color(i, colors[i])
            self.Position.set_line_style(i, styles[i])
            self.Position.set_line_marker(i, markers[i])
            self.Position.set_line_alpha(i, alphas[i])
        
        self._Position_win = sip.wrapinstance(self.Position.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._Position_win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.vlp_trilat_fixed_4in_ff_0, 4))    
        self.connect((self.analog_const_source_x_1, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.analog_const_source_x_2, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_complex_to_float_0_0, 1), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.goertzel_fc_0, 0))    
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.goertzel_fc_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.goertzel_fc_0_1, 0))    
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.goertzel_fc_0_2, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.vlp_proto_distance_ff_0, 0))    
        self.connect((self.blocks_complex_to_mag_0_0, 0), (self.vlp_proto_distance_ff_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_0_1, 0), (self.vlp_proto_distance_ff_0_1, 0))    
        self.connect((self.blocks_complex_to_mag_0_2, 0), (self.vlp_proto_distance_ff_0_2, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.Position, 1))    
        self.connect((self.blocks_float_to_complex_1, 0), (self.Position, 0))    
        self.connect((self.goertzel_fc_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.goertzel_fc_0_0, 0), (self.blocks_complex_to_mag_0_2, 0))    
        self.connect((self.goertzel_fc_0_1, 0), (self.blocks_complex_to_mag_0_1, 0))    
        self.connect((self.goertzel_fc_0_2, 0), (self.blocks_complex_to_mag_0_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.blocks_complex_to_float_0_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.vlp_proto_distance_ff_0, 0), (self.vlp_trilat_fixed_4in_ff_0, 0))    
        self.connect((self.vlp_proto_distance_ff_0_0, 0), (self.vlp_trilat_fixed_4in_ff_0, 1))    
        self.connect((self.vlp_proto_distance_ff_0_1, 0), (self.vlp_trilat_fixed_4in_ff_0, 2))    
        self.connect((self.vlp_proto_distance_ff_0_2, 0), (self.vlp_trilat_fixed_4in_ff_0, 3))    
        self.connect((self.vlp_trilat_fixed_4in_ff_0, 0), (self.blocks_float_to_complex_1, 0))    
        self.connect((self.vlp_trilat_fixed_4in_ff_0, 1), (self.blocks_float_to_complex_1, 1))    
        self.connect((self.vlp_trilat_fixed_4in_ff_0, 0), (self.qtgui_number_sink_0, 0))    
        self.connect((self.vlp_trilat_fixed_4in_ff_0, 1), (self.qtgui_number_sink_0, 1))    
        self.connect((self.vlp_trilat_fixed_4in_ff_0, 2), (self.qtgui_number_sink_0, 2))    
Пример #7
0
    def __init__(self, mon_id, audio_port):
        gr.top_block.__init__(self, "EAS/SAME Monitor")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000

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

        # Resampler from input rate (44.1k) to internal rate (8k)
        self.rational_resampler_44k = filter.rational_resampler_fff(
            interpolation=80,
            decimation=441,
        )

        # Resampler from 8000 Hz to 4166 2/3rd Hz to deal with SAME's weird parameters
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=50,
            decimation=96,
            taps=None,
            fractional_bw=None,
        )

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcc(
            1, (firdes.low_pass(1, samp_rate, 600, 100)), 1822.916667,
            samp_rate)
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=8,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.01,
            freq_error=0.0,
            verbose=True,
            log=False,
        )
        self.src = audio.source(44100, "eas_mon_%s:in" % (mon_id), True)
        self.agc = analog.agc_ff(0.0001, 0.1, 1.0)
        #self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(-50, 0.0001, 0)
        self.msg_queue = gr.msg_queue(10)
        self.same_dec_0 = same.same_dec(self.msg_queue)

        self.tone_det_0 = fft.goertzel_fc(samp_rate, samp_rate / 10, 853)
        self.tone_det_1 = fft.goertzel_fc(samp_rate, samp_rate / 10, 960)
        self.tone_det_2 = fft.goertzel_fc(samp_rate, samp_rate / 10, 1050)
        self.wat_thresh_msg = same.wat_thresh_msg(self.msg_queue, 1, 0.05,
                                                  0.01)

        #self.avg_audio_level = analog.probe_avg_mag_sqrd_ff(-50)
        #self.level_thresh_msg = same.level_thresh_msg(self.msg_queue, 1, 3, db_to_abs(-30), db_to_abs(-40))

        self.audio_sink_converter = blocks.float_to_short(1, 3276)
        self.audio_sink = blocks.udp_sink(2, '127.0.0.1', audio_port)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.src, 0), (self.rational_resampler_44k, 0))
        self.connect((self.rational_resampler_44k, 0), (self.agc, 0))
        #self.connect((self.agc, 0), (self.analog_pwr_squelch_xx_0, 0))

        #self.connect((self.analog_pwr_squelch_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.agc, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.same_dec_0, 0))

        self.connect((self.agc, 0), (self.tone_det_0, 0),
                     (self.wat_thresh_msg, 0))
        self.connect((self.agc, 0), (self.tone_det_1, 0),
                     (self.wat_thresh_msg, 1))
        self.connect((self.agc, 0), (self.tone_det_2, 0),
                     (self.wat_thresh_msg, 2))
        #self.connect((self.agc, 0), (self.avg_audio_level, 0), (self.level_thresh_msg, 0))

        self.connect((self.agc, 0), (self.audio_sink_converter, 0),
                     (self.audio_sink, 0))

        self._watcher = _queue_watcher_thread(self.msg_queue, mon_id,
                                              audio_port)
    def __init__(self):
        gr.top_block.__init__(self, "VOR Decoder")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("VOR Decoder")
        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", "vor_playback_sigmf_2")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 250e3
        self.decim = decim = 5
        self.throttle_rate = throttle_rate = 1
        self.lo_cut = lo_cut = 1e3
        self.hi_cut = hi_cut = 1050
        self.fine = fine = 1e3
        self.audio_rate = audio_rate = samp_rate/decim/25*24
        self.audio_gain = audio_gain = 1
        self.alpha = alpha = .02

        ##################################################
        # Blocks
        ##################################################
        self._throttle_rate_tool_bar = Qt.QToolBar(self)
        self._throttle_rate_tool_bar.addWidget(Qt.QLabel("throttle_rate"+": "))
        self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate))
        self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit)
        self._throttle_rate_line_edit.returnPressed.connect(
        	lambda: self.set_throttle_rate(eng_notation.str_to_num(str(self._throttle_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 0, 6, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._samp_rate_tool_bar = Qt.QToolBar(self)
        self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate"+": "))
        self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate))
        self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit)
        self._samp_rate_line_edit.returnPressed.connect(
        	lambda: self.set_samp_rate(eng_notation.str_to_num(str(self._samp_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 0, 4, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.sigmf_source_0 = gr_sigmf.source('/captures/20191228/VOR_2019-12-28T19:07:15Z.sigmf-data', "cf32" + ("_le" if sys.byteorder == "little" else "_be"), True)
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc(
                interpolation=24,
                decimation=25*5,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024*2, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate / decim, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.010)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
          self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4, 0, 2, 4)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
        	256, #size
        	audio_rate / 3 / 8, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-180, 180)

        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, .25, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        if not True:
          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 = [-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_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.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win, 6, 4, 2, 4)
        for r in range(6, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	8192 /2, #size
        	samp_rate / decim /25 * 24, #samp_rate
        	"30 Hz Variable", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0.set_y_axis(-4, 4)

        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_NORM, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['ref', 'var', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                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, 4, 4, 2, 4)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate / decim / 25 * 24, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_1_0.set_update_time(0.010)
        self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_1_0.enable_grid(True)
        self.qtgui_freq_sink_x_1_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_1_0.disable_legend()

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

        self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 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.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	audio_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1.enable_autoscale(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)

        if not True:
          self.qtgui_freq_sink_x_1.disable_legend()

        if "float" == "float" or "float" == "msg_float":
          self.qtgui_freq_sink_x_1.set_plot_pos_half(not 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 xrange(1):
            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, 4, 1, 4)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	10, samp_rate / decim / 25 *24, 1e3, 500, firdes.WIN_HAMMING, 6.76))
        self._lo_cut_tool_bar = Qt.QToolBar(self)
        self._lo_cut_tool_bar.addWidget(Qt.QLabel("lo_cut"+": "))
        self._lo_cut_line_edit = Qt.QLineEdit(str(self.lo_cut))
        self._lo_cut_tool_bar.addWidget(self._lo_cut_line_edit)
        self._lo_cut_line_edit.returnPressed.connect(
        	lambda: self.set_lo_cut(eng_notation.str_to_num(str(self._lo_cut_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._lo_cut_tool_bar, 2, 4, 1, 2)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._hi_cut_tool_bar = Qt.QToolBar(self)
        self._hi_cut_tool_bar.addWidget(Qt.QLabel("hi_cut"+": "))
        self._hi_cut_line_edit = Qt.QLineEdit(str(self.hi_cut))
        self._hi_cut_tool_bar.addWidget(self._hi_cut_line_edit)
        self._hi_cut_line_edit.returnPressed.connect(
        	lambda: self.set_hi_cut(eng_notation.str_to_num(str(self._hi_cut_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._hi_cut_tool_bar, 2, 6, 1, 2)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.goertzel_fc_0_0 = fft.goertzel_fc(int(audio_rate), 1024, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(int(audio_rate), 1024, 30)
        self._fine_tool_bar = Qt.QToolBar(self)
        self._fine_tool_bar.addWidget(Qt.QLabel('Fine [Hz]'+": "))
        self._fine_line_edit = Qt.QLineEdit(str(self.fine))
        self._fine_tool_bar.addWidget(self._fine_line_edit)
        self._fine_line_edit.returnPressed.connect(
        	lambda: self.set_fine(eng_notation.str_to_num(str(self._fine_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._fine_tool_bar, 1, 4, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate*throttle_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((180/math.pi, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(10, .1, 4000, 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate / decim / 25 * 24 , 25, 35, 5, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate / decim / 25 * 24 , 25, 35, 5, firdes.WIN_HAMMING, 6.76))
        self._audio_gain_tool_bar = Qt.QToolBar(self)
        self._audio_gain_tool_bar.addWidget(Qt.QLabel('vol30'+": "))
        self._audio_gain_line_edit = Qt.QLineEdit(str(self.audio_gain))
        self._audio_gain_tool_bar.addWidget(self._audio_gain_line_edit)
        self._audio_gain_line_edit.returnPressed.connect(
        	lambda: self.set_audio_gain(eng_notation.str_to_num(str(self._audio_gain_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_gain_tool_bar, 1, 7, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(7, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 9960, 1, 0)
        self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc(math.pi/200, math.pi/10, -math.pi/10)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
        	channel_rate=samp_rate / decim / 25 * 24,
        	audio_decim=1,
        	deviation=1e3,
        	audio_pass=100,
        	audio_stop=200,
        	gain=1.0,
        	tau=75e-6,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=48e3,
        	audio_decim=1,
        	audio_pass=12000,
        	audio_stop=13000,
        )
        self.analog_agc2_xx_2 = analog.agc2_ff(1e-4, 1e-4, 1, 1.0)
        self.analog_agc2_xx_2.set_max_gain(65536)
        self.analog_agc2_xx_1 = analog.agc2_ff(1e-4, 1e-4, 1, 1)
        self.analog_agc2_xx_1.set_max_gain(65536)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-2, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)
        self._alpha_tool_bar = Qt.QToolBar(self)
        self._alpha_tool_bar.addWidget(Qt.QLabel('alpha'+": "))
        self._alpha_line_edit = Qt.QLineEdit(str(self.alpha))
        self._alpha_tool_bar.addWidget(self._alpha_line_edit)
        self._alpha_line_edit.returnPressed.connect(
        	lambda: self.set_alpha(eng_notation.str_to_num(str(self._alpha_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._alpha_tool_bar, 1, 6, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0), (self.analog_pll_carriertracking_cc_0, 0))
        self.connect((self.analog_agc2_xx_1, 0), (self.goertzel_fc_0, 0))
        self.connect((self.analog_agc2_xx_1, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.analog_agc2_xx_2, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.analog_agc2_xx_2, 0), (self.qtgui_time_sink_x_0, 1))
        self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.band_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.dc_blocker_xx_0_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.analog_agc2_xx_1, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.analog_agc2_xx_2, 0))
        self.connect((self.goertzel_fc_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.low_pass_filter_0_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.qtgui_freq_sink_x_1_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
Пример #9
0
	def __init__(self, fm_subcarrier=9960, zero_point=-5):
		grc_wxgui.top_block_gui.__init__(self, title="VOR Receiver")

		##################################################
		# Parameters
		##################################################
		self.fm_subcarrier = fm_subcarrier
		self.zero_point = zero_point

		##################################################
		# Variables
		##################################################
		self.rf_rate = rf_rate = 1000000
		self.dir_rate = dir_rate = 10
		self.channel_rate = channel_rate = 40000
		self.audio_rate = audio_rate = 10000
		self.vor_freq = vor_freq = 113.9e6
		self.volume = volume = 0
		self.rf_scale = rf_scale = int(rf_rate/channel_rate) + rf_rate % channel_rate
		self.offset = offset = fm_subcarrier + 4000
		self.dir_scale = dir_scale = int(audio_rate/dir_rate) + audio_rate % dir_rate
		self.channel = channel = 113.9e6
		self.audio_scale = audio_scale = int(channel_rate/audio_rate) + channel_rate % audio_rate

		##################################################
		# Blocks
		##################################################
		_volume_sizer = wx.BoxSizer(wx.VERTICAL)
		self._volume_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			label='volume',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._volume_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			minimum=-10,
			maximum=10,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_volume_sizer)
		self._channel_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.channel,
			callback=self.set_channel,
			label="Channel (Hz)",
			converter=forms.float_converter(),
		)
		self.Add(self._channel_text_box)
		self.zeroer = blocks.add_const_vff((zero_point*(math.pi/180), ))
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="deg",
			minval=-180,
			maxval=180,
			factor=180/math.acos(-1),
			decimal_places=2,
			ref_level=0,
			sample_rate=dir_rate,
			number_rate=dir_rate,
			average=True,
			avg_alpha=.25,
			label="Direction",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=channel,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=channel_rate,
			fft_size=1024,
			fft_rate=15,
			average=True,
			avg_alpha=0.25,
			title="Channel",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self._vor_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.vor_freq,
			callback=self.set_vor_freq,
			label='vor_freq',
			converter=forms.float_converter(),
		)
		self.Add(self._vor_freq_text_box)
		self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
		        interpolation=40,
		        decimation=1,
		        taps=None,
		        fractional_bw=None,
		)
		self.low_pass_filter_1 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, channel_rate, 10000, 4000, firdes.WIN_HAMMING, 6.76))
		self.goertzel_fc_0_0 = fft.goertzel_fc(channel_rate, dir_scale*audio_scale, 30)
		self.goertzel_fc_0 = fft.goertzel_fc(audio_rate, dir_scale, 30)
		self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1.0, channel_rate, 500, 100, firdes.WIN_HAMMING)), fm_subcarrier, channel_rate)
		self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(rf_scale, (firdes.low_pass(1.0, rf_rate, channel_rate, channel_rate/2, firdes.WIN_HAMMING)), 900, rf_rate)
		self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True)
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 1e6)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(volume/10), ))
		self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/john/apps/aviation_rx/woodside_vor25.dat", True)
		self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, int(channel_rate/30*0.0))
		self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
		self.audio_sink_0 = audio.sink(audio_rate, "", True)
		self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
		self.analog_am_demod_cf_0 = analog.am_demod_cf(
			channel_rate=40e3,
			audio_decim=4,
			audio_pass=5000,
			audio_stop=5500,
		)
		self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_1.set_max_gain(65536)
		self.analog_agc2_xx_0_1_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1_0.set_max_gain(100)
		self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1.set_max_gain(100)

		##################################################
		# Connections
		##################################################
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_delay_0, 0))
		self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
		self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0_1, 0))
		self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.blocks_delay_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0))
		self.connect((self.blocks_complex_to_arg_0, 0), (self.zeroer, 0))
		self.connect((self.zeroer, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.low_pass_filter_1, 0), (self.blocks_complex_to_arg_0, 0))
		self.connect((self.analog_agc2_xx_0_1, 0), (self.blocks_multiply_conjugate_cc_0, 0))
		self.connect((self.analog_agc2_xx_0_1_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
		self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_1, 0))
		self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
		self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_1, 0))
		self.connect((self.analog_agc2_xx_1, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
Пример #10
0
    def __init__(self, fm_subcarrier=9960, zero_point=-5):
        grc_wxgui.top_block_gui.__init__(self, title="VOR Receiver")

        ##################################################
        # Parameters
        ##################################################
        self.fm_subcarrier = fm_subcarrier
        self.zero_point = zero_point

        ##################################################
        # Variables
        ##################################################
        self.rf_rate = rf_rate = 1000000
        self.dir_rate = dir_rate = 10
        self.channel_rate = channel_rate = 40000
        self.audio_rate = audio_rate = 10000
        self.vor_freq = vor_freq = 113.9e6
        self.volume = volume = 0
        self.rf_scale = rf_scale = int(
            rf_rate / channel_rate) + rf_rate % channel_rate
        self.offset = offset = fm_subcarrier + 4000
        self.dir_scale = dir_scale = int(
            audio_rate / dir_rate) + audio_rate % dir_rate
        self.channel = channel = 113.9e6
        self.audio_scale = audio_scale = int(
            channel_rate / audio_rate) + channel_rate % audio_rate

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-10,
            maximum=10,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self._channel_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.channel,
            callback=self.set_channel,
            label="Channel (Hz)",
            converter=forms.float_converter(),
        )
        self.Add(self._channel_text_box)
        self.zeroer = blocks.add_const_vff((zero_point * (math.pi / 180), ))
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="deg",
            minval=-180,
            maxval=180,
            factor=180 / math.acos(-1),
            decimal_places=2,
            ref_level=0,
            sample_rate=dir_rate,
            number_rate=dir_rate,
            average=True,
            avg_alpha=.25,
            label="Direction",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=channel,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=channel_rate,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.25,
            title="Channel",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self._vor_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.vor_freq,
            callback=self.set_vor_freq,
            label='vor_freq',
            converter=forms.float_converter(),
        )
        self.Add(self._vor_freq_text_box)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=40,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_1 = filter.fir_filter_ccf(
            1, firdes.low_pass(1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, channel_rate, 10000, 4000, firdes.WIN_HAMMING,
                            6.76))
        self.goertzel_fc_0_0 = fft.goertzel_fc(channel_rate,
                                               dir_scale * audio_scale, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(audio_rate, dir_scale, 30)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(
            1,
            (firdes.low_pass(1.0, channel_rate, 500, 100, firdes.WIN_HAMMING)),
            fm_subcarrier, channel_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            rf_scale, (firdes.low_pass(1.0, rf_rate, channel_rate,
                                       channel_rate / 2, firdes.WIN_HAMMING)),
            900, rf_rate)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, 1e6)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (10**(volume / 10), ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/john/apps/aviation_rx/woodside_vor25.dat", True)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1,
                                           int(channel_rate / 30 * 0.0))
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.audio_sink_0 = audio.sink(audio_rate, "", True)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=40e3,
            audio_decim=4,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_1.set_max_gain(65536)
        self.analog_agc2_xx_0_1_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1_0.set_max_gain(100)
        self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1.set_max_gain(100)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.goertzel_fc_0_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0_1, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0), (self.zeroer, 0))
        self.connect((self.zeroer, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.analog_agc2_xx_0_1, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.analog_agc2_xx_0_1_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_1, 0))
        self.connect((self.analog_agc2_xx_1, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Vor Receive Realtime Clean")

        ##################################################
        # Variables
        ##################################################
        self.morse_vol = morse_vol = 10
        self.samp_rate = samp_rate = 32000
        self.rtl_gain = rtl_gain = 42
        self.rtl_freq = rtl_freq = 112500e3
        self.morse_gain = morse_gain = pow(10, morse_vol / 10)
        self.morse_amp_level = morse_amp_level = 0
        self.PI = PI = 3.14159

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Morse',
            sample_rate=samp_rate / (1600),
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_STRIPCHART,
            y_axis_label='Amp',
        )
        self.Add(self.wxgui_scopesink2_1_0_0.win)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_sample_rate(samp_rate * 64)
        self.rtlsdr_source_0.set_center_freq(rtl_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(rtl_gain, 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.pfb_decimator_ccf_0 = pfb.decimator_ccf(
            64, (firdes.low_pass(1, samp_rate * 64, 16e3, 200e3)), 0, 100,
            True, True)
        self.pfb_decimator_ccf_0.declare_sample_delay(0)

        _morse_vol_sizer = wx.BoxSizer(wx.VERTICAL)
        self._morse_vol_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_morse_vol_sizer,
            value=self.morse_vol,
            callback=self.set_morse_vol,
            label='Morse Volume (dB):',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._morse_vol_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_morse_vol_sizer,
            value=self.morse_vol,
            callback=self.set_morse_vol,
            minimum=-25,
            maximum=25,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_morse_vol_sizer)

        def _morse_amp_level_probe():
            while True:
                val = self.morse_amp.level()
                try:
                    self.set_morse_amp_level(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (25))

        _morse_amp_level_thread = threading.Thread(
            target=_morse_amp_level_probe)
        _morse_amp_level_thread.daemon = True
        _morse_amp_level_thread.start()

        self.hilbert_fc_0 = filter.hilbert_fc(64, firdes.WIN_HAMMING, 6.76)
        self.goertzel_fc_0_0 = fft.goertzel_fc(samp_rate, 3200, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(samp_rate, 3200, 30)
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 480 * 2, 500 * 2)), 9960,
            samp_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(
            gr.sizeof_gr_complex * 1, '0.0.0.0', 20000, True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (morse_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_integrate_xx_1 = blocks.integrate_ff(1600, 1)
        self.blocks_integrate_xx_0 = blocks.integrate_cc(8, 1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fcc(
            1,
            firdes.complex_band_pass(1, samp_rate, 1010, 1030, 100,
                                     firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0_0 = audio.sink(samp_rate, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate,
            audio_decimation=1,
        )
        self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1)
        self.analog_agc3_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc3_xx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.goertzel_fc_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_integrate_xx_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0),
                     (self.blocks_tcp_server_sink_0, 0))
        self.connect((self.blocks_integrate_xx_1, 0),
                     (self.wxgui_scopesink2_1_0_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0),
                     (self.analog_wfm_rcv_0, 0))
        self.connect((self.goertzel_fc_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.hilbert_fc_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0, 0))
        self.connect((self.pfb_decimator_ccf_0, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.pfb_decimator_ccf_0, 0))
Пример #12
0
    def __init__(self):
        gr.top_block.__init__(self, "CtCr Tests")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("CtCr Tests")
        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", "ctcr_tests")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.lamb_order = lamb_order = 0.88
        self.fft_size = fft_size = 2000
        self.TX_height = TX_height = 1.375
        self.TX_ampl = TX_ampl = 0.7
        self.TX4_f = TX4_f = 400000
        self.TX3_f = TX3_f = 200000
        self.TX2_f = TX2_f = 300000
        self.TX1_f = TX1_f = 100000
        self.RX_height = RX_height = 0
        self.RX_area = RX_area = 0.78539816339

        ##################################################
        # Blocks
        ##################################################
        self.vlp_ctcr_ff_3 = vlp.ctcr_ff(lamb_order, TX_ampl, TX_height,
                                         RX_height, RX_area)
        self.vlp_ctcr_ff_2 = vlp.ctcr_ff(lamb_order, TX_ampl, TX_height,
                                         RX_height, RX_area)
        self.vlp_ctcr_ff_1 = vlp.ctcr_ff(lamb_order, TX_ampl, TX_height,
                                         RX_height, RX_area)
        self.vlp_ctcr_ff_0 = vlp.ctcr_ff(lamb_order, TX_ampl, TX_height,
                                         RX_height, RX_area)
        self.qtgui_number_sink_3 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_3.set_update_time(0.10)
        self.qtgui_number_sink_3.set_title("CtCr4")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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_3.set_min(i, -1)
            self.qtgui_number_sink_3.set_max(i, 1)
            self.qtgui_number_sink_3.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_3.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_3.set_label(i, labels[i])
            self.qtgui_number_sink_3.set_unit(i, units[i])
            self.qtgui_number_sink_3.set_factor(i, factor[i])

        self.qtgui_number_sink_3.enable_autoscale(False)
        self._qtgui_number_sink_3_win = sip.wrapinstance(
            self.qtgui_number_sink_3.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_3_win)
        self.qtgui_number_sink_2 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_2.set_update_time(0.10)
        self.qtgui_number_sink_2.set_title("CtCr3")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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_2.set_min(i, -1)
            self.qtgui_number_sink_2.set_max(i, 1)
            self.qtgui_number_sink_2.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_2.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_2.set_label(i, labels[i])
            self.qtgui_number_sink_2.set_unit(i, units[i])
            self.qtgui_number_sink_2.set_factor(i, factor[i])

        self.qtgui_number_sink_2.enable_autoscale(False)
        self._qtgui_number_sink_2_win = sip.wrapinstance(
            self.qtgui_number_sink_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_2_win)
        self.qtgui_number_sink_1 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_1.set_update_time(0.10)
        self.qtgui_number_sink_1.set_title("CtCr2")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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_1.set_min(i, -1)
            self.qtgui_number_sink_1.set_max(i, 1)
            self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_1.set_label(i, labels[i])
            self.qtgui_number_sink_1.set_unit(i, units[i])
            self.qtgui_number_sink_1.set_factor(i, factor[i])

        self.qtgui_number_sink_1.enable_autoscale(False)
        self._qtgui_number_sink_1_win = sip.wrapinstance(
            self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_1_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("CtCr1")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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.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.top_layout.addWidget(self._qtgui_number_sink_0_win)
        self.goertzel_fc_0_2 = fft.goertzel_fc(int(samp_rate), fft_size, TX1_f)
        self.goertzel_fc_0_1 = fft.goertzel_fc(int(samp_rate), fft_size, TX2_f)
        self.goertzel_fc_0_0 = fft.goertzel_fc(int(samp_rate), fft_size, TX3_f)
        self.goertzel_fc_0 = fft.goertzel_fc(int(samp_rate), fft_size, TX4_f)
        self.blocks_throttle_3 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_throttle_2 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_throttle_1 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_file_source_0_2 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/home/rich/CTCR_testing/ctcr2_nolenses",
            True)
        self.blocks_file_source_0_1 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/home/rich/CTCR_testing/ctcr3_nolenses",
            True)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/home/rich/CTCR_testing/ctcr4_nolenses",
            True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/home/rich/CTCR_testing/ctcr1_nolenses",
            True)
        self.blocks_complex_to_mag_3 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_2 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_float_3 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_2 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_1 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_null_sink_0, 3))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.goertzel_fc_0_2, 0))
        self.connect((self.blocks_complex_to_float_1, 1),
                     (self.blocks_null_sink_0, 2))
        self.connect((self.blocks_complex_to_float_1, 0),
                     (self.goertzel_fc_0_1, 0))
        self.connect((self.blocks_complex_to_float_2, 1),
                     (self.blocks_null_sink_0, 1))
        self.connect((self.blocks_complex_to_float_2, 0),
                     (self.goertzel_fc_0_0, 0))
        self.connect((self.blocks_complex_to_float_3, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_complex_to_float_3, 0),
                     (self.goertzel_fc_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.vlp_ctcr_ff_0, 0))
        self.connect((self.blocks_complex_to_mag_1, 0),
                     (self.vlp_ctcr_ff_1, 0))
        self.connect((self.blocks_complex_to_mag_2, 0),
                     (self.vlp_ctcr_ff_2, 0))
        self.connect((self.blocks_complex_to_mag_3, 0),
                     (self.vlp_ctcr_ff_3, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_throttle_3, 0))
        self.connect((self.blocks_file_source_0_1, 0),
                     (self.blocks_throttle_2, 0))
        self.connect((self.blocks_file_source_0_2, 0),
                     (self.blocks_throttle_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_throttle_1, 0),
                     (self.blocks_complex_to_float_1, 0))
        self.connect((self.blocks_throttle_2, 0),
                     (self.blocks_complex_to_float_2, 0))
        self.connect((self.blocks_throttle_3, 0),
                     (self.blocks_complex_to_float_3, 0))
        self.connect((self.goertzel_fc_0, 0),
                     (self.blocks_complex_to_mag_3, 0))
        self.connect((self.goertzel_fc_0_0, 0),
                     (self.blocks_complex_to_mag_2, 0))
        self.connect((self.goertzel_fc_0_1, 0),
                     (self.blocks_complex_to_mag_1, 0))
        self.connect((self.goertzel_fc_0_2, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.vlp_ctcr_ff_0, 0), (self.qtgui_number_sink_0, 0))
        self.connect((self.vlp_ctcr_ff_1, 0), (self.qtgui_number_sink_1, 0))
        self.connect((self.vlp_ctcr_ff_2, 0), (self.qtgui_number_sink_2, 0))
        self.connect((self.vlp_ctcr_ff_3, 0), (self.qtgui_number_sink_3, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vor Receive Realtime Clean")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.morse_vol = morse_vol = 10
        self.samp_rate = samp_rate = 32000
        self.rtl_gain = rtl_gain = 42
        self.rtl_freq = rtl_freq = 115.5e6+64
        self.morse_gain = morse_gain = pow(10,morse_vol/10)
        self.morse_amp_level = morse_amp_level = 0

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title='Morse',
        	sample_rate=samp_rate/(1600),
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_STRIPCHART,
        	y_axis_label='Amp',
        )
        self.Add(self.wxgui_scopesink2_1_0_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0.02,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Units',
        	minval=0,
        	maxval=360,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=1,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label='Number Plot',
        	peak_hold=False,
        	show_gauge=False,
        )
        self.Add(self.wxgui_numbersink2_1.win)
        _morse_vol_sizer = wx.BoxSizer(wx.VERTICAL)
        self._morse_vol_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_morse_vol_sizer,
        	value=self.morse_vol,
        	callback=self.set_morse_vol,
        	label='Morse Volume (dB):',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._morse_vol_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_morse_vol_sizer,
        	value=self.morse_vol,
        	callback=self.set_morse_vol,
        	minimum=-25,
        	maximum=25,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_morse_vol_sizer)

        def _morse_amp_level_probe():
            while True:
                val = self.morse_amp.level()
                try:
                    self.set_morse_amp_level(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (25))
        _morse_amp_level_thread = threading.Thread(target=_morse_amp_level_probe)
        _morse_amp_level_thread.daemon = True
        _morse_amp_level_thread.start()

        self.low_pass_filter_0_1_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 1000, 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 1000, 500, firdes.WIN_HAMMING, 6.76))
        self.iio_modulo_const_ff_0 = iio.modulo_const_ff(360, 1)
        self.goertzel_fc_0_0 = fft.goertzel_fc(samp_rate, 3200, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(samp_rate, 3200, 30)
        self.fir_filter_xxx_0_0 = filter.fir_filter_fff(1, (filter.optfir.low_pass(1, samp_rate, 100, 200, 0.1,  60)))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((-180/pi, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((morse_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_integrate_xx_1 = blocks.integrate_ff(1600, 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/tmp/vor_simulation.cfile', False)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((360, ))
        self.band_pass_filter_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass(
        	1, samp_rate, 1010, 1030, 100, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0_0 = audio.sink(samp_rate, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -9960, 1, 0)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
        	channel_rate=samp_rate,
        	audio_decim=1,
        	deviation=1000,
        	audio_pass=100,
        	audio_stop=200,
        	gain=1.0,
        	tau=75e-6,
        )
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=samp_rate,
        	audio_decim=1,
        	audio_pass=12000,
        	audio_stop=13000,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.low_pass_filter_0_1_0, 0))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.wxgui_scopesink2_0, 1))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.iio_modulo_const_ff_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_integrate_xx_1, 0), (self.wxgui_scopesink2_1_0_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_1, 0))
        self.connect((self.blocks_throttle_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0), (self.goertzel_fc_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.iio_modulo_const_ff_0, 0), (self.wxgui_numbersink2_1, 0))
        self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_demod_cf_0, 0))
        self.connect((self.low_pass_filter_0_1_0, 0), (self.fir_filter_xxx_0_0, 0))
Пример #14
0
    def __init__(self, antenna="TX/RX", vor_freq_1=111e6, com_freq_1=135.275e6, vor_freq_2=111e6, rx_gain=30, gain=20):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.vor_freq_1 = vor_freq_1
        self.com_freq_1 = com_freq_1
        self.vor_freq_2 = vor_freq_2
        self.rx_gain = rx_gain
        self.gain = gain

        ##################################################
        # Variables
        ##################################################
        self.obs_decimation = obs_decimation = 25
        self.ils_decimation = ils_decimation = 50
        self.am_sample_rate = am_sample_rate = 12.5e3
        self.vor_samp_rate = vor_samp_rate = 250e3
        self.vor_freq_entry_2 = vor_freq_entry_2 = vor_freq_2
        self.vor_freq_entry_1 = vor_freq_entry_1 = vor_freq_1
        self.vor_center_freq_0 = vor_center_freq_0 = (117.95e6-108.00e6)/2+117.95e6
        self.vor_center_freq = vor_center_freq = (117.95e6-108.00e6)/2+117.95e6
        self.squelch_slider = squelch_slider = -110
        self.rxgain = rxgain = 15
        self.phase_correction = phase_correction = 5
        self.obs_sample_rate = obs_sample_rate = am_sample_rate/obs_decimation
        self.ils_sample_rate = ils_sample_rate = am_sample_rate/ils_decimation
        self.gain_slider = gain_slider = gain
        self.com_freq_entry_1 = com_freq_entry_1 = com_freq_1
        self.band_center_freq = band_center_freq = (136.975e6-108.0e6)/2+108.0e6
        self.audio_select = audio_select = 0
        self.audio_sample_rate = audio_sample_rate = 48e3
        self.am_decimation = am_decimation = 1

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Analyzer")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Channel FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Audio FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Ref and Phase Scope")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Manipulated Ref and Phase")
        self.Add(self.notebook_0)
        self._vor_freq_entry_1_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.vor_freq_entry_1,
        	callback=self.set_vor_freq_entry_1,
        	label='vor_freq_entry_1',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_1_text_box)
        _gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_slider_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_gain_slider_sizer,
        	value=self.gain_slider,
        	callback=self.set_gain_slider,
        	label='gain_slider',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider_slider = forms.slider(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_gain_slider_sizer,
        	value=self.gain_slider,
        	callback=self.set_gain_slider,
        	minimum=0,
        	maximum=30,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_gain_slider_sizer)
        self._com_freq_entry_1_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.com_freq_entry_1,
        	callback=self.set_com_freq_entry_1,
        	label='com_freq_entry_1',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._com_freq_entry_1_text_box)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=10e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=10,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=12.5e3,
        	fft_size=1024,
        	fft_rate=5,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self._vor_freq_entry_2_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.vor_freq_entry_2,
        	callback=self.set_vor_freq_entry_2,
        	label='vor_freq_entry_2',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_2_text_box)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(2),
        	),
        )
        self.uhd_usrp_source_0.set_subdev_spec("A:0 A:0", 0)
        self.uhd_usrp_source_0.set_samp_rate(vor_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(com_freq_entry_1,rf_freq=band_center_freq, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain_slider, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(vor_freq_entry_1, rf_freq=band_center_freq, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 1)
        self.uhd_usrp_source_0.set_gain(gain_slider, 1)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 1)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(250e3)
        self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(com_freq_entry_1,20e6), 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        _squelch_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_slider_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_squelch_slider_sizer,
        	value=self.squelch_slider,
        	callback=self.set_squelch_slider,
        	label='squelch_slider',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._squelch_slider_slider = forms.slider(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_squelch_slider_sizer,
        	value=self.squelch_slider,
        	callback=self.set_squelch_slider,
        	minimum=-110,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_squelch_slider_sizer)
        self.squelch = analog.pwr_squelch_cc(squelch_slider, 0.01, 20, True)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
                interpolation=250,
                decimation=48,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=480,
                decimation=125,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=4,
                decimation=5,
                taps=None,
                fractional_bw=None,
        )
        self.openavionics_joystick_interface_0 = openavionics.joystick_interface()
        self.openavionics_audio_ptt_0 = openavionics.audio_ptt()
        self.null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.multiply_xx_0_0 = blocks.multiply_vff(1)
        self.low_pass_filter_3 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, 10e3, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0_0 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, vor_samp_rate, 15e3, 5e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_1 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, 12.5e3, 3e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(int(250e3/12.5e3), firdes.low_pass(
        	1, vor_samp_rate, 10e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.goertzel_fc_0_0 = fft.goertzel_fc(10000, 1000, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(40000, 4000, 30)
        self.float_to_complex_0_0 = blocks.float_to_complex(1)
        self.const_source_x_0_0_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.550)
        self.const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-87.2665e-3, ))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(4, firdes.band_pass(
        	1, 40e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, 10e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(int(audio_sample_rate), "", True)
        self._audio_select_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.audio_select,
        	callback=self.set_audio_select,
        	label='audio_select',
        	choices=[0, 1],
        	labels=['AM Voice','VOR Subcarrier'],
        )
        self.Add(self._audio_select_chooser)
        self.analog_sig_source_x_0 = analog.sig_source_c(40e3, analog.GR_COS_WAVE, -9.96e3, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=40e3,
        	audio_decim=4,
        	audio_pass=5000,
        	audio_stop=5500,
        )
        self.analog_agc2_xx_0_1_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1_0.set_max_gain(100)
        self.analog_agc2_xx_0_1 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1.set_max_gain(100)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_0.set_max_gain(100)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(100)
        self.am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=am_sample_rate,
        	audio_decim=am_decimation,
        	audio_pass=3e3,
        	audio_stop=4e3,
        )
        self.agc2_xx_0 = analog.agc2_cc(1, 1, 0.75, 1.0)
        self.agc2_xx_0.set_max_gain(0.0)
        self.add_xx_0_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.agc2_xx_0, 0), (self.am_demod_cf_0, 0))
        self.connect((self.am_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.agc2_xx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.multiply_xx_0_0, 0), (self.add_xx_0_0, 0))
        self.connect((self.const_source_x_0, 0), (self.multiply_xx_0_0, 1))
        self.connect((self.const_source_x_0_0, 0), (self.add_xx_0_0, 1))
        self.connect((self.multiply_xx_0_0_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 1))
        self.connect((self.float_to_complex_0_0, 0), (self.multiply_xx_0_0_0, 0))
        self.connect((self.const_source_x_0_0_0, 0), (self.multiply_xx_0_0_0, 1))
        self.connect((self.uhd_usrp_source_0, 0), (self.null_sink_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_agc2_xx_0_1_0, 0), (self.wxgui_scopesink2_0, 1))
        self.connect((self.analog_agc2_xx_0_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.analog_agc2_xx_0_1, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_3, 0), (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_3, 0))
        self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.low_pass_filter_2_0_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_2_0_0, 0))
        self.connect((self.low_pass_filter_2_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 1), (self.null_sink_0_0, 0))
        self.connect((self.low_pass_filter_2, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.audio_source_0, 0), (self.openavionics_audio_ptt_0, 0))
        self.connect((self.openavionics_audio_ptt_0, 0), (self.rational_resampler_xxx_2, 0))
        self.connect((self.rational_resampler_xxx_2, 0), (self.multiply_xx_0_0, 0))
        self.connect((self.squelch, 0), (self.agc2_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.squelch, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_2, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.openavionics_joystick_interface_0, "out", self.openavionics_audio_ptt_0, "in2")
Пример #15
0
    def __init__(self, mon_id, audio_port):
        gr.top_block.__init__(self, "EAS/SAME Monitor")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000

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

        # Resampler from input rate (44.1k) to internal rate (8k)
        self.rational_resampler_44k = filter.rational_resampler_fff(
                interpolation=80,
                decimation=441,
        )

        # Resampler from 8000 Hz to 4166 2/3rd Hz to deal with SAME's weird parameters
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=50,
                decimation=96,
                taps=None,
                fractional_bw=None,
        )

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcc(1, (firdes.low_pass(1, samp_rate, 600, 100)), 1822.916667, samp_rate)
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=8,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.01,
        	freq_error=0.0,
        	verbose=True,
        	log=False,
        )
        self.src = audio.source(44100, "eas_mon_%s:in" % (mon_id), True)
        self.agc = analog.agc_ff(0.0001, 0.1, 1.0)
        #self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(-50, 0.0001, 0)
        self.msg_queue = gr.msg_queue(10)
        self.same_dec_0 = same.same_dec(self.msg_queue)

        self.tone_det_0 = fft.goertzel_fc(samp_rate, samp_rate / 10, 853)
        self.tone_det_1 = fft.goertzel_fc(samp_rate, samp_rate / 10, 960)
        self.tone_det_2 = fft.goertzel_fc(samp_rate, samp_rate / 10, 1050)
        self.wat_thresh_msg = same.wat_thresh_msg(self.msg_queue, 1, 0.05, 0.01)

        #self.avg_audio_level = analog.probe_avg_mag_sqrd_ff(-50)
        #self.level_thresh_msg = same.level_thresh_msg(self.msg_queue, 1, 3, db_to_abs(-30), db_to_abs(-40))

        self.audio_sink_converter = blocks.float_to_short(1, 3276)
        self.audio_sink = blocks.udp_sink(2, '127.0.0.1', audio_port)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.src, 0), (self.rational_resampler_44k, 0))
        self.connect((self.rational_resampler_44k, 0), (self.agc, 0))
        #self.connect((self.agc, 0), (self.analog_pwr_squelch_xx_0, 0))

        #self.connect((self.analog_pwr_squelch_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.agc, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.same_dec_0, 0))

        self.connect((self.agc, 0), (self.tone_det_0, 0), (self.wat_thresh_msg, 0))
        self.connect((self.agc, 0), (self.tone_det_1, 0), (self.wat_thresh_msg, 1))
        self.connect((self.agc, 0), (self.tone_det_2, 0), (self.wat_thresh_msg, 2))
        #self.connect((self.agc, 0), (self.avg_audio_level, 0), (self.level_thresh_msg, 0))

        self.connect((self.agc, 0), (self.audio_sink_converter, 0), (self.audio_sink, 0))

        self._watcher = _queue_watcher_thread(self.msg_queue, mon_id, audio_port)