Exemple #1
0
    def test_attribute_updater(self):
        attr = "Test"
        val = "100"
        key0 = pmt.intern(attr)
        val0 = pmt.intern(val)
        msg_dic = pmt.make_dict()
        msg_dic = pmt.dict_add(msg_dic, key0, val0)

        src = iio.attr_updater(attr, val, 500)
        snk = blocks.message_debug()

        tb = gr.top_block()
        tb.msg_connect((src, "out"), (snk, "store"))
        tb.start()
        time.sleep(1)
        tb.stop()
        tb.wait()

        rec_msg = snk.get_message(0)
        self.assertTrue(pmt.equal(rec_msg, msg_dic))
Exemple #2
0
    def __init__(self):
        gr.top_block.__init__(self, "WBFM Receiver V2- F1ATB - MARCH 2021")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1200000
        self.Largeur_filtre = Largeur_filtre = 150000
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate, Largeur_filtre / 2, 25000)
        self.decim_LP = decim_LP = 16
        self.Squelch = Squelch = -80
        self.Gain_RF = Gain_RF = 30
        self.Gain_IF = Gain_IF = 20
        self.Gain_BB = Gain_BB = 20
        self.FrRX = FrRX = 145000000
        self.F_Fine = F_Fine = 0

        ##################################################
        # Blocks
        ##################################################
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 9003), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.pluto_source_0 = iio.pluto_source('192.168.2.1', 145000000,
                                               int(samp_rate), 1000000, 32768,
                                               True, True, True, "manual", 50,
                                               '', True)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, decim_LP * samp_rate / 200, 5200, 1200,
                            firdes.WIN_HAMMING, 6.76))
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
            sample_rate=samp_rate / 100,
            fft_size=2048,
            ref_scale=0.00001,
            frame_rate=samp_rate / 100 / 2048,
            avg_alpha=1.0,
            average=False,
        )
        self.iio_attr_updater_0_0 = iio.attr_updater('hardwaregain',
                                                     str(int(Gain_RF * 1.75)),
                                                     1000)
        self.iio_attr_updater_0 = iio.attr_updater('frequency', str(int(FrRX)),
                                                   1000)
        self.iio_attr_sink_0_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                               "voltage0", 0, False, False)
        self.iio_attr_sink_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                             "altvoltage0", 0, True, False)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            6, (xlate_filter_taps), F_Fine, samp_rate)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(
            0, decim_LP / 2)
        self.blocks_udp_sink_1 = blocks.udp_sink(gr.sizeof_short * 2048,
                                                 '127.0.0.1', 9002, 4096, True)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1,
                                                 '127.0.0.1', 9001, 1000, True)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex,
                                                       int(1024 * decim_LP),
                                                       204800, 0)
        self.blocks_float_to_short_1 = blocks.float_to_short(2048, 100)
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 16000)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate / 6,
            audio_decimation=20,
        )
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(Squelch, 1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.iio_attr_updater_0, 'out'),
                         (self.iio_attr_sink_0, 'attr'))
        self.msg_connect((self.iio_attr_updater_0_0, 'out'),
                         (self.iio_attr_sink_0_0, 'attr'))
        self.connect((self.analog_simple_squelch_cc_0, 0),
                     (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blocks_float_to_short_1, 0),
                     (self.blocks_udp_sink_1, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0),
                     (self.logpwrfft_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_simple_squelch_cc_0, 0))
        self.connect((self.logpwrfft_x_0, 0),
                     (self.blocks_float_to_short_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.fractional_resampler_xx_0, 0))
        self.connect((self.pluto_source_0, 0), (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.pluto_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
Exemple #3
0
    def __init__(self):
        gr.top_block.__init__(self, "SSB Receiver V2- F1ATB - MARCH 2021")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1200000
        self.Largeur_filtre = Largeur_filtre = 3800
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate, Largeur_filtre / 2, 500)
        self.decim_LP = decim_LP = 16
        self.LSB_USB = LSB_USB = 0
        self.Gain_RF = Gain_RF = 30
        self.Gain_IF = Gain_IF = 20
        self.Gain_BB = Gain_BB = 20
        self.FrRX = FrRX = 145000000
        self.F_Fine = F_Fine = 0

        ##################################################
        # Blocks
        ##################################################
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 9003), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.pluto_source_0 = iio.pluto_source('192.168.2.1', 145000000,
                                               int(samp_rate), 1000000, 32768,
                                               True, True, True, "manual", 50,
                                               '', True)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, decim_LP * samp_rate / 200, 5200, 1200,
                            firdes.WIN_HAMMING, 6.76))
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
            sample_rate=samp_rate / 100,
            fft_size=2048,
            ref_scale=0.00001,
            frame_rate=samp_rate / 100 / 2048,
            avg_alpha=1.0,
            average=False,
        )
        self.iio_attr_updater_0_0 = iio.attr_updater('hardwaregain',
                                                     str(int(Gain_RF * 1.75)),
                                                     1000)
        self.iio_attr_updater_0 = iio.attr_updater('frequency', str(int(FrRX)),
                                                   1000)
        self.iio_attr_sink_0_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                               "voltage0", 0, False, False)
        self.iio_attr_sink_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                             "altvoltage0", 0, True, False)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            120, (xlate_filter_taps), F_Fine - Largeur_filtre / 2 +
            LSB_USB * Largeur_filtre - 100 + LSB_USB * 200, samp_rate)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(
            0, decim_LP / 2)
        self.blocks_udp_sink_1 = blocks.udp_sink(gr.sizeof_short * 2048,
                                                 '127.0.0.1', 9002, 4096, True)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1,
                                                 '127.0.0.1', 9001, 1000, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (1 - 2 * LSB_USB, ))
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex,
                                                       int(1024 * decim_LP),
                                                       204800, 0)
        self.blocks_float_to_short_1 = blocks.float_to_short(2048, 100)
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 16000)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate / 120, analog.GR_SIN_WAVE, Largeur_filtre / 2 + 100, 1,
            0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate / 120, analog.GR_COS_WAVE, Largeur_filtre / 2 + 100, 1,
            0)
        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)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.iio_attr_updater_0, 'out'),
                         (self.iio_attr_sink_0, 'attr'))
        self.msg_connect((self.iio_attr_updater_0_0, 'out'),
                         (self.iio_attr_sink_0_0, 'attr'))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blocks_float_to_short_1, 0),
                     (self.blocks_udp_sink_1, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.fractional_resampler_xx_0, 0),
                     (self.logpwrfft_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.logpwrfft_x_0, 0),
                     (self.blocks_float_to_short_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.fractional_resampler_xx_0, 0))
        self.connect((self.pluto_source_0, 0), (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.pluto_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
Exemple #4
0
    def __init__(self):
        gr.top_block.__init__(self, "SSB Transmitter V2 - F1ATB - MARCH 2021")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1200000
        self.LSB_USB = LSB_USB = 1
        self.GainRF_TX = GainRF_TX = 100
        self.GainIF_TX = GainIF_TX = 300
        self.GainBB_TX = GainBB_TX = 40
        self.Fr_TX = Fr_TX = 145200000

        ##################################################
        # Blocks
        ##################################################
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 9004), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc(
            interpolation=120,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.pluto_sink_0 = iio.pluto_sink('192.168.2.1', 145000000,
                                           int(samp_rate), 0, 0x8000, False, 0,
                                           '', True)
        self.iio_attr_updater_0 = iio.attr_updater('frequency',
                                                   str(int(Fr_TX)), 2500)
        self.iio_attr_sink_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                             "altvoltage1", 0, True, False)
        self.hilbert_fc_0 = filter.hilbert_fc(64, firdes.WIN_HAMMING, 6.76)
        (self.hilbert_fc_0).set_min_output_buffer(10)
        (self.hilbert_fc_0).set_max_output_buffer(10)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1,
                                                     '127.0.0.1', 9005, 512,
                                                     True)
        (self.blocks_udp_source_0).set_max_output_buffer(2048)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (LSB_USB, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.band_pass_filter_0_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, samp_rate / 120,
                                     -1300 + LSB_USB * 1500,
                                     1300 + LSB_USB * 1500, 200,
                                     firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.iio_attr_updater_0, 'out'),
                         (self.iio_attr_sink_0, 'attr'))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.rational_resampler_xxx_1_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_short_to_float_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.hilbert_fc_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.rational_resampler_xxx_1_0, 0),
                     (self.pluto_sink_0, 0))
Exemple #5
0
    def __init__(self):
        gr.top_block.__init__(self, "NBFM Transmitter V2 - F1ATB - MARCH 2021")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1200000
        self.GainRF_TX = GainRF_TX = 100
        self.GainIF_TX = GainIF_TX = 300
        self.GainBB_TX = GainBB_TX = 40
        self.Fr_TX = Fr_TX = 145200000

        ##################################################
        # Blocks
        ##################################################
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 9004), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=30,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.pluto_sink_0 = iio.pluto_sink('192.168.2.1', 145000000,
                                           int(samp_rate), 0, 0x8000, False, 0,
                                           '', True)
        self.iio_attr_updater_0 = iio.attr_updater('frequency',
                                                   str(int(Fr_TX)), 2500)
        self.iio_attr_sink_0 = iio.attr_sink("ip:192.168.2.1", "ad9361-phy",
                                             "altvoltage1", 0, True, False)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1,
                                                     '127.0.0.1', 9005, 512,
                                                     True)
        (self.blocks_udp_source_0).set_max_output_buffer(2048)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / 120, 300, 3500, 1200,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=samp_rate / 120,
            quad_rate=samp_rate / 30,
            tau=75e-6,
            max_dev=5e3,
            fh=-1.0,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.iio_attr_updater_0, 'out'),
                         (self.iio_attr_sink_0, 'attr'))
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.band_pass_filter_0, 0), (self.analog_nbfm_tx_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.pluto_sink_0, 0))