def test_006(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb sampling_freq = 100 # N must by a multiple of the volk_alignment of the system for this test to work. # For a machine with 512-bit registers, that would be 8 complex-floats. N = int(8 * sampling_freq) src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) dst1 = blocks.vector_sink_c() head = blocks.head(gr.sizeof_gr_complex, N) ref = 1 agc = analog.agc3_cc(1e-2, 1e-3, ref) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) tb.run() dst_data = dst1.data() M = 100 result = [abs(x) for x in dst_data[N - M:]] self.assertFloatTuplesAlmostEqual(result, M * [ref, ], 4)
def test_006(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb sampling_freq = 100 N = int(5 * sampling_freq) src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) dst1 = blocks.vector_sink_c() head = blocks.head(gr.sizeof_gr_complex, N) ref = 1 agc = analog.agc3_cc(1e-2, 1e-3, ref) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) tb.run() dst_data = dst1.data() M = 100 result = [abs(x) for x in dst_data[N - M:]] self.assertFloatTuplesAlmostEqual(result, M * [ ref, ], 4)
def __init__(self): gr.top_block.__init__(self, "SQ5BPF Tetra live receiver 1ch UDP HEADLESS") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.first_decim = first_decim = 32 self.xlate_offset_fine1 = xlate_offset_fine1 = 0 self.xlate_offset1 = xlate_offset1 = 500e3 self.udp_packet_size = udp_packet_size = 1472 self.udp_dest_addr = udp_dest_addr = "127.0.0.1" self.telive_receiver_name = telive_receiver_name = 'SQ5BPF 1-channel headless rx for telive' self.telive_receiver_channels = telive_receiver_channels = 1 self.sdr_ifgain = sdr_ifgain = 20 self.sdr_gain = sdr_gain = 38 self.ppm_corr = ppm_corr = 56 self.out_sample_rate = out_sample_rate = 36000 self.options_low_pass = options_low_pass = 12500 self.if_samp_rate = if_samp_rate = samp_rate/first_decim self.freq = freq = 435e6 self.first_port = first_port = 42000 ################################################## # Blocks ################################################## self.xmlrpc_server_0 = SimpleXMLRPCServer(('0.0.0.0', first_port), allow_none=True) self.xmlrpc_server_0.register_instance(self) self.xmlrpc_server_0_thread = threading.Thread(target=self.xmlrpc_server_0.serve_forever) self.xmlrpc_server_0_thread.daemon = True self.xmlrpc_server_0_thread.start() self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(ppm_corr, 0) self.osmosdr_source_0.set_gain(sdr_gain, 0) self.osmosdr_source_0.set_if_gain(sdr_ifgain, 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.mmse_resampler_xx_0 = filter.mmse_resampler_cc(0, float(float(if_samp_rate)/float(out_sample_rate))) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(first_decim, firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass*0.2), xlate_offset1+xlate_offset_fine1, samp_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, udp_dest_addr, first_port+1, udp_packet_size, False) self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.mmse_resampler_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.mmse_resampler_xx_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "SQ5BPF Tetra live receiver 1ch UDP HEADLESS") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.first_decim = first_decim = 32 self.xlate_offset_fine1 = xlate_offset_fine1 = 0 self.xlate_offset1 = xlate_offset1 = 500e3 self.udp_packet_size = udp_packet_size = 1472 self.udp_dest_addr = udp_dest_addr = "127.0.0.1" self.telive_receiver_name = telive_receiver_name = 'SQ5BPF 1-channel headless rx for telive' self.telive_receiver_channels = telive_receiver_channels = 1 self.sdr_ifgain = sdr_ifgain = 20 self.sdr_gain = sdr_gain = 38 self.ppm_corr = ppm_corr = 56 self.out_sample_rate = out_sample_rate = 36000 self.options_low_pass = options_low_pass = 12500 self.if_samp_rate = if_samp_rate = samp_rate/first_decim self.freq = freq = 435e6 self.first_port = first_port = 42000 ################################################## # Blocks ################################################## self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", first_port), allow_none=True) self.xmlrpc_server_0.register_instance(self) threading.Thread(target=self.xmlrpc_server_0.serve_forever).start() self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(ppm_corr, 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(sdr_gain, 0) self.osmosdr_source_0.set_if_gain(sdr_ifgain, 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.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass*0.2)), xlate_offset1+xlate_offset_fine1, samp_rate) self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(0, float(float(if_samp_rate)/float(out_sample_rate))) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, udp_dest_addr, first_port+1, udp_packet_size, False) self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.fractional_resampler_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc3_xx_0, 0))
def test_006_sets(self): agc = analog.agc3_cc(1e-3, 1e-1, 1) agc.set_attack_rate(1) agc.set_decay_rate(2) agc.set_reference(1.1) agc.set_gain(1.1) self.assertAlmostEqual(agc.attack_rate(), 1) self.assertAlmostEqual(agc.decay_rate(), 2) self.assertAlmostEqual(agc.reference(), 1.1) self.assertAlmostEqual(agc.gain(), 1.1)
def test_006(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb sampling_freq = 100 N = int(5*sampling_freq) src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) dst1 = blocks.vector_sink_c() head = blocks.head(gr.sizeof_gr_complex, N) ref = 1 agc = analog.agc3_cc(1e-2, 1e-3, ref) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) tb.run() dst_data = dst1.data() M = 100 result = [abs(x) for x in dst_data[N-M:]] self.assertFloatTuplesAlmostEqual(result, M*[ref,], 4)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Vor Receive Realtime Clean") ################################################## # Variables ################################################## self.morse_vol = morse_vol = 10 self.samp_rate = samp_rate = 32000 self.rtl_gain = rtl_gain = 42 self.rtl_freq = rtl_freq = 112500e3 self.morse_gain = morse_gain = pow(10, morse_vol / 10) self.morse_amp_level = morse_amp_level = 0 self.PI = PI = 3.14159 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f( self.GetWin(), title='Morse', sample_rate=samp_rate / (1600), v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_STRIPCHART, y_axis_label='Amp', ) self.Add(self.wxgui_scopesink2_1_0_0.win) self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.rtlsdr_source_0.set_sample_rate(samp_rate * 64) self.rtlsdr_source_0.set_center_freq(rtl_freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(rtl_gain, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.pfb_decimator_ccf_0 = pfb.decimator_ccf( 64, (firdes.low_pass(1, samp_rate * 64, 16e3, 200e3)), 0, 100, True, True) self.pfb_decimator_ccf_0.declare_sample_delay(0) _morse_vol_sizer = wx.BoxSizer(wx.VERTICAL) self._morse_vol_text_box = forms.text_box( parent=self.GetWin(), sizer=_morse_vol_sizer, value=self.morse_vol, callback=self.set_morse_vol, label='Morse Volume (dB):', converter=forms.float_converter(), proportion=0, ) self._morse_vol_slider = forms.slider( parent=self.GetWin(), sizer=_morse_vol_sizer, value=self.morse_vol, callback=self.set_morse_vol, minimum=-25, maximum=25, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_morse_vol_sizer) def _morse_amp_level_probe(): while True: val = self.morse_amp.level() try: self.set_morse_amp_level(val) except AttributeError: pass time.sleep(1.0 / (25)) _morse_amp_level_thread = threading.Thread( target=_morse_amp_level_probe) _morse_amp_level_thread.daemon = True _morse_amp_level_thread.start() self.hilbert_fc_0 = filter.hilbert_fc(64, firdes.WIN_HAMMING, 6.76) self.goertzel_fc_0_0 = fft.goertzel_fc(samp_rate, 3200, 30) self.goertzel_fc_0 = fft.goertzel_fc(samp_rate, 3200, 30) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc( 1, (firdes.low_pass(1, samp_rate, 480 * 2, 500 * 2)), 9960, samp_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink( gr.sizeof_gr_complex * 1, '0.0.0.0', 20000, True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (morse_gain, )) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_integrate_xx_1 = blocks.integrate_ff(1600, 1) self.blocks_integrate_xx_0 = blocks.integrate_cc(8, 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.band_pass_filter_0 = filter.fir_filter_fcc( 1, firdes.complex_band_pass(1, samp_rate, 1010, 1030, 100, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0_0 = audio.sink(samp_rate, '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=1, ) self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.goertzel_fc_0_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.goertzel_fc_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_tcp_server_sink_0, 0)) self.connect((self.blocks_integrate_xx_1, 0), (self.wxgui_scopesink2_1_0_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.goertzel_fc_0, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.goertzel_fc_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.hilbert_fc_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.pfb_decimator_ccf_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.pfb_decimator_ccf_0, 0))
def __init__(self): gr.top_block.__init__(self, "Lang Rx") ################################################## # Variables ################################################## plutoip = os.environ.get('PLUTO_IP') if plutoip == None: plutoip = 'pluto.local' plutoip = 'ip:' + plutoip self.SQL = SQL = 50 self.RxOffset = RxOffset = 0 self.Mute = Mute = False self.Mode = Mode = 3 self.Filt_Low = Filt_Low = 300 self.Filt_High = Filt_High = 3000 self.FFTEn = FFTEn = 0 self.AFGain = AFGain = 20 ################################################## # Blocks ################################################## self.pluto_source_0 = iio.pluto_source(plutoip, 1000000000, 528000, 2000000, 0x800, True, True, True, "slow_attack", 64.0, '', True) self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( sample_rate=48000, fft_size=512, ref_scale=2, frame_rate=15, avg_alpha=0.9, average=True, ) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 11, (firdes.low_pass(1, 529200, 23000, 2000)), RxOffset, 528000) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_float * 512, '127.0.0.1', 7373, 1472, False) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 512) self.blocks_multiply_const_vxx_2_1_0 = blocks.multiply_const_vff( (1.0 + (Mode == 5), )) self.blocks_multiply_const_vxx_2_1 = blocks.multiply_const_vff( (Mode == 5, )) self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vff( ((Mode == 4) * 0.2, )) self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff( (Mode < 4, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( ((AFGain / 100.0) * (not Mute), )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_xx_1_0 = blocks.add_vff(1) self.blocks_add_xx_1 = blocks.add_vff(1) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_float * 512, num_inputs=1, num_outputs=2, input_index=0, output_index=FFTEn, ) self.band_pass_filter_0 = filter.fir_filter_ccc( 1, firdes.complex_band_pass(1, 48000, Filt_Low, Filt_High, 100, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(48000, "hw:CARD=Device,DEV=0", False) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( SQL - 100, 0.001, 0, False) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=48000, quad_rate=48000, tau=75e-6, max_dev=5e3, ) self.analog_agc3_xx_0 = analog.agc3_cc(1e-2, 5e-7, 0.1, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(1000) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_2_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blks2_selector_0, 1), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_add_xx_1_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_2_1, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_const_vxx_2, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_multiply_const_vxx_2_1_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_2_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.blocks_multiply_const_vxx_2_1, 0), (self.blocks_add_xx_1_0, 1)) self.connect((self.blocks_multiply_const_vxx_2_1_0, 0), (self.blocks_add_xx_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.logpwrfft_x_0, 0)) self.connect((self.logpwrfft_x_0, 0), (self.blks2_selector_0, 0)) self.connect((self.pluto_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ham2Mon AM Receiver Flow Example") Qt.QWidget.__init__(self) self.setWindowTitle("Ham2Mon AM Receiver Flow Example") 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", "am_flow_example") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1E6 self.initial_decim = initial_decim = 5 self.samp_ratio = samp_ratio = samp_rate/1E6 self.final_rate = final_rate = samp_rate/initial_decim**2/int(samp_rate/1E6) self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass(1.0, final_rate, 3500, 500, firdes.WIN_HAMMING, 6.76) self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass(1.0, samp_rate/25, 12.5E3, 1E3, firdes.WIN_HAMMING, 6.76) self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass(1.0, 1, 0.090, 0.010, firdes.WIN_HAMMING, 6.76) self.squelch_dB = squelch_dB = -70 self.gain_db = gain_db = 30 self.final_decim = final_decim = int(samp_rate/1E6) self.file_name = file_name = "test.wav" self.fft_length = fft_length = 256 * int(pow(2, np.ceil(np.log(samp_ratio)/np.log(2)))) self.demod_bb_freq = demod_bb_freq = 390E3 self.center_freq = center_freq = 144E6 ################################################## # Blocks ################################################## self._squelch_dB_range = Range(-100, 0, 5, -70, 200) self._squelch_dB_win = RangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float) self.top_grid_layout.addWidget(self._squelch_dB_win, 5,1,1,3) self._gain_db_range = Range(0, 70, 1, 30, 200) self._gain_db_win = RangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float) self.top_grid_layout.addWidget(self._gain_db_win, 4,1,1,3) self._demod_bb_freq_range = Range(-samp_rate/2, samp_rate/2, 5E3, 390E3, 200) self._demod_bb_freq_win = RangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float) self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3,1,1,3) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( fft_length, #size samp_rate, #samp_rate "Averaged Spectrum", #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(-60, 40) self.qtgui_time_sink_x_0.set_y_label("Power", "") 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_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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,1,3,1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc final_rate, #bw "Decimated Channel", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-200, -60) self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3,0,3,1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( fft_length, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 144E6, #fc samp_rate, #bw "Spectrum", #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, -20) 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_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,3,1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 16E3/float(final_rate/5), taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "uhd" ) 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(gain_db, 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(samp_rate*0.8, 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0), demod_bb_freq, samp_rate) self.fir_filter_xxx_0_1 = filter.fir_filter_fff(initial_decim, (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0_1.declare_sample_delay(0) self.fir_filter_xxx_0_0 = filter.fir_filter_ccc(int(samp_rate/1E6), (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0_0.declare_sample_delay(0) self.fir_filter_xxx_0 = filter.fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0.declare_sample_delay(0) self.fft_vxx_0 = fft.fft_vcc(fft_length, True, (window.blackmanharris(fft_length)), True, 1) self.blocks_wavfile_sink_0 = blocks.wavfile_sink(file_name, 1, 16000, 8) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_length) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_length) self.blocks_probe_signal_vx_0 = blocks.probe_signal_vf(fft_length) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, fft_length, 0) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*fft_length, int(round(samp_rate/fft_length/1000))) self.blocks_integrate_xx_0 = blocks.integrate_ff(100, fft_length) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_length) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(16000, "", True) self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff(-200, 0.1, 0, True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(squelch_dB, 0.1, 0, False) self.analog_agc3_xx_0 = analog.agc3_cc(1e-0, 1e-4, 0.1, 10, 1) self.analog_agc3_xx_0.set_max_gain(10000) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.fir_filter_xxx_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "Mpsk Stage5") Qt.QWidget.__init__(self) self.setWindowTitle("Mpsk Stage5") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "mpsk_stage5") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sps = sps = 2 self.nfilts = nfilts = 32 self.timing_loop_bw = timing_loop_bw = 6.28 / 100.0 self.samp_rate = samp_rate = 56250 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts) self.phase_bw = phase_bw = 6.28 / 100.0 self.min_freq_deviation = min_freq_deviation = -500 self.max_freq_deviation = max_freq_deviation = 500 self.excess_bw = excess_bw = 0.35 self.eq_gain = eq_gain = 0.01 self.arity = arity = 4 self.NOAA_DSB_Constellation = NOAA_DSB_Constellation = digital.constellation_calcdist( ([0.3907 - 0.9205j, 0.3907 + 0.9205j]), ([0, 1]), 0, 1).base() ################################################## # Blocks ################################################## self._timing_loop_bw_range = Range(0.0, 0.2, 0.01, 6.28 / 100.0, 200) self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range, self.set_timing_loop_bw, 'Time: BW', "slider", float) self.top_grid_layout.addWidget(self._timing_loop_bw_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "Output Bytes", #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(-0.1, 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(False) 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) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ['Direct', 'through decoder', '', '', '', '', '', '', '', ''] 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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "Constellation outputs", #name 3 #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) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['Error', 'Phase', 'Frequency', '', '', '', '', '', '', ''] 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, 4, 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(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_char, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("Byte Output") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win) self.qtgui_const_sink_x_2 = qtgui.const_sink_c( 1024, #size "After AutoGain Control", #name 1 #number of inputs ) self.qtgui_const_sink_x_2.set_update_time(0.10) self.qtgui_const_sink_x_2.set_y_axis(-2, 2) self.qtgui_const_sink_x_2.set_x_axis(-2, 2) self.qtgui_const_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_2.enable_autoscale(False) self.qtgui_const_sink_x_2.enable_grid(False) self.qtgui_const_sink_x_2.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_2.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_2.set_line_label(i, labels[i]) self.qtgui_const_sink_x_2.set_line_width(i, widths[i]) self.qtgui_const_sink_x_2.set_line_color(i, colors[i]) self.qtgui_const_sink_x_2.set_line_style(i, styles[i]) self.qtgui_const_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_2_win = sip.wrapinstance( self.qtgui_const_sink_x_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_2_win) self.qtgui_const_sink_x_1 = qtgui.const_sink_c( 1024, #size "Input Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(False) self.qtgui_const_sink_x_1.enable_grid(False) self.qtgui_const_sink_x_1.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance( self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_1_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "Output Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( sps, timing_loop_bw, (rrc_taps), nfilts, nfilts / 2, 1.5, 2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb( NOAA_DSB_Constellation, phase_bw, min_freq_deviation, max_freq_deviation) self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc( 15, 1, eq_gain, 2) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, 'C:\\Users\\Sevy\\Desktop\\School\\ETH\\SDR\\POES_56k250.raw', False) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_1 = blocks.file_sink( gr.sizeof_char * 1, 'C:\\Users\\Sevy\\Desktop\\School\\ETH\\SDR\\Packed Byte Out.txt', False) self.blocks_file_sink_1.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, 'C:\\Users\\Sevy\\Desktop\\School\\ETH\\SDR\\Byte Out.txt', False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.analog_agc3_xx_0 = analog.agc3_cc(500e-3, 1, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.qtgui_const_sink_x_2, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_file_sink_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_const_sink_x_1, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_constellation_receiver_cb_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 4), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 1), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 3), (self.qtgui_time_sink_x_0, 2)) self.connect((self.digital_constellation_receiver_cb_0, 2), (self.qtgui_time_sink_x_0, 1)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__( self, title="Complex Multiplier RX SDRstick HF1 with PBT & Variable BW") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.kHz = kHz = 0 self.MHz = MHz = 10 self.Hz = Hz = 0 self.samp_rate = samp_rate = 384000 self.pbt = pbt = 0 self.freq = freq = MHz * 1000000 + kHz * 1000 + Hz self.bw = bw = 1500 self.AF_gain = AF_gain = 2 ################################################## # Blocks ################################################## _pbt_sizer = wx.BoxSizer(wx.VERTICAL) self._pbt_text_box = forms.text_box( parent=self.GetWin(), sizer=_pbt_sizer, value=self.pbt, callback=self.set_pbt, label=" Passband Tuning", converter=forms.float_converter(), proportion=0, ) self._pbt_slider = forms.slider( parent=self.GetWin(), sizer=_pbt_sizer, value=self.pbt, callback=self.set_pbt, minimum=-.000190, maximum=.000190, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_pbt_sizer) self._bw_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.bw, callback=self.set_bw, label=" Bandwidth", choices=[500, 1500, 3000, 10000], labels=['500', '1.5K', '3K', '10K'], style=wx.RA_HORIZONTAL, ) self.Add(self._bw_chooser) _AF_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._AF_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_AF_gain_sizer, value=self.AF_gain, callback=self.set_AF_gain, label=" Audio Gain", converter=forms.float_converter(), proportion=0, ) self._AF_gain_slider = forms.slider( parent=self.GetWin(), sizer=_AF_gain_sizer, value=self.AF_gain, callback=self.set_AF_gain, minimum=0, maximum=10, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_AF_gain_sizer) self.wxgui_fftsink2_1 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=freq, y_per_div=10, y_divs=10, ref_level=-30, ref_scale=2.0, sample_rate=(samp_rate), fft_size=4096, fft_rate=15, average=True, avg_alpha=.5, title=" LSB Baseband Frequency kHz USB", peak_hold=False, size=(850, 400), ) self.Add(self.wxgui_fftsink2_1.win) self.low_pass_filter_0 = filter.fir_filter_ccf( samp_rate / 48000, firdes.low_pass(1, samp_rate, bw / 2, 100, firdes.WIN_HAMMING, 6.76)) _kHz_sizer = wx.BoxSizer(wx.VERTICAL) self._kHz_text_box = forms.text_box( parent=self.GetWin(), sizer=_kHz_sizer, value=self.kHz, callback=self.set_kHz, label="kHz", converter=forms.float_converter(), proportion=0, ) self._kHz_slider = forms.slider( parent=self.GetWin(), sizer=_kHz_sizer, value=self.kHz, callback=self.set_kHz, minimum=-500, maximum=500, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_kHz_sizer) self.hpsdr_hermesNB_0 = hpsdr.hermesNB(freq, freq, freq, 0, 0, 1, 1, 0, 384000, "eth0", "0xF0", 0xa0, 0, 0x00, 0x00, 0, 1) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex * 1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff( (AF_gain, )) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.audio_sink_0_0 = audio.sink(48000, "", True) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate / 48000, analog.GR_COS_WAVE, ((bw / 2) * pbt), .99, 0) self.analog_agc3_xx_0 = analog.agc3_cc(1, 1e-5, 0.5, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) _MHz_sizer = wx.BoxSizer(wx.VERTICAL) self._MHz_text_box = forms.text_box( parent=self.GetWin(), sizer=_MHz_sizer, value=self.MHz, callback=self.set_MHz, label="MHz", converter=forms.float_converter(), proportion=0, ) self._MHz_slider = forms.slider( parent=self.GetWin(), sizer=_MHz_sizer, value=self.MHz, callback=self.set_MHz, minimum=0, maximum=50, num_steps=50, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_MHz_sizer) _Hz_sizer = wx.BoxSizer(wx.VERTICAL) self._Hz_text_box = forms.text_box( parent=self.GetWin(), sizer=_Hz_sizer, value=self.Hz, callback=self.set_Hz, label="Fine", converter=forms.float_converter(), proportion=0, ) self._Hz_slider = forms.slider( parent=self.GetWin(), sizer=_Hz_sizer, value=self.Hz, callback=self.set_Hz, minimum=-1000, maximum=1000, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_Hz_sizer) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.audio_sink_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.wxgui_fftsink2_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_null_source_0, 0), (self.hpsdr_hermesNB_0, 0)) self.connect((self.hpsdr_hermesNB_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self, frame_size=60): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.frame_size = frame_size ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1e6 self.timing_loop_bw = timing_loop_bw = 6.28 / 100.0 self.sps = sps = 16 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( 1, samp_rate / 10, 5000, 500, 60) self.rf_gain = rf_gain = 60 self.rate = rate = 2 self.polys = polys = [109, 79] self.phase_bw = phase_bw = 6.28 / 100.0 self.nfilts = nfilts = 32 self.lpfilter = lpfilter = 6000 self.k = k = 7 self.ftune = ftune = 915e6 self.fadj = fadj = -200000 self.eq_gain = eq_gain = 0.01 self.dec = dec = fec.ldpc_decoder.make( 'C:\\Program Files\\GNURadio-3.7\\share\\gnuradio\\fec\\ldpc\\PNB2_512_23C1.alist', 0.3, 50) ################################################## # Blocks ################################################## self._rf_gain_range = Range(0, 100, 10, 60, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'rf_gain', "counter_slider", int) self.top_grid_layout.addWidget(self._rf_gain_win, 2, 0, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._lpfilter_range = Range(0, 50000, 100, 6000, 200) self._lpfilter_win = RangeWidget(self._lpfilter_range, self.set_lpfilter, 'lpfilter', "counter_slider", int) self.top_grid_layout.addWidget(self._lpfilter_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._ftune_range = Range(100e6, 1000e6, 1, 915e6, 200) self._ftune_win = RangeWidget(self._ftune_range, self.set_ftune, "ftune", "counter_slider", float) self.top_grid_layout.addWidget(self._ftune_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._fadj_range = Range(-300000, 300000, 1, -200000, 200) self._fadj_win = RangeWidget(self._fadj_range, self.set_fadj, "fadj", "counter_slider", float) self.top_grid_layout.addWidget(self._fadj_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._timing_loop_bw_range = Range(0.0, 0.2, 0.01, 6.28 / 100.0, 200) self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range, self.set_timing_loop_bw, 'Time: BW', "slider", float) self.top_grid_layout.addWidget(self._timing_loop_bw_win, 3, 0, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(ftune, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(1, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(rf_gain, 0) self.rtlsdr_source_0.set_if_gain(0, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #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 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / 10, #bw 'Base band', #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_grid_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self._phase_bw_range = Range(0.0, 1.0, 0.01, 6.28 / 100.0, 200) self._phase_bw_win = RangeWidget(self._phase_bw_range, self.set_phase_bw, 'Phase: Bandwidth', "counter_slider", float) self.top_grid_layout.addWidget(self._phase_bw_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 10, (firdes.low_pass(1, samp_rate, lpfilter, 1000)), fadj, samp_rate) self._eq_gain_range = Range(0.0, 0.1, 0.001, 0.01, 200) self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain, 'Equalizer: rate', "slider", float) self.top_grid_layout.addWidget(self._eq_gain_win, 2, 1, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=sps, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) self.blocks_file_sink_0_0 = blocks.file_sink( gr.sizeof_char * 1, 'C:\\projects\\gnuradio_prj\\fsk_mod\\fsk_rx_bits_100k.bin', False) self.blocks_file_sink_0_0.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_gr_complex * 1, 'C:\\projects\\gnuradio_prj\\fsk_mod\\fsk_rx_100k.bin', False) self.blocks_file_sink_0.set_unbuffered(False) self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") 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()) ################################################## # Variables ################################################## self.offset_tune_freq = offset_tune_freq = -10E3 self.band_freq = band_freq = 7.055E6 self.usrp_clk_rate = usrp_clk_rate = 200E6 self.usrp_ask_freq = usrp_ask_freq = band_freq+offset_tune_freq self.usrp_DDC_freq = usrp_DDC_freq = np.round(usrp_ask_freq/usrp_clk_rate* 2**32)/2**32 * usrp_clk_rate self.fine_tuner_freq = fine_tuner_freq = 0 self.coarse_tuner_freq = coarse_tuner_freq = 0 self.samp_rate = samp_rate = 250000 self.lo_freq = lo_freq = usrp_DDC_freq + coarse_tuner_freq + fine_tuner_freq - offset_tune_freq self.record_check_box = record_check_box = False self.file_name_string = file_name_string = str(int(time.mktime(time.gmtime())))+"UTC_"+'{:.6f}'.format(lo_freq)+"Hz"+"_"+str(int(samp_rate/100))+"sps"+".raw" self.variable_function_probe_0 = variable_function_probe_0 = 0 self.file_name = file_name = file_name_string if record_check_box==True else "/dev/null" self.volume = volume = 5.0 self.rx_power_label = rx_power_label = '{:.1f}'.format(variable_function_probe_0) self.lo_freq_label = lo_freq_label = '{:.6f}'.format(lo_freq) self.gain_offset_dB = gain_offset_dB = 18.86 self.filter_taps = filter_taps = firdes.low_pass(1.0,2.5,0.1,0.02,firdes.WIN_HAMMING) self.filename_label = filename_label = file_name self.cw_filter_bw = cw_filter_bw = 1000 self.RX_power_offset_dB = RX_power_offset_dB = -35.2 ################################################## # Blocks ################################################## self._volume_layout = Qt.QVBoxLayout() self._volume_knob = Qwt.QwtKnob() self._volume_knob.setRange(0, 10.0, 1.0) self._volume_knob.setValue(self.volume) self._volume_knob.valueChanged.connect(self.set_volume) self._volume_layout.addWidget(self._volume_knob) self._volume_label = Qt.QLabel("Volume") self._volume_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter) self._volume_layout.addWidget(self._volume_label) self.top_grid_layout.addLayout(self._volume_layout, 5,6,1,1) self._cw_filter_bw_options = (100, 500, 1000, ) self._cw_filter_bw_labels = ("100 Hz", "500 Hz", "1 kHz", ) self._cw_filter_bw_tool_bar = Qt.QToolBar(self) self._cw_filter_bw_tool_bar.addWidget(Qt.QLabel("CW Filter BW"+": ")) self._cw_filter_bw_combo_box = Qt.QComboBox() self._cw_filter_bw_tool_bar.addWidget(self._cw_filter_bw_combo_box) for label in self._cw_filter_bw_labels: self._cw_filter_bw_combo_box.addItem(label) self._cw_filter_bw_callback = lambda i: Qt.QMetaObject.invokeMethod(self._cw_filter_bw_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._cw_filter_bw_options.index(i))) self._cw_filter_bw_callback(self.cw_filter_bw) self._cw_filter_bw_combo_box.currentIndexChanged.connect( lambda i: self.set_cw_filter_bw(self._cw_filter_bw_options[i])) self.top_grid_layout.addWidget(self._cw_filter_bw_tool_bar, 5,5,1,1) self.blocks_probe_signal_x_0 = blocks.probe_signal_f() def _variable_function_probe_0_probe(): while True: val = self.blocks_probe_signal_x_0.level() try: self.set_variable_function_probe_0(val) except AttributeError: pass time.sleep(1.0 / (5)) _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start() self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "addr=192.168.40.2")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_subdev_spec("B:A", 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(usrp_ask_freq, 0) self.uhd_usrp_source_0.set_gain(6, 0) self._rx_power_label_tool_bar = Qt.QToolBar(self) if None: self._rx_power_label_formatter = None else: self._rx_power_label_formatter = lambda x: x self._rx_power_label_tool_bar.addWidget(Qt.QLabel("RX Power (dBm)"+": ")) self._rx_power_label_label = Qt.QLabel(str(self._rx_power_label_formatter(self.rx_power_label))) self._rx_power_label_tool_bar.addWidget(self._rx_power_label_label) self.top_grid_layout.addWidget(self._rx_power_label_tool_bar, 4,7,1,1) _record_check_box_check_box = Qt.QCheckBox("Record") self._record_check_box_choices = {True: True, False: False} self._record_check_box_choices_inv = dict((v,k) for k,v in self._record_check_box_choices.iteritems()) self._record_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(_record_check_box_check_box, "setChecked", Qt.Q_ARG("bool", self._record_check_box_choices_inv[i])) self._record_check_box_callback(self.record_check_box) _record_check_box_check_box.stateChanged.connect(lambda i: self.set_record_check_box(self._record_check_box_choices[bool(i)])) self.top_grid_layout.addWidget(_record_check_box_check_box, 6,5,1,1) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48000, decimation=2500, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype usrp_DDC_freq, #fc samp_rate, #bw "Band Waterfall", #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) if complex == type(float()): self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [5, 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(-100, -70) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4,0,3,5) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype lo_freq, #fc samp_rate/100, #bw str(samp_rate/100) + " Hz Channel Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-120, -70) self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) if complex == type(float()): self.qtgui_freq_sink_x_0_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(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 0,5,3,5) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype usrp_DDC_freq, #fc samp_rate, #bw "Band Spectrum", #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(-110, -60) 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) if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,3,5) self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate/100, 0.9*cw_filter_bw, 0.1*cw_filter_bw, firdes.WIN_BLACKMAN, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 10**(gain_offset_dB/20), samp_rate, 100E3, 20E3, firdes.WIN_HAMMING, 6.76)) self._lo_freq_label_tool_bar = Qt.QToolBar(self) if None: self._lo_freq_label_formatter = None else: self._lo_freq_label_formatter = lambda x: x self._lo_freq_label_tool_bar.addWidget(Qt.QLabel("LO Freq (Hz)"+": ")) self._lo_freq_label_label = Qt.QLabel(str(self._lo_freq_label_formatter(self.lo_freq_label))) self._lo_freq_label_tool_bar.addWidget(self._lo_freq_label_label) self.top_grid_layout.addWidget(self._lo_freq_label_tool_bar, 4,6,1,1) self.hilbert_fc_0_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(10, (filter_taps), lo_freq - usrp_DDC_freq, samp_rate) self.fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(10, (filter_taps)) self.fir_filter_xxx_0_0_0.declare_sample_delay(0) self._fine_tuner_freq_layout = Qt.QVBoxLayout() self._fine_tuner_freq_tool_bar = Qt.QToolBar(self) self._fine_tuner_freq_layout.addWidget(self._fine_tuner_freq_tool_bar) self._fine_tuner_freq_tool_bar.addWidget(Qt.QLabel("Fine Tuner (Hz)"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._fine_tuner_freq_counter = qwt_counter_pyslot() self._fine_tuner_freq_counter.setRange(-500, 500, 1) self._fine_tuner_freq_counter.setNumButtons(2) self._fine_tuner_freq_counter.setValue(self.fine_tuner_freq) self._fine_tuner_freq_tool_bar.addWidget(self._fine_tuner_freq_counter) self._fine_tuner_freq_counter.valueChanged.connect(self.set_fine_tuner_freq) self._fine_tuner_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._fine_tuner_freq_slider.setRange(-500, 500, 1) self._fine_tuner_freq_slider.setValue(self.fine_tuner_freq) self._fine_tuner_freq_slider.setMinimumWidth(200) self._fine_tuner_freq_slider.valueChanged.connect(self.set_fine_tuner_freq) self._fine_tuner_freq_layout.addWidget(self._fine_tuner_freq_slider) self.top_grid_layout.addLayout(self._fine_tuner_freq_layout, 3,5,1,5) self._filename_label_tool_bar = Qt.QToolBar(self) if None: self._filename_label_formatter = None else: self._filename_label_formatter = lambda x: x self._filename_label_tool_bar.addWidget(Qt.QLabel("File Name"+": ")) self._filename_label_label = Qt.QLabel(str(self._filename_label_formatter(self.filename_label))) self._filename_label_tool_bar.addWidget(self._filename_label_label) self.top_grid_layout.addWidget(self._filename_label_tool_bar, 6,6,1,3) self._coarse_tuner_freq_layout = Qt.QVBoxLayout() self._coarse_tuner_freq_tool_bar = Qt.QToolBar(self) self._coarse_tuner_freq_layout.addWidget(self._coarse_tuner_freq_tool_bar) self._coarse_tuner_freq_tool_bar.addWidget(Qt.QLabel("Coarse Tuner (Hz)"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._coarse_tuner_freq_counter = qwt_counter_pyslot() self._coarse_tuner_freq_counter.setRange(-samp_rate/2, samp_rate/2, 100) self._coarse_tuner_freq_counter.setNumButtons(2) self._coarse_tuner_freq_counter.setValue(self.coarse_tuner_freq) self._coarse_tuner_freq_tool_bar.addWidget(self._coarse_tuner_freq_counter) self._coarse_tuner_freq_counter.valueChanged.connect(self.set_coarse_tuner_freq) self._coarse_tuner_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._coarse_tuner_freq_slider.setRange(-samp_rate/2, samp_rate/2, 100) self._coarse_tuner_freq_slider.setValue(self.coarse_tuner_freq) self._coarse_tuner_freq_slider.setMinimumWidth(50) self._coarse_tuner_freq_slider.valueChanged.connect(self.set_coarse_tuner_freq) self._coarse_tuner_freq_layout.addWidget(self._coarse_tuner_freq_slider) self.top_grid_layout.addLayout(self._coarse_tuner_freq_layout, 3,0,1,5) self.blocks_null_sink_1_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, RX_power_offset_dB) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_integrate_xx_0 = blocks.integrate_ff(500) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, file_name, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_float_1_0 = blocks.complex_to_float(1) self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vff(1) self._band_freq_options = [1.84E6, 3.598E6, 7.055E6, 2.5E6, 5.0E6, 10.0E6] self._band_freq_labels = ["160m", "80m", "40m", "2.5 MHz", "5 MHz", "10 MHz"] self._band_freq_tool_bar = Qt.QToolBar(self) self._band_freq_tool_bar.addWidget(Qt.QLabel("Band"+": ")) self._band_freq_combo_box = Qt.QComboBox() self._band_freq_tool_bar.addWidget(self._band_freq_combo_box) for label in self._band_freq_labels: self._band_freq_combo_box.addItem(label) self._band_freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._band_freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._band_freq_options.index(i))) self._band_freq_callback(self.band_freq) self._band_freq_combo_box.currentIndexChanged.connect( lambda i: self.set_band_freq(self._band_freq_options[i])) self.top_grid_layout.addWidget(self._band_freq_tool_bar, 4,5,1,1) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate/100, analog.GR_COS_WAVE, 600, 1, 0) self.analog_agc3_xx_0 = analog.agc3_cc(1e-1, 1e-4, volume/100, 1, 1) self.analog_agc3_xx_0.set_max_gain(2**16) ################################################## # Connections ################################################## self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.fir_filter_xxx_0_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.fir_filter_xxx_0_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_1_0, 0)) self.connect((self.fir_filter_xxx_0_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_complex_to_float_0_0, 1), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_complex_to_float_0_0, 0), (self.blocks_null_sink_1_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_null_sink_1_0, 0)) self.connect((self.blocks_complex_to_float_1_0, 1), (self.hilbert_fc_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.blocks_complex_to_float_1_0, 0), (self.hilbert_fc_0_0, 0)) self.connect((self.hilbert_fc_0_0, 0), (self.blocks_complex_to_float_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0_0, 1))
def __init__(self, fsk_dev=10000, lpf_cutoff=12.5e3, lpf_trans=1e3): gr.top_block.__init__(self, "Fsk Rx Udp") Qt.QWidget.__init__(self) self.setWindowTitle("Fsk Rx Udp") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "fsk_rx_udp") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.fsk_dev = fsk_dev self.lpf_cutoff = lpf_cutoff self.lpf_trans = lpf_trans ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.baud = baud = 9600 self.thresh = thresh = -4 self.smooth_len = smooth_len = 25 self.samps_per_symb = samps_per_symb = int(samp_rate/baud) self.offset = offset = 0 self.num_items = num_items = 1024 self.mult = mult = (samp_rate)/2/3.141593 self.decay = decay = 100e-6 self.bw_factor = bw_factor = 1000 self.attack = attack = 0.001 self.alpha = alpha = 0.5 ################################################## # Blocks ################################################## self._thresh_tool_bar = Qt.QToolBar(self) self._thresh_tool_bar.addWidget(Qt.QLabel('Threshold'+": ")) self._thresh_line_edit = Qt.QLineEdit(str(self.thresh)) self._thresh_tool_bar.addWidget(self._thresh_line_edit) self._thresh_line_edit.returnPressed.connect( lambda: self.set_thresh(eng_notation.str_to_num(str(self._thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._thresh_tool_bar, 0,4,1,2) self._offset_range = Range(-10000, 10000, 1, 0, 200) self._offset_win = RangeWidget(self._offset_range, self.set_offset, "offset", "counter_slider", float) self.top_grid_layout.addWidget(self._offset_win, 3,4,1,4) self._decay_tool_bar = Qt.QToolBar(self) self._decay_tool_bar.addWidget(Qt.QLabel("decay"+": ")) self._decay_line_edit = Qt.QLineEdit(str(self.decay)) self._decay_tool_bar.addWidget(self._decay_line_edit) self._decay_line_edit.returnPressed.connect( lambda: self.set_decay(eng_notation.str_to_num(str(self._decay_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._decay_tool_bar, 1,6,1,2) self._bw_factor_tool_bar = Qt.QToolBar(self) self._bw_factor_tool_bar.addWidget(Qt.QLabel("bw_factor"+": ")) self._bw_factor_line_edit = Qt.QLineEdit(str(self.bw_factor)) self._bw_factor_tool_bar.addWidget(self._bw_factor_line_edit) self._bw_factor_line_edit.returnPressed.connect( lambda: self.set_bw_factor(eng_notation.str_to_num(str(self._bw_factor_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bw_factor_tool_bar, 2,6,1,2) self._attack_tool_bar = Qt.QToolBar(self) self._attack_tool_bar.addWidget(Qt.QLabel("attack"+": ")) self._attack_line_edit = Qt.QLineEdit(str(self.attack)) self._attack_tool_bar.addWidget(self._attack_line_edit) self._attack_line_edit.returnPressed.connect( lambda: self.set_attack(eng_notation.str_to_num(str(self._attack_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._attack_tool_bar, 1,4,1,2) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 50, #size samp_rate, #samp_rate "trigger", #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(-1, 1) 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(False) self.qtgui_time_sink_x_2.enable_axis_labels(True) self.qtgui_time_sink_x_2.enable_control_panel(False) self.qtgui_time_sink_x_2.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_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_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, 8,0,2,4) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "Freq Error", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.010) 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(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) self.qtgui_time_sink_x_1.enable_stem_plot(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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 4,0,2,4) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.010) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "packet_len") self.qtgui_time_sink_x_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not False: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 4,4,2,4) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.010) 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, "packet_len") self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 8,4,2,4) self.qtgui_number_sink_1 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_1.set_update_time(0.10) self.qtgui_number_sink_1.set_title("Doppler") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_1.set_min(i, -1) self.qtgui_number_sink_1.set_max(i, 1) self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_1.set_label(i, labels[i]) self.qtgui_number_sink_1.set_unit(i, units[i]) self.qtgui_number_sink_1.set_factor(i, factor[i]) self.qtgui_number_sink_1.enable_autoscale(False) self._qtgui_number_sink_1_win = sip.wrapinstance(self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_1_win, 2,4,1,2) self.qtgui_number_sink_0_0_1 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_0_0_1.set_update_time(0.010) self.qtgui_number_sink_0_0_1.set_title("SNR") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_1.set_min(i, 0) self.qtgui_number_sink_0_0_1.set_max(i, 100) self.qtgui_number_sink_0_0_1.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_1.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_1.set_label(i, labels[i]) self.qtgui_number_sink_0_0_1.set_unit(i, units[i]) self.qtgui_number_sink_0_0_1.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_1.enable_autoscale(False) self._qtgui_number_sink_0_0_1_win = sip.wrapinstance(self.qtgui_number_sink_0_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_1_win, 2,5,1,1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not 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_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0,0,4,4) self.pyqt_time_plot_0 = pyqt.time_plot('') self._pyqt_time_plot_0_win = self.pyqt_time_plot_0; self.top_grid_layout.addWidget(self._pyqt_time_plot_0_win, 6,0,2,4) self.pyqt_time_plot_0.line_off() self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0; self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6,4,2,4) self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300) self.es_trigger_edge_f_0 = es.trigger_edge_f(thresh,3500,500,gr.sizeof_float,100) self.es_sink_0 = es.sink(1*[gr.sizeof_float],8,64,0,2,0) self.es_handler_pdu_0 = es.es_make_handler_pdu(es.es_handler_print.TYPE_F32) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(samps_per_symb, .5, 512, math.pi/bw_factor) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samps_per_symb*(1+0.0), 0.25*0.175*0.175, 0.25, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex*1, '0.0.0.0', 9001, 1472, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, -100, 0) self.blocks_sub_xx_1_0 = blocks.sub_ff(1) self.blocks_sub_xx_1 = blocks.sub_ff(1) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_float*1, num_items) self.blocks_skiphead_1 = blocks.skiphead(gr.sizeof_gr_complex*1, 500) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1) self.blocks_short_to_float_0 = blocks.short_to_float(1, 1) self.blocks_pdu_to_tagged_stream_2 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'packet_len') self.blocks_pdu_remove_0_0 = blocks.pdu_remove(pmt.intern("es::event_buffer")) self.blocks_pdu_remove_0 = blocks.pdu_remove(pmt.intern("es::event_buffer")) self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_short*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_nlog10_ff_0_0_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((mult, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((mult*-1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, )) self.blocks_moving_average_xx_2 = blocks.moving_average_ff(num_items, 1.0/num_items, 4000, 1) self.blocks_moving_average_xx_0_1_0_0 = blocks.moving_average_ff(500, 1.0/500, 4000, 1) self.blocks_moving_average_xx_0_1_0 = blocks.moving_average_ff(2000, 1.0/2000, 4000, 1) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(smooth_len, 1.0/smooth_len, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(smooth_len, 1.0/smooth_len, 4000, 1) self.blocks_keep_m_in_n_1 = blocks.keep_m_in_n(gr.sizeof_float, 1, num_items, 0) self.blocks_keep_m_in_n_0_1 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2000, 3500, 10) self.blocks_keep_m_in_n_0_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 500, 3500, 10) self.blocks_complex_to_mag_squared_0_0_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_argmax_xx_0 = blocks.argmax_fs(num_items) self.blocks_abs_xx_0 = blocks.abs_ff(1) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1000, 1, offset) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf((samp_rate)/(2*math.pi*fsk_dev/8.0)) self.analog_agc3_xx_0 = analog.agc3_cc(attack, decay, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.blocks_pdu_remove_0_0, 'pdus')) self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.pyqt_time_plot_0, 'pdus')) self.msg_connect((self.blocks_pdu_remove_0_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_2, 'pdus')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.connect((self.analog_agc3_xx_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_argmax_xx_0, 0), (self.blocks_null_sink_1, 0)) self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_short_to_float_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_moving_average_xx_0_1_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0_0, 0), (self.blocks_moving_average_xx_0_1_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0_0, 0), (self.blocks_complex_to_mag_squared_0_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0_1, 0), (self.blocks_complex_to_mag_squared_0_0, 0)) self.connect((self.blocks_keep_m_in_n_1, 0), (self.blocks_sub_xx_1, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.qtgui_number_sink_1, 0)) self.connect((self.blocks_moving_average_xx_0_1_0, 0), (self.blocks_nlog10_ff_0_0, 0)) self.connect((self.blocks_moving_average_xx_0_1_0_0, 0), (self.blocks_nlog10_ff_0_0_0, 0)) self.connect((self.blocks_moving_average_xx_2, 0), (self.blocks_keep_m_in_n_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_2, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_moving_average_xx_2, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_sub_xx_1_0, 1)) self.connect((self.blocks_nlog10_ff_0_0_0, 0), (self.blocks_sub_xx_1_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_2, 0), (self.blocks_keep_m_in_n_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_2, 0), (self.blocks_skiphead_1, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.blocks_sub_xx_1, 1)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_skiphead_1, 0), (self.blocks_keep_m_in_n_0_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_argmax_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0)) self.connect((self.blocks_sub_xx_1, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_sub_xx_1_0, 0), (self.qtgui_number_sink_0_0_1, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 3), (self.blocks_multiply_const_vxx_2, 0)) self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0))
def __init__(self, samp_rate=4E6, audio_rate=8000, record=True): gr.hier_block2.__init__(self, "TunerDemodAM", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float)) # Default values self.center_freq = 0 squelch_db = -60 self.agc_ref = 0.1 self.file_name = "/dev/null" self.record = record # Decimation values for four stages of decimation decims = (5, int(samp_rate/1E6)) # Low pass filter taps for decimation by 5 low_pass_filter_taps_0 = \ grfilter.firdes_low_pass(1, 1, 0.090, 0.010, grfilter.firdes.WIN_HAMMING) # Frequency translating FIR filter decimating by 5 self.freq_xlating_fir_filter_ccc = \ grfilter.freq_xlating_fir_filter_ccc(decims[0], low_pass_filter_taps_0, self.center_freq, samp_rate) # FIR filter decimating by 5 fir_filter_ccc_0 = grfilter.fir_filter_ccc(decims[0], low_pass_filter_taps_0) # Low pass filter taps for decimation from samp_rate/25 to 40-79.9 ksps # In other words, decimation by int(samp_rate/1E6) # 12.5 kHz cutoff for NBFM channel bandwidth low_pass_filter_taps_1 = grfilter.firdes_low_pass( 1, samp_rate/decims[0]**2, 12.5E3, 1E3, grfilter.firdes.WIN_HAMMING) # FIR filter decimation by int(samp_rate/1E6) fir_filter_ccc_1 = grfilter.fir_filter_ccc(decims[1], low_pass_filter_taps_1) # Non blocking power squelch # Squelch level needs to be lower than NBFM or else choppy AM demod self.analog_pwr_squelch_cc = analog.pwr_squelch_cc(squelch_db, 1e-1, 0, False) # AGC with reference set for nomninal 0 dB volume # Paramaters tweaked to prevent impulse during squelching self.agc3_cc = analog.agc3_cc(1.0, 1E-4, self.agc_ref, 10, 1) self.agc3_cc.set_max_gain(65536) # AM demod with complex_to_mag() # Can't use analog.am_demod_cf() since it won't work with N>2 demods am_demod_cf = blocks.complex_to_mag(1) # 3.5 kHz cutoff for audio bandwidth low_pass_filter_taps_2 = grfilter.firdes_low_pass(1,\ samp_rate/(decims[1] * decims[0]**2),\ 3.5E3, 500, grfilter.firdes.WIN_HAMMING) # FIR filter decimating by 5 from 40-79.9 ksps to 8-15.98 ksps fir_filter_fff_0 = grfilter.fir_filter_fff(decims[0], low_pass_filter_taps_2) # Polyphase resampler allows arbitary RF sample rates # Takes 8-15.98 ksps to a constant 8 ksps for audio pfb_resamp = audio_rate/float(samp_rate/(decims[1] * decims[0]**3)) pfb_arb_resampler_fff = pfb.arb_resampler_fff(pfb_resamp, taps=None, flt_size=32) # Connect the blocks for the demod self.connect(self, self.freq_xlating_fir_filter_ccc) self.connect(self.freq_xlating_fir_filter_ccc, fir_filter_ccc_0) self.connect(fir_filter_ccc_0, fir_filter_ccc_1) self.connect(fir_filter_ccc_1, self.analog_pwr_squelch_cc) self.connect(self.analog_pwr_squelch_cc, self.agc3_cc) self.connect(self.agc3_cc, am_demod_cf) self.connect(am_demod_cf, fir_filter_fff_0) self.connect(fir_filter_fff_0, pfb_arb_resampler_fff) self.connect(pfb_arb_resampler_fff, self) # Need to set this to a very low value of -200 since it is after demod # Only want it to gate when the previuos squelch has gone to zero analog_pwr_squelch_ff = analog.pwr_squelch_ff(-200, 1e-1, 0, True) # File sink with single channel and 8 bits/sample self.blocks_wavfile_sink = blocks.wavfile_sink(self.file_name, 1, audio_rate, 8) # Connect the blocks for recording self.connect(pfb_arb_resampler_fff, analog_pwr_squelch_ff) self.connect(analog_pwr_squelch_ff, self.blocks_wavfile_sink)
def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, audio_bps=8): gr.hier_block2.__init__(self, "TunerDemodAM", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float)) # Default values self.center_freq = 0 squelch_db = -60 self.agc_ref = 0.1 self.file_name = "/dev/null" self.record = record # Decimation values for four stages of decimation decims = (5, int(samp_rate / 1E6)) # Low pass filter taps for decimation by 5 low_pass_filter_taps_0 = \ grfilter.firdes_low_pass(1, 1, 0.090, 0.010, grfilter.firdes.WIN_HAMMING) # Frequency translating FIR filter decimating by 5 self.freq_xlating_fir_filter_ccc = \ grfilter.freq_xlating_fir_filter_ccc(decims[0], low_pass_filter_taps_0, self.center_freq, samp_rate) # FIR filter decimating by 5 fir_filter_ccc_0 = grfilter.fir_filter_ccc(decims[0], low_pass_filter_taps_0) # Low pass filter taps for decimation from samp_rate/25 to 40-79.9 ksps # In other words, decimation by int(samp_rate/1E6) # 12.5 kHz cutoff for NBFM channel bandwidth low_pass_filter_taps_1 = grfilter.firdes_low_pass( 1, samp_rate / decims[0]**2, 12.5E3, 1E3, grfilter.firdes.WIN_HAMMING) # FIR filter decimation by int(samp_rate/1E6) fir_filter_ccc_1 = grfilter.fir_filter_ccc(decims[1], low_pass_filter_taps_1) # Non blocking power squelch # Squelch level needs to be lower than NBFM or else choppy AM demod self.analog_pwr_squelch_cc = analog.pwr_squelch_cc( squelch_db, 1e-1, 0, False) # AGC with reference set for nomninal 0 dB volume # Paramaters tweaked to prevent impulse during squelching self.agc3_cc = analog.agc3_cc(1.0, 1E-4, self.agc_ref, 10, 1) self.agc3_cc.set_max_gain(65536) # AM demod with complex_to_mag() # Can't use analog.am_demod_cf() since it won't work with N>2 demods am_demod_cf = blocks.complex_to_mag(1) # 3.5 kHz cutoff for audio bandwidth low_pass_filter_taps_2 = grfilter.firdes_low_pass(1,\ samp_rate/(decims[1] * decims[0]**2),\ 3.5E3, 500, grfilter.firdes.WIN_HAMMING) # FIR filter decimating by 5 from 40-79.9 ksps to 8-15.98 ksps fir_filter_fff_0 = grfilter.fir_filter_fff(decims[0], low_pass_filter_taps_2) # Polyphase resampler allows arbitary RF sample rates # Takes 8-15.98 ksps to a constant 8 ksps for audio pfb_resamp = audio_rate / float(samp_rate / (decims[1] * decims[0]**3)) pfb_arb_resampler_fff = pfb.arb_resampler_fff(pfb_resamp, taps=None, flt_size=32) # Connect the blocks for the demod self.connect(self, self.freq_xlating_fir_filter_ccc) self.connect(self.freq_xlating_fir_filter_ccc, fir_filter_ccc_0) self.connect(fir_filter_ccc_0, fir_filter_ccc_1) self.connect(fir_filter_ccc_1, self.analog_pwr_squelch_cc) self.connect(self.analog_pwr_squelch_cc, self.agc3_cc) self.connect(self.agc3_cc, am_demod_cf) self.connect(am_demod_cf, fir_filter_fff_0) self.connect(fir_filter_fff_0, pfb_arb_resampler_fff) self.connect(pfb_arb_resampler_fff, self) # Need to set this to a very low value of -200 since it is after demod # Only want it to gate when the previous squelch has gone to zero analog_pwr_squelch_ff = analog.pwr_squelch_ff(-200, 1e-1, 0, True) # File sink with single channel and 8 bits/sample self.blocks_wavfile_sink = blocks.wavfile_sink(self.file_name, 1, audio_rate, audio_bps) # Connect the blocks for recording self.connect(pfb_arb_resampler_fff, analog_pwr_squelch_ff) self.connect(analog_pwr_squelch_ff, self.blocks_wavfile_sink)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="AM Radio") ################################################## # Variables ################################################## self.am_center_freq = am_center_freq = 1536e3 self.samp_rate = samp_rate = 20e6 self.audio_gain = audio_gain = 3 self.am_min_freq = am_min_freq = 540e3 self.am_max_freq = am_max_freq = 1600e3 self.am_channel_width = am_channel_width = 10e3 self.am_channel_freq = am_channel_freq = am_center_freq ################################################## # Blocks ################################################## self.notebook_main = self.notebook_main = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook_main.AddPage(grc_wxgui.Panel(self.notebook_main), "Controls") self.Add(self.notebook_main) self.notebook_radio = self.notebook_radio = wx.Notebook( self.notebook_main.GetPage(0).GetWin(), style=wx.NB_TOP) self.notebook_radio.AddPage(grc_wxgui.Panel(self.notebook_radio), "Spectrum Analysis") self.notebook_main.GetPage(0).Add(self.notebook_radio) _audio_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._audio_gain_text_box = forms.text_box( parent=self.notebook_main.GetPage(0).GetWin(), sizer=_audio_gain_sizer, value=self.audio_gain, callback=self.set_audio_gain, label='Volume', converter=forms.int_converter(), proportion=0, ) self._audio_gain_slider = forms.slider( parent=self.notebook_main.GetPage(0).GetWin(), sizer=_audio_gain_sizer, value=self.audio_gain, callback=self.set_audio_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.notebook_main.GetPage(0).GridAdd(_audio_gain_sizer, 0, 2, 1, 13) _am_channel_freq_sizer = wx.BoxSizer(wx.VERTICAL) self._am_channel_freq_text_box = forms.text_box( parent=self.notebook_radio.GetPage(0).GetWin(), sizer=_am_channel_freq_sizer, value=self.am_channel_freq, callback=self.set_am_channel_freq, label='Station', converter=forms.float_converter(), proportion=0, ) self._am_channel_freq_slider = forms.slider( parent=self.notebook_radio.GetPage(0).GetWin(), sizer=_am_channel_freq_sizer, value=self.am_channel_freq, callback=self.set_am_channel_freq, minimum=am_min_freq, maximum=am_max_freq, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.notebook_radio.GetPage(0).GridAdd(_am_channel_freq_sizer, 0, 1, 1, 39) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.notebook_radio.GetPage(0).GetWin(), baseband_freq=am_channel_freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=True, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.notebook_radio.GetPage(0).Add(self.wxgui_fftsink2_0.win) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=12, decimation=16, taps=None, fractional_bw=None, ) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(am_channel_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.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (10, ), am_center_freq, samp_rate) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff( (audio_gain, )) self.audio_sink_0 = audio.sink(48000, '', True) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=48e3, audio_decim=10, audio_pass=5000, audio_stop=5500, ) self.analog_agc3_xx_0 = analog.agc3_cc(1e-1, 1e-2, .7, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) self.am_low_pass_filter = filter.fir_filter_ccf( int(samp_rate / am_channel_width), firdes.low_pass(1, samp_rate, 10e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.am_fosphor_wx_sink_c = fosphor.wx_sink_c( self.notebook_main.GetPage(0).GetWin()) self.am_fosphor_wx_sink_c.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.am_fosphor_wx_sink_c.set_frequency_range(am_channel_freq, samp_rate) self.notebook_main.GetPage(0).Add(self.am_fosphor_wx_sink_c.win) ################################################## # Connections ################################################## self.connect((self.am_low_pass_filter, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.audio_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.am_low_pass_filter, 0)) self.connect((self.osmosdr_source_0, 0), (self.am_fosphor_wx_sink_c, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_agc3_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "RX logic") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 192000 self.mode = mode = 2 self.bw = bw = 3200 self.aud_rate = aud_rate = 22050 self.visualsq = visualsq = 1 self.st = st = 1 self.sq = sq = -700 self.sb_pos = sb_pos = ((bw*mode==2)-(bw*mode==3)) self.rec = rec = 1 self.laj_0 = laj_0 = 0 self.laj = laj = 0 self.lai_0 = lai_0 = 0 self.lai = lai = 0 self.freq = freq = 98500000 self.device = device = "fcd=0,type=2" self.dev = dev = 19000 self.decimation = decimation = samp_rate/aud_rate self.batswitch = batswitch = 0 self.batido = batido = 2950 self.VEC = VEC = 1280 ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="nchan=" + str(1) + " " + device ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(7, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(0, 0) self.rtlsdr_source_0.set_gain(14, 0) self.rtlsdr_source_0.set_if_gain(14, 0) self.rtlsdr_source_0.set_bb_gain(14, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.probe_st = analog.probe_avg_mag_sqrd_f(10, 1) self.low_pass_filter_0_2 = filter.fir_filter_ccf(decimation, firdes.low_pass( 1, samp_rate, bw*(2+(mode==2)+(mode==3)), 500, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_1_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.low_pass( 30, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass( visualsq, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass( 1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.fractional_resampler_xx_0_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0) self.fractional_resampler_xx_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0) self.fractional_resampler_xx_0 = filter.fractional_resampler_ff(0, (samp_rate/decimation)/48000.0) self.fft_vxx_0 = fft.fft_vcc(VEC, True, (window.blackmanharris(1024)), True, 1) self.fft_probe = blocks.probe_signal_vf(VEC) self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/tmp/CAPTURE.WAV", 2, 48000, 16) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, VEC) self.blocks_multiply_xx_0_1_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_complex_to_real_0_0_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(VEC) self.blocks_add_xx_0 = blocks.add_vff(1) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-complex(lai,laj), )) self.blks2_valve_0_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec)) self.blks2_valve_0_0_1 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=5)) self.blks2_valve_0_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(0)) self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=4)) self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec)) self.blks2_selector_0_1_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=2, num_outputs=1, input_index=(mode==3), output_index=0, ) self.blks2_selector_0_0_1_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=3, num_outputs=1, input_index=(mode>3)+(mode>4), output_index=0, ) self.blks2_selector_0_0_1 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=3, num_outputs=1, input_index=(mode>3)+(mode>4), output_index=0, ) self.blks2_selector_0_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=4, num_outputs=1, input_index=mode, output_index=0, ) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=1, num_outputs=4, input_index=0, output_index=mode, ) self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass( 250, samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass( 120, samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(48000, "dmix:CARD=Pro,DEV=0", False) self.analog_wfm_rcv_1 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=1, ) self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate/decimation, analog.GR_COS_WAVE, -bw, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, dev+(bw*mode==2)+(bw*mode==3), 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.25) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=samp_rate, audio_decim=samp_rate/48000, deviation=50000, audio_pass=15000, audio_stop=16000, gain=3.0, tau=50e-6, ) self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=50e-6) self.analog_fm_deemph_0 = analog.fm_deemph(fs=48000, tau=50e-6) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(64, 0.9) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=samp_rate/decimation, audio_decim=samp_rate/decimation/aud_rate, audio_pass=(samp_rate/decimation/2)-500, audio_stop=(samp_rate/decimation/2)-100, ) self.analog_agc3_xx_0 = analog.agc3_cc(0.0001, 0.0001, 0.9, 0.1) self.analog_agc3_xx_0.set_max_gain(200) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.fft_probe, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blks2_valve_0_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_1_0, 0)) self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_deemph_0, 0)) self.connect((self.analog_fm_deemph_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.low_pass_filter_0_1, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.low_pass_filter_0_1_0_0_0, 0), (self.analog_fm_deemph_0_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.analog_wfm_rcv_1, 0)) self.connect((self.blks2_valve_0_0_1, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_1, 0)) self.connect((self.blocks_multiply_xx_0_1_0, 0), (self.low_pass_filter_0_1_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 1)) self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 2)) self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.analog_fm_deemph_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.fractional_resampler_xx_0_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fractional_resampler_xx_0_0, 0)) self.connect((self.blks2_valve_0_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_2, 0)) self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 3)) self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 2)) self.connect((self.blks2_selector_0_1_0, 0), (self.blocks_multiply_xx_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_complex_to_real_0_0_0_0, 0)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1)) self.connect((self.analog_am_demod_cf_0, 0), (self.blks2_selector_0_0, 0)) self.connect((self.blks2_selector_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blks2_selector_0_0, 1)) self.connect((self.blks2_selector_0, 1), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.blks2_selector_0_0, 0), (self.low_pass_filter_0_0_0_0, 0)) self.connect((self.blks2_selector_0, 2), (self.high_pass_filter_0, 0)) self.connect((self.blks2_selector_0, 3), (self.low_pass_filter_0_0_0, 0)) self.connect((self.high_pass_filter_0, 0), (self.blks2_selector_0_1_0, 0)) self.connect((self.low_pass_filter_0_0_0, 0), (self.blks2_selector_0_1_0, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1_0, 1)) self.connect((self.fractional_resampler_xx_0_0_0, 0), (self.blks2_selector_0_0_1_0, 2)) self.connect((self.fractional_resampler_xx_0_0, 0), (self.blks2_selector_0_0_1, 2)) self.connect((self.blks2_selector_0_0_1_0, 0), (self.audio_sink_0, 1)) self.connect((self.blks2_selector_0_0_1, 0), (self.audio_sink_0, 0)) self.connect((self.blks2_valve_0, 0), (self.blocks_wavfile_sink_0, 1)) self.connect((self.blks2_selector_0_0_1_0, 0), (self.blks2_valve_0, 0)) self.connect((self.blks2_selector_0_0_1, 0), (self.blks2_valve_0_1, 0)) self.connect((self.blks2_valve_0_1, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1, 0)) self.connect((self.low_pass_filter_0_2, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.low_pass_filter_0_0_0_0, 0), (self.fractional_resampler_xx_0, 0)) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.blks2_selector_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.probe_st, 0))
def __init__(self): gr.top_block.__init__(self, "SQ5BPF Tetra live receiver 6ch UDP HEADLESS") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.first_decim = first_decim = 32 self.xlate_offset_fine6 = xlate_offset_fine6 = 0 self.xlate_offset_fine5 = xlate_offset_fine5 = 0 self.xlate_offset_fine4 = xlate_offset_fine4 = 0 self.xlate_offset_fine3 = xlate_offset_fine3 = 0 self.xlate_offset_fine2 = xlate_offset_fine2 = 0 self.xlate_offset_fine1 = xlate_offset_fine1 = 0 self.xlate_offset6 = xlate_offset6 = 500e3 self.xlate_offset5 = xlate_offset5 = 500e3 self.xlate_offset4 = xlate_offset4 = 500e3 self.xlate_offset3 = xlate_offset3 = 500e3 self.xlate_offset2 = xlate_offset2 = 500e3 self.xlate_offset1 = xlate_offset1 = 500e3 self.udp_packet_size = udp_packet_size = 1472 self.udp_dest_addr = udp_dest_addr = "127.0.0.1" self.telive_receiver_name = telive_receiver_name = 'SQ5BPF 6-channel headless rx for telive' self.telive_receiver_channels = telive_receiver_channels = 6 self.sdr_ifgain = sdr_ifgain = 20 self.sdr_gain = sdr_gain = 38 self.ppm_corr = ppm_corr = 56 self.out_sample_rate = out_sample_rate = 36000 self.options_low_pass = options_low_pass = 12500 self.if_samp_rate = if_samp_rate = samp_rate / first_decim self.freq = freq = 435e6 self.first_port = first_port = 42000 ################################################## # Blocks ################################################## self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer( ("0.0.0.0", first_port), allow_none=True) self.xmlrpc_server_0.register_instance(self) threading.Thread(target=self.xmlrpc_server_0.serve_forever).start() self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "") self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(ppm_corr, 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(sdr_gain, 0) self.osmosdr_source_0.set_if_gain(sdr_ifgain, 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.freq_xlating_fir_filter_xxx_0_0_0_0_0_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset6 + xlate_offset_fine6, samp_rate) self.freq_xlating_fir_filter_xxx_0_0_0_0_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset5 + xlate_offset_fine5, samp_rate) self.freq_xlating_fir_filter_xxx_0_0_0_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset4 + xlate_offset_fine4, samp_rate) self.freq_xlating_fir_filter_xxx_0_0_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset3 + xlate_offset_fine3, samp_rate) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset2 + xlate_offset_fine2, samp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( first_decim, (firdes.low_pass(1, samp_rate, options_low_pass, options_low_pass * 0.2)), xlate_offset1 + xlate_offset_fine1, samp_rate) self.fractional_resampler_xx_0_4 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.fractional_resampler_xx_0_3 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.fractional_resampler_xx_0_2 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.fractional_resampler_xx_0_1 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.fractional_resampler_xx_0_0 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.fractional_resampler_xx_0 = filter.fractional_resampler_cc( 0, float(float(if_samp_rate) / float(out_sample_rate))) self.blocks_udp_sink_0_4 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 5, udp_packet_size, False) self.blocks_udp_sink_0_3 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 6, udp_packet_size, False) self.blocks_udp_sink_0_2 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 4, udp_packet_size, False) self.blocks_udp_sink_0_1 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 3, udp_packet_size, False) self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 2, udp_packet_size, False) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1, udp_dest_addr, first_port + 1, udp_packet_size, False) self.analog_agc3_xx_0_0_0_0_0_0 = analog.agc3_cc( 1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0_0_0_0_0_0.set_max_gain(65536) self.analog_agc3_xx_0_0_0_0_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0_0_0_0_0.set_max_gain(65536) self.analog_agc3_xx_0_0_0_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0_0_0_0.set_max_gain(65536) self.analog_agc3_xx_0_0_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0_0_0.set_max_gain(65536) self.analog_agc3_xx_0_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0_0.set_max_gain(65536) self.analog_agc3_xx_0 = analog.agc3_cc(1e-3, 1e-4, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.fractional_resampler_xx_0_0, 0), (self.blocks_udp_sink_0_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.fractional_resampler_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_agc3_xx_0_0, 0)) self.connect((self.analog_agc3_xx_0_0, 0), (self.fractional_resampler_xx_0_0, 0)) self.connect((self.analog_agc3_xx_0_0_0, 0), (self.fractional_resampler_xx_0_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0, 0), (self.analog_agc3_xx_0_0_0, 0)) self.connect((self.fractional_resampler_xx_0_1, 0), (self.blocks_udp_sink_0_1, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0, 0)) self.connect((self.analog_agc3_xx_0_0_0_0, 0), (self.fractional_resampler_xx_0_2, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0_0, 0), (self.analog_agc3_xx_0_0_0_0, 0)) self.connect((self.fractional_resampler_xx_0_2, 0), (self.blocks_udp_sink_0_2, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0_0, 0)) self.connect((self.analog_agc3_xx_0_0_0_0_0, 0), (self.fractional_resampler_xx_0_3, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0_0_0, 0), (self.analog_agc3_xx_0_0_0_0_0, 0)) self.connect((self.fractional_resampler_xx_0_3, 0), (self.blocks_udp_sink_0_4, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0_0_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0_0_0_0, 0)) self.connect((self.fractional_resampler_xx_0_4, 0), (self.blocks_udp_sink_0_3, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0_0_0_0, 0), (self.analog_agc3_xx_0_0_0_0_0_0, 0)) self.connect((self.analog_agc3_xx_0_0_0_0_0_0, 0), (self.fractional_resampler_xx_0_4, 0))
def __init__(self): gr.top_block.__init__(self, "NOAA APT Satellite Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("NOAA APT Satellite Receiver") 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", "apt_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) self._lock = threading.RLock() ################################################## # Variables ################################################## self.satellite_select = satellite_select = 137.62 self.valid_gains = valid_gains = [0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6] self.satellite_frequency = satellite_frequency = satellite_select * 1e6 self.rf_samp_rate = rf_samp_rate = 2.048e6 self.max_doppler = max_doppler = 3000 self.fsk_deviation_hz = fsk_deviation_hz = 17000 self.am_carrier = am_carrier = 2400 self.tuner_frequency = tuner_frequency = satellite_frequency - (rf_samp_rate / 4) self.rf_gain = rf_gain = valid_gains[-1] self.rail_level = rail_level = 0.5 self.processing_rate = processing_rate = 256000 self.fm_bandwidth = fm_bandwidth = (2 * (fsk_deviation_hz + am_carrier)) + max_doppler self.baud_rate = baud_rate = 4160 ################################################## # Blocks ################################################## self.tabs_top = Qt.QTabWidget() self.tabs_top_widget_0 = Qt.QWidget() self.tabs_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_0) self.tabs_top_grid_layout_0 = Qt.QGridLayout() self.tabs_top_layout_0.addLayout(self.tabs_top_grid_layout_0) self.tabs_top.addTab(self.tabs_top_widget_0, "RF Recieve") self.tabs_top_widget_1 = Qt.QWidget() self.tabs_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_1) self.tabs_top_grid_layout_1 = Qt.QGridLayout() self.tabs_top_layout_1.addLayout(self.tabs_top_grid_layout_1) self.tabs_top.addTab(self.tabs_top_widget_1, "APT Signal") self.tabs_top_widget_2 = Qt.QWidget() self.tabs_top_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_2) self.tabs_top_grid_layout_2 = Qt.QGridLayout() self.tabs_top_layout_2.addLayout(self.tabs_top_grid_layout_2) self.tabs_top.addTab(self.tabs_top_widget_2, "APT Baseband") self.top_grid_layout.addWidget(self.tabs_top, 2, 0, 1, 4) self.tabs_rf = Qt.QTabWidget() self.tabs_rf_widget_0 = Qt.QWidget() self.tabs_rf_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_0) self.tabs_rf_grid_layout_0 = Qt.QGridLayout() self.tabs_rf_layout_0.addLayout(self.tabs_rf_grid_layout_0) self.tabs_rf.addTab(self.tabs_rf_widget_0, "Spectrum") self.tabs_rf_widget_1 = Qt.QWidget() self.tabs_rf_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_1) self.tabs_rf_grid_layout_1 = Qt.QGridLayout() self.tabs_rf_layout_1.addLayout(self.tabs_rf_grid_layout_1) self.tabs_rf.addTab(self.tabs_rf_widget_1, "Waterfall") self.tabs_rf_widget_2 = Qt.QWidget() self.tabs_rf_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_2) self.tabs_rf_grid_layout_2 = Qt.QGridLayout() self.tabs_rf_layout_2.addLayout(self.tabs_rf_grid_layout_2) self.tabs_rf.addTab(self.tabs_rf_widget_2, "Scope") self.tabs_top_layout_0.addWidget(self.tabs_rf) self.tabs_apt_data = Qt.QTabWidget() self.tabs_apt_data_widget_0 = Qt.QWidget() self.tabs_apt_data_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_0) self.tabs_apt_data_grid_layout_0 = Qt.QGridLayout() self.tabs_apt_data_layout_0.addLayout(self.tabs_apt_data_grid_layout_0) self.tabs_apt_data.addTab(self.tabs_apt_data_widget_0, "Scope") self.tabs_apt_data_widget_1 = Qt.QWidget() self.tabs_apt_data_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_1) self.tabs_apt_data_grid_layout_1 = Qt.QGridLayout() self.tabs_apt_data_layout_1.addLayout(self.tabs_apt_data_grid_layout_1) self.tabs_apt_data.addTab(self.tabs_apt_data_widget_1, "Raster") self.tabs_top_layout_1.addWidget(self.tabs_apt_data) self._satellite_select_options = [137.62, 137.9125, 137.1] self._satellite_select_labels = ['NOAA 15 (137.62 MHz)', 'NOAA 18 (137.9125 MHz)', 'NOAA 19 (137.1 MHz)'] self._satellite_select_tool_bar = Qt.QToolBar(self) self._satellite_select_tool_bar.addWidget(Qt.QLabel("Satellite Select"+": ")) self._satellite_select_combo_box = Qt.QComboBox() self._satellite_select_tool_bar.addWidget(self._satellite_select_combo_box) for label in self._satellite_select_labels: self._satellite_select_combo_box.addItem(label) self._satellite_select_callback = lambda i: Qt.QMetaObject.invokeMethod(self._satellite_select_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._satellite_select_options.index(i))) self._satellite_select_callback(self.satellite_select) self._satellite_select_combo_box.currentIndexChanged.connect( lambda i: self.set_satellite_select(self._satellite_select_options[i])) self.top_grid_layout.addWidget(self._satellite_select_tool_bar, 0, 0, 1, 1) self._rf_gain_options = valid_gains self._rf_gain_labels = map(str, self._rf_gain_options) self._rf_gain_tool_bar = Qt.QToolBar(self) self._rf_gain_tool_bar.addWidget(Qt.QLabel("RF Gain"+": ")) self._rf_gain_combo_box = Qt.QComboBox() self._rf_gain_tool_bar.addWidget(self._rf_gain_combo_box) for label in self._rf_gain_labels: self._rf_gain_combo_box.addItem(label) self._rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod(self._rf_gain_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rf_gain_options.index(i))) self._rf_gain_callback(self.rf_gain) self._rf_gain_combo_box.currentIndexChanged.connect( lambda i: self.set_rf_gain(self._rf_gain_options[i])) self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 1 , 1, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype satellite_frequency, #fc processing_rate // 2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.50) self.qtgui_waterfall_sink_x_0.enable_grid(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 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-40, 0) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( baud_rate / 2, #size baud_rate, #samp_rate 'APT Full Line', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0.01, 0, 'SyncA') self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tabs_apt_data_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size processing_rate // 2, #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_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_2.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( baud_rate, 120*3, baud_rate // 2, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 1.5) self.qtgui_time_raster_sink_x_0.enable_grid(False) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [1, 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_time_raster_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_apt_data_layout_1.addWidget(self._qtgui_time_raster_sink_x_0_win) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 16.64e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.10) self.qtgui_freq_sink_x_1_0.set_y_axis(-40, 0) self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(False) self.qtgui_freq_sink_x_1_0.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.tabs_top_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_win) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype satellite_frequency, #fc processing_rate // 2, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-100, 0) self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""] 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(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_0.addWidget(self._qtgui_freq_sink_x_1_win) self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, processing_rate // 2, fm_bandwidth + 1e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass( 1, processing_rate, 60e3, 15e3, firdes.WIN_HAMMING, 6.76)) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, processing_rate,True) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/Users/bjmclaug/Downloads/noaa-12_256k.dat", False) self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_float*1, "/Users/bjmclaug/source/stem_station/noaa12_sample.dat", baud_rate, 1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True) self.blocks_file_meta_sink_0.set_unbuffered(False) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.apt_am_demod_0 = apt_am_demod( parameter_apt_gain=1, parameter_samp_rate=processing_rate / 2, ) self.analog_rail_ff_0_0 = analog.rail_ff(-rail_level, rail_level) self.analog_rail_ff_0 = analog.rail_ff(-rail_level, rail_level) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf((processing_rate // 2)/(2*math.pi*fsk_deviation_hz/8.0)) self.analog_agc3_xx_0 = analog.agc3_cc(0.25, 0.5, 0.9, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(1) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.apt_am_demod_0, 0)) self.connect((self.analog_rail_ff_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_rail_ff_0_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.apt_am_demod_0, 0), (self.blocks_file_meta_sink_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.analog_rail_ff_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.analog_rail_ff_0_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ham2Mon AM Receiver Flow Example") Qt.QWidget.__init__(self) self.setWindowTitle("Ham2Mon AM Receiver Flow Example") 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", "am_flow_example") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1E6 self.initial_decim = initial_decim = 5 self.samp_ratio = samp_ratio = samp_rate / 1E6 self.final_rate = final_rate = samp_rate / initial_decim**2 / int( samp_rate / 1E6) self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass( 1.0, final_rate, 3500, 500, firdes.WIN_HAMMING, 6.76) self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass( 1.0, samp_rate / 25, 12.5E3, 1E3, firdes.WIN_HAMMING, 6.76) self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass( 1.0, 1, 0.090, 0.010, firdes.WIN_HAMMING, 6.76) self.squelch_dB = squelch_dB = -70 self.gain_db = gain_db = 30 self.final_decim = final_decim = int(samp_rate / 1E6) self.file_name = file_name = "test.wav" self.fft_length = fft_length = 256 * int( pow(2, np.ceil(np.log(samp_ratio) / np.log(2)))) self.demod_bb_freq = demod_bb_freq = 390E3 self.center_freq = center_freq = 144E6 ################################################## # Blocks ################################################## self._squelch_dB_range = Range(-100, 0, 5, -70, 200) self._squelch_dB_win = RangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float) self.top_grid_layout.addWidget(self._squelch_dB_win, 5, 1, 1, 3) self._gain_db_range = Range(0, 70, 1, 30, 200) self._gain_db_win = RangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float) self.top_grid_layout.addWidget(self._gain_db_win, 4, 1, 1, 3) self._demod_bb_freq_range = Range(-samp_rate / 2, samp_rate / 2, 5E3, 390E3, 200) self._demod_bb_freq_win = RangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float) self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3, 1, 1, 3) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( fft_length, #size samp_rate, #samp_rate "Averaged Spectrum", #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(-60, 40) self.qtgui_time_sink_x_0.set_y_label("Power", "") 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_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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0, 1, 3, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc final_rate, #bw "Decimated Channel", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-200, -60) self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0_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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3, 0, 3, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( fft_length, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 144E6, #fc samp_rate, #bw "Spectrum", #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, -20) 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_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 3, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 16E3 / float(final_rate / 5), taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "uhd") 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(gain_db, 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(samp_rate * 0.8, 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( initial_decim, (variable_low_pass_filter_taps_0), demod_bb_freq, samp_rate) self.fir_filter_xxx_0_1 = filter.fir_filter_fff( initial_decim, (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0_1.declare_sample_delay(0) self.fir_filter_xxx_0_0 = filter.fir_filter_ccc( int(samp_rate / 1E6), (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0_0.declare_sample_delay(0) self.fir_filter_xxx_0 = filter.fir_filter_ccc( initial_decim, (variable_low_pass_filter_taps_0)) self.fir_filter_xxx_0.declare_sample_delay(0) self.fft_vxx_0 = fft.fft_vcc(fft_length, True, (window.blackmanharris(fft_length)), True, 1) self.blocks_wavfile_sink_0 = blocks.wavfile_sink( file_name, 1, 16000, 8) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_float * 1, fft_length) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fft_length) self.blocks_probe_signal_vx_0 = blocks.probe_signal_vf(fft_length) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, fft_length, 0) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * fft_length, int(round(samp_rate / fft_length / 1000))) self.blocks_integrate_xx_0 = blocks.integrate_ff(100, fft_length) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fft_length) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(16000, "", True) self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff( -200, 0.1, 0, True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( squelch_dB, 0.1, 0, False) self.analog_agc3_xx_0 = analog.agc3_cc(1e-0, 1e-4, 0.1, 10, 1) self.analog_agc3_xx_0.set_max_gain(10000) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.fir_filter_xxx_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "NOAA APT Satellite Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("NOAA APT Satellite Receiver") 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", "apt_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) self._lock = threading.RLock() ################################################## # Variables ################################################## self.satellite_select = satellite_select = 137.62 self.valid_gains = valid_gains = [ 0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6 ] self.satellite_frequency = satellite_frequency = satellite_select * 1e6 self.rf_samp_rate = rf_samp_rate = 2.048e6 self.max_doppler = max_doppler = 3000 self.fsk_deviation_hz = fsk_deviation_hz = 17000 self.am_carrier = am_carrier = 2400 self.tuner_frequency = tuner_frequency = satellite_frequency - ( rf_samp_rate / 4) self.rf_gain = rf_gain = valid_gains[-1] self.rail_level = rail_level = 0.5 self.processing_rate = processing_rate = 256000 self.fm_bandwidth = fm_bandwidth = ( 2 * (fsk_deviation_hz + am_carrier)) + max_doppler self.baud_rate = baud_rate = 4160 ################################################## # Blocks ################################################## self.tabs_top = Qt.QTabWidget() self.tabs_top_widget_0 = Qt.QWidget() self.tabs_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_0) self.tabs_top_grid_layout_0 = Qt.QGridLayout() self.tabs_top_layout_0.addLayout(self.tabs_top_grid_layout_0) self.tabs_top.addTab(self.tabs_top_widget_0, "RF Recieve") self.tabs_top_widget_1 = Qt.QWidget() self.tabs_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_1) self.tabs_top_grid_layout_1 = Qt.QGridLayout() self.tabs_top_layout_1.addLayout(self.tabs_top_grid_layout_1) self.tabs_top.addTab(self.tabs_top_widget_1, "APT Signal") self.tabs_top_widget_2 = Qt.QWidget() self.tabs_top_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_2) self.tabs_top_grid_layout_2 = Qt.QGridLayout() self.tabs_top_layout_2.addLayout(self.tabs_top_grid_layout_2) self.tabs_top.addTab(self.tabs_top_widget_2, "APT Baseband") self.top_grid_layout.addWidget(self.tabs_top, 2, 0, 1, 4) self.tabs_rf = Qt.QTabWidget() self.tabs_rf_widget_0 = Qt.QWidget() self.tabs_rf_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_0) self.tabs_rf_grid_layout_0 = Qt.QGridLayout() self.tabs_rf_layout_0.addLayout(self.tabs_rf_grid_layout_0) self.tabs_rf.addTab(self.tabs_rf_widget_0, "Spectrum") self.tabs_rf_widget_1 = Qt.QWidget() self.tabs_rf_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_1) self.tabs_rf_grid_layout_1 = Qt.QGridLayout() self.tabs_rf_layout_1.addLayout(self.tabs_rf_grid_layout_1) self.tabs_rf.addTab(self.tabs_rf_widget_1, "Waterfall") self.tabs_rf_widget_2 = Qt.QWidget() self.tabs_rf_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_2) self.tabs_rf_grid_layout_2 = Qt.QGridLayout() self.tabs_rf_layout_2.addLayout(self.tabs_rf_grid_layout_2) self.tabs_rf.addTab(self.tabs_rf_widget_2, "Scope") self.tabs_top_layout_0.addWidget(self.tabs_rf) self.tabs_apt_data = Qt.QTabWidget() self.tabs_apt_data_widget_0 = Qt.QWidget() self.tabs_apt_data_layout_0 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_0) self.tabs_apt_data_grid_layout_0 = Qt.QGridLayout() self.tabs_apt_data_layout_0.addLayout(self.tabs_apt_data_grid_layout_0) self.tabs_apt_data.addTab(self.tabs_apt_data_widget_0, "Scope") self.tabs_apt_data_widget_1 = Qt.QWidget() self.tabs_apt_data_layout_1 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_1) self.tabs_apt_data_grid_layout_1 = Qt.QGridLayout() self.tabs_apt_data_layout_1.addLayout(self.tabs_apt_data_grid_layout_1) self.tabs_apt_data.addTab(self.tabs_apt_data_widget_1, "Raster") self.tabs_top_layout_1.addWidget(self.tabs_apt_data) self._satellite_select_options = [137.62, 137.9125, 137.1] self._satellite_select_labels = [ 'NOAA 15 (137.62 MHz)', 'NOAA 18 (137.9125 MHz)', 'NOAA 19 (137.1 MHz)' ] self._satellite_select_tool_bar = Qt.QToolBar(self) self._satellite_select_tool_bar.addWidget( Qt.QLabel("Satellite Select" + ": ")) self._satellite_select_combo_box = Qt.QComboBox() self._satellite_select_tool_bar.addWidget( self._satellite_select_combo_box) for label in self._satellite_select_labels: self._satellite_select_combo_box.addItem(label) self._satellite_select_callback = lambda i: Qt.QMetaObject.invokeMethod( self._satellite_select_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._satellite_select_options.index(i))) self._satellite_select_callback(self.satellite_select) self._satellite_select_combo_box.currentIndexChanged.connect( lambda i: self.set_satellite_select(self._satellite_select_options[ i])) self.top_grid_layout.addWidget(self._satellite_select_tool_bar, 0, 0, 1, 1) self._rf_gain_options = valid_gains self._rf_gain_labels = map(str, self._rf_gain_options) self._rf_gain_tool_bar = Qt.QToolBar(self) self._rf_gain_tool_bar.addWidget(Qt.QLabel("RF Gain" + ": ")) self._rf_gain_combo_box = Qt.QComboBox() self._rf_gain_tool_bar.addWidget(self._rf_gain_combo_box) for label in self._rf_gain_labels: self._rf_gain_combo_box.addItem(label) self._rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod( self._rf_gain_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rf_gain_options.index(i))) self._rf_gain_callback(self.rf_gain) self._rf_gain_combo_box.currentIndexChanged.connect( lambda i: self.set_rf_gain(self._rf_gain_options[i])) self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 1, 1, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype satellite_frequency, #fc processing_rate // 2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.50) self.qtgui_waterfall_sink_x_0.enable_grid(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 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-40, 0) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( baud_rate / 2, #size baud_rate, #samp_rate 'APT Full Line', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0.01, 0, 'SyncA') self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tabs_apt_data_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size processing_rate // 2, #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_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_2.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( baud_rate, 120 * 3, baud_rate // 2, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 1.5) self.qtgui_time_raster_sink_x_0.enable_grid(False) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [1, 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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.tabs_apt_data_layout_1.addWidget( self._qtgui_time_raster_sink_x_0_win) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 16.64e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.10) self.qtgui_freq_sink_x_1_0.set_y_axis(-40, 0) self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(False) self.qtgui_freq_sink_x_1_0.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.tabs_top_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_win) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype satellite_frequency, #fc processing_rate // 2, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-100, 0) self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""] 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(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.tabs_rf_layout_0.addWidget(self._qtgui_freq_sink_x_1_win) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, processing_rate // 2, fm_bandwidth + 1e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 2, firdes.low_pass(1, processing_rate, 60e3, 15e3, firdes.WIN_HAMMING, 6.76)) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, processing_rate, True) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/Users/bjmclaug/Downloads/noaa-12_256k.dat", False) self.blocks_file_meta_sink_0 = blocks.file_meta_sink( gr.sizeof_float * 1, "/Users/bjmclaug/source/stem_station/noaa12_sample.dat", baud_rate, 1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True) self.blocks_file_meta_sink_0.set_unbuffered(False) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.apt_am_demod_0 = apt_am_demod( parameter_apt_gain=1, parameter_samp_rate=processing_rate / 2, ) self.analog_rail_ff_0_0 = analog.rail_ff(-rail_level, rail_level) self.analog_rail_ff_0 = analog.rail_ff(-rail_level, rail_level) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (processing_rate // 2) / (2 * math.pi * fsk_deviation_hz / 8.0)) self.analog_agc3_xx_0 = analog.agc3_cc(0.25, 0.5, 0.9, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(1) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.apt_am_demod_0, 0)) self.connect((self.analog_rail_ff_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_rail_ff_0_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.apt_am_demod_0, 0), (self.blocks_file_meta_sink_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.analog_rail_ff_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.analog_rail_ff_0_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0))