Esempio n. 1
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=9600.0,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 excess_bw=0.35,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 max_cfo=1000.0,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 samp_rate_rx=satnogs.not_set_samp_rate_rx,
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "satnogs_bpsk_ax25")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.excess_bw = excess_bw
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.max_cfo = max_cfo
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), excess_bw, 11 * sps * nfilts)

        self.bpsk_constellation = bpsk_constellation = digital.constellation_bpsk(
        ).base()

        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.satnogs_ax25_decoder_bm_0_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, False, 1024)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.pfb_arb_resampler_xxx_0_0 = pfb.arb_resampler_ccf(
            (1.0 * sps * baudrate) /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0_0.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            audio_samp_rate /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.low_pass_filter_0_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate,
                            ((1.0 + excess_bw) * baudrate / 2.0) +
                            min(baudrate, abs(max_cfo)), baudrate / 10.0,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, sps * baudrate,
                            ((1.0 + excess_bw) * baudrate / 2.0) +
                            min(baudrate, abs(max_cfo)), baudrate / 10.0,
                            firdes.WIN_HAMMING, 6.76))
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, 2.0 * math.pi / 100.0, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(
            2.0 * math.pi / 100.0, 2, True)
        self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb(
            bpsk_constellation, 2.0 * math.pi / 100.0, -0.25, 0.25)
        self.blocks_rotator_cc_0_0 = blocks.rotator_cc(
            2.0 * math.pi * (1200.0 / audio_samp_rate))
        self.blocks_rotator_cc_0 = blocks.rotator_cc(
            -2.0 * math.pi *
            (lo_offset /
             satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx)))
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(0.01, 0.001, 0.015, 1.0)
        self.analog_agc2_xx_0_0.set_max_gain(65536)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-3, 0.5, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.pfb_arb_resampler_xxx_0_0, 0))
        self.connect((self.analog_agc2_xx_0_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.blocks_rotator_cc_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.blocks_rotator_cc_0_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0_0, 0))
        self.connect((self.digital_costas_loop_cc_0_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_constellation_receiver_cb_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_costas_loop_cc_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_rotator_cc_0_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.analog_agc2_xx_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "FSK9600 AX.25 decoder with G3RUH support")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 9600
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000,
                                           firdes.WIN_HAMMING, 6.76)

        self.modulation_index = modulation_index = deviation / (baud_rate /
                                                                2.0)
        self.filter_rate = filter_rate = 250000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.audio_gain = audio_gain = satnogs.fm_demod_settings[
            rx_sdr_device]['audio_gain']

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(
            ((audio_samp_rate) / baud_rate) / (math.pi * modulation_index))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, samp_rate_rx)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, audio_samp_rate, 7850, audio_samp_rate * 0.15,
                            firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            int(samp_rate_rx / filter_rate), (xlate_filter_taps), lo_offset,
            samp_rate_rx)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            2.0 * math.pi / 100.0, 2, False)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            48e3 / 9600, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=48000,
            decimation=int(samp_rate_rx / (int(samp_rate_rx / filter_rate))),
            taps=None,
            fractional_bw=None,
        )
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            ((audio_samp_rate) / baud_rate) / (math.pi * modulation_index))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
Esempio n. 3
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=9600.0,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 mark_frequency=2200.0,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 samp_rate_rx=satnogs.not_set_samp_rate_rx,
                 space_frequency=1200.0,
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "AFSK1200 AX.25 decoder ")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.mark_frequency = mark_frequency
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.space_frequency = space_frequency
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.max_modulation_freq = max_modulation_freq = 3000
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 1200
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(
            ((audio_samp_rate / 10) / baud_rate) / (math.pi * 1))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.satnogs_ax25_decoder_bm_0_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, False, 1024)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            audio_samp_rate /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.low_pass_filter_1 = filter.fir_filter_ccf(
            10,
            firdes.low_pass(10, audio_samp_rate,
                            (mark_frequency - space_frequency) / 2.0, 1000,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate,
                            deviation + max_modulation_freq, 3000,
                            firdes.WIN_HAMMING, 6.76))
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            (48e3 / 10) / baud_rate, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(
            -2.0 * math.pi *
            (lo_offset /
             satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx)))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            audio_samp_rate, analog.GR_COS_WAVE, -(1200 + 2200) / 2, 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            (2 * math.pi * deviation) / audio_samp_rate)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            ((audio_samp_rate / 10) / baud_rate) / (math.pi * 1))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_rotator_cc_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
Esempio n. 4
0
    def __init__(self,
                 bind_addr='0.0.0.0',
                 dest_addr='127.0.0.1',
                 lo_offset=100e3,
                 recv_port=16886,
                 rx_sdr_device='usrpb200',
                 send_port=5022,
                 tx_sdr_device='usrpb200',
                 wod_port=5023):
        gr.top_block.__init__(self, "UPSat Transceiver QT")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("UPSat Transceiver QT")
        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", "upsat_transceiver_qt")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.bind_addr = bind_addr
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.recv_port = recv_port
        self.rx_sdr_device = rx_sdr_device
        self.send_port = send_port
        self.tx_sdr_device = tx_sdr_device
        self.wod_port = wod_port

        ##################################################
        # Variables
        ##################################################
        self.samples_per_symbol_tx = samples_per_symbol_tx = 4 * 8
        self.sq_wave = sq_wave = (1.0, ) * samples_per_symbol_tx
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.gaussian_taps = gaussian_taps = filter.firdes.gaussian(
            1.0, samples_per_symbol_tx, 1.0, 4 * samples_per_symbol_tx)
        self.deviation = deviation = 3.9973e3
        self.decimation_rx = decimation_rx = 20
        self.baud_rate_uplink = baud_rate_uplink = 1200
        self.baud_rate_downlink = baud_rate_downlink = 9600
        self.tx_frequency = tx_frequency = 145.835e6

        self.taps = taps = firdes.low_pass(1.0, samp_rate_rx, 20000, 60000,
                                           firdes.WIN_HAMMING, 6.76)

        self.samp_rate_tx = samp_rate_tx = satnogs.hw_tx_settings[
            rx_sdr_device]['samp_rate']
        self.rx_frequency = rx_frequency = 435.765e6
        self.modulation_index_uplink = modulation_index_uplink = deviation / (
            baud_rate_uplink / 2.0)
        self.modulation_index_downlink = modulation_index_downlink = deviation / (
            baud_rate_downlink / 2.0)
        self.interp_taps = interp_taps = numpy.convolve(
            numpy.array(gaussian_taps), numpy.array(sq_wave))
        self.first_stage_samp_rate_rx = first_stage_samp_rate_rx = samp_rate_rx / decimation_rx

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder(
            [0x33] * 8, [0x7A, 0x0E], False, False, False, True, True, 'ABCD',
            0, 'ON02GR', 0, 64)
        self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source(
            bind_addr, recv_port, 1500, 0)
        self.satnogs_udp_msg_sink_0_0_0 = satnogs.udp_msg_sink(
            dest_addr, wod_port, 1500)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            dest_addr, send_port, 1500)
        self.satnogs_qb50_deframer_0 = satnogs.qb50_deframer(0xe)
        self.satnogs_multi_format_msg_sink_0 = satnogs.multi_format_msg_sink(1)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, False, True, 256, 3)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            50e3,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(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_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate_rx / decimation_rx,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.01)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 0)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        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(True)

        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.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            samp_rate_tx / (baud_rate_uplink * samples_per_symbol_tx),
            taps=(firdes.low_pass_2(32, 32, 0.8, 0.1, 60)),
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'])
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_frequency - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.osmosdr_sink_0 = osmosdr.sink(
            args="numchan=" + str(1) + " " +
            satnogs.hw_tx_settings[rx_sdr_device]['dev_arg'])
        self.osmosdr_sink_0.set_sample_rate(samp_rate_tx)
        self.osmosdr_sink_0.set_center_freq(tx_frequency - lo_offset, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['rf_gain'], 0)
        self.osmosdr_sink_0.set_if_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['if_gain'], 0)
        self.osmosdr_sink_0.set_bb_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['bb_gain'], 0)
        self.osmosdr_sink_0.set_antenna(
            satnogs.hw_tx_settings[tx_sdr_device]['antenna'], 0)
        self.osmosdr_sink_0.set_bandwidth(samp_rate_tx, 0)

        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            samples_per_symbol_tx, (interp_taps))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            decimation_rx, (taps), lo_offset, samp_rate_rx)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            first_stage_samp_rate_rx / baud_rate_downlink,
            0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate_tx, analog.GR_COS_WAVE, lo_offset, 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            ((first_stage_samp_rate_rx) / baud_rate_downlink) /
            (math.pi * modulation_index_downlink))
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(
            (math.pi * modulation_index_uplink) / samples_per_symbol_tx)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'failed_pdu'),
                         (self.satnogs_multi_format_msg_sink_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_qb50_deframer_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'out'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'wod'),
                         (self.satnogs_udp_msg_sink_0_0_0, 'in'))
        self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'),
                         (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
        self.connect((self.analog_frequency_modulator_fc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.satnogs_upsat_fsk_frame_encoder_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
    def __init__(self,
                 bind_addr="0.0.0.0",
                 dest_addr="127.0.0.1",
                 lo_offset=100e3,
                 recv_port=16886,
                 rx_sdr_device="usrpb200",
                 send_port=5022,
                 tx_sdr_device="usrpb200",
                 wod_port=5023):
        gr.top_block.__init__(self, "Upsat Transceiver Cli")

        ##################################################
        # Parameters
        ##################################################
        self.bind_addr = bind_addr
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.recv_port = recv_port
        self.rx_sdr_device = rx_sdr_device
        self.send_port = send_port
        self.tx_sdr_device = tx_sdr_device
        self.wod_port = wod_port

        ##################################################
        # Variables
        ##################################################
        self.samples_per_symbol_tx = samples_per_symbol_tx = 4 * 8
        self.sq_wave = sq_wave = (1.0, ) * samples_per_symbol_tx
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.gaussian_taps = gaussian_taps = filter.firdes.gaussian(
            1.0, samples_per_symbol_tx, 1.0, 4 * samples_per_symbol_tx)
        self.deviation = deviation = 3.9973e3
        self.decimation_rx = decimation_rx = 20
        self.baud_rate_uplink = baud_rate_uplink = 1200
        self.baud_rate_downlink = baud_rate_downlink = 9600
        self.tx_frequency = tx_frequency = 145.835e6

        self.taps = taps = firdes.low_pass(1.0, samp_rate_rx, 20000, 60000,
                                           firdes.WIN_HAMMING, 6.76)

        self.samp_rate_tx = samp_rate_tx = satnogs.hw_tx_settings[
            rx_sdr_device]['samp_rate']
        self.rx_frequency = rx_frequency = 435.765e6
        self.modulation_index_uplink = modulation_index_uplink = deviation / (
            baud_rate_uplink / 2.0)
        self.modulation_index_downlink = modulation_index_downlink = deviation / (
            baud_rate_downlink / 2.0)
        self.interp_taps = interp_taps = numpy.convolve(
            numpy.array(gaussian_taps), numpy.array(sq_wave))
        self.first_stage_samp_rate_rx = first_stage_samp_rate_rx = samp_rate_rx / decimation_rx

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder(
            [0x33] * 8, [0x7A, 0x0E], False, False, False, True, True, "ABCD",
            0, "ON02GR", 0, 64)
        self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source(
            bind_addr, recv_port, 1500)
        self.satnogs_udp_msg_sink_0_0_0 = satnogs.udp_msg_sink(
            dest_addr, wod_port, 1500)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            dest_addr, send_port, 1500)
        self.satnogs_qb50_deframer_0 = satnogs.qb50_deframer(0xe)
        self.satnogs_multi_format_msg_sink_0 = satnogs.multi_format_msg_sink(1)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, False, True, 256, 3)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            samp_rate_tx / (baud_rate_uplink * samples_per_symbol_tx),
            taps=(firdes.low_pass_2(32, 32, 0.8, 0.1, 60)),
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'])
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_frequency - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.osmosdr_sink_0 = osmosdr.sink(
            args="numchan=" + str(1) + " " +
            satnogs.hw_tx_settings[rx_sdr_device]['dev_arg'])
        self.osmosdr_sink_0.set_sample_rate(samp_rate_tx)
        self.osmosdr_sink_0.set_center_freq(tx_frequency - lo_offset, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['rf_gain'], 0)
        self.osmosdr_sink_0.set_if_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['if_gain'], 0)
        self.osmosdr_sink_0.set_bb_gain(
            satnogs.hw_tx_settings[tx_sdr_device]['bb_gain'], 0)
        self.osmosdr_sink_0.set_antenna(
            satnogs.hw_tx_settings[tx_sdr_device]['antenna'], 0)
        self.osmosdr_sink_0.set_bandwidth(samp_rate_tx, 0)

        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            samples_per_symbol_tx, (interp_taps))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            decimation_rx, (taps), lo_offset, samp_rate_rx)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            first_stage_samp_rate_rx / baud_rate_downlink,
            0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate_tx, analog.GR_COS_WAVE, lo_offset, 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            ((first_stage_samp_rate_rx) / baud_rate_downlink) /
            (math.pi * modulation_index_downlink))
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(
            (math.pi * modulation_index_uplink) / samples_per_symbol_tx)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'failed_pdu'),
                         (self.satnogs_multi_format_msg_sink_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_qb50_deframer_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'out'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'wod'),
                         (self.satnogs_udp_msg_sink_0_0_0, 'in'))
        self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'),
                         (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
        self.connect((self.analog_frequency_modulator_fc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.satnogs_upsat_fsk_frame_encoder_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
Esempio n. 6
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=1200,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 cw_offset=1500,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path='test.ogg',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='rtlsdr',
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "BPSK Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.cw_offset = cw_offset
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.samp_per_sym = samp_per_sym = 5
        self.nfilts = nfilts = 16
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000,
                                           firdes.WIN_HAMMING, 6.76)

        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(samp_per_sym), 0.35,
            11 * samp_per_sym * nfilts)
        self.filter_rate = filter_rate = 250000
        self.filt_mode = filt_mode = 0.1
        self.deviation = deviation = 5000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.alpha = alpha = 0.1

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            max(12000, int(3 * (1 + alpha) * baudrate)), 0.0, 10, 1024,
            waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000 / doppler_correction_per_sec,
            1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, samp_rate_rx)
        self.satnogs_ax25_decoder_bm_0_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, False, 1024)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate, (1 + alpha) * baudrate,
                            ((1 + alpha) * baudrate) * filt_mode,
                            firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccf(
            audio_samp_rate / (samp_per_sym * baudrate),
            (firdes.low_pass(1, audio_samp_rate, (1 + alpha) * baudrate,
                             (1 + alpha) * baudrate * filt_mode)),
            cw_offset / 1200.0 * baudrate, audio_samp_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            int(samp_rate_rx / filter_rate), (xlate_filter_taps), lo_offset,
            samp_rate_rx)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            samp_per_sym, 0.063, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_costas_loop_cc_0_0_0_0 = digital.costas_loop_cc(
            0.063, 2, False)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blks2_rational_resampler_xxx_1_0 = filter.rational_resampler_ccc(
            interpolation=max(12000, int(3 * (1 + alpha) * baudrate)),
            decimation=48000,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=audio_samp_rate,
            decimation=int(samp_rate_rx / (samp_rate_rx / filter_rate)),
            taps=None,
            fractional_bw=None,
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(
            audio_samp_rate, analog.GR_COS_WAVE, cw_offset / 1200.0 * baudrate,
            1, 0)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(0.01, 0.001, 0.015, 0.0)
        self.analog_agc2_xx_0_0.set_max_gain(65536)
        self.analog_agc2_xx_0 = analog.agc2_cc(0.01, 0.001, 0.5, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.analog_agc2_xx_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.blks2_rational_resampler_xxx_1_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0_0, 0))
        self.connect((self.digital_costas_loop_cc_0_0_0_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_costas_loop_cc_0_0_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
    def __init__(self, bind_addr="0.0.0.0", dest_addr="127.0.0.1", lo_offset=100e3, recv_port=16886, rx_sdr_device="usrpb200", send_port=5022, tx_sdr_device="usrpb200", wod_port=5023):
        gr.top_block.__init__(self, "UPSat Tranceiver")

        ##################################################
        # Parameters
        ##################################################
        self.bind_addr = bind_addr
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.recv_port = recv_port
        self.rx_sdr_device = rx_sdr_device
        self.send_port = send_port
        self.tx_sdr_device = tx_sdr_device
        self.wod_port = wod_port

        ##################################################
        # Variables
        ##################################################
        self.samples_per_symbol_tx = samples_per_symbol_tx = 4*8
        self.sq_wave = sq_wave = (1.0, ) * samples_per_symbol_tx
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.gaussian_taps = gaussian_taps = filter.firdes.gaussian(1.0, samples_per_symbol_tx, 1.0, 4*samples_per_symbol_tx)
        self.deviation = deviation = 3.9973e3
        self.decimation_rx = decimation_rx = 20
        self.baud_rate_uplink = baud_rate_uplink = 1200
        self.baud_rate_downlink = baud_rate_downlink = 9600
        self.tx_frequency = tx_frequency = 145.835e6
        
        self.taps = taps = firdes.low_pass(1.0, samp_rate_rx, 20000, 60000, firdes.WIN_HAMMING, 6.76)
          
        self.samp_rate_tx = samp_rate_tx = satnogs.hw_tx_settings[rx_sdr_device]['samp_rate']
        self.rx_frequency = rx_frequency = 435.765e6
        self.modulation_index_uplink = modulation_index_uplink = deviation / (baud_rate_uplink / 2.0)
        self.modulation_index_downlink = modulation_index_downlink = deviation / (baud_rate_downlink / 2.0)
        self.interp_taps = interp_taps = numpy.convolve(numpy.array(gaussian_taps), numpy.array(sq_wave))
        self.first_stage_samp_rate_rx = first_stage_samp_rate_rx = samp_rate_rx / decimation_rx

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder([0x33]*8 , [0x7A, 0x0E], False, False, False, True, True, "ABCD", 0, "ON02GR", 0, 64)
        self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source(bind_addr, recv_port, 1500)
        self.satnogs_udp_msg_sink_0_0_0 = satnogs.udp_msg_sink(dest_addr, wod_port, 1500)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(dest_addr, send_port, 1500)
        self.satnogs_qb50_deframer_0 = satnogs.qb50_deframer(0xe)
        self.satnogs_multi_format_msg_sink_0 = satnogs.multi_format_msg_sink(1)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm('GND', 0, False, True, 256, 3)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
        	  samp_rate_tx / (baud_rate_uplink * samples_per_symbol_tx),
                  taps=(firdes.low_pass_2(32, 32, 0.8, 0.1, 60)),
        	  flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)
        	
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_frequency - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0)
        self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0)
        self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)
          
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + satnogs.hw_tx_settings[rx_sdr_device]['dev_arg'] )
        self.osmosdr_sink_0.set_sample_rate(samp_rate_tx)
        self.osmosdr_sink_0.set_center_freq(tx_frequency - lo_offset, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(satnogs.hw_tx_settings[tx_sdr_device]['rf_gain'], 0)
        self.osmosdr_sink_0.set_if_gain(satnogs.hw_tx_settings[tx_sdr_device]['if_gain'], 0)
        self.osmosdr_sink_0.set_bb_gain(satnogs.hw_tx_settings[tx_sdr_device]['bb_gain'], 0)
        self.osmosdr_sink_0.set_antenna(satnogs.hw_tx_settings[tx_sdr_device]['antenna'], 0)
        self.osmosdr_sink_0.set_bandwidth(samp_rate_tx, 0)
          
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(samples_per_symbol_tx, (interp_taps))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(decimation_rx, (taps), lo_offset, samp_rate_rx)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(first_stage_samp_rate_rx/baud_rate_downlink, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate_tx, analog.GR_COS_WAVE, lo_offset , 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(((first_stage_samp_rate_rx) / baud_rate_downlink)/(math.pi*modulation_index_downlink))
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc((math.pi*modulation_index_uplink) / samples_per_symbol_tx)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'failed_pdu'), (self.satnogs_multi_format_msg_sink_0, 'in'))    
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_qb50_deframer_0, 'in'))    
        self.msg_connect((self.satnogs_qb50_deframer_0, 'out'), (self.satnogs_udp_msg_sink_0_0, 'in'))    
        self.msg_connect((self.satnogs_qb50_deframer_0, 'wod'), (self.satnogs_udp_msg_sink_0_0_0, 'in'))    
        self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'), (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))    
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.pfb_arb_resampler_xxx_0, 0))    
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satnogs_ax25_decoder_bm_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))    
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.satnogs_upsat_fsk_frame_encoder_0, 0), (self.interp_fir_filter_xxx_0, 0))    
Esempio n. 8
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=9600.0,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 samp_rate_rx=satnogs.not_set_samp_rate_rx,
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "msk_ax25")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(1.2)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            'decoded_data_file_path', 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, audio_samp_rate)
        self.satnogs_ax25_decoder_bm_0_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, False, 1024)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.pfb_arb_resampler_xxx_0_0 = pfb.arb_resampler_ccf(
            (2.0 * baudrate) / audio_samp_rate, taps=None, flt_size=32)
        self.pfb_arb_resampler_xxx_0_0.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            audio_samp_rate /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            2, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.analog_quadrature_demod_cf_0_0_0 = analog.quadrature_demod_cf(0.9)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(1.2)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0_0, 0),
                     (self.dc_blocker_xx_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.analog_quadrature_demod_cf_0_0_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.pfb_arb_resampler_xxx_0_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
Esempio n. 9
0
    def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=1000, enable_iq_dump=0, file_path='test.wav', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', udp_IP='127.0.0.1', udp_port=16887, waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "FSK9600 AX.25 decoder ")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 9600
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76)

        self.modulation_index = modulation_index = deviation / (baud_rate / 2.0)
        self.filter_rate = filter_rate = 250000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.audio_gain = audio_gain = satnogs.fm_demod_settings[rx_sdr_device]['audio_gain']

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(((audio_samp_rate) / baud_rate)/(math.pi*modulation_index))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, '/tmp/iq.bin', False, enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm('GND', 0, True, False, 1024)
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, audio_samp_rate, 7850, audio_samp_rate * 0.15, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(2.0 * math.pi / 100.0, 2, False)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(48e3/9600, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=48000,
                decimation=int(samp_rate_rx / (int(samp_rate_rx/filter_rate))),
                taps=None,
                fractional_bw=None,
        )
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(((audio_samp_rate) / baud_rate)/(math.pi*modulation_index))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_costas_loop_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0), (self.digital_binary_slicer_fb_0, 0))
Esempio n. 10
0
    def __init__(self, bind_addr='0.0.0.0', dest_addr='127.0.0.1', lo_offset=100e3, recv_port=16886, rx_sdr_device='usrpb200', send_port=5022, tx_sdr_device='usrpb200', wod_port=5023):
        gr.top_block.__init__(self, "UPSat Transceiver QT")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("UPSat Transceiver QT")
        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", "upsat_transceiver_qt")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.bind_addr = bind_addr
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.recv_port = recv_port
        self.rx_sdr_device = rx_sdr_device
        self.send_port = send_port
        self.tx_sdr_device = tx_sdr_device
        self.wod_port = wod_port

        ##################################################
        # Variables
        ##################################################
        self.samples_per_symbol_tx = samples_per_symbol_tx = 4*8
        self.sq_wave = sq_wave = (1.0, ) * samples_per_symbol_tx
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.gaussian_taps = gaussian_taps = filter.firdes.gaussian(1.0, samples_per_symbol_tx, 1.0, 4*samples_per_symbol_tx)
        self.deviation = deviation = 3.9973e3
        self.decimation_rx = decimation_rx = 20
        self.baud_rate_uplink = baud_rate_uplink = 1200
        self.baud_rate_downlink = baud_rate_downlink = 9600
        self.tx_frequency = tx_frequency = 145.835e6

        self.taps = taps = firdes.low_pass(1.0, samp_rate_rx, 20000, 60000, firdes.WIN_HAMMING, 6.76)

        self.samp_rate_tx = samp_rate_tx = satnogs.hw_tx_settings[rx_sdr_device]['samp_rate']
        self.rx_frequency = rx_frequency = 435.765e6
        self.modulation_index_uplink = modulation_index_uplink = deviation / (baud_rate_uplink / 2.0)
        self.modulation_index_downlink = modulation_index_downlink = deviation / (baud_rate_downlink / 2.0)
        self.interp_taps = interp_taps = numpy.convolve(numpy.array(gaussian_taps), numpy.array(sq_wave))
        self.first_stage_samp_rate_rx = first_stage_samp_rate_rx = samp_rate_rx / decimation_rx

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder([0x33]*8 , [0x7A, 0x0E], False, False, False, True, True, 'ABCD', 0, 'ON02GR', 0, 64)
        self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source(bind_addr, recv_port, 1500, 0)
        self.satnogs_udp_msg_sink_0_0_0 = satnogs.udp_msg_sink(dest_addr, wod_port, 1500)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(dest_addr, send_port, 1500)
        self.satnogs_qb50_deframer_0 = satnogs.qb50_deframer(0xe)
        self.satnogs_multi_format_msg_sink_0 = satnogs.multi_format_msg_sink(1, False, True, '')
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm('GND', 0, False, True, 256, 3)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	50e3, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(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_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate_rx/decimation_rx, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.01)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 0)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        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(True)

        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.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
        	  samp_rate_tx / (baud_rate_uplink * samples_per_symbol_tx),
                  taps=(firdes.low_pass_2(32, 32, 0.8, 0.1, 60)),
        	  flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_frequency - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0)
        self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0)
        self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + satnogs.hw_tx_settings[rx_sdr_device]['dev_arg'] )
        self.osmosdr_sink_0.set_sample_rate(samp_rate_tx)
        self.osmosdr_sink_0.set_center_freq(tx_frequency - lo_offset, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(satnogs.hw_tx_settings[tx_sdr_device]['rf_gain'], 0)
        self.osmosdr_sink_0.set_if_gain(satnogs.hw_tx_settings[tx_sdr_device]['if_gain'], 0)
        self.osmosdr_sink_0.set_bb_gain(satnogs.hw_tx_settings[tx_sdr_device]['bb_gain'], 0)
        self.osmosdr_sink_0.set_antenna(satnogs.hw_tx_settings[tx_sdr_device]['antenna'], 0)
        self.osmosdr_sink_0.set_bandwidth(samp_rate_tx, 0)

        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(samples_per_symbol_tx, (interp_taps))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(decimation_rx, (taps), lo_offset, samp_rate_rx)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(first_stage_samp_rate_rx/baud_rate_downlink, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate_tx, analog.GR_COS_WAVE, lo_offset , 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(((first_stage_samp_rate_rx) / baud_rate_downlink)/(math.pi*modulation_index_downlink))
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc((math.pi*modulation_index_uplink) / samples_per_symbol_tx)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'failed_pdu'), (self.satnogs_multi_format_msg_sink_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_qb50_deframer_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'out'), (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_qb50_deframer_0, 'wod'), (self.satnogs_udp_msg_sink_0_0_0, 'in'))
        self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'), (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.satnogs_upsat_fsk_frame_encoder_0, 0), (self.interp_fir_filter_xxx_0, 0))