def __init(self, OSR=4, fc=939.4e6, samp_rate=0.4e6): ################################################## # Parameters ################################################## self.OSR = OSR self.fc = fc self.samp_rate = samp_rate self.channels_num = int(samp_rate/0.2e6) self.OSR_PFB = 2 ################################################## # Blocks ################################################## self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( self.channels_num, (), self.OSR_PFB, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.create_receivers() ################################################## # Connections ################################################## self.connect((self, 0), (self.pfb_channelizer_ccf_0, 0)) for chan in xrange(0,self.channels_num): self.connect((self.pfb_channelizer_ccf_0, chan), (self.receivers_with_decoders[chan], 0)) self.msg_connect(self.receivers_with_decoders[chan], 'bursts', self, 'bursts') self.msg_connect(self.receivers_with_decoders[chan], 'msgs', self, 'msgs')
def __init(self, OSR=4, fc=939.4e6, samp_rate=0.4e6): ################################################## # Parameters ################################################## self.OSR = OSR self.fc = fc self.samp_rate = samp_rate self.channels_num = int(samp_rate / 0.2e6) self.OSR_PFB = 2 ################################################## # Blocks ################################################## self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( self.channels_num, (), self.OSR_PFB, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.create_receivers() ################################################## # Connections ################################################## self.connect((self, 0), (self.pfb_channelizer_ccf_0, 0)) for chan in xrange(0, self.channels_num): self.connect((self.pfb_channelizer_ccf_0, chan), (self.receivers_with_decoders[chan], 0)) self.msg_connect(self.receivers_with_decoders[chan], 'bursts', self, 'bursts') self.msg_connect(self.receivers_with_decoders[chan], 'msgs', self, 'msgs')
def __init__(self, length=0.2, gain=25, channelizer_osr=1, fc=937e6, usrp_decim=4, fs=100e6): gr.top_block.__init__(self, "Gsm Receiver Usrp Channelizer Python") ################################################## # Parameters ################################################## self.length = length self.gain = gain self.channelizer_osr = channelizer_osr self.fc = fc self.usrp_decim = usrp_decim self.channels_num = int(round(fs/usrp_decim/200e3)) self.fs = fs ################################################## # Variables ################################################## self.samp_rate = 100e6/self.usrp_decim self.samp_rate_channelizer_out = self.samp_rate/self.channels_num*channelizer_osr self.freqs = fft.fftfreq(self.channels_num,1/self.samp_rate)+self.fc self.arfcns = get_arfcns_from_freqs(self.freqs,"e") print self.freqs print self.arfcns ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="addr=192.168.11.2", stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) self.uhd_usrp_source_0.set_center_freq(fc, 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( self.channels_num, (), channelizer_osr, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex*1, int(self.samp_rate*length)) self.gsm_bursts_printer_0 = gsm.bursts_printer() self.connect((self.uhd_usrp_source_0, 0), (self.blocks_head_0, 0)) self.connect((self.blocks_head_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.gsm_receiver_hier = {} for ii in xrange(0,self.channels_num): self.gsm_receiver_hier[ii] = gsm.receiver_hier(self.samp_rate_channelizer_out, 4, int(self.freqs[ii]/1e5)) self.connect((self.pfb_channelizer_ccf_0, ii), (self.gsm_receiver_hier[ii], 0)) self.msg_connect(self.gsm_receiver_hier[ii], "bursts", self.gsm_bursts_printer_0, "bursts")
def __init__(self): gr.top_block.__init__(self, "Pfb Test2") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 12.8e6 self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass( 1.0, samp_rate, 20000, 5000, firdes.WIN_HAMMING, 6.76) self.Noversample = Noversample = 1 self.M = M = 512 ################################################## # Blocks ################################################## self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( M, (variable_low_pass_filter_taps_0), Noversample, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'soapy=0,driver=remote,remote=tcp://localhost:55132') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(470850000, 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.blocks_udp_sink_0 = blocks.udp_sink( gr.sizeof_gr_complex * 1, 'localhost', 7355, 1472, True) # Change 'localhost' to IP address of UDP sink # self.blocks_rotator_cc_0 = blocks.rotator_cc(-3.14159*0.0375/2.4) # This rotator shifts the center of the band to a 25 kHz boundary so all the pfb channels line up. self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) ################################################## # Connections ################################################## # self.connect((self.blocks_rotator_cc_0, 0), (self.pfb_channelizer_ccf_0, 0)) # self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) for i in range(M - 1): self.connect((self.pfb_channelizer_ccf_0, i + 1), (self.blocks_null_sink_0, i)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_udp_sink_0, 0))
def __init__(self, rate, channel_spacing): numchans = int(rate / channel_spacing) gr.hier_block2.__init__( self, "filterbank", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(numchans, numchans, gr.sizeof_gr_complex)) self._channel_spacing = channel_spacing self._rate = rate self._bank = pfb.channelizer_ccf(numchans, atten=60) print "Filterbank using %i channels" % numchans print "Filterbank filter length per channel: %i" % len( self._bank.pfb.taps()[0]) self._map = [0] * numchans self._bank.set_channel_map(self._map) self.connect(self, self._bank) for i in xrange(numchans): self.connect((self._bank, i), (self, i))
def __init__(self, rate, channel_spacing): numchans = int(rate/channel_spacing) gr.hier_block2.__init__(self, "filterbank", gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(numchans,numchans,gr.sizeof_gr_complex)) self._channel_spacing = channel_spacing self._rate = rate self._bank = pfb.channelizer_ccf(numchans, atten=60) print "Filterbank using %i channels" % numchans print "Filterbank filter length per channel: %i" % len(self._bank.pfb.taps()[0]) self._map = [0]*numchans self._bank.set_channel_map(self._map) self.connect(self, self._bank) for i in xrange(numchans): self.connect((self._bank,i), (self,i))
def __init__(self, options): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.num_chans = num_chans = 1 + options.chan_max - options.chan_min assert (self.num_chans > 0 and self.num_chans % 2 == 0) center_chan = (options.chan_max + options.chan_min) / 2 self.samp_rate = 1e6 * (num_chans) self.freq = freq = 1e6 * (2401 + center_chan) self.samp_per_sym = samp_per_sym = 2 self.gain_mu = gain_mu = 0.175 self.cutoff_freq = cutoff_freq = 500e3 self.transition_width = transition_width = 200e3 print("Create %d channels around %d" % (self.num_chans, center_chan)) ################################################## # Blocks ################################################## self.source = self.make_osmocom_source(gain=14) # Filtering self.taps = firdes.low_pass(1.0, 2e6, self.cutoff_freq, self.transition_width, firdes.WIN_BLACKMAN, 6.76) self.pfb_channelizer = pfb.channelizer_ccf(num_chans, (self.taps), samp_per_sym, 100) self.bthandler = btbr.btsink() self.pfb_channelizer.set_channel_map( range(num_chans / 2 + 1, num_chans) + range(0, num_chans / 2 + 1)) # Connections self.connect(self.source, self.pfb_channelizer) for i in range(num_chans): self.set_decoder((self.pfb_channelizer, i), options.chan_min + i)
def __init__(self, args): gr.top_block.__init__(self, "Benchmark Copy", catch_exceptions=True) ################################################## # Variables ################################################## nsamples = args.samples nchans = args.nchans attn = args.attenuation bufsize = args.buffer_size # taps = filter.firdes.low_pass_2(1, nchans, 1 / 2, 1 / 10, attenuation_dB=attn,window=fft.window.WIN_BLACKMAN_hARRIS), ################################################## # Blocks ################################################## self.nsrc = blocks.null_source(gr.sizeof_gr_complex*1) self.nsnk = blocks.null_sink(gr.sizeof_gr_complex*1) self.hd = blocks.head(gr.sizeof_gr_complex*1, int(nsamples)) self.channelizer = pfb.channelizer_ccf( nchans, [], 1.0, attn) self.nsrc.set_min_output_buffer(bufsize) self.hd.set_min_output_buffer(bufsize) self.channelizer.set_min_output_buffer(bufsize) ################################################## # Connections ################################################## for ii in range(nchans): self.connect((self.channelizer, ii), (self.nsnk, ii)) self.connect((self.hd, 0), (self.channelizer, 0)) self.connect((self.nsrc, 0), (self.hd, 0))
def __init__(self): gr.top_block.__init__(self, "superdarn_playback_sigmf") Qt.QWidget.__init__(self) self.setWindowTitle("superdarn_playback_sigmf") 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", "superdarn_playback_sigmf_channelizer") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.trig_lvl = trig_lvl = 0 self.throttle_rate = throttle_rate = 1 self.samp_rate = samp_rate = 250e3 self.decim = decim = 5 self.cutoff = cutoff = 5e3 self.coarse_freq = coarse_freq = 0 ################################################## # Blocks ################################################## self._trig_lvl_tool_bar = Qt.QToolBar(self) self._trig_lvl_tool_bar.addWidget(Qt.QLabel("trig_lvl" + ": ")) self._trig_lvl_line_edit = Qt.QLineEdit(str(self.trig_lvl)) self._trig_lvl_tool_bar.addWidget(self._trig_lvl_line_edit) self._trig_lvl_line_edit.returnPressed.connect( lambda: self.set_trig_lvl( eng_notation.str_to_num( str(self._trig_lvl_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._trig_lvl_tool_bar, 7, 6, 1, 2) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._throttle_rate_tool_bar = Qt.QToolBar(self) self._throttle_rate_tool_bar.addWidget( Qt.QLabel("throttle_rate" + ": ")) self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate)) self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit) self._throttle_rate_line_edit.returnPressed.connect( lambda: self.set_throttle_rate( eng_notation.str_to_num( str(self._throttle_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 4, 6, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num( str(self._samp_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._cutoff_tool_bar = Qt.QToolBar(self) self._cutoff_tool_bar.addWidget(Qt.QLabel("cutoff" + ": ")) self._cutoff_line_edit = Qt.QLineEdit(str(self.cutoff)) self._cutoff_tool_bar.addWidget(self._cutoff_line_edit) self._cutoff_line_edit.returnPressed.connect(lambda: self.set_cutoff( eng_notation.str_to_num( str(self._cutoff_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._cutoff_tool_bar, 6, 4, 1, 2) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._coarse_freq_range = Range(-125e3, 125e3, 1, 0, 200) self._coarse_freq_win = RangeWidget(self._coarse_freq_range, self.set_coarse_freq, "coarse_freq", "counter_slider", float) self.top_grid_layout.addWidget(self._coarse_freq_win, 5, 4, 1, 4) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.sigmf_source_0 = gr_sigmf.source( '/captures/20200731/SUPERDARN_2020-08-01T03:43:13Z.sigmf-data', "cf32" + ("_le" if sys.byteorder == "little" else "_be"), True) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None, ) 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.010) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4, 0, 4, 4) for r in range(4, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate / decim / decim, #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(-30, 20) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, trig_lvl, 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 False: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(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, 2, 4, 2, 4) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim / 5, #bw "", #name 5 #number of inputs ) self.qtgui_freq_sink_x_0_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_0_0_0.set_y_axis(-80, 10) self.qtgui_freq_sink_x_0_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_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(5): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win, 0, 4, 2, 4) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [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, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( 5, ([ -9.350743681157793e-22, -8.924677104005241e-07, -1.517776468062948e-06, 3.3261155749642057e-06, 1.0132545867236331e-05, -3.5773099338126395e-20, -2.7946829504799098e-05, -2.6574774892651476e-05, 3.9495575038017705e-05, 9.235227480530739e-05, -2.3499991822538964e-19, -0.00018029908824246377, -0.00015138900198508054, 0.000202417082618922, 0.0004316549457143992, -8.676545599252473e-19, -0.0007217706879600883, -0.000567141454666853, 0.0007138229557313025, 0.0014402356464415789, -2.292740344385692e-18, -0.0021837777458131313, -0.0016431574476882815, 0.001986929913982749, 0.0038632487412542105, -4.754846332781923e-18, -0.005486111156642437, -0.004011092707514763, 0.004725519102066755, 0.008975901640951633, -8.117160574110425e-18, -0.012270297855138779, -0.008844290859997272, 0.010310066863894463, 0.019460389390587807, -1.1717819877910876e-17, -0.026701966300606728, -0.019494548439979553, 0.023256469517946243, 0.04555940255522728, -1.4527066686025705e-17, -0.07233384996652603, -0.06079959124326706, 0.09249789267778397, 0.3018770217895508, 0.39999985694885254, 0.3018770217895508, 0.09249789267778397, -0.06079958751797676, -0.07233384996652603, -1.4527066686025705e-17, 0.04555939510464668, 0.023256471380591393, -0.019494548439979553, -0.02670196443796158, -1.1717820705091489e-17, 0.019460393115878105, 0.010310065001249313, -0.008844291791319847, -0.012270297855138779, -8.1171589197492e-18, 0.008975899778306484, 0.00472552003338933, -0.00401109317317605, -0.005486111622303724, -4.75484550560131e-18, 0.003863247577100992, 0.001986929215490818, -0.0016431581461802125, -0.0021837782114744186, -2.292741378361458e-18, 0.0014402354136109352, 0.0007138226646929979, -0.0005671412218362093, -0.0007217710372060537, -8.67654870117977e-19, 0.00043165491661056876, 0.00020241719903424382, -0.00015138874005060643, -0.00018029888451565057, -2.349999699241779e-19, 9.23524348763749e-05, 3.94955714000389e-05, -2.657469485711772e-05, -2.7946751288254745e-05, -3.57728182259651e-20, 1.0132655916095246e-05, 3.326256774016656e-06, -1.5177643035713118e-06, -8.925894121603051e-07, -9.350743681157793e-22 ]), 2.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate / decim, cutoff, 1e3, firdes.WIN_HAMMING, 6.76)) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * throttle_rate, True) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * coarse_freq, 1, 0) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_0_0_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_0_0_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_0_0_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_0_0_0, 4)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "Xbee Playback") Qt.QWidget.__init__(self) self.setWindowTitle("Xbee Playback") 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", "xbee_playback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 12e6 self.baud = baud = 95.2e3 self.samps_per_symb = samps_per_symb = samp_rate / 30 / baud self.offset = offset = -1500 ################################################## # Blocks ################################################## self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel('SAMP_RATE' + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num( str(self._samp_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 9, 0, 1, 1) self._offset_tool_bar = Qt.QToolBar(self) self._offset_tool_bar.addWidget(Qt.QLabel('offset' + ": ")) self._offset_line_edit = Qt.QLineEdit(str(self.offset)) self._offset_tool_bar.addWidget(self._offset_line_edit) self._offset_line_edit.returnPressed.connect(lambda: self.set_offset( eng_notation.str_to_num( str(self._offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._offset_tool_bar, 9, 2, 1, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(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 = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( samp_rate, 20, 1000, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(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_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.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / 30, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-80, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 4, 4) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( 30, ([ -0.0009440003777854145, -1.9967922852119293e-18, 0.0011775379534810781, -2.1018872363980166e-18, -0.001785947591997683, 1.104649332765264e-17, 0.0028464579954743385, -4.376348750402665e-18, -0.0044487821869552135, 6.047675863462489e-18, 0.006705658044666052, -7.96089705741242e-18, -0.009772991761565208, 1.0012871595263528e-17, 0.013889657333493233, -1.2092975237025114e-17, -0.019461529329419136, 1.4089067934233976e-17, 0.02725801058113575, -1.589354424254493e-17, -0.0389452800154686, 1.7409121104476838e-17, 0.058897972106933594, -1.855409458220539e-17, -0.10325390845537186, 1.9266737149699424e-17, 0.31760919094085693, 0.500455915927887, 0.31760919094085693, 1.9266737149699424e-17, -0.10325390845537186, -1.855409458220539e-17, 0.058897972106933594, 1.7409121104476838e-17, -0.0389452800154686, -1.589354424254493e-17, 0.02725801058113575, 1.4089067934233976e-17, -0.019461529329419136, -1.2092975237025114e-17, 0.013889657333493233, 1.0012871595263528e-17, -0.009772991761565208, -7.96089705741242e-18, 0.006705658044666052, 6.047675863462489e-18, -0.0044487821869552135, -4.376348750402665e-18, 0.0028464579954743385, 1.104649332765264e-17, -0.001785947591997683, -2.1018872363980166e-18, 0.0011775379534810781, -1.9967922852119293e-18, -0.0009440003777854145 ]), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.fosphor_glfw_sink_c_0 = fosphor.glfw_sink_c() self.fosphor_glfw_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_glfw_sink_c_0.set_frequency_range(0, samp_rate) 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.5, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/zleffke/captures/xbee/xbee_12MSPS.fc32', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * offset, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.fosphor_glfw_sink_c_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.blocks_delay_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_null_sink_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.blocks_null_sink_0, 10)) self.connect((self.pfb_channelizer_ccf_0, 11), (self.blocks_null_sink_0, 11)) self.connect((self.pfb_channelizer_ccf_0, 12), (self.blocks_null_sink_0, 12)) self.connect((self.pfb_channelizer_ccf_0, 13), (self.blocks_null_sink_0, 13)) self.connect((self.pfb_channelizer_ccf_0, 14), (self.blocks_null_sink_0, 14)) self.connect((self.pfb_channelizer_ccf_0, 15), (self.blocks_null_sink_0, 15)) self.connect((self.pfb_channelizer_ccf_0, 16), (self.blocks_null_sink_0, 16)) self.connect((self.pfb_channelizer_ccf_0, 17), (self.blocks_null_sink_0, 17)) self.connect((self.pfb_channelizer_ccf_0, 18), (self.blocks_null_sink_0, 18)) self.connect((self.pfb_channelizer_ccf_0, 19), (self.blocks_null_sink_0, 19)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_null_sink_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 20), (self.blocks_null_sink_0, 20)) self.connect((self.pfb_channelizer_ccf_0, 21), (self.blocks_null_sink_0, 21)) self.connect((self.pfb_channelizer_ccf_0, 22), (self.blocks_null_sink_0, 22)) self.connect((self.pfb_channelizer_ccf_0, 23), (self.blocks_null_sink_0, 23)) self.connect((self.pfb_channelizer_ccf_0, 24), (self.blocks_null_sink_0, 24)) self.connect((self.pfb_channelizer_ccf_0, 25), (self.blocks_null_sink_0, 25)) self.connect((self.pfb_channelizer_ccf_0, 26), (self.blocks_null_sink_0, 26)) self.connect((self.pfb_channelizer_ccf_0, 27), (self.blocks_null_sink_0, 27)) self.connect((self.pfb_channelizer_ccf_0, 28), (self.blocks_null_sink_0, 28)) self.connect((self.pfb_channelizer_ccf_0, 29), (self.blocks_null_sink_0, 29)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_null_sink_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_null_sink_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_null_sink_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_null_sink_0, 6)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_null_sink_0, 7)) self.connect((self.pfb_channelizer_ccf_0, 8), (self.blocks_null_sink_0, 8)) self.connect((self.pfb_channelizer_ccf_0, 9), (self.blocks_null_sink_0, 9))
def __init__(self): gr.top_block.__init__(self, "Receive Single FM Station") Qt.QWidget.__init__(self) self.setWindowTitle("Receive Single FM Station") 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", "rcv_single_fm_channelize_channel_power") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.rf_rate = rf_rate = 20e6 self.rf_frequency_h = rf_frequency_h = 88.5 self.fm_taps = fm_taps = firdes.low_pass_2(32., rf_rate, 96e3, 25e3, 50) self.audio_rate = audio_rate = 44100 self.taps_len = taps_len = fm_taps.__len__() self.rf_gain = rf_gain = 50 self.rf_frequency = rf_frequency = 98.1e6 self.fm_channel_rate = fm_channel_rate = audio_rate * 5 self.channel_number = channel_number = int( 10 * (rf_frequency_h - 98)) / 2 if rf_frequency_h >= 98 else 50 + int( 10 * (rf_frequency_h - 88.1)) / 2 ################################################## # Blocks ################################################## self._rf_rate_range = Range(100e3, 20e6, 200e3, 20e6, 200) self._rf_rate_win = RangeWidget(self._rf_rate_range, self.set_rf_rate, 'RF sample rate', "counter_slider", float) self.top_layout.addWidget(self._rf_rate_win) self._rf_gain_range = Range(0, 90, 1, 50, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'RF gain', "counter_slider", float) self.top_layout.addWidget(self._rf_gain_win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(rf_rate) self.uhd_usrp_source_0.set_center_freq(rf_frequency, 0) self.uhd_usrp_source_0.set_gain(rf_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self._rf_frequency_h_range = Range(88.0, 108.0, .2, 88.5, 200) self._rf_frequency_h_win = RangeWidget(self._rf_frequency_h_range, self.set_rf_frequency_h, 'RF Frequency', "counter_slider", float) self.top_layout.addWidget(self._rf_frequency_h_win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=fm_channel_rate, decimation=int(200e3), taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rf_frequency, #fc rf_rate, #bw "Received Spectrum", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_0.enable_grid(False) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( 100, (fm_taps), 1.0, 100) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.channel_power_display = qtgui.vector_sink_f( 100, 0, 1.0, "x-Axis", "y-Axis", "Power per FM Channel", 1 # Number of inputs ) self.channel_power_display.set_update_time(0.10) self.channel_power_display.set_y_axis(-140, 10) self.channel_power_display.enable_autoscale(False) self.channel_power_display.enable_grid(False) self.channel_power_display.set_x_axis_units("") self.channel_power_display.set_y_axis_units("") self.channel_power_display.set_ref_level(0) 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.channel_power_display.set_line_label( i, "Data {0}".format(i)) else: self.channel_power_display.set_line_label(i, labels[i]) self.channel_power_display.set_line_width(i, widths[i]) self.channel_power_display.set_line_color(i, colors[i]) self.channel_power_display.set_line_alpha(i, alphas[i]) self._channel_power_display_win = sip.wrapinstance( self.channel_power_display.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._channel_power_display_win) self.blocks_streams_to_vector_0 = blocks.streams_to_vector( gr.sizeof_float * 1, 100) ################################################## # Connections ################################################## for channel_number in range(100): resampler = filter.rational_resampler_ccc( interpolation=fm_channel_rate, decimation=int(200e3), taps=None, fractional_bw=None) mag_squarer = blocks.complex_to_mag_squared(1) dber = blocks.nlog10_ff(10.) self.connect((self.pfb_channelizer_ccf_0, channel_number), (resampler, 0)) self.connect((resampler, 0), (mag_squarer, 0)) self.connect((mag_squarer, 0), (dber, 0)) self.connect((dber, 0), (self.blocks_streams_to_vector_0, channel_number)) self.connect((self.blocks_streams_to_vector_0, 0), (self.channel_power_display, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Pfb Test") Qt.QWidget.__init__(self) self.setWindowTitle("Pfb Test") 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", "pfb_test") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 4.8e6 self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass( 1.0, samp_rate, 20000, 5000, firdes.WIN_HAMMING, 6.76) self.Noversample = Noversample = 1 self.M = M = 192 ################################################## # Blocks ################################################## self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / M * Noversample, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_0.enable_grid(False) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win) 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_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( M, (variable_low_pass_filter_taps_0), Noversample, 100) self.pfb_channelizer_ccf_0.set_channel_map(([1])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, 'localhost', 7355, 1472, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_rotator_cc_0 = blocks.rotator_cc(-3.14159 * 0.0375 / 2.4) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_float_to_short_0 = blocks.float_to_short(1, 127) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, 'dump1.cf32', False) self.blocks_endian_swap_0 = blocks.endian_swap(2) self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(-60, 1) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=25000, quad_rate=25000, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.analog_simple_squelch_cc_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blocks_endian_swap_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_endian_swap_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.analog_simple_squelch_cc_0, 0)) for i in range(M - 1): self.connect((self.pfb_channelizer_ccf_0, i + 1), (self.blocks_null_sink_0, i)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Tetra Rx Multi") options = self.get_options() ################################################## # Variables ################################################## self.srate_rx = srate_rx = options.sample_rate self.channels = srate_rx / 25000 self.srate_channel = 36000 self.afc_period = 5 self.afc_gain = 1. self.afc_channel = options.auto_tune or -1 self.afc_ppm_step = 100 self.debug = options.debug self.last_pwr = -100000 self.sig_det_period = 10 self.sig_det_bw = sig_det_bw = options.sig_detection_bw or srate_rx if self.sig_det_bw <= 1.: self.sig_det_bw *= srate_rx self.sig_det_threshold = options.sig_detection_threshold self.sig_det_channels = [] for ch in range(self.channels): if ch >= self.channels / 2: ch_ = (self.channels - ch - 1) else: ch_ = ch if (float(ch_) / self.channels * 2) <= (self.sig_det_bw / srate_rx): self.sig_det_channels.append(ch) ################################################## # RPC server ################################################## self.xmlrpc_server = SimpleXMLRPCServer.SimpleXMLRPCServer( ("localhost", options.listen_port), allow_none=True) self.xmlrpc_server.register_instance(self) threading.Thread(target=self.xmlrpc_server.serve_forever).start() ################################################## # Rx Blocks and connections ################################################## self.src = osmosdr.source( args=options.args ) self.src.set_sample_rate(srate_rx) self.src.set_center_freq(options.frequency, 0) self.src.set_freq_corr(options.ppm, 0) self.src.set_dc_offset_mode(0, 0) self.src.set_iq_balance_mode(0, 0) if options.gain is not None: self.src.set_gain_mode(False, 0) self.src.set_gain(36, 0) else: self.src.set_gain_mode(True, 0) out_type, dst_path = options.output.split("://", 1) if out_type == "udp": dst_ip, dst_port = dst_path.split(':', 1) self.freq_xlating = freq_xlating_fft_filter_ccc(1, (1, ), 0, srate_rx) self.channelizer = pfb.channelizer_ccf( self.channels, (firdes.root_raised_cosine(1, srate_rx, 18000, 0.35, 1024)), 36./25., 100) self.squelch = [] self.digital_mpsk_receiver_cc = [] self.diff_phasor = [] self.complex_to_arg = [] self.multiply_const = [] self.add_const = [] self.float_to_uchar = [] self.map_bits = [] self.unpack_k_bits = [] self.blocks_sink = [] for ch in range(0, self.channels): squelch = analog.pwr_squelch_cc(0, 0.001, 0, True) mpsk = digital.mpsk_receiver_cc( 4, math.pi/4, math.pi/100.0, -0.5, 0.5, 0.25, 0.001, 2, 0.001, 0.001) diff_phasor = digital.diff_phasor_cc() complex_to_arg = blocks.complex_to_arg(1) multiply_const = blocks.multiply_const_vff((2./math.pi, )) add_const = blocks.add_const_vff((1.5, )) float_to_uchar = blocks.float_to_uchar() map_bits = digital.map_bb(([3, 2, 0, 1, 3])) unpack_k_bits = blocks.unpack_k_bits_bb(2) brmchannels = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71] #brmchannels = [11,4,3,64,45,47,53,8,68,6,56,49,17,54,65,5,71,22,48,7,50] # itds kancl #brmchannels = [23,13,40,69,59,7,42,54,5,14,4,56,45,46,67,55,66,44,71,49,31,57,0,65,70] # doma - dole brmchannels = [23,13,59,40,69,7,49,60,42,70,4,50,66,67,3,14,57,33,46,22,68,32,39,24,6,12,43,58,48,17,5,56,65,29,54,30,16,52,53,41,47,2,34,44,8] # doma - strecha #brmchannels = [67, 7, 23, 70] # doma - strecha - SDS brmchannels = [67, 7, 23, 70,9,71,64,63,62,61,55,51,45,38,37,36,35,31,28,27,26,25,21,20,19,18,15,11,10,1,0] # doma - strecha - komplement if out_type == 'udp': sink = blocks.udp_sink(gr.sizeof_gr_char, dst_ip, int(dst_port)+ch, 1472, True) elif out_type == 'file': sink = blocks.file_sink(gr.sizeof_char, dst_path % ch, False) sink.set_unbuffered(True) else: raise ValueError("Invalid output URL '%s'" % options.output) if ch in brmchannels: self.connect((self.channelizer, ch), #(squelch, 0), (mpsk, 0), (diff_phasor, 0), (complex_to_arg, 0), (multiply_const, 0), (add_const, 0), (float_to_uchar, 0), (map_bits, 0), (unpack_k_bits, 0), (sink, 0)) self.squelch.append(squelch) self.digital_mpsk_receiver_cc.append(mpsk) self.diff_phasor.append(diff_phasor) self.complex_to_arg.append(complex_to_arg) self.multiply_const.append(multiply_const) self.add_const.append(add_const) self.float_to_uchar.append(float_to_uchar) self.map_bits.append(map_bits) self.unpack_k_bits.append(unpack_k_bits) self.blocks_sink.append(sink) self.connect( (self.src, 0), (self.freq_xlating, 0), (self.channelizer, 0)) ################################################## # signal strenght identification ################################################## self.pwr_probes = [] for ch in range(self.channels): pwr_probe = analog.probe_avg_mag_sqrd_c(0, 1./self.srate_channel) self.pwr_probes.append(pwr_probe) self.connect((self.channelizer, ch), (pwr_probe, 0)) def _sig_det_probe(): while True: pwr = [self.pwr_probes[ch].level() for ch in range(self.channels) if ch in self.sig_det_channels] pwr = [10 * math.log10(p) for p in pwr if p > 0.] if not pwr: continue pwr = min(pwr) + self.sig_det_threshold print "power threshold target %f"%pwr if abs(pwr - self.last_pwr) > (self.sig_det_threshold / 2): for s in self.squelch: s.set_threshold(pwr) self.last_pwr = pwr time.sleep(self.sig_det_period) if self.sig_det_threshold is not None: self._sig_det_probe_thread = threading.Thread(target=_sig_det_probe) self._sig_det_probe_thread.daemon = True self._sig_det_probe_thread.start() ################################################## # AFC blocks and connections ################################################## self.afc_selector = grc_blks2.selector( item_size=gr.sizeof_gr_complex, num_inputs=self.channels, num_outputs=1, input_index=0, output_index=0, ) self.afc_demod = analog.quadrature_demod_cf(self.srate_channel/(2*math.pi)) samp_afc = self.srate_channel*self.afc_period / 2 self.afc_avg = blocks.moving_average_ff(samp_afc, 1./samp_afc*self.afc_gain) self.afc_probe = blocks.probe_signal_f() def _afc_probe(): while True: time.sleep(self.afc_period) if self.afc_channel == -1: continue err = self.afc_probe.level() if abs(err) < self.afc_ppm_step: continue freq = self.freq_xlating.center_freq + err * self.afc_gain print "err: %f\tfreq: %f" % (err, freq, ) self.freq_xlating.set_center_freq(freq) self.afc_channel = 23 self._afc_err_thread = threading.Thread(target=_afc_probe) self._afc_err_thread.daemon = True self._afc_err_thread.start() for ch in range(self.channels): self.connect((self.channelizer, ch), (self.afc_selector, ch)) self.connect( (self.afc_selector, 0), (self.afc_demod, 0), (self.afc_avg, 0), (self.afc_probe, 0)) if self.afc_channel != -1: self.afc_selector.set_input_index(self.afc_channel)
def __init__(self, freq, ch_width, num_chan, audio_rate, squelch, out_scale, do_audio, zmqh, loop, filename=None, file_samprate=None, osmo_args=None, osmo_freq_cor=None, osmo_rf_gain=None, osmo_if_gain=None, osmo_bb_gain=None): gr.top_block.__init__(self, "Multipager") sample_rate = num_chan * ch_width ################################################## # Blocks ################################################## if not (filename == None) ^ (osmo_args == None): raise (exceptions.ValueError( 'Must specify either filename or osmo_args')) if filename != None: self.source = blocks.file_source(gr.sizeof_gr_complex * 1, filename, True) if file_samprate != None and file_samprate < sample_rate: raise (exceptions.ValueError( 'File sample %f rate must be >= computed sample rate %f' % (file_samprate, sample_rate))) else: self.source = osmosdr.source(args=osmo_args) if self.source.set_sample_rate(sample_rate) != sample_rate: raise (exceptions.ValueError( 'Wanted %.4f kSPS got %.4f kSPS' % (sample_rate / 1e3, self.source.get_sample_rate() / 1e3))) self.source.set_center_freq(freq, 0) if osmo_freq_cor != None: self.source.set_freq_corr(osmo_freq_cor, 0) self.source.set_dc_offset_mode(0, 0) self.source.set_iq_balance_mode(0, 0) self.source.set_gain_mode(False, 0) if osmo_rf_gain != None: self.source.set_gain(osmo_rf_gain, 0) if osmo_if_gain != None: self.source.set_if_gain(osmo_if_gain, 0) if osmo_bb_gain != None: self.source.set_bb_gain(osmo_bb_gain, 0) self.source.set_antenna("", 0) self.source.set_bandwidth(0, 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_chan, (firdes.low_pass(1.0, sample_rate, 8e3, 1.5e3, firdes.WIN_HAMMING, 6.76)), 1, 60) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) ################################################## # Connections ################################################## if file_samprate != None: logger.info('Resampling %f' % (file_samprate / sample_rate)) self.filter = grfilter.fir_filter_ccf( 1, firdes.low_pass(1, file_samprate, sample_rate / 2, 1e4, firdes.WIN_HAMMING, 6.76)) self.resampler = grfilter.fractional_resampler_cc( 0, file_samprate / sample_rate) self.connect((self.source, 0), (self.filter, 0)) self.connect((self.filter, 0), (self.resampler, 0)) self.connect((self.resampler, 0), (self.pfb_channelizer_ccf_0, 0)) else: self.connect((self.source, 0), (self.pfb_channelizer_ccf_0, 0)) # Enable decoding on all channels sel = [True] * num_chan self.fms = {} for i in range(num_chan): if i > num_chan / 2: chfreq = freq + ch_width * (i - num_chan) else: chfreq = freq + ch_width * i if sel[i]: logger.info("Channel %d %.3f MHz" % (i, chfreq / 1e6)) command = cmdpat.format(audio_in=ch_width, audio_out=audio_rate) fm = FMtoCommand(squelch, int(ch_width), 5e3, out_scale, chfreq, command, do_audio=(i == 0) and do_audio) self.connect((self.pfb_channelizer_ccf_0, i), (fm, 0)) self.fms[chfreq] = fm loop.add_reader(fm.p.stdout, parse_multimon, zmqh, fm.p.stdout, chfreq, fm.p) else: n = blocks.null_sink(gr.sizeof_gr_complex * 1) self.connect((self.pfb_channelizer_ccf_0, i), (n, 0))
def __init__(self, config, tune_offset_cb): gr.hier_block2.__init__(self, "indri_recording_channelizer", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(0, 0, 0)) self.config = config self.tune_offset_cb = tune_offset_cb self.server_api = ServerAPI(config) self.samp_rate = config["scanner"]["Fs"] self.Fc = config["scanner"]["Fc"] self.base_url = config["websocket_uri"] self.threshold = config["scanner"]["threshold"] # Stuff for our squelch tuning loop self.power_observations = [] # list of (ts, dB) observations self.threshold_alpha = 0.97 # 0.97 of old average, 0.03 of new pt self.threshold_obs_maxage = 30 # seconds to use self.freq_corr = config["scanner"]["receiver"]["freq_corr"] self.gain = config["scanner"]["receiver"]["gain"] self.gain_if = 0 self.gain_bb = 0 self.control_counts = { "good": 0, "bad": 0, "exp": 0, "offset": 0, "squelch": self.threshold } self.chan_rate = chan_rate = config["scanner"]["chan_rate"] self.min_burst = 8000 * config["scanner"]["min_burst"] ################################################## # Variables ################################################## self.freq_offset = 0.0 self.perflog = file("/tmp/indri.perflog", "a") self.cpu_meter = CPUMeter() self.radio_channels = {} # freq => radio_channel object self.voice_channels = {} # freq => voice_channel object self.n_channels = self.samp_rate / self.chan_rate self.channels = config["channels"] self.channel_dict = {} for c in self.channels: self.channel_dict[c["freq"]] = c self.holdoff = holdoff = 0.5 self.control_sinks = {} # freq => control sinks self.control_log_tmp_dir = config["scanner"]["control_log_tmp_dir"] self.control_log_dir = config["scanner"]["control_log_dir"] self.control_log = ControlLog(self.control_log_tmp_dir, self.control_log_dir) self.traffic_log = None if "traffic_log_tmp_dir" in config["scanner"]: self.traffic_log_tmp_dir = config["scanner"]["traffic_log_tmp_dir"] self.traffic_log_dir = config["scanner"]["traffic_log_dir"] self.traffic_log = ControlLog(self.traffic_log_tmp_dir, self.traffic_log_dir) def channelizer_frequency(i): if i > self.n_channels / 2: return self.Fc - (self.n_channels - i) * self.chan_rate return self.Fc + i * self.chan_rate all_freqs = map(channelizer_frequency, range(self.n_channels)) logging.info( "Starting up scanner: Fs=%d, Fc=%d, %d~%d,Fchan=%d, n_chan=%d, threshold=%d" % (self.samp_rate, self.Fc, min(all_freqs), max(all_freqs), self.chan_rate, self.n_channels, self.threshold)) if self.channels: missing_channels = set(self.channel_dict.keys()) skipped_channels = 0 for i in range(self.n_channels): f_i = channelizer_frequency(i) if f_i in self.channel_dict: logging.debug(" * %03d %d" % (i, f_i)) missing_channels.remove(f_i) else: skipped_channels += 1 logging.info(" Skipped %d channels" % skipped_channels) logging.info(" Input channels missing:") for f_i in sorted(list(missing_channels)): logging.info(" ! ___ %d" % f_i) self.lpf_taps = firdes.low_pass(1.0, self.samp_rate, self.samp_rate / self.n_channels / 2, self.samp_rate / self.n_channels / 4, firdes.WIN_HAMMING, 6.76) logging.debug(" LPF taps: %d long" % len(self.lpf_taps)) ################################################## # Blocks ################################################## # Set up the Polyphase Filter Bank Channelizer: self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( self.n_channels, self.lpf_taps, 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) ################################################## # Connections ################################################## self.connect(self, (self.pfb_channelizer_ccf_0, 0)) chains = [] for i in range(self.n_channels): f_i = channelizer_frequency(i) if not self.channels or f_i in self.channel_dict: radio_source = self.attach_radio_channel(f_i, i) self.radio_channels[f_i] = radio_source c = self.channel_dict[f_i] if c["is_control"]: self.attach_control_finals(f_i, radio_source) else: self.attach_voice_finals(f_i, i, radio_source) else: null_sink = blocks.null_sink(gr.sizeof_gr_complex) self.connect((self.pfb_channelizer_ccf_0, i), null_sink)
def __init__(self): gr.top_block.__init__(self, "Tetra Rx Multi") options = self.get_options() ################################################## # Variables ################################################## self.srate_rx = srate_rx = options.sample_rate self.channels = srate_rx / 25000 self.srate_channel = 36000 self.afc_period = 5 self.afc_gain = 1. self.afc_channel = options.auto_tune or -1 self.afc_ppm_step = 100 self.debug = options.debug self.last_pwr = -100000 self.sig_det_period = 1 self.sig_det_bw = sig_det_bw = options.sig_detection_bw or srate_rx if self.sig_det_bw <= 1.: self.sig_det_bw *= srate_rx self.sig_det_threshold = options.sig_detection_threshold self.sig_det_channels = [] for ch in range(self.channels): if ch >= self.channels / 2: ch_ = (self.channels - ch - 1) else: ch_ = ch if (float(ch_) / self.channels * 2) <= (self.sig_det_bw / srate_rx): self.sig_det_channels.append(ch) ################################################## # RPC server ################################################## self.xmlrpc_server = SimpleXMLRPCServer.SimpleXMLRPCServer( ("localhost", options.listen_port), allow_none=True) self.xmlrpc_server.register_instance(self) threading.Thread(target=self.xmlrpc_server.serve_forever).start() ################################################## # Rx Blocks and connections ################################################## self.src = osmosdr.source( args=options.args ) self.src.set_sample_rate(srate_rx) self.src.set_center_freq(options.frequency, 0) self.src.set_freq_corr(options.ppm, 0) self.src.set_dc_offset_mode(0, 0) self.src.set_iq_balance_mode(0, 0) if options.gain is not None: self.src.set_gain_mode(False, 0) self.src.set_gain(36, 0) else: self.src.set_gain_mode(True, 0) out_type, dst_path = options.output.split("://", 1) if out_type == "udp": dst_ip, dst_port = dst_path.split(':', 1) self.freq_xlating = freq_xlating_fft_filter_ccc(1, (1, ), 0, srate_rx) self.channelizer = pfb.channelizer_ccf( self.channels, (firdes.root_raised_cosine(1, srate_rx, 18000, 0.35, 1024)), 36./25., 100) self.squelch = [] self.digital_mpsk_receiver_cc = [] self.diff_phasor = [] self.complex_to_arg = [] self.multiply_const = [] self.add_const = [] self.float_to_uchar = [] self.map_bits = [] self.unpack_k_bits = [] self.blocks_sink = [] for ch in range(0, self.channels): squelch = analog.pwr_squelch_cc(0, 0.001, 0, True) mpsk = digital.mpsk_receiver_cc( 4, math.pi/4, math.pi/100.0, -0.5, 0.5, 0.25, 0.001, 2, 0.001, 0.001) diff_phasor = digital.diff_phasor_cc() complex_to_arg = blocks.complex_to_arg(1) multiply_const = blocks.multiply_const_vff((2./math.pi, )) add_const = blocks.add_const_vff((1.5, )) float_to_uchar = blocks.float_to_uchar() map_bits = digital.map_bb(([3, 2, 0, 1, 3])) unpack_k_bits = blocks.unpack_k_bits_bb(2) if out_type == 'udp': sink = blocks.udp_sink(gr.sizeof_gr_char, dst_ip, int(dst_port)+ch, 1472, True) elif out_type == 'file': sink = blocks.file_sink(gr.sizeof_char, dst_path % ch, False) sink.set_unbuffered(True) else: raise ValueError("Invalid output URL '%s'" % options.output) self.connect((self.channelizer, ch), (squelch, 0), (mpsk, 0), (diff_phasor, 0), (complex_to_arg, 0), (multiply_const, 0), (add_const, 0), (float_to_uchar, 0), (map_bits, 0), (unpack_k_bits, 0), (sink, 0)) self.squelch.append(squelch) self.digital_mpsk_receiver_cc.append(mpsk) self.diff_phasor.append(diff_phasor) self.complex_to_arg.append(complex_to_arg) self.multiply_const.append(multiply_const) self.add_const.append(add_const) self.float_to_uchar.append(float_to_uchar) self.map_bits.append(map_bits) self.unpack_k_bits.append(unpack_k_bits) self.blocks_sink.append(sink) self.connect( (self.src, 0), (self.freq_xlating, 0), (self.channelizer, 0)) ################################################## # signal strenght identification ################################################## self.pwr_probes = [] for ch in range(self.channels): pwr_probe = analog.probe_avg_mag_sqrd_c(0, 1./self.srate_channel) self.pwr_probes.append(pwr_probe) self.connect((self.channelizer, ch), (pwr_probe, 0)) def _sig_det_probe(): while True: pwr = [self.pwr_probes[ch].level() for ch in range(self.channels) if ch in self.sig_det_channels] pwr = [10 * math.log10(p) for p in pwr if p > 0.] if not pwr: continue pwr = min(pwr) + self.sig_det_threshold print "Power level for squelch % 5.1f" % pwr if abs(pwr - self.last_pwr) > (self.sig_det_threshold / 2): for s in self.squelch: s.set_threshold(pwr) self.last_pwr = pwr time.sleep(self.sig_det_period) if self.sig_det_threshold is not None: self._sig_det_probe_thread = threading.Thread(target=_sig_det_probe) self._sig_det_probe_thread.daemon = True self._sig_det_probe_thread.start() ################################################## # AFC blocks and connections ################################################## self.afc_selector = grc_blks2.selector( item_size=gr.sizeof_gr_complex, num_inputs=self.channels, num_outputs=1, input_index=0, output_index=0, ) self.afc_demod = analog.quadrature_demod_cf(self.srate_channel/(2*math.pi)) samp_afc = self.srate_channel*self.afc_period / 2 self.afc_avg = blocks.moving_average_ff(samp_afc, 1./samp_afc*self.afc_gain) self.afc_probe = blocks.probe_signal_f() def _afc_probe(): while True: time.sleep(self.afc_period) if self.afc_channel == -1: continue err = self.afc_probe.level() if abs(err) < self.afc_ppm_step: continue freq = self.freq_xlating.center_freq + err * self.afc_gain if self.debug: print "err: %f\tfreq: %f" % (err, freq, ) self.freq_xlating.set_center_freq(freq) self._afc_err_thread = threading.Thread(target=_afc_probe) self._afc_err_thread.daemon = True self._afc_err_thread.start() for ch in range(self.channels): self.connect((self.channelizer, ch), (self.afc_selector, ch)) self.connect( (self.afc_selector, 0), (self.afc_demod, 0), (self.afc_avg, 0), (self.afc_probe, 0)) if self.afc_channel != -1: self.afc_selector.set_input_index(self.afc_channel)
def __init__(self): gr.top_block.__init__(self, "Polyphase Fb") Qt.QWidget.__init__(self) self.setWindowTitle("Polyphase Fb") 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", "polyphase_fb") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.88e6 ################################################## # Blocks ################################################## self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 7 #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(-100, 0) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') 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(0.2) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) 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" == "float" or "complex" == "msg_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(7): 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_layout.addWidget(self._qtgui_freq_sink_x_0_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-100, 0) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf(7, (), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) 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(101.7e6, 0) self.osmosdr_source_0.set_freq_corr(55, 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(30, 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) ################################################## # Connections ################################################## self.connect((self.osmosdr_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_0_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_0_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_0_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_0_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.qtgui_freq_sink_x_0_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.qtgui_freq_sink_x_0_0, 6))
def __init__(self): gr.top_block.__init__(self, "Dect Multirx") Qt.QWidget.__init__(self) self.setWindowTitle("Dect Multirx") 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", "dect_multirx") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 1.152e6 self.samp_rate = samp_rate = 20e6 self.rf_gain = rf_gain = 10 self.ppm = ppm = 0 self.if_gain = if_gain = 20 self.channels = channels = 11 self.ch_tb = ch_tb = 1.728e6 - symbol_rate self.ch_bw = ch_bw = 1.728e6 self.bb_gain = bb_gain = 20 self.atten = atten = 60 self.total_bw = total_bw = ch_bw * channels self.range_rf_gain = range_rf_gain = rf_gain self.range_ppm = range_ppm = ppm self.range_if_gain = range_if_gain = if_gain self.range_bb_gain = range_bb_gain = bb_gain self.pfb_taps = pfb_taps = firdes.low_pass_2(1, samp_rate, ch_bw, ch_tb, atten, firdes.WIN_HANN) self.bb_freq = bb_freq = 1897.344e6 - (5 * 1.728e6) ################################################## # Blocks ################################################## self.rational_resampler_xxx_1_1_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_1 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_1_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_1 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_0_1 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_0_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=4, decimation=3, taps=None, fractional_bw=None) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=594, decimation=625, taps=None, fractional_bw=None) self._range_rf_gain_range = Range(0, 100, 1, rf_gain, 200) self._range_rf_gain_win = RangeWidget(self._range_rf_gain_range, self.set_range_rf_gain, 'RF Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._range_rf_gain_win) self._range_ppm_range = Range(-70, 70, 1, ppm, 200) self._range_ppm_win = RangeWidget(self._range_ppm_range, self.set_range_ppm, 'PPM', "counter_slider", float) self.top_grid_layout.addWidget(self._range_ppm_win) self._range_if_gain_range = Range(0, 100, 1, if_gain, 200) self._range_if_gain_win = RangeWidget(self._range_if_gain_range, self.set_range_if_gain, 'IF Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._range_if_gain_win) self._range_bb_gain_range = Range(0, 100, 1, bb_gain, 200) self._range_bb_gain_win = RangeWidget(self._range_bb_gain_range, self.set_range_bb_gain, 'BB Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._range_bb_gain_win) 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) 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 range(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.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( 11, pfb_taps, 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map([]) self.pfb_channelizer_ccf_0.declare_sample_delay(0) 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(bb_freq, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_gain(rf_gain, 0) self.osmosdr_source_0.set_if_gain(if_gain, 0) self.osmosdr_source_0.set_bb_gain(bb_gain, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(20e6, 0) self.digital_gmsk_demod_0_1_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_1 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_1_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_1 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_0_1 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_0_0_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_0_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0, verbose=False, log=False) self.blocks_udp_sink_0_1_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2330, 1472, True) self.blocks_udp_sink_0_1 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2326, 1472, True) self.blocks_udp_sink_0_0_1_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2331, 1472, True) self.blocks_udp_sink_0_0_1 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2327, 1472, True) self.blocks_udp_sink_0_0_0_1 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2329, 1472, True) self.blocks_udp_sink_0_0_0_0_0 = blocks.udp_sink( gr.sizeof_char * 1, '127.0.0.1', 2332, 1472, True) self.blocks_udp_sink_0_0_0_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2328, 1472, True) self.blocks_udp_sink_0_0_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2325, 1472, True) self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2324, 1472, True) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 2323, 1472, True) self.blocks_pack_k_bits_bb_0_1_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_1 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_1_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_1 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_0_1 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_0_0_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_0_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) ################################################## # Connections ################################################## self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0, 0), (self.blocks_udp_sink_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_0, 0), (self.blocks_udp_sink_0_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_0_0, 0), (self.blocks_udp_sink_0_0_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_0_0_0, 0), (self.blocks_udp_sink_0_0_0_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_0_1, 0), (self.blocks_udp_sink_0_0_0_1, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_1, 0), (self.blocks_udp_sink_0_0_1, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0_1_0, 0), (self.blocks_udp_sink_0_0_1_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_1, 0), (self.blocks_udp_sink_0_1, 0)) self.connect((self.blocks_pack_k_bits_bb_0_1_0, 0), (self.blocks_udp_sink_0_1_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.digital_gmsk_demod_0_0, 0), (self.blocks_pack_k_bits_bb_0_0, 0)) self.connect((self.digital_gmsk_demod_0_0_0, 0), (self.blocks_pack_k_bits_bb_0_0_0, 0)) self.connect((self.digital_gmsk_demod_0_0_0_0, 0), (self.blocks_pack_k_bits_bb_0_0_0_0, 0)) self.connect((self.digital_gmsk_demod_0_0_0_0_0, 0), (self.blocks_pack_k_bits_bb_0_0_0_0_0, 0)) self.connect((self.digital_gmsk_demod_0_0_0_1, 0), (self.blocks_pack_k_bits_bb_0_0_0_1, 0)) self.connect((self.digital_gmsk_demod_0_0_1, 0), (self.blocks_pack_k_bits_bb_0_0_1, 0)) self.connect((self.digital_gmsk_demod_0_0_1_0, 0), (self.blocks_pack_k_bits_bb_0_0_1_0, 0)) self.connect((self.digital_gmsk_demod_0_1, 0), (self.blocks_pack_k_bits_bb_0_1, 0)) self.connect((self.digital_gmsk_demod_0_1_0, 0), (self.blocks_pack_k_bits_bb_0_1_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.rational_resampler_xxx_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.rational_resampler_xxx_1_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.rational_resampler_xxx_1_0_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.rational_resampler_xxx_1_0_0_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.rational_resampler_xxx_1_0_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.rational_resampler_xxx_1_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 9), (self.rational_resampler_xxx_1_0_1_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.rational_resampler_xxx_1_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 8), (self.rational_resampler_xxx_1_1_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.digital_gmsk_demod_0_0, 0)) self.connect((self.rational_resampler_xxx_1_0_0, 0), (self.digital_gmsk_demod_0_0_0, 0)) self.connect((self.rational_resampler_xxx_1_0_0_0, 0), (self.digital_gmsk_demod_0_0_0_0, 0)) self.connect((self.rational_resampler_xxx_1_0_0_0_0, 0), (self.digital_gmsk_demod_0_0_0_0_0, 0)) self.connect((self.rational_resampler_xxx_1_0_0_1, 0), (self.digital_gmsk_demod_0_0_0_1, 0)) self.connect((self.rational_resampler_xxx_1_0_1, 0), (self.digital_gmsk_demod_0_0_1, 0)) self.connect((self.rational_resampler_xxx_1_0_1_0, 0), (self.digital_gmsk_demod_0_0_1_0, 0)) self.connect((self.rational_resampler_xxx_1_1, 0), (self.digital_gmsk_demod_0_1, 0)) self.connect((self.rational_resampler_xxx_1_1_0, 0), (self.digital_gmsk_demod_0_1_0, 0))
def __init__(self): gr.top_block.__init__(self, "Multipager") ################################################## # Variables ################################################## self.volume = volume = 0.5 self.squelch = squelch = -20 self.sample_rate = sample_rate = 1e6 self.out_scale = out_scale = 10000 self.num_chan = num_chan = 20 self.freq = freq = 148.664e6 self.decim = decim = 2 self.channel = channel = 19 self.audio_rate = audio_rate = 50e3 ################################################## # Blocks ################################################## if True: self.source = blocks.file_source(gr.sizeof_gr_complex*1, samplefile, True) else: self.source = osmosdr.source(args="hackrf") self.source.set_sample_rate(sample_rate) self.source.set_center_freq(freq, 0) self.source.set_freq_corr(0, 0) self.source.set_dc_offset_mode(0, 0) self.source.set_iq_balance_mode(0, 0) self.source.set_gain_mode(False, 0) self.source.set_gain(0, 0) self.source.set_if_gain(36, 0) self.source.set_bb_gain(44, 0) self.source.set_antenna("", 0) self.source.set_bandwidth(0, 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_chan, (firdes.low_pass(1.0, sample_rate/decim, 7.25e3, 1.5e3, firdes.WIN_HAMMING, 6.76)), 1, 60) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.low_pass_filter_0 = filter.fir_filter_ccf(decim, firdes.low_pass( 1, sample_rate, 400e3, 500e3, firdes.WIN_HAMMING, 6.76)) chwidth = sample_rate / decim / num_chan ################################################## # Connections ################################################## self.connect((self.source, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.pfb_channelizer_ccf_0, 0)) # All channels sel = map(None, range(num_chan)) loop = asyncio.get_event_loop() self.fms = {} for i in range(num_chan): #fifopath = fifopat % (i) fifopath = None if i > num_chan / 2: chfreq = freq + chwidth * (i - num_chan) else: chfreq = freq + chwidth * i if i in sel: print("Channel %d %.3f MHz" % (i, chfreq / 1e6)) command = cmdpat % (chfreq / 1e6) fm = FMtoCommand(squelch, int(sample_rate / num_chan / decim), int(sample_rate / num_chan / decim), 5e3, out_scale, chfreq, command) self.connect((self.pfb_channelizer_ccf_0, i), (fm, 0)) self.fms[chfreq] = fm else: n = blocks.null_sink(gr.sizeof_gr_complex*1) self.connect((self.pfb_channelizer_ccf_0, i), (n, 0))
def __init__(self): gr.top_block.__init__(self, "2M Multi-RX -- 7 simultaneous channels") Qt.QWidget.__init__(self) self.setWindowTitle("2M Multi-RX -- 7 simultaneous channels") 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", "noaa_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.noaa_num_chans = noaa_num_chans = 7 self.noaa_chan_width = noaa_chan_width = int(15e3) self.noaa_band_start = noaa_band_start = 146.475e6 self.oversampled_width = oversampled_width = noaa_chan_width * ( noaa_num_chans + 1) self.noaa_fm_dev = noaa_fm_dev = int(5e3) self.noaa_band_center = noaa_band_center = noaa_band_start + ( noaa_num_chans / 2 * noaa_chan_width) self.hardware_rate = hardware_rate = int(1e6) self.tuner_freq = tuner_freq = 146.4e6 self.target_freq = target_freq = noaa_band_center self.ppm = ppm = 0 self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width, noaa_fm_dev * 2, 1000, firdes.WIN_HAMMING, 6.76) self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate, oversampled_width / 2, noaa_chan_width, firdes.WIN_HAMMING, 6.76) self.channel_map = channel_map = range(0, noaa_num_chans) self.volume = volume = 0.4 self.tuner_offset = tuner_offset = target_freq - tuner_freq self.squelch = squelch = -55 self.sq_ramp = sq_ramp = 10 self.sq_alpha = sq_alpha = 0.005 self.ppm_corr = ppm_corr = tuner_freq * (ppm / 1e6) self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps) self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans self.noaa_band_end = noaa_band_end = noaa_band_start + ( noaa_num_chans * noaa_chan_width) self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps) self.fftwidth = fftwidth = 512 self.fft_interval = fft_interval = 1.0 / 20 self.decimation = decimation = hardware_rate / oversampled_width self.channelizer_map = channelizer_map = 5, 6, 7, 0, 1, 2, 3 self.channel_names = channel_names = map( lambda x: "%.3fMHz" % (146.475 + (x * 0.015)), channel_map) self.ch6_mute = ch6_mute = 1 self.ch5_mute = ch5_mute = 1 self.ch4_mute = ch4_mute = 1 self.ch3_mute = ch3_mute = 1 self.ch2_mute = ch2_mute = 1 self.ch1_mute = ch1_mute = 1 self.ch0_mute = ch0_mute = 1 self.audio_rate = audio_rate = 15000 ################################################## # Blocks ################################################## self._volume_range = Range(0, 1, 0.01, 0.4, 50) self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "slider", float) self.top_grid_layout.addWidget(self._volume_win, 0, 0, 1, 3) self._squelch_range = Range(-70, -30, 2, -55, 50) self._squelch_win = RangeWidget(self._squelch_range, self.set_squelch, "squelch", "slider", float) self.top_grid_layout.addWidget(self._squelch_win, 0, 3, 1, 3) self._ch6_mute_options = ( 0, 1, ) self._ch6_mute_labels = ( "Mute", "Unmute", ) self._ch6_mute_group_box = Qt.QGroupBox("Ch6") self._ch6_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch6_mute_button_group = variable_chooser_button_group() self._ch6_mute_group_box.setLayout(self._ch6_mute_box) for i, label in enumerate(self._ch6_mute_labels): radio_button = Qt.QRadioButton(label) self._ch6_mute_box.addWidget(radio_button) self._ch6_mute_button_group.addButton(radio_button, i) self._ch6_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch6_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch6_mute_options.index(i))) self._ch6_mute_callback(self.ch6_mute) self._ch6_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch6_mute(self._ch6_mute_options[i])) self.top_grid_layout.addWidget(self._ch6_mute_group_box, 1, 6, 1, 1) self._ch5_mute_options = ( 0, 1, ) self._ch5_mute_labels = ( "Mute", "Unmute", ) self._ch5_mute_group_box = Qt.QGroupBox("Ch5") self._ch5_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch5_mute_button_group = variable_chooser_button_group() self._ch5_mute_group_box.setLayout(self._ch5_mute_box) for i, label in enumerate(self._ch5_mute_labels): radio_button = Qt.QRadioButton(label) self._ch5_mute_box.addWidget(radio_button) self._ch5_mute_button_group.addButton(radio_button, i) self._ch5_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch5_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch5_mute_options.index(i))) self._ch5_mute_callback(self.ch5_mute) self._ch5_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch5_mute(self._ch5_mute_options[i])) self.top_grid_layout.addWidget(self._ch5_mute_group_box, 1, 5, 1, 1) self._ch4_mute_options = ( 0, 1, ) self._ch4_mute_labels = ( "Mute", "Unmute", ) self._ch4_mute_group_box = Qt.QGroupBox("Ch4") self._ch4_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch4_mute_button_group = variable_chooser_button_group() self._ch4_mute_group_box.setLayout(self._ch4_mute_box) for i, label in enumerate(self._ch4_mute_labels): radio_button = Qt.QRadioButton(label) self._ch4_mute_box.addWidget(radio_button) self._ch4_mute_button_group.addButton(radio_button, i) self._ch4_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch4_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch4_mute_options.index(i))) self._ch4_mute_callback(self.ch4_mute) self._ch4_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch4_mute(self._ch4_mute_options[i])) self.top_grid_layout.addWidget(self._ch4_mute_group_box, 1, 4, 1, 1) self._ch2_mute_options = ( 0, 1, ) self._ch2_mute_labels = ( "Mute", "Unmute", ) self._ch2_mute_group_box = Qt.QGroupBox("Ch2") self._ch2_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch2_mute_button_group = variable_chooser_button_group() self._ch2_mute_group_box.setLayout(self._ch2_mute_box) for i, label in enumerate(self._ch2_mute_labels): radio_button = Qt.QRadioButton(label) self._ch2_mute_box.addWidget(radio_button) self._ch2_mute_button_group.addButton(radio_button, i) self._ch2_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch2_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch2_mute_options.index(i))) self._ch2_mute_callback(self.ch2_mute) self._ch2_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch2_mute(self._ch2_mute_options[i])) self.top_grid_layout.addWidget(self._ch2_mute_group_box, 1, 2, 1, 1) self._ch1_mute_options = ( 0, 1, ) self._ch1_mute_labels = ( "Mute", "Unmute", ) self._ch1_mute_group_box = Qt.QGroupBox("Ch1") self._ch1_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch1_mute_button_group = variable_chooser_button_group() self._ch1_mute_group_box.setLayout(self._ch1_mute_box) for i, label in enumerate(self._ch1_mute_labels): radio_button = Qt.QRadioButton(label) self._ch1_mute_box.addWidget(radio_button) self._ch1_mute_button_group.addButton(radio_button, i) self._ch1_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch1_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch1_mute_options.index(i))) self._ch1_mute_callback(self.ch1_mute) self._ch1_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch1_mute(self._ch1_mute_options[i])) self.top_grid_layout.addWidget(self._ch1_mute_group_box, 1, 1, 1, 1) self._ch0_mute_options = ( 0, 1, ) self._ch0_mute_labels = ( "Mute", "Unmute", ) self._ch0_mute_group_box = Qt.QGroupBox("Ch0") self._ch0_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch0_mute_button_group = variable_chooser_button_group() self._ch0_mute_group_box.setLayout(self._ch0_mute_box) for i, label in enumerate(self._ch0_mute_labels): radio_button = Qt.QRadioButton(label) self._ch0_mute_box.addWidget(radio_button) self._ch0_mute_button_group.addButton(radio_button, i) self._ch0_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch0_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch0_mute_options.index(i))) self._ch0_mute_callback(self.ch0_mute) self._ch0_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch0_mute(self._ch0_mute_options[i])) self.top_grid_layout.addWidget(self._ch0_mute_group_box, 1, 0, 1, 1) self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "") self.rtlsdr_source_0.set_clock_source("internal", 0) self.rtlsdr_source_0.set_sample_rate(hardware_rate) self.rtlsdr_source_0.set_center_freq(tuner_freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(2, 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(10, 0) self.rtlsdr_source_0.set_if_gain(30, 0) self.rtlsdr_source_0.set_bb_gain(40, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=15, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0_0 = qtgui.waterfall_sink_c( fftwidth, #size firdes.WIN_BLACKMAN_hARRIS, #wintype target_freq, #fc oversampled_width, #bw "Band Monitor", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0_0.set_update_time(fft_interval) self.qtgui_waterfall_sink_x_0_0_0.enable_grid(True) if not True: self.qtgui_waterfall_sink_x_0_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0_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_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0_0.set_intensity_range(-100, 0) self._qtgui_waterfall_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_0_win, 2, 0, 1, 9) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( fftwidth, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc noaa_chan_width, #bw "Channelizer Output", #name noaa_num_chans #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(fft_interval) self.qtgui_freq_sink_x_0.set_y_axis(-100, 0) 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.1) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = [ channel_names[0], channel_names[1], channel_names[2], channel_names[3], channel_names[4], channel_names[5], channel_names[6], "channel_names[7]", "", "" ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "dark red", "dark green", "dark blue", "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(noaa_num_chans): 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, 3, 0, 1, 9) self._ppm_range = Range(-60, 60, 1, 0, 50) self._ppm_win = RangeWidget(self._ppm_range, self.set_ppm, "ppm", "slider", float) self.top_grid_layout.addWidget(self._ppm_win, 0, 6, 1, 3) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( noaa_num_chans + 1, (pfb_taps), 1, 1) self.pfb_channelizer_ccf_0.set_channel_map((channelizer_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc( int(decimation), (lpf_taps), tuner_offset + ppm_corr, hardware_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self._ch3_mute_options = ( 0, 1, ) self._ch3_mute_labels = ( "Mute", "Unmute", ) self._ch3_mute_group_box = Qt.QGroupBox("Ch3") self._ch3_mute_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ch3_mute_button_group = variable_chooser_button_group() self._ch3_mute_group_box.setLayout(self._ch3_mute_box) for i, label in enumerate(self._ch3_mute_labels): radio_button = Qt.QRadioButton(label) self._ch3_mute_box.addWidget(radio_button) self._ch3_mute_button_group.addButton(radio_button, i) self._ch3_mute_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ch3_mute_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ch3_mute_options.index(i))) self._ch3_mute_callback(self.ch3_mute) self._ch3_mute_button_group.buttonClicked[int].connect( lambda i: self.set_ch3_mute(self._ch3_mute_options[i])) self.top_grid_layout.addWidget(self._ch3_mute_group_box, 1, 3, 1, 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_1_2_0_1 = blocks.multiply_const_vcc( (ch6_mute, )) self.blocks_multiply_const_vxx_1_2_0_0 = blocks.multiply_const_vcc( (ch5_mute, )) self.blocks_multiply_const_vxx_1_2_0 = blocks.multiply_const_vcc( (ch4_mute, )) self.blocks_multiply_const_vxx_1_1_0 = blocks.multiply_const_vcc( (ch2_mute, )) self.blocks_multiply_const_vxx_1_1 = blocks.multiply_const_vcc( (ch2_mute, )) self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vcc( (ch1_mute, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc( (ch0_mute, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (volume, )) self.blocks_add_xx_0_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_pwr_squelch_xx_0_2_0_1 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0_2_0_0 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0_2_0 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0_2 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0_1 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( squelch, sq_alpha, sq_ramp, False) self.analog_nbfm_rx_0_2_0_1 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0_2_0_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0_2_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0_2 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0_1 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.analog_nbfm_rx_0_1, 0), (self.blocks_add_xx_0_0, 2)) self.connect((self.analog_nbfm_rx_0_2, 0), (self.blocks_add_xx_0_0, 3)) self.connect((self.analog_nbfm_rx_0_2_0, 0), (self.blocks_add_xx_0_0, 4)) self.connect((self.analog_nbfm_rx_0_2_0_0, 0), (self.blocks_add_xx_0_0, 5)) self.connect((self.analog_nbfm_rx_0_2_0_1, 0), (self.blocks_add_xx_0_0, 6)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_multiply_const_vxx_1_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_1, 0), (self.blocks_multiply_const_vxx_1_1, 0)) self.connect((self.analog_pwr_squelch_xx_0_2, 0), (self.blocks_multiply_const_vxx_1_1_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_2_0, 0), (self.blocks_multiply_const_vxx_1_2_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_2_0_0, 0), (self.blocks_multiply_const_vxx_1_2_0_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_2_0_1, 0), (self.blocks_multiply_const_vxx_1_2_0_1, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.analog_nbfm_rx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1_1, 0), (self.analog_nbfm_rx_0_1, 0)) self.connect((self.blocks_multiply_const_vxx_1_1_0, 0), (self.analog_nbfm_rx_0_2, 0)) self.connect((self.blocks_multiply_const_vxx_1_2_0, 0), (self.analog_nbfm_rx_0_2_0, 0)) self.connect((self.blocks_multiply_const_vxx_1_2_0_0, 0), (self.analog_nbfm_rx_0_2_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1_2_0_1, 0), (self.analog_nbfm_rx_0_2_0_1, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.qtgui_waterfall_sink_x_0_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.analog_pwr_squelch_xx_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.analog_pwr_squelch_xx_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.analog_pwr_squelch_xx_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.analog_pwr_squelch_xx_0_2_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.analog_pwr_squelch_xx_0_2_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.analog_pwr_squelch_xx_0_2_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.qtgui_freq_sink_x_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.qtgui_freq_sink_x_0, 6)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_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.samp_rate = samp_rate = 15e6 self.integration_bandwidth = integration_bandwidth = 2.5e3 self.if_bandwidth_2 = if_bandwidth_2 = .75e6 self.dec_rate_1 = dec_rate_1 = 5 self.samp_rate_2 = samp_rate_2 = samp_rate / dec_rate_1 self.num_channels = num_channels = int(if_bandwidth_2 / integration_bandwidth) self.samp_rate_3 = samp_rate_3 = samp_rate_2 / num_channels self.integration_time = integration_time = .5 self.variable_function_probe = variable_function_probe = 0 self.output_samp_rate = output_samp_rate = 1.0 / integration_time self.integration_dec_rate = integration_dec_rate = int( integration_time * samp_rate_3 / 2) self.if_bandwidth_0 = if_bandwidth_0 = 4.5e6 self.gain = gain = 60 self.freq = freq = 1.4204e9 self.channel_map = channel_map = range( int(num_channels / 2.0 + 1.0), num_channels, 1) + range( 0, int(num_channels / 2.0 + 1.0), 1) ################################################## # Blocks ################################################## self.probe_signal = blocks.probe_signal_vf(num_channels) self._gain_range = Range(0, 70, 1, 60, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", int) self.top_layout.addWidget(self._gain_win) def _variable_function_probe_probe(): while True: val = self.probe_signal.level() try: self.set_variable_function_probe(val) except AttributeError: pass pytime.sleep(1.0 / (10)) _variable_function_probe_thread = threading.Thread( target=_variable_function_probe_probe) _variable_function_probe_thread.daemon = True _variable_function_probe_thread.start() self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_channels, (firdes.low_pass(1, samp_rate_2, integration_bandwidth, 250, firdes.WIN_HAMMING)), 1.0, 0) self.pfb_channelizer_ccf_0.set_channel_map((channel_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.low_pass_filter_1 = filter.fir_filter_ccf( dec_rate_1, firdes.low_pass(10, samp_rate, if_bandwidth_2, 1e5, firdes.WIN_HAMMING, 6.76)) self.limesdr_source_2 = limesdr.source('0009072C02873717', 2, 1, 0, 0, '', freq - 800e3, samp_rate, 0, 1, 15e6, 0, 10e6, 3, 2, 2, 1, if_bandwidth_0, 1, 5e6, 1, if_bandwidth_0, 0, 0, gain, 30, 0, 0, 0, 0) self.blocks_streams_to_vector_0 = blocks.streams_to_vector( gr.sizeof_gr_complex * 1, num_channels) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_integrate_xx_0_0 = blocks.integrate_ff( integration_dec_rate, num_channels) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_gr_complex * 1, '/home/w1xm-admin/Documents/DSP/data_out/recieve_block_sink', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_copy_0_0 = blocks.copy(gr.sizeof_gr_complex * 1) self.blocks_copy_0_0.set_enabled(False) self.blocks_copy_0 = blocks.copy(gr.sizeof_gr_complex * 1) self.blocks_copy_0.set_enabled(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( num_channels) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_SIN_WAVE, -800e3, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0_0, 0)) self.connect((self.blocks_copy_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_copy_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_integrate_xx_0_0, 0), (self.probe_signal, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_streams_to_vector_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.limesdr_source_2, 0), (self.blocks_copy_0, 0)) self.connect((self.limesdr_source_2, 0), (self.blocks_copy_0_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.pfb_channelizer_ccf_0, 0)) for i in range(num_channels): self.connect((self.pfb_channelizer_ccf_0, i), (self.blocks_streams_to_vector_0, i))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Elster Rx Multi") ################################################## # Variables ################################################## self.window_size = window_size = (800, 600) self.samp_rate = samp_rate = 2400000 self.rx_gain = rx_gain = 45 self.corr = corr = 0 self.channel_rate = channel_rate = 400000 self.channel_decimation = channel_decimation = 4 self.ch_filt_trans = ch_filt_trans = 10000 self.ch_filt_cut = ch_filt_cut = 35000 self.center_freq = center_freq = 904600000 ################################################## # Blocks ################################################## self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band spectrum") self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band waterfall") self.Add(self.nb) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.nb.GetPage(1).GetWin(), baseband_freq=center_freq, dynamic_range=50, ref_level=-30, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='Waterfall Plot', size=(window_size), ) self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.nb.GetPage(0).GetWin(), baseband_freq=center_freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=True, size=(window_size), ) self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(center_freq), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( samp_rate / channel_rate, (firdes.low_pass( 1, samp_rate, 175000, 50000, firdes.WIN_HAMMING, 6.76)), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.elster_packetize_0 = elster.packetize(6) self.digital_pfb_clock_sync_xxx_0_0_2 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_1 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0_1 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff( channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100, (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2), 1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5, 1) self.digital_binary_slicer_fb_0_4 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_3 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_2 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_1 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() _corr_sizer = wx.BoxSizer(wx.VERTICAL) self._corr_text_box = forms.text_box( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, label='Freq. correction', converter=forms.float_converter(), proportion=0, ) self._corr_slider = forms.slider( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, minimum=-100, maximum=100, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_corr_sizer) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -200000, 1, 0) self.analog_quadrature_demod_cf_0_4 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_3 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_2 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_1 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( channel_rate / (115000 * 2 * 3.1416)) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_pfb_clock_sync_xxx_0_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_1, 0), (self.digital_pfb_clock_sync_xxx_0_0_1, 0)) self.connect((self.analog_quadrature_demod_cf_0_2, 0), (self.digital_pfb_clock_sync_xxx_0_0_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_3, 0), (self.digital_pfb_clock_sync_xxx_0_0_2, 0)) self.connect((self.analog_quadrature_demod_cf_0_4, 0), (self.digital_pfb_clock_sync_xxx_0_0_0_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.elster_packetize_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.elster_packetize_0, 1)) self.connect((self.digital_binary_slicer_fb_0_1, 0), (self.elster_packetize_0, 2)) self.connect((self.digital_binary_slicer_fb_0_2, 0), (self.elster_packetize_0, 3)) self.connect((self.digital_binary_slicer_fb_0_3, 0), (self.elster_packetize_0, 4)) self.connect((self.digital_binary_slicer_fb_0_4, 0), (self.elster_packetize_0, 5)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_0, 0), (self.digital_binary_slicer_fb_0_2, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_1, 0), (self.digital_binary_slicer_fb_0_4, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_1, 0), (self.digital_binary_slicer_fb_0_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0_2, 0), (self.digital_binary_slicer_fb_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.analog_quadrature_demod_cf_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.analog_quadrature_demod_cf_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.analog_quadrature_demod_cf_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.analog_quadrature_demod_cf_0_4, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "NOAA Demo based on PFB Channelizer Demo") Qt.QWidget.__init__(self) self.setWindowTitle("NOAA Demo based on PFB Channelizer Demo") 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", "noaa_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.noaa_num_chans = noaa_num_chans = 7 self.noaa_chan_width = noaa_chan_width = int(25e3) self.noaa_band_start = noaa_band_start = 162.4e6 self.oversampled_width = oversampled_width = noaa_chan_width * ( noaa_num_chans + 1) self.noaa_fm_dev = noaa_fm_dev = int(5e3) self.noaa_band_center = noaa_band_center = noaa_band_start + ( noaa_num_chans / 2 * noaa_chan_width) self.hardware_rate = hardware_rate = int(1e6) self.tuner_freq = tuner_freq = 162.3e6 self.target_freq = target_freq = noaa_band_center self.ppm = ppm = 0 self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width, noaa_fm_dev * 2, 1000, firdes.WIN_HAMMING, 6.76) self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate, oversampled_width / 2, noaa_chan_width, firdes.WIN_HAMMING, 6.76) self.channel_map = channel_map = range(0, noaa_num_chans) self.volume = volume = 0.15 self.tuner_offset = tuner_offset = target_freq - tuner_freq self.ppm_corr = ppm_corr = tuner_freq * (ppm / 1e6) self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps) self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans self.noaa_band_end = noaa_band_end = noaa_band_start + ( noaa_num_chans * noaa_chan_width) self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps) self.fftwidth = fftwidth = 512 self.fft_interval = fft_interval = 1.0 / 20 self.decimation = decimation = hardware_rate / oversampled_width self.channelizer_map = channelizer_map = 5, 6, 7, 0, 1, 2, 3 self.channel_names = channel_names = map( lambda x: "%.3fMHz" % (162.4 + (x * 0.025)), channel_map) self.chan_num = chan_num = channel_map[6] ################################################## # Blocks ################################################## self._volume_layout = Qt.QVBoxLayout() self._volume_label = Qt.QLabel("volume") self._volume_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._volume_slider.setRange(0, 1, 0.05) self._volume_slider.setValue(self.volume) self._volume_slider.setMinimumWidth(50) self._volume_slider.valueChanged.connect(self.set_volume) self._volume_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) self._volume_layout.addWidget(self._volume_label) self._volume_layout.addWidget(self._volume_slider) self.top_grid_layout.addLayout(self._volume_layout, 0, 1, 1, 1) self._chan_num_options = channel_map self._chan_num_labels = channel_names self._chan_num_tool_bar = Qt.QToolBar(self) self._chan_num_tool_bar.addWidget(Qt.QLabel("Channel" + ": ")) self._chan_num_combo_box = Qt.QComboBox() self._chan_num_tool_bar.addWidget(self._chan_num_combo_box) for label in self._chan_num_labels: self._chan_num_combo_box.addItem(label) self._chan_num_callback = lambda i: Qt.QMetaObject.invokeMethod( self._chan_num_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._chan_num_options.index(i))) self._chan_num_callback(self.chan_num) self._chan_num_combo_box.currentIndexChanged.connect( lambda i: self.set_chan_num(self._chan_num_options[i])) self.top_grid_layout.addWidget(self._chan_num_tool_bar, 0, 0, 1, 1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source("external", 0) self.uhd_usrp_source_0.set_subdev_spec("A:0", 0) self.uhd_usrp_source_0.set_samp_rate(hardware_rate) self.uhd_usrp_source_0.set_center_freq(tuner_freq, 0) self.uhd_usrp_source_0.set_gain(30, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=25, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate, #bw "Radoi Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_0_win = sip.wrapinstance( self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate / decimation, #bw "Filtered Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self._ppm_layout = Qt.QVBoxLayout() self._ppm_label = Qt.QLabel("ppm") self._ppm_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._ppm_slider.setRange(-20, 20, 0.5) self._ppm_slider.setValue(self.ppm) self._ppm_slider.setMinimumWidth(50) self._ppm_slider.valueChanged.connect(self.set_ppm) self._ppm_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) self._ppm_layout.addWidget(self._ppm_label) self._ppm_layout.addWidget(self._ppm_slider) self.top_grid_layout.addLayout(self._ppm_layout, 0, 2, 1, 1) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( noaa_num_chans + 1, (pfb_taps), 1, 1) self.pfb_channelizer_ccf_0.set_channel_map((channelizer_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc( int(decimation), (lpf_taps), tuner_offset + ppm_corr, hardware_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.blocks_multiply_const_vxx_0_7 = blocks.multiply_const_vcc((50, )) self.blocks_multiply_const_vxx_0_6_0 = blocks.multiply_const_vff( (volume, )) self.blocks_multiply_const_vxx_0_6 = blocks.multiply_const_vcc((10, )) self.blocks_multiply_const_vxx_0_5_0 = blocks.multiply_const_vcc( (1 if chan_num is 7 else 0, )) self.blocks_multiply_const_vxx_0_5 = blocks.multiply_const_vcc( (1 if chan_num is 6 else 0, )) self.blocks_multiply_const_vxx_0_4 = blocks.multiply_const_vcc( (1 if chan_num is 5 else 0, )) self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vcc( (1 if chan_num is 4 else 0, )) self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc( (1 if chan_num is 3 else 0, )) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc( (1 if chan_num is 2 else 0, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc( (1 if chan_num is 1 else 0, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (1 if chan_num is 0 else 0, )) self.blocks_add_xx_0 = blocks.add_vcc(1) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=noaa_chan_width, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_add_xx_0, 3)) self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0, 4)) self.connect((self.blocks_multiply_const_vxx_0_4, 0), (self.blocks_add_xx_0, 5)) self.connect((self.blocks_multiply_const_vxx_0_5, 0), (self.blocks_add_xx_0, 6)) self.connect((self.blocks_multiply_const_vxx_0_5_0, 0), (self.blocks_add_xx_0, 7)) self.connect((self.blocks_multiply_const_vxx_0_6, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_6_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_7, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0_6_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0_7, 0)) self.connect((self.blocks_multiply_const_vxx_0_7, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0_6, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_multiply_const_vxx_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_multiply_const_vxx_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_multiply_const_vxx_0_4, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_multiply_const_vxx_0_5, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_multiply_const_vxx_0_5_0, 0))
def __init__(self): gr.top_block.__init__(self, "Fm Channelizer") Qt.QWidget.__init__(self) self.setWindowTitle("Fm Channelizer") 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", "fm_channelizer") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.synth_channels = synth_channels = 6 self.channels = channels = 10 self.ch_rate = ch_rate = 100e3 self.samp_rate = samp_rate = ch_rate * channels self.gain = gain = 20 self.fm_quad_rate = fm_quad_rate = ch_rate * synth_channels self.ch_tb = ch_tb = 20e3 self.ch_bw = ch_bw = ch_rate / 2 self.audio_rate = audio_rate = 60e3 self.atten = atten = 80 self.volume = volume = 0.1 self.tun_gain = tun_gain = gain self.pfb_taps = pfb_taps = firdes.low_pass_2(1, samp_rate, ch_bw, ch_tb, atten, firdes.WIN_BLACKMAN_HARRIS) self.pfb_synth_taps = pfb_synth_taps = firdes.low_pass_2( channels / 2, synth_channels * ch_rate, ch_bw, ch_tb, atten, firdes.WIN_BLACKMAN_HARRIS ) self.freq_corr = freq_corr = 0 self.fm_audio_decim = fm_audio_decim = int(fm_quad_rate / audio_rate) * 2 self.channel = channel = 0 self.center_freq = center_freq = 101.1e6 + 0e3 self.address = address = "" ################################################## # Blocks ################################################## self._volume_layout = Qt.QVBoxLayout() self._volume_tool_bar = Qt.QToolBar(self) self._volume_layout.addWidget(self._volume_tool_bar) self._volume_tool_bar.addWidget(Qt.QLabel("Volume" + ": ")) 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._volume_counter = qwt_counter_pyslot() self._volume_counter.setRange(0, 10, 0.1) self._volume_counter.setNumButtons(2) self._volume_counter.setValue(self.volume) self._volume_tool_bar.addWidget(self._volume_counter) self._volume_counter.valueChanged.connect(self.set_volume) self._volume_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._volume_slider.setRange(0, 10, 0.1) self._volume_slider.setValue(self.volume) self._volume_slider.setMinimumWidth(200) self._volume_slider.valueChanged.connect(self.set_volume) self._volume_layout.addWidget(self._volume_slider) self.top_grid_layout.addLayout(self._volume_layout, 3, 0, 1, 1) self._tun_gain_layout = Qt.QVBoxLayout() self._tun_gain_tool_bar = Qt.QToolBar(self) self._tun_gain_layout.addWidget(self._tun_gain_tool_bar) self._tun_gain_tool_bar.addWidget(Qt.QLabel("Gain (dB)" + ": ")) 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._tun_gain_counter = qwt_counter_pyslot() self._tun_gain_counter.setRange(0, 70, 1) self._tun_gain_counter.setNumButtons(2) self._tun_gain_counter.setValue(self.tun_gain) self._tun_gain_tool_bar.addWidget(self._tun_gain_counter) self._tun_gain_counter.valueChanged.connect(self.set_tun_gain) self._tun_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._tun_gain_slider.setRange(0, 70, 1) self._tun_gain_slider.setValue(self.tun_gain) self._tun_gain_slider.setMinimumWidth(200) self._tun_gain_slider.valueChanged.connect(self.set_tun_gain) self._tun_gain_layout.addWidget(self._tun_gain_slider) self.top_grid_layout.addLayout(self._tun_gain_layout, 2, 1, 1, 1) self._freq_corr_layout = Qt.QVBoxLayout() self._freq_corr_tool_bar = Qt.QToolBar(self) self._freq_corr_layout.addWidget(self._freq_corr_tool_bar) self._freq_corr_tool_bar.addWidget(Qt.QLabel("Frequency Correction" + ": ")) 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._freq_corr_counter = qwt_counter_pyslot() self._freq_corr_counter.setRange(-40e3, 40e3, 100) self._freq_corr_counter.setNumButtons(2) self._freq_corr_counter.setValue(self.freq_corr) self._freq_corr_tool_bar.addWidget(self._freq_corr_counter) self._freq_corr_counter.valueChanged.connect(self.set_freq_corr) self._freq_corr_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._freq_corr_slider.setRange(-40e3, 40e3, 100) self._freq_corr_slider.setValue(self.freq_corr) self._freq_corr_slider.setMinimumWidth(200) self._freq_corr_slider.valueChanged.connect(self.set_freq_corr) self._freq_corr_layout.addWidget(self._freq_corr_slider) self.top_grid_layout.addLayout(self._freq_corr_layout, 3, 1, 1, 1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join((address, "")), uhd.stream_args(cpu_format="fc32", channels=range(1)) ) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(center_freq + freq_corr, 0) self.uhd_usrp_source_0.set_gain(tun_gain, 0) self.uhd_usrp_source_0.set_antenna("RX2", 0) self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_c( 1024, # size firdes.WIN_FLATTOP, # wintype 0, # fc ch_rate * synth_channels, # bw "QT GUI Plot", # name 1, # number of inputs ) self.qtgui_freq_sink_x_0_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0) if complex == type(float()): self.qtgui_freq_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win, 1, 1, 1, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, # size firdes.WIN_BLACKMAN_hARRIS, # wintype 0, # fc samp_rate, # bw "QT GUI Plot", # name 1, # number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_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) 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, 1, 2) self.pfb_synthesizer_ccf_0 = filter.pfb_synthesizer_ccf(synth_channels, (pfb_synth_taps), True) self.pfb_synthesizer_ccf_0.set_channel_map(([10, 11, 0, 1, 2, 3])) self.pfb_synthesizer_ccf_0.declare_sample_delay(0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf(channels, (pfb_taps), 2.0, atten) self.pfb_channelizer_ccf_0.set_channel_map(()) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 44.1e3 / (fm_quad_rate / fm_audio_decim), taps=None, flt_size=32 ) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.fir_filter_xxx_0 = filter.fir_filter_ccc( 2, (firdes.low_pass_2(1, ch_rate * synth_channels, 250e3, 300e3, 40, firdes.WIN_BLACKMAN_HARRIS)) ) self.fir_filter_xxx_0.declare_sample_delay(0) self._channel_layout = Qt.QVBoxLayout() self._channel_tool_bar = Qt.QToolBar(self) self._channel_layout.addWidget(self._channel_tool_bar) self._channel_tool_bar.addWidget(Qt.QLabel("Output Channel" + ": ")) 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._channel_counter = qwt_counter_pyslot() self._channel_counter.setRange(0, channels - 1, 1) self._channel_counter.setNumButtons(2) self._channel_counter.setValue(self.channel) self._channel_tool_bar.addWidget(self._channel_counter) self._channel_counter.valueChanged.connect(self.set_channel) self._channel_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._channel_slider.setRange(0, channels - 1, 1) self._channel_slider.setValue(self.channel) self._channel_slider.setMinimumWidth(200) self._channel_slider.valueChanged.connect(self.set_channel) self._channel_layout.addWidget(self._channel_slider) self.top_grid_layout.addLayout(self._channel_layout, 2, 0, 1, 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx = blocks.multiply_const_vff((volume,)) self.audio_sink = audio.sink(44100, "", True) self.analog_wfm_rcv = analog.wfm_rcv(quad_rate=fm_quad_rate, audio_decimation=fm_audio_decim) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_wfm_rcv, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx, 0), (self.audio_sink, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.analog_wfm_rcv, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_null_sink_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 8), (self.blocks_null_sink_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 9), (self.blocks_null_sink_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.pfb_synthesizer_ccf_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.pfb_synthesizer_ccf_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.pfb_synthesizer_ccf_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.pfb_synthesizer_ccf_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.pfb_synthesizer_ccf_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.pfb_synthesizer_ccf_0, 5)) self.connect((self.pfb_synthesizer_ccf_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.analog_agc2_xx_0, 0))
def __init__(self, center_freq, samp_rate, chan_width, chan_align_fn, need_Nx=False, sps=4): # Pre-compute params # Grid alignement mid_center_freq = chan_align_fn(center_freq) if abs(mid_center_freq - center_freq) > 200: self.rotation = 2.0 * math.pi * (self.center_freq - new_center_freq) / samp_rate else: self.rotation = 0 # Save pfb alignement data self.pfb_center_freq = mid_center_freq self.pfb_chan_width = chan_width # Channel count (must be even !) self.n_chans = (int(math.ceil(samp_rate / chan_width)) + 1) & ~1 # Resampling self.resamp = (self.n_chans * chan_width) / samp_rate if abs(self.resamp - 1.0) < 1e-5: self.resamp = 1.0 mid_samp_rate = samp_rate else: mid_samp_rate = (math.ceil(self.samp_rate / chan_width) * chan_width) # PFB taps if need_Nx: # Need multiple width channels, so we need a filter supporting perfect reconstruction ! self.taps = firdes.low_pass_2(1.0, self.n_chans, 0.5, 0.2, 80, firdes.WIN_BLACKMAN_HARRIS) else: # Use a looser filter to reduce CPU self.taps = firdes.low_pass( 1.0, mid_samp_rate, chan_width * 0.50, chan_width * 0.25, ) # Super gr.hier_block2.__init__( self, "OutputBranch", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(self.n_chans, self.n_chans, gr.sizeof_gr_complex)) prev = self # Pre-rotation if self.rotation: self.rotator = blocks.rotator_cc(self.rotation) self.connect((prev, 0), (self.rotator, 0)) prev = self.rotator # Pre-resampling if self.resamp != 1: self.resamp = pfb.arb_resampler_ccf(self.resamp, taps=None, flt_size=32) self.connect((prev, 0), (self.resamp, 0)) prev = self.resamp # Channelizer self.channelizer = pfb.channelizer_ccf(self.n_chans, self.taps, 2, 100) self.connect((prev, 0), (self.channelizer, 0)) # Link all outputs for i in range(self.n_chans): self.connect((self.channelizer, i), (self, i))
def __init__(self): gr.top_block.__init__(self, "Receive Single FM Station") Qt.QWidget.__init__(self) self.setWindowTitle("Receive Single FM Station") 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", "rcv_single_fm") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.rf_rate = rf_rate = 20e6 self.rf_frequency_h = rf_frequency_h = 88.5 self.fm_taps = fm_taps = firdes.low_pass_2(32., rf_rate, 96e3, 25e3, 50) self.audio_rate = audio_rate = 44100 self.taps_len = taps_len = fm_taps.__len__() self.rf_gain = rf_gain = 50 self.rf_frequency = rf_frequency = 98.1e6 self.fm_channel_rate = fm_channel_rate = audio_rate*5 self.channel_number = channel_number = int(10*(rf_frequency_h-98)) /2if rf_frequency_h>=98 else 50 + int(10*(rf_frequency_h-88.1))/2 ################################################## # Blocks ################################################## self._rf_rate_range = Range(100e3, 20e6, 200e3, 20e6, 200) self._rf_rate_win = RangeWidget(self._rf_rate_range, self.set_rf_rate, 'RF sample rate', "counter_slider", float) self.top_layout.addWidget(self._rf_rate_win) self._rf_gain_range = Range(0, 90, 1, 50, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'RF gain', "counter_slider", float) self.top_layout.addWidget(self._rf_gain_win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(rf_rate) self.uhd_usrp_source_0.set_center_freq(rf_frequency, 0) self.uhd_usrp_source_0.set_gain(rf_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self._rf_frequency_h_range = Range(88.0, 108.0, .2, 88.5, 200) self._rf_frequency_h_win = RangeWidget(self._rf_frequency_h_range, self.set_rf_frequency_h, 'RF Frequency', "counter_slider", float) self.top_layout.addWidget(self._rf_frequency_h_win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=fm_channel_rate, decimation=int(200e3), taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rf_frequency, #fc rf_rate, #bw "Received Spectrum", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_0.enable_grid(False) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rf_frequency, #fc fm_channel_rate, #bw "Selected Channel", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1., #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( 100, (fm_taps), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([channel_number])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.audio_sink_0 = audio.sink(audio_rate, '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=fm_channel_rate, audio_decimation=fm_channel_rate/audio_rate, ) self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(-20, .1) ################################################## # Connections ################################################## self.connect((self.analog_simple_squelch_cc_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.audio_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_null_sink_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_null_sink_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_null_sink_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_null_sink_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_null_sink_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_null_sink_0, 6)) self.connect((self.pfb_channelizer_ccf_0, 8), (self.blocks_null_sink_0, 7)) self.connect((self.pfb_channelizer_ccf_0, 9), (self.blocks_null_sink_0, 8)) self.connect((self.pfb_channelizer_ccf_0, 10), (self.blocks_null_sink_0, 9)) self.connect((self.pfb_channelizer_ccf_0, 11), (self.blocks_null_sink_0, 10)) self.connect((self.pfb_channelizer_ccf_0, 12), (self.blocks_null_sink_0, 11)) self.connect((self.pfb_channelizer_ccf_0, 13), (self.blocks_null_sink_0, 12)) self.connect((self.pfb_channelizer_ccf_0, 14), (self.blocks_null_sink_0, 13)) self.connect((self.pfb_channelizer_ccf_0, 15), (self.blocks_null_sink_0, 14)) self.connect((self.pfb_channelizer_ccf_0, 16), (self.blocks_null_sink_0, 15)) self.connect((self.pfb_channelizer_ccf_0, 17), (self.blocks_null_sink_0, 16)) self.connect((self.pfb_channelizer_ccf_0, 18), (self.blocks_null_sink_0, 17)) self.connect((self.pfb_channelizer_ccf_0, 19), (self.blocks_null_sink_0, 18)) self.connect((self.pfb_channelizer_ccf_0, 20), (self.blocks_null_sink_0, 19)) self.connect((self.pfb_channelizer_ccf_0, 21), (self.blocks_null_sink_0, 20)) self.connect((self.pfb_channelizer_ccf_0, 22), (self.blocks_null_sink_0, 21)) self.connect((self.pfb_channelizer_ccf_0, 23), (self.blocks_null_sink_0, 22)) self.connect((self.pfb_channelizer_ccf_0, 24), (self.blocks_null_sink_0, 23)) self.connect((self.pfb_channelizer_ccf_0, 25), (self.blocks_null_sink_0, 24)) self.connect((self.pfb_channelizer_ccf_0, 26), (self.blocks_null_sink_0, 25)) self.connect((self.pfb_channelizer_ccf_0, 27), (self.blocks_null_sink_0, 26)) self.connect((self.pfb_channelizer_ccf_0, 28), (self.blocks_null_sink_0, 27)) self.connect((self.pfb_channelizer_ccf_0, 29), (self.blocks_null_sink_0, 28)) self.connect((self.pfb_channelizer_ccf_0, 30), (self.blocks_null_sink_0, 29)) self.connect((self.pfb_channelizer_ccf_0, 31), (self.blocks_null_sink_0, 30)) self.connect((self.pfb_channelizer_ccf_0, 32), (self.blocks_null_sink_0, 31)) self.connect((self.pfb_channelizer_ccf_0, 33), (self.blocks_null_sink_0, 32)) self.connect((self.pfb_channelizer_ccf_0, 34), (self.blocks_null_sink_0, 33)) self.connect((self.pfb_channelizer_ccf_0, 35), (self.blocks_null_sink_0, 34)) self.connect((self.pfb_channelizer_ccf_0, 36), (self.blocks_null_sink_0, 35)) self.connect((self.pfb_channelizer_ccf_0, 37), (self.blocks_null_sink_0, 36)) self.connect((self.pfb_channelizer_ccf_0, 38), (self.blocks_null_sink_0, 37)) self.connect((self.pfb_channelizer_ccf_0, 39), (self.blocks_null_sink_0, 38)) self.connect((self.pfb_channelizer_ccf_0, 40), (self.blocks_null_sink_0, 39)) self.connect((self.pfb_channelizer_ccf_0, 41), (self.blocks_null_sink_0, 40)) self.connect((self.pfb_channelizer_ccf_0, 42), (self.blocks_null_sink_0, 41)) self.connect((self.pfb_channelizer_ccf_0, 43), (self.blocks_null_sink_0, 42)) self.connect((self.pfb_channelizer_ccf_0, 44), (self.blocks_null_sink_0, 43)) self.connect((self.pfb_channelizer_ccf_0, 45), (self.blocks_null_sink_0, 44)) self.connect((self.pfb_channelizer_ccf_0, 46), (self.blocks_null_sink_0, 45)) self.connect((self.pfb_channelizer_ccf_0, 47), (self.blocks_null_sink_0, 46)) self.connect((self.pfb_channelizer_ccf_0, 48), (self.blocks_null_sink_0, 47)) self.connect((self.pfb_channelizer_ccf_0, 49), (self.blocks_null_sink_0, 48)) self.connect((self.pfb_channelizer_ccf_0, 50), (self.blocks_null_sink_0, 49)) self.connect((self.pfb_channelizer_ccf_0, 51), (self.blocks_null_sink_0, 50)) self.connect((self.pfb_channelizer_ccf_0, 52), (self.blocks_null_sink_0, 51)) self.connect((self.pfb_channelizer_ccf_0, 53), (self.blocks_null_sink_0, 52)) self.connect((self.pfb_channelizer_ccf_0, 54), (self.blocks_null_sink_0, 53)) self.connect((self.pfb_channelizer_ccf_0, 55), (self.blocks_null_sink_0, 54)) self.connect((self.pfb_channelizer_ccf_0, 56), (self.blocks_null_sink_0, 55)) self.connect((self.pfb_channelizer_ccf_0, 57), (self.blocks_null_sink_0, 56)) self.connect((self.pfb_channelizer_ccf_0, 58), (self.blocks_null_sink_0, 57)) self.connect((self.pfb_channelizer_ccf_0, 59), (self.blocks_null_sink_0, 58)) self.connect((self.pfb_channelizer_ccf_0, 60), (self.blocks_null_sink_0, 59)) self.connect((self.pfb_channelizer_ccf_0, 61), (self.blocks_null_sink_0, 60)) self.connect((self.pfb_channelizer_ccf_0, 62), (self.blocks_null_sink_0, 61)) self.connect((self.pfb_channelizer_ccf_0, 63), (self.blocks_null_sink_0, 62)) self.connect((self.pfb_channelizer_ccf_0, 64), (self.blocks_null_sink_0, 63)) self.connect((self.pfb_channelizer_ccf_0, 65), (self.blocks_null_sink_0, 64)) self.connect((self.pfb_channelizer_ccf_0, 66), (self.blocks_null_sink_0, 65)) self.connect((self.pfb_channelizer_ccf_0, 67), (self.blocks_null_sink_0, 66)) self.connect((self.pfb_channelizer_ccf_0, 68), (self.blocks_null_sink_0, 67)) self.connect((self.pfb_channelizer_ccf_0, 69), (self.blocks_null_sink_0, 68)) self.connect((self.pfb_channelizer_ccf_0, 70), (self.blocks_null_sink_0, 69)) self.connect((self.pfb_channelizer_ccf_0, 71), (self.blocks_null_sink_0, 70)) self.connect((self.pfb_channelizer_ccf_0, 72), (self.blocks_null_sink_0, 71)) self.connect((self.pfb_channelizer_ccf_0, 73), (self.blocks_null_sink_0, 72)) self.connect((self.pfb_channelizer_ccf_0, 74), (self.blocks_null_sink_0, 73)) self.connect((self.pfb_channelizer_ccf_0, 75), (self.blocks_null_sink_0, 74)) self.connect((self.pfb_channelizer_ccf_0, 76), (self.blocks_null_sink_0, 75)) self.connect((self.pfb_channelizer_ccf_0, 77), (self.blocks_null_sink_0, 76)) self.connect((self.pfb_channelizer_ccf_0, 78), (self.blocks_null_sink_0, 77)) self.connect((self.pfb_channelizer_ccf_0, 79), (self.blocks_null_sink_0, 78)) self.connect((self.pfb_channelizer_ccf_0, 80), (self.blocks_null_sink_0, 79)) self.connect((self.pfb_channelizer_ccf_0, 81), (self.blocks_null_sink_0, 80)) self.connect((self.pfb_channelizer_ccf_0, 82), (self.blocks_null_sink_0, 81)) self.connect((self.pfb_channelizer_ccf_0, 83), (self.blocks_null_sink_0, 82)) self.connect((self.pfb_channelizer_ccf_0, 84), (self.blocks_null_sink_0, 83)) self.connect((self.pfb_channelizer_ccf_0, 85), (self.blocks_null_sink_0, 84)) self.connect((self.pfb_channelizer_ccf_0, 86), (self.blocks_null_sink_0, 85)) self.connect((self.pfb_channelizer_ccf_0, 87), (self.blocks_null_sink_0, 86)) self.connect((self.pfb_channelizer_ccf_0, 88), (self.blocks_null_sink_0, 87)) self.connect((self.pfb_channelizer_ccf_0, 89), (self.blocks_null_sink_0, 88)) self.connect((self.pfb_channelizer_ccf_0, 90), (self.blocks_null_sink_0, 89)) self.connect((self.pfb_channelizer_ccf_0, 91), (self.blocks_null_sink_0, 90)) self.connect((self.pfb_channelizer_ccf_0, 92), (self.blocks_null_sink_0, 91)) self.connect((self.pfb_channelizer_ccf_0, 93), (self.blocks_null_sink_0, 92)) self.connect((self.pfb_channelizer_ccf_0, 94), (self.blocks_null_sink_0, 93)) self.connect((self.pfb_channelizer_ccf_0, 95), (self.blocks_null_sink_0, 94)) self.connect((self.pfb_channelizer_ccf_0, 96), (self.blocks_null_sink_0, 95)) self.connect((self.pfb_channelizer_ccf_0, 97), (self.blocks_null_sink_0, 96)) self.connect((self.pfb_channelizer_ccf_0, 98), (self.blocks_null_sink_0, 97)) self.connect((self.pfb_channelizer_ccf_0, 99), (self.blocks_null_sink_0, 98)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_simple_squelch_cc_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0))
def __init__(self): gr.top_block.__init__(self, 'receiver') self.log = logging.getLogger('frontend') try: gr.enable_realtime_scheduling() except: pass self.access_lock = threading.RLock() self.access_lock.acquire() self.last_channel_cleanup = time.time() self.channel_idle_timeout = 300 self.config = config = rc_config() try: self.scan_mode = config.scan_mode except: self.scan_mode = False self.realsources = config.sources self.sources = {} numsources = 0 for source in self.realsources: if config.receiver_split2: newsource1 = copy.copy(self.realsources[source]) newsource2 = copy.copy(self.realsources[source]) decim = 2 samp_rate = self.realsources[source]['samp_rate'] channel_rate = (samp_rate / decim) / 2 transition = channel_rate * 0.5 taps = firdes.low_pass(1, samp_rate, channel_rate, transition) filt1 = filter.freq_xlating_fir_filter_ccc( decim, (taps), -samp_rate / 4, samp_rate) filt2 = filter.freq_xlating_fir_filter_ccc( decim, (taps), samp_rate / 4, samp_rate) if self.realsources[source]['type'] == 'usrp': from gnuradio import uhd this_dev = uhd.usrp_source( device_addr=self.realsources[source]['device_addr'], stream_args=uhd.stream_args( cpu_format="fc32", otw_format=self.realsources[source]['otw_format'], args=self.realsources[source]['args'], ), ) this_dev.set_samp_rate(self.realsources[source]['samp_rate']) this_dev.set_center_freq( self.realsources[source]['center_freq']) this_dev.set_gain(self.realsources[source]['rf_gain']) try: null_sink = gr.null_sink(gr.sizeof_gr_complex * 1) except: null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) #self.connect(this_dev, null_sink) self.realsources[source]['block'] = this_dev if self.realsources[source]['type'] == 'usrp2x': from gnuradio import uhd this_dev = uhd.usrp_source( device_addr=self.realsources[source]['device_addr'], stream_args=uhd.stream_args( cpu_format="fc32", otw_format=self.realsources[source]['otw_format'], args=self.realsources[source]['args'], channels=range(2), ), ) this_dev.set_subdev_spec('A:RX1 A:RX2', 0) this_dev.set_samp_rate(self.realsources[source]['samp_rate']) this_dev.set_center_freq( self.realsources[source]['center_freq'], 0) this_dev.set_center_freq( self.realsources[source + 1]['center_freq'], 1) this_dev.set_gain(self.realsources[source]['rf_gain'], 0) this_dev.set_gain(self.realsources[source + 1]['rf_gain'], 1) multiply = blocks.multiply_const_vcc((1, )) try: null_sink = gr.null_sink(gr.sizeof_gr_complex * 1) except: null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) #self.connect((this_dev,0), multiply, null_sink) self.realsources[source]['block'] = multiply multiply = blocks.multiply_const_vcc((1, )) try: null_sink = gr.null_sink(gr.sizeof_gr_complex * 1) except: null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) #self.connect((this_dev,1), multiply, null_sink) self.realsources[source + 1]['block'] = multiply if self.realsources[source]['type'] == 'bladerf': import osmosdr this_dev = osmosdr.source( args=self.realsources[source]['args']) this_dev.set_sample_rate(self.realsources[source]['samp_rate']) this_dev.set_center_freq( self.realsources[source]['center_freq'], 0) this_dev.set_freq_corr(0, 0) #this_dev.set_dc_offset_mode(0, 0) #this_dev.set_iq_balance_mode(0, 0) this_dev.set_gain_mode(0, 0) this_dev.set_gain(self.realsources[source]['rf_gain'], 0) this_dev.set_if_gain(20, 0) this_dev.set_bb_gain(self.realsources[source]['bb_gain'], 0) this_dev.set_antenna("", 0) this_dev.set_bandwidth(0, 0) try: null_sink = gr.null_sink(gr.sizeof_gr_complex * 1) except: null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) #self.connect(this_dev, null_sink) self.realsources[source]['block'] = this_dev if self.realsources[source]['type'] == 'rtlsdr': import osmosdr #process = os.popen('CellSearch -i '+ str(self.realsources[source]['serial']) +' -s 739e6 -e 739e6 -b | grep 739M | awk \'{sum+=$10} END { printf("%.10f", sum/NR)}\'') #output = float(process.read()) #process.close() #self.realsources[source]['offset'] = (1000000-(output*1000000)) #self.realsources[source]['offset'] = 0 #print 'Measured PPM - Dev#%s: %s' % (source, self.realsources[source]['offset']) this_dev = osmosdr.source( args=self.realsources[source]['args']) this_dev.set_sample_rate(self.realsources[source]['samp_rate']) this_dev.set_center_freq( self.realsources[source]['center_freq'] + self.realsources[source]['offset'], 0) #this_dev.set_freq_corr(self.realsources[source]['offset'], 0) this_dev.set_max_output_buffer(65535 * 64) this_dev.set_dc_offset_mode(1, 0) this_dev.set_iq_balance_mode(1, 0) this_dev.set_gain_mode(False, 0) this_dev.set_gain(self.realsources[source]['rf_gain'], 0) this_dev.set_if_gain(30, 0) this_dev.set_bb_gain(self.realsources[source]['bb_gain'], 0) try: null_sink = gr.null_sink(gr.sizeof_gr_complex * 1) except: null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) self.connect(this_dev, null_sink) self.realsources[source]['block'] = this_dev if config.receiver_split2: newsource1 = copy.copy(self.realsources[source]) newsource2 = copy.copy(self.realsources[source]) decim = 2 samp_rate = self.realsources[source]['samp_rate'] channel_rate = (samp_rate / decim) / 2 transition = channel_rate * 0.5 taps = firdes.low_pass(1, samp_rate, channel_rate, transition) filt1 = filter.freq_xlating_fir_filter_ccc( decim, (taps), -samp_rate / 4, samp_rate) filt2 = filter.freq_xlating_fir_filter_ccc( decim, (taps), samp_rate / 4, samp_rate) null_sink1 = blocks.null_sink(gr.sizeof_gr_complex * 1) null_sink2 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.connect(self.realsources[source]['block'], filt1, null_sink1) self.connect(self.realsources[source]['block'], filt2, null_sink2) newsource1['block'] = filt1 newsource1['center_freq'] = self.realsources[source][ 'center_freq'] - self.realsources[source]['samp_rate'] / 4 newsource1['samp_rate'] = newsource1['samp_rate'] / decim newsource2['block'] = filt2 newsource2['center_freq'] = self.realsources[source][ 'center_freq'] + self.realsources[source]['samp_rate'] / 4 newsource2['samp_rate'] = newsource2['samp_rate'] / decim self.sources[numsources] = newsource1 numsources = numsources + 1 self.sources[numsources] = newsource2 numsources = numsources + 1 else: self.sources[numsources] = self.realsources[source] numsources = numsources + 1 if self.config.frontend_mode == 'pfb': for source in self.sources: self.target_size = target_size = 400000 if (self.sources[source]['samp_rate'] % target_size): raise Exception('samp_rate not round enough') num_channels = int( math.ceil(self.sources[source]['samp_rate'] / target_size)) self.sources[source]['pfb'] = pfb.channelizer_ccf( num_channels, (optfir.low_pass( 1, num_channels, 0.5, 0.5 + 0.2, 0.1, 80)), 1.0, 100) self.sources[source]['pfb'].set_channel_map(([])) #null_sink = blocks.null_sink(gr.sizeof_gr_complex*1) #self.connect((self.sources[source]['pfb'], 0), null_sink) for x in range(0, num_channels): null_sink = blocks.null_sink(gr.sizeof_gr_complex * 1) self.connect((self.sources[source]['pfb'], x), null_sink) self.connect(self.sources[source]['block'], self.sources[source]['pfb']) self.channels = {} #for i in self.sources.keys(): # self.channels[i] = [] self.start() self.access_lock.release()
def __init__(self): gr.top_block.__init__(self, "PFB Channelizer Demo") Qt.QWidget.__init__(self) self.setWindowTitle("PFB Channelizer Demo") 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", "pfb_channelizer_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.noaa_num_chans = noaa_num_chans = 7 self.noaa_chan_width = noaa_chan_width = int(25e3) self.noaa_band_start = noaa_band_start = 162.4e6 self.oversampled_width = oversampled_width = noaa_chan_width * (noaa_num_chans + 1) self.noaa_fm_dev = noaa_fm_dev = int(5e3) self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans self.noaa_band_center = noaa_band_center = noaa_band_start + (noaa_num_chans / 2 * noaa_chan_width) self.hardware_rate = hardware_rate = int(1e6) self.tuner_freq = tuner_freq = 162.3e6 self.target_freq = target_freq = noaa_band_center self.ppm = ppm = 0 self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width, noaa_fm_dev * 2, 2500, firdes.WIN_HAMMING, 6.76) self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate, noaa_band_width / 2, noaa_chan_width, firdes.WIN_HAMMING, 6.76) self.channel_map = channel_map = range(0, noaa_num_chans+1) self.tuner_offset = tuner_offset = target_freq - tuner_freq self.ppm_corr = ppm_corr = tuner_freq * (ppm/1e6) self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps) self.noaa_band_end = noaa_band_end = noaa_band_start + (noaa_num_chans * noaa_chan_width) self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps) self.fftwidth = fftwidth = 512 self.fft_interval = fft_interval = 1.0/20 self.decimation = decimation = hardware_rate / oversampled_width self.channel_names = channel_names = map(lambda x: "%.3fMHz" % (162.4 + (x*0.025)), channel_map) self.chan_num = chan_num = channel_map[0] ################################################## # Blocks ################################################## self._chan_num_options = channel_map self._chan_num_labels = channel_names self._chan_num_tool_bar = Qt.QToolBar(self) self._chan_num_tool_bar.addWidget(Qt.QLabel("Channel"+": ")) self._chan_num_combo_box = Qt.QComboBox() self._chan_num_tool_bar.addWidget(self._chan_num_combo_box) for label in self._chan_num_labels: self._chan_num_combo_box.addItem(label) self._chan_num_callback = lambda i: Qt.QMetaObject.invokeMethod(self._chan_num_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._chan_num_options.index(i))) self._chan_num_callback(self.chan_num) self._chan_num_combo_box.currentIndexChanged.connect( lambda i: self.set_chan_num(self._chan_num_options[i])) self.top_grid_layout.addWidget(self._chan_num_tool_bar, 0,0,1,2) self.qtgui_waterfall_sink_x_0_0_0 = qtgui.waterfall_sink_c( fftwidth, #size firdes.WIN_BLACKMAN_hARRIS, #wintype target_freq, #fc oversampled_width, #bw "Band Monitor", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0_0.set_update_time(fft_interval) self.qtgui_waterfall_sink_x_0_0_0.enable_grid(True) if not True: self.qtgui_waterfall_sink_x_0_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0_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_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0_0.set_intensity_range(-80, -35) self._qtgui_waterfall_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_0_win, 1,0,1,2) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( fftwidth, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc noaa_chan_width, #bw "Channel Monitor", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(fft_interval) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-67, -37) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 1,2,1,2) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( fftwidth, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc noaa_chan_width, #bw "Channelizer Output", #name noaa_num_chans +1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(fft_interval) self.qtgui_freq_sink_x_0.set_y_axis(-80, -35) 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.1) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = [channel_names[0], channel_names[1], channel_names[2], channel_names[3], channel_names[4], channel_names[5], channel_names[6], channel_names[7], "", ""] 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(noaa_num_chans +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, 2,0,1,4) self._ppm_range = Range(-20, 20, 0.5, 0, 100) self._ppm_win = RangeWidget(self._ppm_range, self.set_ppm, "ppm", "counter_slider", float) self.top_grid_layout.addWidget(self._ppm_win, 0,2,1,2) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( noaa_num_chans+1, (pfb_taps), 1, 100) self.pfb_channelizer_ccf_0.set_channel_map((channel_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.osmosdr_source_0_0 = osmosdr.source( args="numchan=" + str(1) + " " + "type=usrp2" ) self.osmosdr_source_0_0.set_sample_rate(hardware_rate) self.osmosdr_source_0_0.set_center_freq(tuner_freq, 0) self.osmosdr_source_0_0.set_freq_corr(0, 0) self.osmosdr_source_0_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0_0.set_iq_balance_mode(2, 0) self.osmosdr_source_0_0.set_gain_mode(True, 0) self.osmosdr_source_0_0.set_gain(10, 0) self.osmosdr_source_0_0.set_if_gain(20, 0) self.osmosdr_source_0_0.set_bb_gain(20, 0) self.osmosdr_source_0_0.set_antenna("TX/RX", 0) self.osmosdr_source_0_0.set_bandwidth(0, 0) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(int(decimation), (lpf_taps), tuner_offset + ppm_corr, hardware_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.blocks_multiply_const_vxx_0_5_0 = blocks.multiply_const_vcc((1, )) self.blocks_multiply_const_vxx_0_5 = blocks.multiply_const_vcc((1 if chan_num is 6 else 0, )) self.blocks_multiply_const_vxx_0_4 = blocks.multiply_const_vcc((1 if chan_num is 5 else 0, )) self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vcc((1 if chan_num is 4 else 0, )) self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((1 if chan_num is 3 else 0, )) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc((1 if chan_num is 2 else 0, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((1 if chan_num is 1 else 0, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1 if chan_num is 0 else 0, )) self.blocks_add_xx_0 = blocks.add_vcc(1) self.audio_sink_0 = audio.sink(24000, "", True) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=noaa_chan_width, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) (self.analog_nbfm_rx_0).set_max_output_buffer(512) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_add_xx_0, 3)) self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0, 4)) self.connect((self.blocks_multiply_const_vxx_0_4, 0), (self.blocks_add_xx_0, 5)) self.connect((self.blocks_multiply_const_vxx_0_5, 0), (self.blocks_add_xx_0, 6)) self.connect((self.blocks_multiply_const_vxx_0_5_0, 0), (self.blocks_add_xx_0, 7)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.qtgui_waterfall_sink_x_0_0_0, 0)) self.connect((self.osmosdr_source_0_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_multiply_const_vxx_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_multiply_const_vxx_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_multiply_const_vxx_0_4, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_multiply_const_vxx_0_5, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_multiply_const_vxx_0_5_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.qtgui_freq_sink_x_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.qtgui_freq_sink_x_0, 6)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.qtgui_freq_sink_x_0, 7))
def __init__(self): gr.top_block.__init__(self, "NOAA Demo based on PFB Channelizer Demo") Qt.QWidget.__init__(self) self.setWindowTitle("NOAA Demo based on PFB Channelizer Demo") 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", "noaa_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.noaa_num_chans = noaa_num_chans = 7 self.noaa_chan_width = noaa_chan_width = int(25e3) self.noaa_band_start = noaa_band_start = 162.4e6 self.oversampled_width = oversampled_width = noaa_chan_width * (noaa_num_chans + 1) self.noaa_fm_dev = noaa_fm_dev = int(5e3) self.noaa_band_center = noaa_band_center = noaa_band_start + (noaa_num_chans / 2 * noaa_chan_width) self.hardware_rate = hardware_rate = int(1e6) self.tuner_freq = tuner_freq = 162.3e6 self.target_freq = target_freq = noaa_band_center self.ppm = ppm = 0 self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width, noaa_fm_dev*2 ,1000, firdes.WIN_HAMMING, 6.76) self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate, oversampled_width / 2,noaa_chan_width, firdes.WIN_HAMMING, 6.76) self.channel_map = channel_map = range(0, noaa_num_chans) self.volume = volume = 0.15 self.tuner_offset = tuner_offset = target_freq - tuner_freq self.ppm_corr = ppm_corr = tuner_freq * (ppm/1e6) self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps) self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans self.noaa_band_end = noaa_band_end = noaa_band_start + (noaa_num_chans * noaa_chan_width) self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps) self.fftwidth = fftwidth = 512 self.fft_interval = fft_interval = 1.0/20 self.decimation = decimation = hardware_rate / oversampled_width self.channelizer_map = channelizer_map = 5,6,7,0,1,2,3 self.channel_names = channel_names = map(lambda x: "%.3fMHz" % (162.4 + (x*0.025)), channel_map) self.chan_num = chan_num = channel_map[6] ################################################## # Blocks ################################################## self._volume_layout = Qt.QVBoxLayout() self._volume_label = Qt.QLabel("volume") self._volume_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._volume_slider.setRange(0, 1, 0.05) self._volume_slider.setValue(self.volume) self._volume_slider.setMinimumWidth(50) self._volume_slider.valueChanged.connect(self.set_volume) self._volume_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) self._volume_layout.addWidget(self._volume_label) self._volume_layout.addWidget(self._volume_slider) self.top_grid_layout.addLayout(self._volume_layout, 0,1,1,1) self._chan_num_options = channel_map self._chan_num_labels = channel_names self._chan_num_tool_bar = Qt.QToolBar(self) self._chan_num_tool_bar.addWidget(Qt.QLabel("Channel"+": ")) self._chan_num_combo_box = Qt.QComboBox() self._chan_num_tool_bar.addWidget(self._chan_num_combo_box) for label in self._chan_num_labels: self._chan_num_combo_box.addItem(label) self._chan_num_callback = lambda i: Qt.QMetaObject.invokeMethod(self._chan_num_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._chan_num_options.index(i))) self._chan_num_callback(self.chan_num) self._chan_num_combo_box.currentIndexChanged.connect( lambda i: self.set_chan_num(self._chan_num_options[i])) self.top_grid_layout.addWidget(self._chan_num_tool_bar, 0,0,1,1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source("external", 0) self.uhd_usrp_source_0.set_subdev_spec("A:0", 0) self.uhd_usrp_source_0.set_samp_rate(hardware_rate) self.uhd_usrp_source_0.set_center_freq(tuner_freq, 0) self.uhd_usrp_source_0.set_gain(30, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=25, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate, #bw "Radoi Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0/10) self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate/decimation, #bw "Filtered Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0/10) self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self._ppm_layout = Qt.QVBoxLayout() self._ppm_label = Qt.QLabel("ppm") self._ppm_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._ppm_slider.setRange(-20, 20, 0.5) self._ppm_slider.setValue(self.ppm) self._ppm_slider.setMinimumWidth(50) self._ppm_slider.valueChanged.connect(self.set_ppm) self._ppm_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) self._ppm_layout.addWidget(self._ppm_label) self._ppm_layout.addWidget(self._ppm_slider) self.top_grid_layout.addLayout(self._ppm_layout, 0,2,1,1) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( noaa_num_chans+1, (pfb_taps), 1, 1) self.pfb_channelizer_ccf_0.set_channel_map((channelizer_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(int(decimation), (lpf_taps), tuner_offset + ppm_corr, hardware_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.blocks_multiply_const_vxx_0_7 = blocks.multiply_const_vcc((50, )) self.blocks_multiply_const_vxx_0_6_0 = blocks.multiply_const_vff((volume, )) self.blocks_multiply_const_vxx_0_6 = blocks.multiply_const_vcc((10, )) self.blocks_multiply_const_vxx_0_5_0 = blocks.multiply_const_vcc((1 if chan_num is 7 else 0, )) self.blocks_multiply_const_vxx_0_5 = blocks.multiply_const_vcc((1 if chan_num is 6 else 0, )) self.blocks_multiply_const_vxx_0_4 = blocks.multiply_const_vcc((1 if chan_num is 5 else 0, )) self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vcc((1 if chan_num is 4 else 0, )) self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((1 if chan_num is 3 else 0, )) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc((1 if chan_num is 2 else 0, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((1 if chan_num is 1 else 0, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1 if chan_num is 0 else 0, )) self.blocks_add_xx_0 = blocks.add_vcc(1) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=noaa_chan_width, quad_rate=noaa_chan_width, tau=75e-6, max_dev=noaa_fm_dev, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_add_xx_0, 3)) self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0, 4)) self.connect((self.blocks_multiply_const_vxx_0_4, 0), (self.blocks_add_xx_0, 5)) self.connect((self.blocks_multiply_const_vxx_0_5, 0), (self.blocks_add_xx_0, 6)) self.connect((self.blocks_multiply_const_vxx_0_5_0, 0), (self.blocks_add_xx_0, 7)) self.connect((self.blocks_multiply_const_vxx_0_6, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_6_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_7, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0_6_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0_7, 0)) self.connect((self.blocks_multiply_const_vxx_0_7, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0_6, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_multiply_const_vxx_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_multiply_const_vxx_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_multiply_const_vxx_0_4, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_multiply_const_vxx_0_5, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_multiply_const_vxx_0_5_0, 0))
def __init__(self): 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()) ################################################## # Variables ################################################## self.num_channels = num_channels = 7 self.samp_rate = samp_rate = 400000 * num_channels self.center_freq = center_freq = 101.1e6 ################################################## # Blocks ################################################## self._center_freq_range = Range(98.1e6, 108.1e6, 200000, 101.1e6, 200) self._center_freq_win = RangeWidget(self._center_freq_range, self.set_center_freq, 'Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._center_freq_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.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype center_freq, #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(True) 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(-90, -50) 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_freq_sink_x_0 = qtgui.freq_sink_c( 512, #size firdes.WIN_HAMMING, #wintype center_freq, #fc samp_rate, #bw "", #name num_channels #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-100, -50) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dBm') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [0.5, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(num_channels): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 1, 1) 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.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_channels, (makeTaps.makePolyphaseFilter(num_channels, 10)), 1.0, 1) self.pfb_channelizer_ccf_0.set_channel_map(([4, 5, 6, 0, 1, 2, 3])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.limesdr_source_0 = limesdr.source('1D40F7A60B4B4E', 0, '') self.limesdr_source_0.set_sample_rate(samp_rate) self.limesdr_source_0.set_center_freq(center_freq, 0) self.limesdr_source_0.set_bandwidth(5e6, 0) self.limesdr_source_0.set_digital_filter(samp_rate, 0) self.limesdr_source_0.set_gain(40, 0) self.limesdr_source_0.set_antenna(2, 0) self.limesdr_source_0.calibrate(5e6, 0) ################################################## # Connections ################################################## self.connect((self.limesdr_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.limesdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_0, 2)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_0, 3)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_0, 4)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.qtgui_freq_sink_x_0, 5)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.qtgui_freq_sink_x_0, 6))
def __init__(self): gr.top_block.__init__(self, "Multipager") ################################################## # Variables ################################################## self.volume = volume = 0.5 self.squelch = squelch = -20 self.sample_rate = sample_rate = 1e6 self.out_scale = out_scale = 10000 self.num_chan = num_chan = 20 self.freq = freq = 148.664e6 self.decim = decim = 2 self.channel = channel = 19 self.audio_rate = audio_rate = 50e3 ################################################## # Blocks ################################################## if True: self.source = blocks.file_source(gr.sizeof_gr_complex * 1, samplefile, True) else: self.source = osmosdr.source(args="hackrf") self.source.set_sample_rate(sample_rate) self.source.set_center_freq(freq, 0) self.source.set_freq_corr(0, 0) self.source.set_dc_offset_mode(0, 0) self.source.set_iq_balance_mode(0, 0) self.source.set_gain_mode(False, 0) self.source.set_gain(0, 0) self.source.set_if_gain(36, 0) self.source.set_bb_gain(44, 0) self.source.set_antenna("", 0) self.source.set_bandwidth(0, 0) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_chan, (firdes.low_pass(1.0, sample_rate / decim, 7.25e3, 1.5e3, firdes.WIN_HAMMING, 6.76)), 1, 60) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, sample_rate, 400e3, 500e3, firdes.WIN_HAMMING, 6.76)) chwidth = sample_rate / decim / num_chan ################################################## # Connections ################################################## self.connect((self.source, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.pfb_channelizer_ccf_0, 0)) # All channels sel = map(None, range(num_chan)) loop = asyncio.get_event_loop() self.fms = {} for i in range(num_chan): #fifopath = fifopat % (i) fifopath = None if i > num_chan / 2: chfreq = freq + chwidth * (i - num_chan) else: chfreq = freq + chwidth * i if i in sel: print("Channel %d %.3f MHz" % (i, chfreq / 1e6)) command = cmdpat % (chfreq / 1e6) fm = FMtoCommand(squelch, int(sample_rate / num_chan / decim), int(sample_rate / num_chan / decim), 5e3, out_scale, chfreq, command) self.connect((self.pfb_channelizer_ccf_0, i), (fm, 0)) self.fms[chfreq] = fm else: n = blocks.null_sink(gr.sizeof_gr_complex * 1) self.connect((self.pfb_channelizer_ccf_0, i), (n, 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.samp_rate = samp_rate = 15e6 self.if_bandwidth_1 = if_bandwidth_1 = 2e6 self.sdr_gain = sdr_gain = 60 self.integration_bandwidth = integration_bandwidth = 5e3 self.if_filter_decimation_rate = if_filter_decimation_rate = int(samp_rate/(1.1*if_bandwidth_1)) self.sdr_power_offset = sdr_power_offset = 1.0 self.sdr_gain_lin = sdr_gain_lin = 10**(sdr_gain/20) self.num_channels = num_channels = int((samp_rate/if_filter_decimation_rate)/integration_bandwidth) self.lna_gain_measured = lna_gain_measured = 33.33 self.integration_time = integration_time = 10 self.if_samp_rate = if_samp_rate = samp_rate/if_filter_decimation_rate self.cable_loss = cable_loss = 0.25 self.variable_function_probe = variable_function_probe = 0 self.sdr_frequency = sdr_frequency = 1420.406e6 self.output_vector_bandwidth = output_vector_bandwidth = samp_rate/if_filter_decimation_rate self.offset_frequency = offset_frequency = if_bandwidth_1/2+1e5 self.integration_scale_factor = integration_scale_factor = np.full((num_channels),float(1.0/(integration_time*integration_bandwidth*50)),dtype=float) self.integration_dec_rate = integration_dec_rate = int(integration_time*if_samp_rate/num_channels) self.if_filter_gain = if_filter_gain = 1/(lna_gain_measured*cable_loss*sdr_gain_lin*sdr_power_offset) self.if_bandwidth_0 = if_bandwidth_0 = 5.5e6 self.channel_skirt = channel_skirt = integration_bandwidth/100 self.channel_map = channel_map = range(int(num_channels/2.0+1.0),num_channels,1)+range(0,int(num_channels/2.0+1.0),1) self.antenna_gain_estimated = antenna_gain_estimated = 173 ################################################## # Blocks ################################################## self.probe_signal = blocks.probe_signal_vf(num_channels) def _variable_function_probe_probe(): while True: val = self.probe_signal.level() try: self.set_variable_function_probe(val) except AttributeError: pass time.sleep(1.0 / (10)) _variable_function_probe_thread = threading.Thread(target=_variable_function_probe_probe) _variable_function_probe_thread.daemon = True _variable_function_probe_thread.start() self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( num_channels, (firdes.low_pass(1, if_samp_rate, (integration_bandwidth/2-channel_skirt), channel_skirt, firdes.WIN_HAMMING)), 1.0, 0) self.pfb_channelizer_ccf_0.set_channel_map((channel_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.low_pass_filter_1 = filter.fir_filter_ccf(if_filter_decimation_rate, firdes.low_pass( if_filter_gain, samp_rate, if_bandwidth_1/2, 1e5, firdes.WIN_HAMMING, 6.76)) self.limesdr_source_2 = limesdr.source('0009060B00471B22', 2, 1, 0, 0, '', sdr_frequency-offset_frequency, samp_rate, 0, 1, 15e6, 0, 10e6, 3, 2, 2, 1, if_bandwidth_0, 1, 5e6, 1, if_bandwidth_0, 0, 0, sdr_gain, 30, 0, 0, 0, 0) self.blocks_streams_to_vector_0 = blocks.streams_to_vector(gr.sizeof_gr_complex*1, num_channels) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((integration_scale_factor)) self.blocks_integrate_xx_0_0 = blocks.integrate_ff(integration_dec_rate, num_channels) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/home/w1xm-admin/Documents/DSP/data_out/recieve_block_sink', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_copy_0_0 = blocks.copy(gr.sizeof_gr_complex*1) self.blocks_copy_0_0.set_enabled(False) self.blocks_copy_0 = blocks.copy(gr.sizeof_gr_complex*1) self.blocks_copy_0.set_enabled(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(num_channels) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, -offset_frequency, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0_0, 0)) self.connect((self.blocks_copy_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_copy_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.probe_signal, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_streams_to_vector_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.limesdr_source_2, 0), (self.blocks_copy_0, 0)) self.connect((self.limesdr_source_2, 0), (self.blocks_copy_0_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.pfb_channelizer_ccf_0, 0)) for i in range(num_channels): self.connect((self.pfb_channelizer_ccf_0, i), (self.blocks_streams_to_vector_0, i))
def __init__(self, freq=394e6, gain=0, sample_rate=2400000, args="", channel_bw=12500, listen_port=60100, ppm=0, output="channel%d.bits", output_offset=None, auto_tune=-1): gr.top_block.__init__(self, "TETRAPOL multichannel reciever") ################################################## # Parameters and variables ################################################## self.freq = freq self.gain = gain self.sample_rate = sample_rate self.args = args self.channel_bw = channel_bw self.listen_port = listen_port self.ppm = ppm self.output = output self.auto_tune = auto_tune # TODO: parametrize self.debug = True self.channels = channels = int(sample_rate/channel_bw) channel_symb_rate = 8000 samples_per_symbol = 2 self.channel_samp_rate = channel_samp_rate = \ channel_symb_rate * samples_per_symbol afc_period = 6 self.afc_gain = 1 self.afc_ppm_threshold = 100 if output_offset is None: self.output_offset = 0 else: self.output_offset = output_offset - ((channels - 1) // 2) ################################################## # Blocks - RPC server ################################################## self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer( ("localhost", listen_port), allow_none=True) self.xmlrpc_server_0.register_instance(self) threading.Thread(target=self.xmlrpc_server_0.serve_forever).start() ################################################## # Blocks - RX, demod, sink ################################################## self.src = osmosdr.source( args="numchan=" + str(1) + " " + "" + self.args ) self.src.set_sample_rate(sample_rate) self.src.set_center_freq(freq, 0) self.src.set_freq_corr(ppm, 0) # TODO: manual gain control self.src.set_gain_mode(True, 0) #self.src.set_gain(gain, 0) self.freq_xlating = freq_xlating_fft_filter_ccc(1, (1, ), 0, sample_rate) bw = (9200 + self.afc_ppm_threshold)/2 self.channelizer = pfb.channelizer_ccf( channels, firdes.low_pass(1, sample_rate, bw, bw*0.15, firdes.WIN_HANN), float(channel_samp_rate)/(sample_rate/channels), 100) self.connect( (self.src, 0), (self.freq_xlating, 0), (self.channelizer, 0)) self.valves = [] self.gmsk_demods = [] self.file_sinks = [] even_no_of_chs = not (channels % 2) center_ch = channels // 2 for ch_in in range(0, channels): ch_out = (ch_in + center_ch + 1) % channels if ch_out == center_ch and even_no_of_chs: null_sink = blocks.null_sink(gr.sizeof_gr_complex) self.connect( (self.channelizer, ch_out), (null_sink, 0)) continue valve = grc_blks2.valve(item_size=gr.sizeof_gr_complex, open=True) gmsk_demod = digital.gmsk_demod( samples_per_symbol=samples_per_symbol, gain_mu=0.050, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) o = output % (ch_in + self.output_offset) file_sink = blocks.file_sink(gr.sizeof_char, o, False) file_sink.set_unbuffered(True) self.connect( (self.channelizer, ch_out), (valve, 0), (gmsk_demod, 0), (file_sink, 0)) self.valves.append(valve) self.gmsk_demods.append(gmsk_demod) self.file_sinks.append(file_sink) ################################################## # Blocks - automatic fine tune ################################################## self.afc_selector = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=channels - even_no_of_chs, num_outputs=1, input_index=0, output_index=0, ) if auto_tune != -1: self.afc_selector.set_input_index(auto_tune) self.afc_demod = analog.quadrature_demod_cf(channel_samp_rate/(2*math.pi)) afc_samp = channel_samp_rate * afc_period / 2 self.afc_avg = blocks.moving_average_ff(afc_samp, 1./afc_samp*self.afc_gain) self.afc_probe = blocks.probe_signal_f() def _afc_probe(): while True: time.sleep(afc_period) if self.auto_tune == -1: continue err = self.afc_probe.level() if abs(err) < self.afc_ppm_threshold: continue freq = self.freq_xlating.center_freq + err * self.afc_gain if self.debug: print "freq err: % .0f\tfreq: %f" % (err, freq) self.freq_xlating.set_center_freq(freq) self._afc_err_thread = threading.Thread(target=_afc_probe) self._afc_err_thread.daemon = True self._afc_err_thread.start() for ch_in in range(0, channels - even_no_of_chs): ch_out = (ch_in + center_ch + 1) % channels self.connect((self.channelizer, ch_out), (self.afc_selector, ch_in)) self.connect((self.afc_selector, 0), (self.afc_demod, 0), (self.afc_avg, 0), (self.afc_probe, 0)) ################################################## # Blocks - signal strenght indication ################################################## self.pwr_probes = [] for ch in range(self.channels - even_no_of_chs): ch = (ch + center_ch + 1) % channels pwr_probe = analog.probe_avg_mag_sqrd_c(0, 1./channel_samp_rate) self.connect((self.channelizer, ch), (pwr_probe, 0)) self.pwr_probes.append(pwr_probe)
def __init__(self): gr.top_block.__init__(self, "Bcfm Channelizer") Qt.QWidget.__init__(self) self.setWindowTitle("Bcfm Channelizer") 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", "bcfm_channelizer") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.8e6 self.disp_min = disp_min = -100 self.disp_max = disp_max = -10 ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, 'RF In') self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, 'Channels') self.tab_widget_2 = Qt.QWidget() self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2) self.tab_grid_layout_2 = Qt.QGridLayout() self.tab_layout_2.addLayout(self.tab_grid_layout_2) self.tab.addTab(self.tab_widget_2, 'Tab 2') self.top_layout.addWidget(self.tab) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-90, 0) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1, 0, 1, 1) self.qtgui_freq_sink_x_6 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_6.set_update_time(0.10) self.qtgui_freq_sink_x_6.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_6.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_6.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_6.enable_autoscale(False) self.qtgui_freq_sink_x_6.enable_grid(False) self.qtgui_freq_sink_x_6.set_fft_average(1.0) self.qtgui_freq_sink_x_6.enable_axis_labels(True) self.qtgui_freq_sink_x_6.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_6.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_6.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_6.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_6.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_6.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_6.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_6.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_6_win = sip.wrapinstance( self.qtgui_freq_sink_x_6.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_6_win, 2, 0, 1, 1) self.qtgui_freq_sink_x_5 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_5.set_update_time(0.10) self.qtgui_freq_sink_x_5.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_5.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_5.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_5.enable_autoscale(False) self.qtgui_freq_sink_x_5.enable_grid(False) self.qtgui_freq_sink_x_5.set_fft_average(1.0) self.qtgui_freq_sink_x_5.enable_axis_labels(True) self.qtgui_freq_sink_x_5.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_5.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_5.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_5.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_5.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_5.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_5.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_5.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_5_win = sip.wrapinstance( self.qtgui_freq_sink_x_5.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_5_win, 1, 2, 1, 1) self.qtgui_freq_sink_x_4 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_4.set_update_time(0.10) self.qtgui_freq_sink_x_4.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_4.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_4.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_4.enable_autoscale(False) self.qtgui_freq_sink_x_4.enable_grid(False) self.qtgui_freq_sink_x_4.set_fft_average(1.0) self.qtgui_freq_sink_x_4.enable_axis_labels(True) self.qtgui_freq_sink_x_4.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_4.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_4.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_4.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_4.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_4.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_4.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_4.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_4_win = sip.wrapinstance( self.qtgui_freq_sink_x_4.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_4_win, 1, 1, 1, 1) self.qtgui_freq_sink_x_3_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_3_0.set_update_time(0.10) self.qtgui_freq_sink_x_3_0.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_3_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_3_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_3_0.enable_autoscale(False) self.qtgui_freq_sink_x_3_0.enable_grid(True) self.qtgui_freq_sink_x_3_0.set_fft_average(0.2) self.qtgui_freq_sink_x_3_0.enable_axis_labels(True) self.qtgui_freq_sink_x_3_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_3_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_3_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_3_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_3_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_3_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_3_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_3_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_3_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_3_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_3_0_win, 0, 0, 1, 1) self.qtgui_freq_sink_x_3 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_3.set_update_time(0.10) self.qtgui_freq_sink_x_3.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_3.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_3.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_3.enable_autoscale(False) self.qtgui_freq_sink_x_3.enable_grid(False) self.qtgui_freq_sink_x_3.set_fft_average(1.0) self.qtgui_freq_sink_x_3.enable_axis_labels(True) self.qtgui_freq_sink_x_3.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_3.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_3.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_3.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_3.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_3.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_3.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_3.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_3_win = sip.wrapinstance( self.qtgui_freq_sink_x_3.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_3_win, 1, 0, 1, 1) self.qtgui_freq_sink_x_2 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_2.set_update_time(0.10) self.qtgui_freq_sink_x_2.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_2.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_2.enable_autoscale(False) self.qtgui_freq_sink_x_2.enable_grid(False) self.qtgui_freq_sink_x_2.set_fft_average(1.0) self.qtgui_freq_sink_x_2.enable_axis_labels(True) self.qtgui_freq_sink_x_2.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_2.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_2.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_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_2.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_2.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_2.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_2_win = sip.wrapinstance( self.qtgui_freq_sink_x_2.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_2_win, 0, 2, 1, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: 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 = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 1, 1, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(disp_min, disp_max) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 1, 1) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf(7, (), 1.0, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.pfb_channelizer_ccf_0.declare_sample_delay(0) 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(91.5e6, 0) self.osmosdr_source_0.set_freq_corr(55, 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(30, 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) ################################################## # Connections ################################################## self.connect((self.osmosdr_source_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_3_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.qtgui_freq_sink_x_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.qtgui_freq_sink_x_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.qtgui_freq_sink_x_4, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.qtgui_freq_sink_x_5, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.qtgui_freq_sink_x_6, 0))
def __init__(self): gr.top_block.__init__(self, "NOAA Demo based on PFB Channelizer Demo") Qt.QWidget.__init__(self) self.setWindowTitle("NOAA Demo based on PFB Channelizer Demo") 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", "amplitude_loss_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.noaa_num_chans = noaa_num_chans = 7 self.noaa_chan_width = noaa_chan_width = int(25e3) self.noaa_band_start = noaa_band_start = 162.4e6 self.oversampled_width = oversampled_width = noaa_chan_width * (noaa_num_chans + 1) self.noaa_fm_dev = noaa_fm_dev = int(5e3) self.noaa_band_center = noaa_band_center = noaa_band_start + (noaa_num_chans / 2 * noaa_chan_width) self.hardware_rate = hardware_rate = int(1e6) self.tuner_freq = tuner_freq = 162.3e6 self.target_freq = target_freq = noaa_band_center self.ppm = ppm = 0 self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width, noaa_fm_dev*2 ,1000, firdes.WIN_HAMMING, 6.76) self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate, oversampled_width / 2,noaa_chan_width, firdes.WIN_HAMMING, 6.76) self.channel_map = channel_map = range(0, noaa_num_chans) self.volume = volume = 0 self.tuner_offset = tuner_offset = target_freq - tuner_freq self.ppm_corr = ppm_corr = tuner_freq * (ppm/1e6) self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps) self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans self.noaa_band_end = noaa_band_end = noaa_band_start + (noaa_num_chans * noaa_chan_width) self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps) self.fftwidth = fftwidth = 512 self.fft_interval = fft_interval = 1.0/20 self.decimation = decimation = hardware_rate / oversampled_width self.channelizer_map = channelizer_map = 5,6,7,0,1,2,3 self.channel_names = channel_names = map(lambda x: "%.3fMHz" % (162.4 + (x*0.025)), channel_map) self.chan_num = chan_num = 3 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source("external", 0) self.uhd_usrp_source_0.set_subdev_spec("A:0", 0) self.uhd_usrp_source_0.set_samp_rate(hardware_rate) self.uhd_usrp_source_0.set_center_freq(tuner_freq, 0) self.uhd_usrp_source_0.set_gain(30, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.qtgui_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate, #bw "Radio Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0/10) self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_0_win, 0,0,1,2) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc hardware_rate/decimation, #bw "Filtered Samples", #name True, #plotfreq False, #plotwaterfall False, #plottime False, #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, 0,2,1,2) self.qtgui_sink_x_0.enable_rf_freq(False) self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( noaa_num_chans+1, (pfb_taps), 1, 1) self.pfb_channelizer_ccf_0.set_channel_map((channelizer_map)) self.pfb_channelizer_ccf_0.declare_sample_delay(0) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(int(decimation), (lpf_taps), tuner_offset + ppm_corr, hardware_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.blocks_null_sink_0_5 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_4 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_3 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_2_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_2 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) ################################################## # Connections ################################################## self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.pfb_channelizer_ccf_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 5), (self.blocks_null_sink_0_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 1), (self.blocks_null_sink_0_1, 0)) self.connect((self.pfb_channelizer_ccf_0, 2), (self.blocks_null_sink_0_2, 0)) self.connect((self.pfb_channelizer_ccf_0, 3), (self.blocks_null_sink_0_2_0, 0)) self.connect((self.pfb_channelizer_ccf_0, 4), (self.blocks_null_sink_0_3, 0)) self.connect((self.pfb_channelizer_ccf_0, 6), (self.blocks_null_sink_0_4, 0)) self.connect((self.pfb_channelizer_ccf_0, 7), (self.blocks_null_sink_0_5, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_sink_x_0_0, 0))