def test02(self): # Test real BPSK sync excess_bw = 0.35 sps = 4 loop_bw = cmath.pi/100.0 nfilts = 32 init_phase = nfilts/2 max_rate_deviation = 0.5 osps = 1 ntaps = 11 * int(sps*nfilts) taps = filter.firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, excess_bw, ntaps) self.test = digital.pfb_clock_sync_fff(sps, loop_bw, taps, nfilts, init_phase, max_rate_deviation, osps) data = 10000*[1, -1] self.src = blocks.vector_source_f(data, False) # pulse shaping interpolation filter rrc_taps = filter.firdes.root_raised_cosine( nfilts, # gain nfilts, # sampling rate based on 32 filters in resampler 1.0, # symbol rate excess_bw, # excess bandwidth (roll-off factor) ntaps) self.rrc_filter = filter.pfb_arb_resampler_fff(sps, rrc_taps) self.snk = blocks.vector_sink_f() self.tb.connect(self.src, self.rrc_filter, self.test, self.snk) self.tb.run() expected_result = 10000*[1, -1] dst_data = self.snk.data() # Only compare last Ncmp samples Ncmp = 1000 len_e = len(expected_result) len_d = len(dst_data) expected_result = expected_result[len_e - Ncmp:] dst_data = dst_data[len_d - Ncmp:] #for e,d in zip(expected_result, dst_data): # print e, d self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 1)
def __init__(self): gr.top_block.__init__(self, "Ask Rx Top Raspi") ################################################## # Variables ################################################## self.sound_card_sample_rate = sound_card_sample_rate = 44000 self.samples_per_symbol = samples_per_symbol = 19 self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol self.bits_per_symbol = bits_per_symbol = 1 self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate, symbol_rate, 0.5, 70) self.bit_rate = bit_rate = symbol_rate / bits_per_symbol ################################################## # Blocks ################################################## self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( samples_per_symbol, 0.5, (variable_rrc_filter_taps), 32, 0, 1.5, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, sound_card_sample_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.01, 0.01, 0) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'burst') self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.audio_source_0 = audio.source(sound_card_sample_rate, '', True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.audio_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_threshold_ff_0, 0))
def __init__(self, bb_params, working_samp_rate): gr.hier_block2.__init__( self, "RX Clock Sync", gr.io_signature(1, 1, gr.sizeof_char * 1), # single in gr.io_signature(1, 1, gr.sizeof_char * 1) # single out ) # parameters self.bb_params = bb_params self.working_samp_rate = working_samp_rate # variables self.nfilts = 32 self.sps = int(self.working_samp_rate * bb_params.symbol_time) self.rrc_taps = firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0 / float(self.sps), 0.35, 11 * self.sps * self.nfilts) # convert to float and shift down to center around zero self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.connect((self, 0), (self.blocks_uchar_to_float_0, 0)) self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((-0.5, )) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0_0, 0)) # clock sync block self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( self.sps, 6.28 / 100.0, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, 1) self.connect((self.blocks_add_const_vxx_0_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) # convert back to uchar self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) # connect hier block output self.connect((self.digital_binary_slicer_fb_0_0, 0), (self, 0))
def test03_f(self): # Test resting of taps excess_bw0 = 0.35 excess_bw1 = 0.22 sps = 4 loop_bw = cmath.pi / 100.0 nfilts = 32 init_phase = nfilts / 2 max_rate_deviation = 0.5 osps = 1 ntaps = 11 * int(sps * nfilts) taps = filter.firdes.root_raised_cosine(nfilts, nfilts * sps, 1.0, excess_bw0, ntaps) self.test = digital.pfb_clock_sync_fff(sps, loop_bw, taps, nfilts, init_phase, max_rate_deviation, osps) self.src = blocks.null_source(gr.sizeof_float) self.snk = blocks.null_sink(gr.sizeof_float) self.tb.connect(self.src, self.test, self.snk) self.tb.start() time.sleep(0.1) taps = filter.firdes.root_raised_cosine(nfilts, nfilts * sps, 1.0, excess_bw1, ntaps) self.test.update_taps(taps) self.tb.stop() self.tb.wait() self.assertTrue(True)
def test03_f(self): # Test resting of taps excess_bw0 = 0.35 excess_bw1 = 0.22 sps = 4 loop_bw = cmath.pi/100.0 nfilts = 32 init_phase = nfilts/2 max_rate_deviation = 0.5 osps = 1 ntaps = 11 * int(sps*nfilts) taps = filter.firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, excess_bw0, ntaps) self.test = digital.pfb_clock_sync_fff(sps, loop_bw, taps, nfilts, init_phase, max_rate_deviation, osps) self.src = blocks.null_source(gr.sizeof_float) self.snk = blocks.null_sink(gr.sizeof_float) self.tb.connect(self.src, self.test, self.snk) self.tb.start() time.sleep(0.1) taps = filter.firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, excess_bw1, ntaps) self.test.update_taps(taps) self.tb.stop() self.tb.wait() self.assertTrue(True)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Elster Rx Multi") ################################################## # Variables ################################################## self.window_size = window_size = (800, 600) self.samp_rate = samp_rate = 2400000 self.rx_gain = rx_gain = 45 self.corr = corr = 0 self.channel_rate = channel_rate = 400000 self.channel_decimation = channel_decimation = 4 self.ch_filt_trans = ch_filt_trans = 10000 self.ch_filt_cut = ch_filt_cut = 35000 self.center_freq = center_freq = 904600000 ################################################## # Blocks ################################################## self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band spectrum") self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band waterfall") self.Add(self.nb) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.nb.GetPage(1).GetWin(), baseband_freq=center_freq, dynamic_range=50, ref_level=-30, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='Waterfall Plot', size=(window_size), ) self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.nb.GetPage(0).GetWin(), baseband_freq=center_freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=True, size=(window_size), ) self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(center_freq), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( samp_rate / channel_rate, (firdes.low_pass( 1, samp_rate, 175000, 50000, firdes.WIN_HAMMING, 6.76)), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.elster_packetize_0 = elster.packetize(6) self.digital_pfb_clock_sync_xxx_0_0_2 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_1 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0_1 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_binary_slicer_fb_0_4 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_3 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_2 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_1 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() _corr_sizer = wx.BoxSizer(wx.VERTICAL) self._corr_text_box = forms.text_box( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, label='Freq. correction', converter=forms.float_converter(), proportion=0, ) self._corr_slider = forms.slider( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, minimum=-100, maximum=100, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_corr_sizer) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -200000, 1, 0) self.analog_quadrature_demod_cf_0_4 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_3 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_2 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_1 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_pfb_clock_sync_xxx_0_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_1, 0), (self.digital_pfb_clock_sync_xxx_0_0_1, 0)) self.connect((self.analog_quadrature_demod_cf_0_2, 0), (self.digital_pfb_clock_sync_xxx_0_0_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_3, 0), (self.digital_pfb_clock_sync_xxx_0_0_2, 0)) self.connect((self.analog_quadrature_demod_cf_0_4, 0), (self.digital_pfb_clock_sync_xxx_0_0_0_1, 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.pfb_channelizer_ccf_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.elster_packetize_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.elster_packetize_0, 1)) self.connect((self.digital_binary_slicer_fb_0_1, 0), (self.elster_packetize_0, 2)) self.connect((self.digital_binary_slicer_fb_0_2, 0), (self.elster_packetize_0, 3)) self.connect((self.digital_binary_slicer_fb_0_3, 0), (self.elster_packetize_0, 4)) self.connect((self.digital_binary_slicer_fb_0_4, 0), (self.elster_packetize_0, 5)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_0, 0), (self.digital_binary_slicer_fb_0_2, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_1, 0), (self.digital_binary_slicer_fb_0_4, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_1, 0), (self.digital_binary_slicer_fb_0_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_2, 0), (self.digital_binary_slicer_fb_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.analog_quadrature_demod_cf_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.analog_quadrature_demod_cf_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.analog_quadrature_demod_cf_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.analog_quadrature_demod_cf_0_4, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
def __init__(self, center_freq=440000000): gr.top_block.__init__(self, "Rx 2400 R2") ################################################## # Parameters ################################################## self.center_freq = center_freq ################################################## # Variables ################################################## self.sps = sps = 10 self.baud_rate = baud_rate = 2530 self.samp_rate_tx = samp_rate_tx = 400000 self.samp_rate = samp_rate = int(baud_rate * sps) self.rx_vga_gain = rx_vga_gain = 35 self.rx_lna_gain = rx_lna_gain = 6 self.quad_gain = quad_gain = 8 self.freq = freq = center_freq ################################################## # Blocks ################################################## self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "bladerf=0") self.osmosdr_source_0.set_sample_rate(samp_rate_tx) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(1, 0) self.osmosdr_source_0.set_iq_balance_mode(1, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(rx_lna_gain, 0) self.osmosdr_source_0.set_if_gain(0, 0) self.osmosdr_source_0.set_bb_gain(rx_vga_gain, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(1500000, 0) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate_tx, 6000, 6000, firdes.WIN_HAMMING, 6.76)) self.fir_filter_xxx_0 = filter.fir_filter_fff(16, (firdes.low_pass( 1.0, baud_rate * sps, baud_rate, 0.25 * baud_rate))) self.fir_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( sps, 2 * 3.14159265 / 100, (firdes.low_pass( 1.0, baud_rate * sps, baud_rate, 0.25 * baud_rate)), 32, 16, 1.5, 1) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_file_sink_0_0 = blocks.file_sink( gr.sizeof_char * 1, "/usr/share/adafruit/webide/repositories/seelab_drones/data/_out.bin", False) self.blocks_file_sink_0_0.set_unbuffered(True) self.blocks_add_const_vxx_0 = blocks.add_const_vff((0, )) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( quad_gain) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( -70, 1e-4, 0, True) ################################################## # Connections ################################################## self.connect((self.analog_pwr_squelch_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.analog_pwr_squelch_xx_0, 0))
def __init__(self, hdr_format=digital.header_format_default( digital.packet_utils.default_access_code, 0)): gr.top_block.__init__(self, "Audio modem FSK loop back test") Qt.QWidget.__init__(self) self.setWindowTitle("Audio modem FSK loop back test") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.hdr_format = hdr_format ################################################## # Variables ################################################## self.nfilts = nfilts = 32 self.SPS = SPS = 147 self.RX_decimation = RX_decimation = 49 self.EBW = EBW = .05 self.samp_rate = samp_rate = 44.1E3 self.fsk_deviation_hz = fsk_deviation_hz = 100 self.carrier_freq = carrier_freq = 1.75E3 self.RRC_filter_taps = RRC_filter_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0, EBW, 5 * SPS * nfilts / RX_decimation) ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=RX_decimation, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate / RX_decimation, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / RX_decimation, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not 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.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, '', '', False, False, '') self._qtgui_edit_box_msg_0_win = sip.wrapinstance( self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_edit_box_msg_0_win) self.epy_block_0 = epy_block_0.msg_block() self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb( hdr_format, 'len_key') self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( SPS / RX_decimation, 6.28 / 400.0 * 2 / 70, (RRC_filter_taps), nfilts, nfilts / 2, 2, 1) self.digital_correlate_access_code_xx_ts_1_0_0 = digital.correlate_access_code_bb_ts( digital.packet_utils.default_access_code, 2, 'len_key2') self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bf( ((2 * 3.14 * carrier_freq - 2 * 3.14 * fsk_deviation_hz, 2 * 3.14 * carrier_freq + 2 * 3.14 * fsk_deviation_hz)), 1) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.blocks_vector_source_x_0 = blocks.vector_source_b((1, 0), True, 1, []) self.blocks_vco_f_0 = blocks.vco_f(samp_rate, 1, 1) self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'len_key2') self.blocks_tagged_stream_mux_1 = blocks.tagged_stream_mux( gr.sizeof_char * 1, 'len_key', 0) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_char * 1, 'len_key', 0) self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, 200, 'len_key') self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1, SPS - 1) self.blocks_repack_bits_bb_0_0_0_0 = blocks.repack_bits_bb( 1, 8, 'len_key2', False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb( 8, 1, 'len_key', False, gr.GR_MSB_FIRST) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'len_key') self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_message_debug_0_0 = blocks.message_debug() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.audio_source_0 = audio.source(44100, '', True) self.audio_sink_0 = audio.sink(44100, '', True) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -carrier_freq, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( samp_rate / (2 * math.pi * fsk_deviation_hz / 8.0) / (RX_decimation)) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(-60, .01, 0, True) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 1.0) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0, 'pdus'), (self.blocks_message_debug_0_0, 'print')) self.msg_connect((self.epy_block_0, 'msg_out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'), (self.epy_block_0, 'msg_in')) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.audio_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.digital_protocol_formatter_bb_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_tagged_stream_mux_1, 1)) self.connect((self.blocks_repack_bits_bb_0_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vco_f_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.blocks_tagged_stream_mux_1, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.blocks_tagged_stream_mux_1, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_correlate_access_code_xx_ts_1_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.digital_correlate_access_code_xx_ts_1_0_0, 0), (self.blocks_repack_bits_bb_0_0_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_pwr_squelch_xx_0, 0))
def __init__(self, verbose, center_freq, freq, samp_rate, threshold, channel_width, tcp_str, hw_sel, payload_len, transition_width=0, iq_file_name=""): gr.top_block.__init__(self) if True: #verbose > 0: print "\nFlowgraph Properties:" print " Center Frequency: {} MHz".format(center_freq / 1000000.0) print " Tune Frequency: {} MHz".format(freq / 1000000.0) print " IQ Sample Rate (in): {} MHz".format(samp_rate / 1000000.0) print " Channel Width: {} MHz".format(channel_width / 1000000.0) print " Transition Width: {} MHz".format(transition_width / 1000000.0) print " Threshold: {}".format(threshold) print " IQ File Name: {}".format(iq_file_name) print " ZMQ TCP ADDR: {}".format(tcp_str) print " HW Sel: {}".format(hw_sel) # start by dumping baseband into a file and viewing in grc if verbose > 0: print "Entering OOK Demodulator..." # variables self.center_freq = center_freq self.freq = freq self.threshold = threshold self.channel_width = channel_width self.samp_rate = samp_rate if transition_width == 0: self.transition_width = channel_width / 10 else: self.transition_width = transition_width self.taps = firdes.low_pass(1, self.samp_rate, self.channel_width / 2, self.transition_width) self.symbol_rate = 10e3 self.samples_per_symbol = \ int(self.samp_rate/self.symbol_rate) self.payload_len = payload_len # blocks, starting from the input channel filter self.freq_xlating_fir_filter_xxx_0 = \ filter.freq_xlating_fir_filter_ccc( 1, self.taps, freq - center_freq, samp_rate) if hw_sel == HW_SEL_FILE: self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, iq_file_name, True) # skip the throttle block, we just want to get done self.connect((self.blocks_file_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) elif hw_sel == HW_SEL_HACKRF: self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'hackrf=0') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(center_freq, 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(10, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) elif self.hw_sel == HW_SEL_USRP: self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(center_freq, 0) self.uhd_usrp_source_0.set_gain(20, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.connect((self.osmosdr_source_0, 0), (self.uhd_usrp_source_0, 0)) # add limeSDR using osmocom #elif self.hw_sel == HW_SEL_LIME: # demodulation self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1 * threshold, )) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_add_const_vxx_0, 0)) # binary slicer is next major thing, but there # may be a pfb block in between self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() # polyphase clock sync (optional) if False: nfilts = 32 self.rrc_taps = rrc_taps = \ firdes.root_raised_cosine( nfilts, samp_rate, self.symbol_rate, 0.35, nfilts) self.digital_pfb_clock_sync_xxx_0_0 = \ digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (rrc_taps), 32, 16, 1.5, self.samples_per_symbol) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) else: self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) # decimate down to the symbol rate self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_char * 1, int(self.samp_rate / self.symbol_rate)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_keep_one_in_n_0, 0)) # find preamble and apply tag self.digital_correlate_access_code_xx_ts_0 = \ digital.correlate_access_code_bb_ts( "01010101010101010101", 0, "packet_len") self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_correlate_access_code_xx_ts_0, 0)) # pack bitstream into bytes self.blocks_repack_bits_bb_0_0_0 = blocks.repack_bits_bb( 1, 8, 'packet_len', False, gr.GR_MSB_FIRST) self.connect((self.digital_correlate_access_code_xx_ts_0, 0), (self.blocks_repack_bits_bb_0_0_0, 0)) # generate PDU self.blocks_tagged_stream_to_pdu_0 = \ blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.connect((self.blocks_repack_bits_bb_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) # add ZeroMQ sink to get data out of flowgraph self.zeromq_push_msg_sink_0 = zeromq.push_msg_sink(tcp_str, 100) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.zeromq_push_msg_sink_0, 'in')) # debug only if False: self.blocks_random_pdu_0 = blocks.random_pdu(50, 128, chr(0xFF), 2) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.zeromq_push_msg_sink_0, 'in'))
def __init__(self): gr.top_block.__init__(self, "FSK Packet Transmission") Qt.QWidget.__init__(self) self.setWindowTitle("FSK Packet Transmission") 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", "fsk") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.baudrate = baudrate = 1200 self.sps = sps = int(samp_rate) / baudrate self.nfilts = nfilts = 32 self.fsk_lo_tone = fsk_lo_tone = 1200 self.zero_pad = zero_pad = 100000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, samp_rate, 1200.0, 0.7, 11 * sps) self.preamble_len = preamble_len = 32 self.preamble_char = preamble_char = 0xaa self.hdr_format = hdr_format = digital.header_format_default( digital.packet_utils.default_access_code, 0) self.fsk_hi_tone = fsk_hi_tone = 2200 * 0 + (fsk_lo_tone + baudrate) * 1 ################################################## # Blocks ################################################## self.root_raised_cosine_filter_1 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, samp_rate, baudrate, 0.7, 11 * int(samp_rate) / baudrate)) self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, samp_rate, baudrate, 0.7, 11 * int(samp_rate) / baudrate)) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #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 = [6, 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(-70, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0, 1, 1, 1) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-2.125, 2.125) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(True) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not False: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192 * 6, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-2.125, 2.125) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0.02, 0, 'packet_len') self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-100, 20) 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(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 1, 1) self.fsk_packet_tx_1_0 = fsk_packet_tx_1( baud=baudrate, fsk_hi=fsk_lo_tone, fsk_low=fsk_hi_tone, hdr_format=hdr_format, preamble_len=preamble_len, preamble_sym=preamble_char, samp_rate=samp_rate, zero_pad=zero_pad, ) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( sps, 6.28 / 200, (rrc_taps), nfilts, 1, 1.5, 1) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.25, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 0.0j, ), noise_seed=0, block_tags=False) self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_rotator_cc_1 = blocks.rotator_cc( (-1.0 * fsk_hi_tone / samp_rate) * 2 * math.pi) self.blocks_rotator_cc_0 = blocks.rotator_cc( (-1.0 * fsk_lo_tone / samp_rate) * 2 * math.pi) self.blocks_random_pdu_0 = blocks.random_pdu(2, 128 * 4, chr(0xFF), 2) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, )) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 500) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(int(samp_rate), '', True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.fsk_packet_tx_1_0, 'data in')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_complex_to_mag_1, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.blocks_rotator_cc_1, 0), (self.root_raised_cosine_filter_1, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_rotator_cc_1, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.fsk_packet_tx_1_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.root_raised_cosine_filter_1, 0), (self.blocks_complex_to_mag_1, 0))
def __init__(self, samp_rate_in, samp_rate_out, center_freq, tune_freq0, tune_freq1, tune_freq2, channel_width, transition_width, threshold, fsk_deviation, fskSquelch, iq_filename, dig_out_filename): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.cutoff_freq = channel_width / 2 self.firdes_taps = firdes.low_pass(1, samp_rate_in, self.cutoff_freq, transition_width) self.nfilts = 32 self.symbol_rate = 16000 self.samples_per_symbol = int(samp_rate_out / self.symbol_rate) self.rrc_taps = firdes.root_raised_cosine(self.nfilts, samp_rate_out, self.symbol_rate, 0.35, self.nfilts) ################################################## # Blocks ################################################## self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, iq_filename, False) # flow for channel 0 self.blocks_tuning_filter_0 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq0 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_0 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_0 = digital.binary_slicer_fb() # flow for channel 1 self.blocks_tuning_filter_1 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq1 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_1 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_1 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) self.digital_pfb_clock_sync_xxx_1 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_1 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_1 = digital.binary_slicer_fb() # flow for channel 2 self.blocks_tuning_filter_2 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq2 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_2 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_2 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) include_pfb = False self.digital_pfb_clock_sync_xxx_2 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_2 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_2 = digital.binary_slicer_fb() # these are high during idle times, so we need to combine the three channel outputs logically with an and function self.blocks_and_xx_0 = blocks.and_bb() # swapped message sink for file sink #self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, dig_out_filename, False) #self.blocks_file_sink_0.set_unbuffered(False) self.sink_queue = gr.msg_queue() self.blocks_message_sink_0 = blocks.message_sink( gr.sizeof_char * 1, self.sink_queue, False) ################################################## # Connections ################################################## # channel 0 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_0, 0)) self.connect((self.blocks_tuning_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_quadrature_demod_0, 0)) self.connect((self.blocks_quadrature_demod_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_add_const_vxx_0, 0)) #self.connect((self.blocks_quadrature_demod_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_digital_binary_slicer_fb_0, 0)) # channel 1 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_1, 0)) self.connect((self.blocks_tuning_filter_1, 0), (self.analog_pwr_squelch_xx_1, 0)) self.connect((self.analog_pwr_squelch_xx_1, 0), (self.blocks_quadrature_demod_1, 0)) self.connect((self.blocks_quadrature_demod_1, 0), (self.digital_pfb_clock_sync_xxx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_1, 0), (self.blocks_add_const_vxx_1, 0)) #self.connect((self.blocks_quadrature_demod_1, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_digital_binary_slicer_fb_1, 0)) # channel 2 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_2, 0)) self.connect((self.blocks_tuning_filter_2, 0), (self.analog_pwr_squelch_xx_2, 0)) self.connect((self.analog_pwr_squelch_xx_2, 0), (self.blocks_quadrature_demod_2, 0)) self.connect((self.blocks_quadrature_demod_2, 0), (self.digital_pfb_clock_sync_xxx_2, 0)) self.connect((self.digital_pfb_clock_sync_xxx_2, 0), (self.blocks_add_const_vxx_2, 0)) #self.connect((self.blocks_quadrature_demod_2, 0), (self.blocks_add_const_vxx_2, 0)) self.connect((self.blocks_add_const_vxx_2, 0), (self.blocks_digital_binary_slicer_fb_2, 0)) # and gate self.connect((self.blocks_digital_binary_slicer_fb_0, 0), (self.blocks_and_xx_0, 0)) self.connect((self.blocks_digital_binary_slicer_fb_1, 0), (self.blocks_and_xx_0, 1)) self.connect((self.blocks_digital_binary_slicer_fb_2, 0), (self.blocks_and_xx_0, 2)) #self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0, 0)) # output to message sink self.connect((self.blocks_and_xx_0, 0), (self.blocks_message_sink_0, 0))
def __init__(self, carrier_freq=1080, input_path='/tmp/data.wav', output_path='/tmp/data.bin'): gr.top_block.__init__(self, "Fsk Demodulation") ################################################## # Parameters ################################################## self.carrier_freq = carrier_freq self.input_path = input_path self.output_path = output_path ################################################## # Variables ################################################## self.nfilts = nfilts = 32 self.SPS = SPS = 147 self.RX_decimation = RX_decimation = 49 self.EBW = EBW = .05 self.samp_rate = samp_rate = 44.1E3 self.fsk_deviation_hz = fsk_deviation_hz = 100 self.RRC_filter_taps = RRC_filter_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0, EBW, 5 * SPS * nfilts / RX_decimation) ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=RX_decimation, taps=None, fractional_bw=None, ) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( SPS / RX_decimation, 6.28 / 400.0 * 2 / 70, (RRC_filter_taps), nfilts, nfilts / 2, 2, 1) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source(input_path, False) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, output_path, False) self.blocks_file_sink_0.set_unbuffered(False) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -carrier_freq, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( samp_rate / (2 * math.pi * fsk_deviation_hz / 8.0) / (RX_decimation)) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(-60, .01, 0, True) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 1.0) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_pwr_squelch_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Redesigned Gfsk") ################################################## # Variables ################################################## self.trans_wdth = trans_wdth = 300e3 self.samp_rate = samp_rate = 4e6 self.ntaps = ntaps = 5*32 self.data_rate = data_rate = 1e6 self.cutoff_freq = cutoff_freq = 500e3 self.taps = taps = firdes.low_pass(1, samp_rate, cutoff_freq, trans_wdth, firdes.WIN_HAMMING, 6.76) self.sqlch_threshold = sqlch_threshold = -100 self.sqlch_alpha = sqlch_alpha = .1 self.sensivity = sensivity = .20 self.samp_per_sym_4 = samp_per_sym_4 = int(samp_rate/data_rate) self.samp_per_sym = samp_per_sym = int(samp_rate/data_rate) self.rf_gain = rf_gain = 70 self.out_sps = out_sps = 1 self.max_rate_dev = max_rate_dev = 1.5 self.loop_bandwidth = loop_bandwidth = 0.06283185307179587 self.initial_phase = initial_phase = 0 self.freq_offset = freq_offset = 0 self.filter_taps = filter_taps = firdes.root_raised_cosine(1.0,samp_rate,data_rate,.3,ntaps) self.filter_size = filter_size = 32 self.filename = filename = "/Users/mmohamoud/software_defined_radios/ble_collect/demodulated_files/resigned_demod" self.cntr_freq = cntr_freq = 2426e6 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(cntr_freq, 0) self.uhd_usrp_source_0.set_gain(rf_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (taps), 0, samp_rate) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff(samp_per_sym, loop_bandwidth, (taps), filter_size, initial_phase, max_rate_dev, out_sps) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_LSB_FIRST) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/Users/mmohamoud/software_defined_radios/ble_collect/demodulated_files/redesigned', False) self.blocks_file_sink_0.set_unbuffered(False) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1.0/sensivity) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(sqlch_threshold, sqlch_alpha, 0, True) ################################################## # Connections ################################################## self.connect((self.analog_pwr_squelch_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_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)) self.connect((self.uhd_usrp_source_0, 0), (self.analog_pwr_squelch_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "APRS S-Gate") Qt.QWidget.__init__(self) self.setWindowTitle("APRS S-Gate") 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", "aprs_satgate") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.freq = freq = 145.825e6 self.variable_qtgui_label_0 = variable_qtgui_label_0 = int(freq) self.samp_rate = samp_rate = 2.4e6 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(4, 48000, 1200, 0.35, 16*48000/1200) self.rfgain = rfgain = 35 self.audio_mute = audio_mute = True self.afgain = afgain = -7 ################################################## # Blocks ################################################## self._rfgain_range = Range(0, 49, 1, 35, 200) self._rfgain_win = RangeWidget(self._rfgain_range, self.set_rfgain, 'RF Gain (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._rfgain_win, 3,0,1,1) self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_formatter = None else: self._variable_qtgui_label_0_formatter = lambda x: x self._variable_qtgui_label_0_tool_bar.addWidget(Qt.QLabel('Freq (Hz)'+": ")) self._variable_qtgui_label_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_formatter(self.variable_qtgui_label_0))) self._variable_qtgui_label_0_tool_bar.addWidget(self._variable_qtgui_label_0_label) self.top_grid_layout.addWidget(self._variable_qtgui_label_0_tool_bar, 4,0,1,1) self.show_text_2 = display.show_text() self._show_text_2_win = sip.wrapinstance(self.show_text_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._show_text_2_win, 2,2,2,1) self.show_text_0 = display.show_text() self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._show_text_0_win, 2,0,1,2) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 192e3, #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(False) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 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(-105, -20) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0,2,1,1) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 2048, #size 1200, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-4, 4) self.qtgui_time_sink_x_2.set_y_label('Amplitude', "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_axis_labels(False) self.qtgui_time_sink_x_2.enable_control_panel(False) if not False: self.qtgui_time_sink_x_2.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 2, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "blue", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [0.7, 0.7, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win, 1,0,1,3) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 144.39e6, #fc 192e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-120, -10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(False) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["red", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [0.8, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,1,2) self.igate_aprs_pkt_gen_0 = igate.aprs_pkt_gen(120, 'YD1SDL-10', 'APGRC', 'WIDE2-2', 240, 3, '!0745.80S/11022.51E` Temporary / Experimental APRS I/S-Gate') self.igate_aprs_is_sink_0 = igate.aprs_is_sink('rotate.aprs.net', 14580, 'YD1SDL-10', 24505) self.igate_aprs_demod_0 = igate.aprs_demod(48000) self.gpredict_doppler_0 = gpredict.doppler(self.set_freq, "localhost", 4532, True) self.fft_filter_xxx_3 = filter.fft_filter_fff(1, (firdes.band_pass(0.5,48e3,1e3,2400,1e2,firdes.WIN_HAMMING)), 1) self.fft_filter_xxx_3.declare_sample_delay(0) self.fft_filter_xxx_2 = filter.fft_filter_fff(2, (firdes.band_pass(0.25,48e3,400,2500,500,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_2.declare_sample_delay(0) self.fft_filter_xxx_1 = filter.fft_filter_fff(1, (rrc_taps), 1) self.fft_filter_xxx_1.declare_sample_delay(0) self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (firdes.low_pass(1,48e3,1e3,1e2,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff(48000 / 1200, 6.28 / 1000, (rrc_taps), 39, 20, 1.5, 1) self.blocks_wavfile_sink_0 = blocks.wavfile_sink('IO86-wav-dump.wav', 1, 24000, 16) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_rotator_cc_0 = blocks.rotator_cc(-1700 / 48e3 * 2 * math.pi) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, 10) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int(10e3*math.pi), 1.0/(10e3*math.pi), 4000) self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) _audio_mute_check_box = Qt.QCheckBox('Audio Mute') self._audio_mute_choices = {True: True, False: False} self._audio_mute_choices_inv = dict((v,k) for k,v in self._audio_mute_choices.iteritems()) self._audio_mute_callback = lambda i: Qt.QMetaObject.invokeMethod(_audio_mute_check_box, "setChecked", Qt.Q_ARG("bool", self._audio_mute_choices_inv[i])) self._audio_mute_callback(self.audio_mute) _audio_mute_check_box.stateChanged.connect(lambda i: self.set_audio_mute(self._audio_mute_choices[bool(i)])) self.top_grid_layout.addWidget(_audio_mute_check_box, 4,1,1,1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(48e3 / (2*math.pi*1200/8.0)) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.afsk_aprs2inet_1 = afsk.aprs2inet(12000, 4) self.afsk_afsk1200_0 = afsk.afsk1200(48000,4) self._afgain_range = Range(-20, -1, 0.1, -7, 200) self._afgain_win = RangeWidget(self._afgain_range, self.set_afgain, 'AF Gain (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._afgain_win, 3,1,1,1) self.RTL_APRS_RX_0 = RTL_APRS_RX( device_ppm=58, freq=freq, rf_gain=rfgain, samp_rate=samp_rate, ) ################################################## # Connections ################################################## self.msg_connect((self.igate_aprs_demod_0, 'out'), (self.igate_aprs_is_sink_0, 'in')) self.msg_connect((self.igate_aprs_pkt_gen_0, 'out'), (self.igate_aprs_is_sink_0, 'in')) self.connect((self.RTL_APRS_RX_0, 1), (self.fft_filter_xxx_2, 0)) self.connect((self.RTL_APRS_RX_0, 1), (self.fft_filter_xxx_3, 0)) self.connect((self.RTL_APRS_RX_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.RTL_APRS_RX_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.afsk_afsk1200_0, 0), (self.show_text_2, 0)) self.connect((self.afsk_aprs2inet_1, 0), (self.show_text_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_float_to_complex_0_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_repeat_0, 0), (self.afsk_aprs2inet_1, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.fft_filter_xxx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.fft_filter_xxx_1, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.fft_filter_xxx_2, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.afsk_afsk1200_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.blocks_float_to_complex_0_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.igate_aprs_demod_0, 0))
def __init__(self, callsign='', gpredict_port=4532, latitude=0, longitude=0): gr.top_block.__init__(self, "LilacSat-2 decoder for FUNcube Dongle Pro+") ################################################## # Parameters ################################################## self.callsign = callsign self.gpredict_port = gpredict_port self.latitude = latitude self.longitude = longitude ################################################## # Variables ################################################## self.sub_sps = sub_sps = 32 self.sub_nfilts = sub_nfilts = 16 self.sub_alpha = sub_alpha = 0.35 self.sps = sps = 5 self.nfilts = nfilts = 16 self.freq = freq = 437.2e6 self.alpha = alpha = 0.35 self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist(([-1, 1]), ([0, 1]), 2, 1).base() self.threshold = threshold = 4 self.sub_rrc_taps = sub_rrc_taps = firdes.root_raised_cosine(sub_nfilts, sub_nfilts, 1.0/float(sub_sps), sub_alpha, 11*sub_sps*sub_nfilts) self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), alpha, 11*sps*nfilts) self.rf_samp_rate = rf_samp_rate = 192000 self.offset = offset = 30e3 self.if_samp_rate = if_samp_rate = 48000 self.doppler_freq = doppler_freq = freq self.af_samp_rate = af_samp_rate = 9600 ################################################## # Blocks ################################################## self.sync_to_pdu_0_1_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_1 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sids_submit_0 = sids.submit('http://tlm.pe0sat.nl/tlmdb/frame_db.php', 40908, callsign, longitude, latitude, '') self.sids_print_timestamp_0 = sids.print_timestamp('%Y-%m-%d %H:%M:%S') self.low_pass_filter_3_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, if_samp_rate, 8e3, 2e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, af_samp_rate, 200, 50, firdes.WIN_HAMMING, 6.76)) self.libfec_decode_rs_0_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0 = libfec.decode_rs(True, 0) self.kiss_kiss_to_pdu_0_1 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0_0 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(False) self.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(rf_samp_rate/if_samp_rate, (filter.firdes.low_pass(1,rf_samp_rate,10000,2000)), doppler_freq - freq + offset, rf_samp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(rf_samp_rate/if_samp_rate, (filter.firdes.low_pass(1,rf_samp_rate,5000,2000)), doppler_freq - freq + offset + 25e3, rf_samp_rate) self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus('',1) self.fcdproplus_fcdproplus_0.set_lna(0) self.fcdproplus_fcdproplus_0.set_mixer_gain(0) self.fcdproplus_fcdproplus_0.set_if_gain(0) self.fcdproplus_fcdproplus_0.set_freq_corr(0) self.fcdproplus_fcdproplus_0.set_freq(freq-offset) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff(sub_sps, 0.0628, (sub_rrc_taps), sub_nfilts, sub_nfilts/2, 0.01, 1) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 0.100, (rrc_taps), nfilts, nfilts/2, 1.5, 2) self.digital_lms_dd_equalizer_cc_0_0 = digital.lms_dd_equalizer_cc(2, 0.3, 2, variable_constellation_0) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(sps, 0.350, 100, 0.1) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(0.4, 2, False) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(10, 0.25*0.175*0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True) self.ccsds_viterbi_0_1 = ccsds_viterbi() self.ccsds_viterbi_0_0_0 = ccsds_viterbi() self.ccsds_viterbi_0_0 = ccsds_viterbi() self.ccsds_viterbi_0 = ccsds_viterbi() self.ccsds_descrambler_0_0_0 = ccsds_descrambler() self.ccsds_descrambler_0_0 = ccsds_descrambler() self.ccsds_descrambler_0 = ccsds_descrambler() self.blocks_pdu_to_tagged_stream_0_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_message_debug_0 = blocks.message_debug() self.blocks_delay_0_0_0 = blocks.delay(gr.sizeof_float*1, 1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float*1, 1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.5) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=af_samp_rate, quad_rate=if_samp_rate, tau=75e-6, max_dev=3.5e3, ) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 2) ################################################## # Connections ################################################## self.msg_connect((self.ccsds_descrambler_0, 'out'), (self.libfec_decode_rs_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0, 'out'), (self.libfec_decode_rs_0_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0_0, 'out'), (self.libfec_decode_rs_0_0_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.libfec_decode_rs_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_1, 'pdus')) self.msg_connect((self.sids_print_timestamp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.sync_to_pdu_0, 'out'), (self.ccsds_descrambler_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.ccsds_viterbi_0_1, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ccsds_viterbi_0_0_0, 0)) self.connect((self.blocks_delay_0_0_0, 0), (self.ccsds_viterbi_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.kiss_kiss_to_pdu_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.kiss_kiss_to_pdu_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_1, 0), (self.kiss_kiss_to_pdu_0_1, 0)) self.connect((self.ccsds_viterbi_0, 0), (self.sync_to_pdu_0_1_0, 0)) self.connect((self.ccsds_viterbi_0_0, 0), (self.sync_to_pdu_0_0_0, 0)) self.connect((self.ccsds_viterbi_0_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.ccsds_viterbi_0_1, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.digital_binary_slicer_fb_1, 0), (self.sync_to_pdu_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_delay_0_0_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.ccsds_viterbi_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.digital_lms_dd_equalizer_cc_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.sync_to_pdu_0_1, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.sync_to_pdu_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_lms_dd_equalizer_cc_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_binary_slicer_fb_1, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.low_pass_filter_3_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.low_pass_filter_3_0_0, 0), (self.analog_nbfm_rx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Rx Top") Qt.QWidget.__init__(self) self.setWindowTitle("Rx Top") 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", "rx_top") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sound_card_sample_rate = sound_card_sample_rate = 44000 self.samples_per_symbol = samples_per_symbol = 19 self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol self.bits_per_symbol = bits_per_symbol = 1 self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate, symbol_rate, 0.5, 70) self.bit_rate = bit_rate = symbol_rate / bits_per_symbol ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1_2_0 = qtgui.time_sink_f( 500, #size sound_card_sample_rate, #samp_rate "Filtered signal", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_2_0.set_update_time(0.10) self.qtgui_time_sink_x_1_2_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_2_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_2_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_2_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_2_0.enable_autoscale(True) self.qtgui_time_sink_x_1_2_0.enable_grid(False) self.qtgui_time_sink_x_1_2_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_2_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_2_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1_2_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_2_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_2_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_2_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_2_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_2_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_2_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_2_0_win = sip.wrapinstance( self.qtgui_time_sink_x_1_2_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_0_win) self.qtgui_time_sink_x_1_2 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization phase", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_2.set_update_time(0.10) self.qtgui_time_sink_x_1_2.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_2.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_2.enable_tags(-1, True) self.qtgui_time_sink_x_1_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_2.enable_autoscale(True) self.qtgui_time_sink_x_1_2.enable_grid(False) self.qtgui_time_sink_x_1_2.enable_axis_labels(True) self.qtgui_time_sink_x_1_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_2.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_2_win = sip.wrapinstance( self.qtgui_time_sink_x_1_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_win) self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization rate", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_1.set_update_time(0.10) self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_1.enable_autoscale(True) self.qtgui_time_sink_x_1_1.enable_grid(False) self.qtgui_time_sink_x_1_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_1_win) self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization error", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_0.enable_autoscale(True) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_win = sip.wrapinstance( self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 50, #size symbol_rate, #samp_rate "Received symbols", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_sink_x_0_1 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate, #bw "sync symbols", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_1.set_update_time(1.0 / 10) self._qtgui_sink_x_0_1_win = sip.wrapinstance( self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_1_win) self.qtgui_sink_x_0_1.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate, #bw "received-symbol", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.fft_filter_xxx_0 = filter.fft_filter_fff( 1, (variable_rrc_filter_taps), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( samples_per_symbol, 0.5, (variable_rrc_filter_taps), 32, 0, 1.5, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, sound_card_sample_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.01, 0.01, 0) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'burst') self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.audio_source_0 = audio.source(sound_card_sample_rate, '', True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.audio_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.audio_source_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_sink_x_0_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 1), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 2), (self.qtgui_time_sink_x_1_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 3), (self.qtgui_time_sink_x_1_2, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.qtgui_time_sink_x_1_2_0, 0))
def __init__(self, center_freq=433920000): gr.top_block.__init__(self, "Rx 2400 R2") ################################################## # Parameters ################################################## self.center_freq = center_freq ################################################## # Variables ################################################## self.sps = sps = 10 self.baud_rate = baud_rate = 2530 self.samp_rate_tx = samp_rate_tx = 400000 self.samp_rate = samp_rate = baud_rate * sps self.rx_vga_gain = rx_vga_gain = 35 self.rx_lna_gain = rx_lna_gain = 6 self.quad_gain = quad_gain = 8 self.freq = freq = 433920000 self._fft_size_config = ConfigParser.ConfigParser() self._fft_size_config.read('default') try: fft_size = self._fft_size_config.getint('main', 'key') except: fft_size = 2048 self.fft_size = fft_size ################################################## # Blocks ################################################## self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'bladerf=0') self.osmosdr_source_0.set_sample_rate(samp_rate_tx) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(1, 0) self.osmosdr_source_0.set_iq_balance_mode(1, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(rx_lna_gain, 0) self.osmosdr_source_0.set_if_gain(0, 0) self.osmosdr_source_0.set_bb_gain(rx_vga_gain, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(1500000, 0) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate_tx, 6000, 6000, firdes.WIN_HAMMING, 6.76)) self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( sample_rate=samp_rate_tx, fft_size=fft_size, ref_scale=2, frame_rate=1, avg_alpha=1.0, average=False, ) self.fir_filter_xxx_0 = filter.fir_filter_fff(16, (firdes.low_pass( 1.0, baud_rate * sps, baud_rate, 0.25 * baud_rate))) self.fir_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( sps, 2 * 3.14159265 / 100, (firdes.low_pass( 1.0, baud_rate * sps, baud_rate, 0.25 * baud_rate)), 32, 16, 1.5, 1) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_float * fft_size, 1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char * 1, '_out.bin', False) self.blocks_file_sink_0_0.set_unbuffered(True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * fft_size, 'log_power_fft_data.bin', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_const_vxx_0 = blocks.add_const_vff((0, )) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( quad_gain) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( -70, 1e-4, 0, True) ################################################## # Connections ################################################## self.connect((self.analog_pwr_squelch_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.logpwrfft_x_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.logpwrfft_x_0, 0))
def __init__(self, bfo=12000, callsign='', invert=1, ip='::', latitude=0, longitude=0, port=7355, recstart=''): gr.top_block.__init__(self, "LilacSat-2 decoder") ################################################## # Parameters ################################################## self.bfo = bfo self.callsign = callsign self.invert = invert self.ip = ip self.latitude = latitude self.longitude = longitude self.port = port self.recstart = recstart ################################################## # Variables ################################################## self.sub_sps = sub_sps = 32 self.sub_nfilts = sub_nfilts = 16 self.sub_alpha = sub_alpha = 0.35 self.sps = sps = 5 self.samp_per_sym = samp_per_sym = 5 self.nfilts = nfilts = 16 self.alpha = alpha = 0.35 self.variable_constellation_0_0 = variable_constellation_0_0 = digital.constellation_calcdist( ([-1, 1]), ([0, 1]), 2, 1).base() self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist( ([-1, 1]), ([0, 1]), 2, 1).base() self.threshold = threshold = 4 self.sub_rrc_taps = sub_rrc_taps = firdes.root_raised_cosine( sub_nfilts, sub_nfilts, 1.0 / float(sub_sps), sub_alpha, 11 * sub_sps * sub_nfilts) self.samp_rate = samp_rate = 48000 self.rrc_taps_0 = rrc_taps_0 = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(samp_per_sym), 0.35, 11 * samp_per_sym * nfilts) self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(sps), alpha, 11 * sps * nfilts) self.nfilts_0 = nfilts_0 = 16 ################################################## # Blocks ################################################## self.sync_to_pdu_0_1_0 = sync_to_pdu( packlen=(114 + 32) * 8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_1 = sync_to_pdu( packlen=(114 + 32) * 8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0_0 = sync_to_pdu( packlen=(114 + 32) * 8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0 = sync_to_pdu( packlen=(114 + 32) * 8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0 = sync_to_pdu( packlen=(114 + 32) * 8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sids_submit_0 = sids.submit( 'http://tlm.pe0sat.nl/tlmdb/frame_db.php', 40908, callsign, longitude, latitude, recstart) self.sids_print_timestamp_0 = sids.print_timestamp('%Y-%m-%d %H:%M:%S') self.low_pass_filter_0 = filter.fir_filter_fff( 5, firdes.low_pass(1, samp_rate, 200, 50, firdes.WIN_HAMMING, 6.76)) self.libfec_decode_rs_0_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0 = libfec.decode_rs(True, 0) self.kiss_kiss_to_pdu_0_1 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0_0 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf( 1, (firdes.low_pass(1, samp_rate, 10000, 1000)), bfo, samp_rate) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff( sub_sps, 0.0628, (sub_rrc_taps), sub_nfilts, sub_nfilts / 2, 0.01, 1) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( sps, 0.100, (rrc_taps), nfilts, nfilts / 2, 1.5, 2) self.digital_lms_dd_equalizer_cc_0_0 = digital.lms_dd_equalizer_cc( 2, 0.3, 2, variable_constellation_0) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( sps, 0.350, 100, 0.1) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(0.4, 2, False) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( 10, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True) self.ccsds_viterbi_0_1 = ccsds_viterbi() self.ccsds_viterbi_0_0_0 = ccsds_viterbi() self.ccsds_viterbi_0_0 = ccsds_viterbi() self.ccsds_viterbi_0 = ccsds_viterbi() self.ccsds_descrambler_0_0_0 = ccsds_descrambler() self.ccsds_descrambler_0_0 = ccsds_descrambler() self.ccsds_descrambler_0 = ccsds_descrambler() self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1, ip, port, 1472, False) self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767) self.blocks_pdu_to_tagged_stream_0_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff( (invert * 10, )) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_delay_0_0_0 = blocks.delay(gr.sizeof_float * 1, 1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float * 1, 1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 2) ################################################## # Connections ################################################## self.msg_connect((self.ccsds_descrambler_0, 'out'), (self.libfec_decode_rs_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0, 'out'), (self.libfec_decode_rs_0_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0_0, 'out'), (self.libfec_decode_rs_0_0_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.libfec_decode_rs_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_1, 'pdus')) self.msg_connect((self.sids_print_timestamp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.sync_to_pdu_0, 'out'), (self.ccsds_descrambler_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.ccsds_viterbi_0_1, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ccsds_viterbi_0_0_0, 0)) self.connect((self.blocks_delay_0_0_0, 0), (self.ccsds_viterbi_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.kiss_kiss_to_pdu_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.kiss_kiss_to_pdu_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_1, 0), (self.kiss_kiss_to_pdu_0_1, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_short_to_float_0, 0)) self.connect((self.ccsds_viterbi_0, 0), (self.sync_to_pdu_0_1_0, 0)) self.connect((self.ccsds_viterbi_0_0, 0), (self.sync_to_pdu_0_0_0, 0)) self.connect((self.ccsds_viterbi_0_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.ccsds_viterbi_0_1, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.digital_binary_slicer_fb_1, 0), (self.sync_to_pdu_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_delay_0_0_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.ccsds_viterbi_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.digital_lms_dd_equalizer_cc_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.sync_to_pdu_0_1, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.sync_to_pdu_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_lms_dd_equalizer_cc_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_binary_slicer_fb_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))