def __init__(self): gr.top_block.__init__(self, "Uhd Hf Am") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Hf Am") 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", "uhd_hf_am") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.5e6 self.rx_freq = rx_freq = 1.0e6 self.fine_freq = fine_freq = 0 self.coarse_freq = coarse_freq = 0 self.volume = volume = 1 self.usb_lsb = usb_lsb = -1 self.ssb_am = ssb_am = 0 self.selection = selection = ((1, 0, 0), (0, 1, 0), (0, 0, 1)) self.pll_lbw = pll_lbw = 200 self.pll_freq = pll_freq = 100 self.lpf_cutoff = lpf_cutoff = 2e3 self.interp = interp = 48 self.freq_label = freq_label = rx_freq + fine_freq + coarse_freq self.decim = decim = samp_rate / 1e3 self.decay_rate = decay_rate = 100e-6 self.audio_ref = audio_ref = 1 self.audio_max_gain = audio_max_gain = 1 self.audio_gain = audio_gain = 1 self.audio_decay = audio_decay = 100 self.audio_attack = audio_attack = 1000 ################################################## # Blocks ################################################## self._volume_range = Range(0, 100, .1, 1, 200) self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "counter_slider", float) self.top_grid_layout.addWidget(self._volume_win, 7, 0, 1, 4) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._usb_lsb_options = ( -1, 1, ) self._usb_lsb_labels = ( 'USB', 'LSB', ) self._usb_lsb_group_box = Qt.QGroupBox("usb_lsb") self._usb_lsb_box = Qt.QHBoxLayout() 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._usb_lsb_button_group = variable_chooser_button_group() self._usb_lsb_group_box.setLayout(self._usb_lsb_box) for i, label in enumerate(self._usb_lsb_labels): radio_button = Qt.QRadioButton(label) self._usb_lsb_box.addWidget(radio_button) self._usb_lsb_button_group.addButton(radio_button, i) self._usb_lsb_callback = lambda i: Qt.QMetaObject.invokeMethod( self._usb_lsb_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._usb_lsb_options.index(i))) self._usb_lsb_callback(self.usb_lsb) self._usb_lsb_button_group.buttonClicked[int].connect( lambda i: self.set_usb_lsb(self._usb_lsb_options[i])) self.top_grid_layout.addWidget(self._usb_lsb_group_box, 5, 5, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._ssb_am_options = ( 0, 1, 2, ) self._ssb_am_labels = ( 'SSB', 'AM', 'AM*', ) self._ssb_am_group_box = Qt.QGroupBox("ssb_am") self._ssb_am_box = Qt.QHBoxLayout() 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._ssb_am_button_group = variable_chooser_button_group() self._ssb_am_group_box.setLayout(self._ssb_am_box) for i, label in enumerate(self._ssb_am_labels): radio_button = Qt.QRadioButton(label) self._ssb_am_box.addWidget(radio_button) self._ssb_am_button_group.addButton(radio_button, i) self._ssb_am_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ssb_am_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ssb_am_options.index(i))) self._ssb_am_callback(self.ssb_am) self._ssb_am_button_group.buttonClicked[int].connect( lambda i: self.set_ssb_am(self._ssb_am_options[i])) self.top_grid_layout.addWidget(self._ssb_am_group_box, 4, 4, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._rx_freq_range = Range(.2e6, 100e6, 100e3, 1.0e6, 200) self._rx_freq_win = RangeWidget(self._rx_freq_range, self.set_rx_freq, "rx_freq", "counter_slider", float) self.top_grid_layout.addWidget(self._rx_freq_win, 4, 0, 1, 4) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._pll_lbw_tool_bar = Qt.QToolBar(self) self._pll_lbw_tool_bar.addWidget(Qt.QLabel("pll_lbw" + ": ")) self._pll_lbw_line_edit = Qt.QLineEdit(str(self.pll_lbw)) self._pll_lbw_tool_bar.addWidget(self._pll_lbw_line_edit) self._pll_lbw_line_edit.returnPressed.connect(lambda: self.set_pll_lbw( eng_notation.str_to_num( str(self._pll_lbw_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._pll_lbw_tool_bar, 9, 7, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 8): self.top_grid_layout.setColumnStretch(c, 1) self._pll_freq_tool_bar = Qt.QToolBar(self) self._pll_freq_tool_bar.addWidget(Qt.QLabel("pll_freq" + ": ")) self._pll_freq_line_edit = Qt.QLineEdit(str(self.pll_freq)) self._pll_freq_tool_bar.addWidget(self._pll_freq_line_edit) self._pll_freq_line_edit.returnPressed.connect( lambda: self.set_pll_freq( eng_notation.str_to_num( str(self._pll_freq_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._pll_freq_tool_bar, 9, 6, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self._lpf_cutoff_options = ( 2e3, 3e3, 4e3, 8e3, ) self._lpf_cutoff_labels = ( str(self._lpf_cutoff_options[0]), str(self._lpf_cutoff_options[1]), str(self._lpf_cutoff_options[2]), str(self._lpf_cutoff_options[3]), ) self._lpf_cutoff_tool_bar = Qt.QToolBar(self) self._lpf_cutoff_tool_bar.addWidget(Qt.QLabel("lpf_cutoff" + ": ")) self._lpf_cutoff_combo_box = Qt.QComboBox() self._lpf_cutoff_tool_bar.addWidget(self._lpf_cutoff_combo_box) for label in self._lpf_cutoff_labels: self._lpf_cutoff_combo_box.addItem(label) self._lpf_cutoff_callback = lambda i: Qt.QMetaObject.invokeMethod( self._lpf_cutoff_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._lpf_cutoff_options.index(i))) self._lpf_cutoff_callback(self.lpf_cutoff) self._lpf_cutoff_combo_box.currentIndexChanged.connect( lambda i: self.set_lpf_cutoff(self._lpf_cutoff_options[i])) self.top_grid_layout.addWidget(self._lpf_cutoff_tool_bar, 4, 5, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._fine_freq_range = Range(-1e3, 1e3, 1, 0, 200) self._fine_freq_win = RangeWidget(self._fine_freq_range, self.set_fine_freq, "fine_freq", "counter_slider", float) self.top_grid_layout.addWidget(self._fine_freq_win, 6, 0, 1, 4) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._decay_rate_options = ( 100e-6, 65e-3, 20e-3, ) self._decay_rate_labels = ( 'Fast', 'Medium', 'Slow', ) self._decay_rate_group_box = Qt.QGroupBox("decay_rate") self._decay_rate_box = Qt.QHBoxLayout() 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._decay_rate_button_group = variable_chooser_button_group() self._decay_rate_group_box.setLayout(self._decay_rate_box) for i, label in enumerate(self._decay_rate_labels): radio_button = Qt.QRadioButton(label) self._decay_rate_box.addWidget(radio_button) self._decay_rate_button_group.addButton(radio_button, i) self._decay_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._decay_rate_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._decay_rate_options.index(i))) self._decay_rate_callback(self.decay_rate) self._decay_rate_button_group.buttonClicked[int].connect( lambda i: self.set_decay_rate(self._decay_rate_options[i])) self.top_grid_layout.addWidget(self._decay_rate_group_box, 4, 6, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self._coarse_freq_range = Range(-100e3, 100e3, 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, 0, 1, 4) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._audio_ref_tool_bar = Qt.QToolBar(self) self._audio_ref_tool_bar.addWidget(Qt.QLabel("audio_ref" + ": ")) self._audio_ref_line_edit = Qt.QLineEdit(str(self.audio_ref)) self._audio_ref_tool_bar.addWidget(self._audio_ref_line_edit) self._audio_ref_line_edit.returnPressed.connect( lambda: self.set_audio_ref( eng_notation.str_to_num( str(self._audio_ref_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_ref_tool_bar, 9, 3, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._audio_max_gain_tool_bar = Qt.QToolBar(self) self._audio_max_gain_tool_bar.addWidget( Qt.QLabel("audio_max_gain" + ": ")) self._audio_max_gain_line_edit = Qt.QLineEdit(str(self.audio_max_gain)) self._audio_max_gain_tool_bar.addWidget(self._audio_max_gain_line_edit) self._audio_max_gain_line_edit.returnPressed.connect( lambda: self.set_audio_max_gain( eng_notation.str_to_num( str(self._audio_max_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_max_gain_tool_bar, 9, 5, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._audio_gain_tool_bar = Qt.QToolBar(self) self._audio_gain_tool_bar.addWidget(Qt.QLabel("audio_gain" + ": ")) self._audio_gain_line_edit = Qt.QLineEdit(str(self.audio_gain)) self._audio_gain_tool_bar.addWidget(self._audio_gain_line_edit) self._audio_gain_line_edit.returnPressed.connect( lambda: self.set_audio_gain( eng_notation.str_to_num( str(self._audio_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_gain_tool_bar, 9, 4, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._audio_decay_tool_bar = Qt.QToolBar(self) self._audio_decay_tool_bar.addWidget(Qt.QLabel("audio_decay" + ": ")) self._audio_decay_line_edit = Qt.QLineEdit(str(self.audio_decay)) self._audio_decay_tool_bar.addWidget(self._audio_decay_line_edit) self._audio_decay_line_edit.returnPressed.connect( lambda: self.set_audio_decay( eng_notation.str_to_num( str(self._audio_decay_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_decay_tool_bar, 9, 2, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._audio_attack_tool_bar = Qt.QToolBar(self) self._audio_attack_tool_bar.addWidget(Qt.QLabel("audio_attack" + ": ")) self._audio_attack_line_edit = Qt.QLineEdit(str(self.audio_attack)) self._audio_attack_tool_bar.addWidget(self._audio_attack_line_edit) self._audio_attack_line_edit.returnPressed.connect( lambda: self.set_audio_attack( eng_notation.str_to_num( str(self._audio_attack_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_attack_tool_bar, 9, 1, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("addr=192.168.10.2", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_clock_source('external', 0) self.uhd_usrp_source_1.set_time_source('external', 0) self.uhd_usrp_source_1.set_subdev_spec('A:AB', 0) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, ), 0) self.uhd_usrp_source_1.set_gain(0, 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=200, decimation=int(samp_rate / 1e3), taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=int(decim), taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate / decim * interp / 3, #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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 8, 0, 1, 4) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.010) self.qtgui_number_sink_0.set_title('') labels = ["RSSI", '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 50) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 5, 6, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp / 3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.0010) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) 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(True) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not False: 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 = ['', 'processed', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 6, 4, 3, 2) for r in range(6, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): 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 / decim * interp, #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(-120, -10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(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 = ['pre-d', 'processed', '', '', '', '', '', '', '', ''] 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, 4, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_1 = filter.interp_fir_filter_fff( 1, firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 3, firdes.low_pass(1, samp_rate / decim * interp, lpf_cutoff, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.interp_fir_filter_fff( 1, firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100, firdes.WIN_HAMMING, 6.76)) self._freq_label_tool_bar = Qt.QToolBar(self) if None: self._freq_label_formatter = None else: self._freq_label_formatter = lambda x: eng_notation.num_to_str(x) self._freq_label_tool_bar.addWidget(Qt.QLabel('Tuned Freq' + ": ")) self._freq_label_label = Qt.QLabel( str(self._freq_label_formatter(self.freq_label))) self._freq_label_tool_bar.addWidget(self._freq_label_label) self.top_grid_layout.addWidget(self._freq_label_tool_bar, 5, 4, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.fosphor_qt_sink_c_0 = fosphor.qt_sink_c() self.fosphor_qt_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_qt_sink_c_0.set_frequency_range( rx_freq, samp_rate / int(samp_rate / 1e3) * 200) self._fosphor_qt_sink_c_0_win = sip.wrapinstance( self.fosphor_qt_sink_c_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_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.blocks_multiply_xx_1_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_matrix_xx_0_0_0 = blocks.multiply_matrix_cc( (selection[ssb_am], ), gr.TPP_ALL_TO_ALL) self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_ff( (selection[ssb_am], ), gr.TPP_ALL_TO_ALL) self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff( (100000, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (usb_lsb, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (volume, )) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 1000, 1 / 1000.0, 4000, 1) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(16000, '', True) self.analog_sig_source_x_0_0_0 = analog.sig_source_f( samp_rate / decim * interp / 3, analog.GR_SIN_WAVE, 1.5e3, 1, 0) self.analog_sig_source_x_0_0 = analog.sig_source_f( samp_rate / decim * interp / 3, analog.GR_COS_WAVE, 1.5e3, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * (fine_freq + coarse_freq), 1, 0) self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc( math.pi / pll_lbw, math.pi / pll_freq, -math.pi / pll_freq) self.analog_agc2_xx_0_0 = analog.agc2_ff(audio_attack, audio_decay, audio_ref, audio_gain) self.analog_agc2_xx_0_0.set_max_gain(audio_max_gain) self.analog_agc2_xx_0 = analog.agc2_cc(0.1, decay_rate, .3, 1000) self.analog_agc2_xx_0.set_max_gain(65000) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 2)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_1_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_matrix_xx_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.low_pass_filter_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_matrix_xx_0, 2)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_multiply_matrix_xx_0, 1)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_pll_carriertracking_cc_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 1)) self.connect((self.low_pass_filter_0_1, 0), (self.blocks_multiply_xx_1_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0_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, 0), (self.fosphor_qt_sink_c_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.analog_agc2_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Run Rootmusic Calib Lin Array Simulation") Qt.QWidget.__init__(self) self.setWindowTitle("Run Rootmusic Calib Lin Array Simulation") 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", "run_RootMUSIC_calib_lin_array_simulation") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.theta1_deg = theta1_deg = 123 self.theta0_deg = theta0_deg = 30 self.input_variables = input_variables = struct({ 'SampleRate': 320000, 'ToneFreq1': 10000, 'ToneFreq2': 20000, 'NormSpacing': 0.44, 'NumTargets': 2, 'NumArrayElements': 4, 'PSpectrumLength': 2**10, 'SnapshotSize': 2**11, 'OverlapSize': 2**9, 'AntGains': numpy.array([0.94984789, 0.4544107, 0.34649469, 0.25083929]), 'AntPhases': numpy.array([0.28647672, 5.27248071, 2.71271102, 1.36970886]), 'DirectoryConfigFiles': "/tmp", 'AntennaCalibration': "calibration_lin_array_simulated.cfg", }) self.theta1 = theta1 = numpy.pi * theta1_deg / 180 self.theta0 = theta0 = numpy.pi * theta0_deg / 180 self.ant_locs = ant_locs = numpy.dot( input_variables.NormSpacing, numpy.arange(input_variables.NumArrayElements / 2, -input_variables.NumArrayElements / 2, -1) if (input_variables.NumArrayElements % 2 == 1) else numpy.arange( input_variables.NumArrayElements / 2 - 0.5, -input_variables.NumArrayElements / 2 - 0.5, -1)) self.ant_coeffs = ant_coeffs = input_variables.AntGains * numpy.exp( 1j * input_variables.AntPhases) self.amv1_true = amv1_true = numpy.exp(-1j * ant_locs * 2 * numpy.pi * numpy.cos(theta1)) self.amv0_true = amv0_true = numpy.exp(-1j * ant_locs * 2 * numpy.pi * numpy.cos(theta0)) self.amv1 = amv1 = numpy.multiply(ant_coeffs, amv1_true) self.amv0 = amv0 = numpy.multiply(ant_coeffs, amv0_true) self.array_manifold_matrix = array_manifold_matrix = numpy.array( [amv0, amv1]).transpose() self.antenna_calibration_file_name = antenna_calibration_file_name = os.path.join( input_variables.DirectoryConfigFiles, input_variables.AntennaCalibration) ################################################## # 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, 'Direction of Arrival') 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, 'Direction of Arrival') self.top_layout.addWidget(self.tab) self._theta1_deg_range = Range(0, 180, 1, 123, 200) self._theta1_deg_win = RangeWidget(self._theta1_deg_range, self.set_theta1_deg, 'AoA', "counter_slider", float) self.top_layout.addWidget(self._theta1_deg_win) self._theta0_deg_range = Range(0, 180, 1, 30, 200) self._theta0_deg_win = RangeWidget(self._theta0_deg_range, self.set_theta0_deg, 'AoA', "counter_slider", float) self.top_layout.addWidget(self._theta0_deg_win) self.doa_rootMUSIC_linear_array_0 = doa.rootMUSIC_linear_array( input_variables.NormSpacing, input_variables.NumTargets, input_variables.NumArrayElements) self.doa_compass_0 = doa.compass("", 0, 180, 10, 0) self.tab_layout_1.addLayout(self.doa_compass_0.this_layout) self.doa_compass = doa.compass("", 0, 180, 10, 0) self.tab_layout_0.addLayout(self.doa_compass.this_layout) self.doa_autocorrelate_0 = doa.autocorrelate( input_variables.NumArrayElements, input_variables.SnapshotSize, input_variables.OverlapSize, 1) self.doa_antenna_correction_0 = doa.antenna_correction( input_variables.NumArrayElements, antenna_calibration_file_name) self.blocks_vector_to_streams_0 = blocks.vector_to_streams( gr.sizeof_float * 1, input_variables.NumTargets) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, input_variables.SampleRate, True) self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_cc( array_manifold_matrix, gr.TPP_ALL_TO_ALL) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c( input_variables.SampleRate, analog.GR_COS_WAVE, input_variables.ToneFreq2, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( input_variables.SampleRate, analog.GR_COS_WAVE, input_variables.ToneFreq1, 1, 0) self.analog_noise_source_x_0_0_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 0.5, 0) self.analog_noise_source_x_0_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 0.0005, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_noise_source_x_0_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_matrix_xx_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 0), (self.doa_antenna_correction_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 1), (self.doa_antenna_correction_0, 1)) self.connect((self.blocks_multiply_matrix_xx_0, 2), (self.doa_antenna_correction_0, 2)) self.connect((self.blocks_multiply_matrix_xx_0, 3), (self.doa_antenna_correction_0, 3)) self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_matrix_xx_0, 1)) self.connect((self.blocks_vector_to_streams_0, 0), (self.doa_compass, 0)) self.connect((self.blocks_vector_to_streams_0, 1), (self.doa_compass_0, 0)) self.connect((self.doa_antenna_correction_0, 0), (self.doa_autocorrelate_0, 0)) self.connect((self.doa_antenna_correction_0, 1), (self.doa_autocorrelate_0, 1)) self.connect((self.doa_antenna_correction_0, 2), (self.doa_autocorrelate_0, 2)) self.connect((self.doa_antenna_correction_0, 3), (self.doa_autocorrelate_0, 3)) self.connect((self.doa_autocorrelate_0, 0), (self.doa_rootMUSIC_linear_array_0, 0)) self.connect((self.doa_rootMUSIC_linear_array_0, 0), (self.blocks_vector_to_streams_0, 0))
def __init__(self): gr.top_block.__init__(self, "Run Music Lin Array Simulation") Qt.QWidget.__init__(self) self.setWindowTitle("Run Music Lin Array Simulation") 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", "run_MUSIC_lin_array_simulation") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.theta1_deg = theta1_deg = 123 self.theta0_deg = theta0_deg = 30 self.input_variables = input_variables = struct({'SampleRate': 320000, 'ToneFreq1': 10000, 'ToneFreq2': 20000, 'NormSpacing': 0.4, 'NumTargets': 2, 'NumArrayElements': 4, 'PSpectrumLength': 2**10, 'SnapshotSize': 2**11, 'OverlapSize': 2**9, }) self.theta1 = theta1 = numpy.pi*theta1_deg/180 self.theta0 = theta0 = numpy.pi*theta0_deg/180 self.ant_locs = ant_locs = numpy.dot(input_variables.NormSpacing, numpy.arange(input_variables.NumArrayElements/2, -input_variables.NumArrayElements/2, -1) if (input_variables.NumArrayElements%2==1) else numpy.arange(input_variables.NumArrayElements/2-0.5, -input_variables.NumArrayElements/2-0.5, -1)) self.amv1 = amv1 = numpy.exp(-1j*ant_locs*2*numpy.pi*numpy.cos(theta1)) self.amv0 = amv0 = numpy.exp(-1j*ant_locs*2*numpy.pi*numpy.cos(theta0)) self.array_manifold_matrix = array_manifold_matrix = numpy.array([amv0, amv1]).transpose() ################################################## # 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, 'Pseudo-Spectrum') 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, 'Direction of Arrival') 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, 'Direction of Arrival') self.top_layout.addWidget(self.tab) self._theta1_deg_range = Range(0, 180, 1, 123, 200) self._theta1_deg_win = RangeWidget(self._theta1_deg_range, self.set_theta1_deg, 'AoA', "counter_slider", float) self.top_layout.addWidget(self._theta1_deg_win) self._theta0_deg_range = Range(0, 180, 1, 30, 200) self._theta0_deg_win = RangeWidget(self._theta0_deg_range, self.set_theta0_deg, 'AoA', "counter_slider", float) self.top_layout.addWidget(self._theta0_deg_win) self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f( input_variables.PSpectrumLength, 0, 180.0/input_variables.PSpectrumLength, "angle (in degrees)", "Pseudo-Spectrum (dB)", "", 1 # Number of inputs ) self.qtgui_vector_sink_f_0.set_update_time(0.05) self.qtgui_vector_sink_f_0.set_y_axis(-50, 0) self.qtgui_vector_sink_f_0.enable_autoscale(False) self.qtgui_vector_sink_f_0.enable_grid(True) self.qtgui_vector_sink_f_0.set_x_axis_units("") self.qtgui_vector_sink_f_0.set_y_axis_units("") self.qtgui_vector_sink_f_0.set_ref_level(0) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget) self.tab_layout_0.addWidget(self._qtgui_vector_sink_f_0_win) self.doa_find_local_max_0 = doa.find_local_max(input_variables.NumTargets, input_variables.PSpectrumLength, 0.0, 180.0) self.doa_compass_0 = doa.compass("", 0, 180, 10, 0) self.tab_layout_1.addLayout(self.doa_compass_0.this_layout) self.doa_compass = doa.compass("", 0, 180, 10, 0) self.tab_layout_2.addLayout(self.doa_compass.this_layout) self.doa_autocorrelate_0 = doa.autocorrelate(input_variables.NumArrayElements, input_variables.SnapshotSize, input_variables.OverlapSize, 1) self.doa_MUSIC_lin_array_0 = doa.MUSIC_lin_array(input_variables.NormSpacing, input_variables.NumTargets, input_variables.NumArrayElements, input_variables.PSpectrumLength) self.blocks_vector_to_streams_0 = blocks.vector_to_streams(gr.sizeof_float*1, input_variables.NumTargets) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, input_variables.SampleRate,True) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*input_variables.NumTargets) self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_cc(array_manifold_matrix, gr.TPP_ALL_TO_ALL) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(input_variables.SampleRate, analog.GR_COS_WAVE, input_variables.ToneFreq2, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(input_variables.SampleRate, analog.GR_COS_WAVE, input_variables.ToneFreq1, 1, 0) self.analog_noise_source_x_0_0_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.5, 0) self.analog_noise_source_x_0_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.0005, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_noise_source_x_0_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_matrix_xx_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 0), (self.doa_autocorrelate_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 1), (self.doa_autocorrelate_0, 1)) self.connect((self.blocks_multiply_matrix_xx_0, 2), (self.doa_autocorrelate_0, 2)) self.connect((self.blocks_multiply_matrix_xx_0, 3), (self.doa_autocorrelate_0, 3)) self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_matrix_xx_0, 1)) self.connect((self.blocks_vector_to_streams_0, 0), (self.doa_compass, 0)) self.connect((self.blocks_vector_to_streams_0, 1), (self.doa_compass_0, 0)) self.connect((self.doa_MUSIC_lin_array_0, 0), (self.doa_find_local_max_0, 0)) self.connect((self.doa_MUSIC_lin_array_0, 0), (self.qtgui_vector_sink_f_0, 0)) self.connect((self.doa_autocorrelate_0, 0), (self.doa_MUSIC_lin_array_0, 0)) self.connect((self.doa_find_local_max_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.doa_find_local_max_0, 1), (self.blocks_vector_to_streams_0, 0))
def __init__(self): gr.top_block.__init__(self, "Telemetry Rx Hp") Qt.QWidget.__init__(self) self.setWindowTitle("Telemetry Rx Hp") 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", "telemetry_rx_hp") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.symb_rate = symb_rate = 52083 self.samp_per_symb = samp_per_symb = 6 self.sec_dec = sec_dec = 4 self.rate = rate = 2 self.polys = polys = [109, 79] self.k = k = 7 self.channel_bw = channel_bw = symb_rate * samp_per_symb / 2 self.MTU = MTU = 1500 self.waterfall_per = waterfall_per = 0.1 self.ss_ted_gain_range = ss_ted_gain_range = 100 self.ss_loopbw_range = ss_loopbw_range = 0.4 self.ss_damping_factor_range = ss_damping_factor_range = 0.5 self.source_option = source_option = (1, 0) self.pll_loopbw_range = pll_loopbw_range = 0.3 self.gain_before_tr = gain_before_tr = 30 self.f_if = f_if = 75000 self.doppler = doppler = 0 self.dec_cc = dec_cc = fec.cc_decoder.make(MTU * 8, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False) self.ad_samp_rate = ad_samp_rate = symb_rate * sec_dec * samp_per_symb self.ad_channel_bw = ad_channel_bw = channel_bw * 5 self.ad9361_lo_freq = ad9361_lo_freq = 437000000 ################################################## # Blocks ################################################## self.tab_control = Qt.QTabWidget() self.tab_control_widget_0 = Qt.QWidget() self.tab_control_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_control_widget_0) self.tab_control_grid_layout_0 = Qt.QGridLayout() self.tab_control_layout_0.addLayout(self.tab_control_grid_layout_0) self.tab_control.addTab(self.tab_control_widget_0, 'General') self.tab_control_widget_1 = Qt.QWidget() self.tab_control_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_control_widget_1) self.tab_control_grid_layout_1 = Qt.QGridLayout() self.tab_control_layout_1.addLayout(self.tab_control_grid_layout_1) self.tab_control.addTab(self.tab_control_widget_1, 'GMSK Demodulator') self.tab_control_widget_2 = Qt.QWidget() self.tab_control_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_control_widget_2) self.tab_control_grid_layout_2 = Qt.QGridLayout() self.tab_control_layout_2.addLayout(self.tab_control_grid_layout_2) self.tab_control.addTab(self.tab_control_widget_2, 'Gardner Timing Recovery') self.top_grid_layout.addWidget(self.tab_control, 0, 0, 3, 1) for r in range(0, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._waterfall_per_tool_bar = Qt.QToolBar(self) self._waterfall_per_tool_bar.addWidget( Qt.QLabel('Waterfall Plot Period' + ": ")) self._waterfall_per_line_edit = Qt.QLineEdit(str(self.waterfall_per)) self._waterfall_per_tool_bar.addWidget(self._waterfall_per_line_edit) self._waterfall_per_line_edit.returnPressed.connect( lambda: self.set_waterfall_per( eng_notation.str_to_num( str(self._waterfall_per_line_edit.text().toAscii())))) self.tab_control_grid_layout_0.addWidget(self._waterfall_per_tool_bar, 3, 0, 1, 4) for r in range(3, 4): self.tab_control_grid_layout_0.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_0.setColumnStretch(c, 1) self.tab_stat = Qt.QTabWidget() self.tab_stat_widget_0 = Qt.QWidget() self.tab_stat_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_stat_widget_0) self.tab_stat_grid_layout_0 = Qt.QGridLayout() self.tab_stat_layout_0.addLayout(self.tab_stat_grid_layout_0) self.tab_stat.addTab(self.tab_stat_widget_0, 'General') self.top_grid_layout.addWidget(self.tab_stat, 3, 0, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.tab_plot = Qt.QTabWidget() self.tab_plot_widget_0 = Qt.QWidget() self.tab_plot_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_0) self.tab_plot_grid_layout_0 = Qt.QGridLayout() self.tab_plot_layout_0.addLayout(self.tab_plot_grid_layout_0) self.tab_plot.addTab(self.tab_plot_widget_0, 'Frequency Plot') self.tab_plot_widget_1 = Qt.QWidget() self.tab_plot_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_1) self.tab_plot_grid_layout_1 = Qt.QGridLayout() self.tab_plot_layout_1.addLayout(self.tab_plot_grid_layout_1) self.tab_plot.addTab(self.tab_plot_widget_1, 'Time Plot') self.tab_plot_widget_2 = Qt.QWidget() self.tab_plot_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_2) self.tab_plot_grid_layout_2 = Qt.QGridLayout() self.tab_plot_layout_2.addLayout(self.tab_plot_grid_layout_2) self.tab_plot.addTab(self.tab_plot_widget_2, 'Demoded Bits 1') self.tab_plot_widget_3 = Qt.QWidget() self.tab_plot_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_3) self.tab_plot_grid_layout_3 = Qt.QGridLayout() self.tab_plot_layout_3.addLayout(self.tab_plot_grid_layout_3) self.tab_plot.addTab(self.tab_plot_widget_3, 'Demoded Bits 2') self.tab_plot_widget_4 = Qt.QWidget() self.tab_plot_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_4) self.tab_plot_grid_layout_4 = Qt.QGridLayout() self.tab_plot_layout_4.addLayout(self.tab_plot_grid_layout_4) self.tab_plot.addTab(self.tab_plot_widget_4, 'Decoded Data (Viterbi)') self.tab_plot_widget_5 = Qt.QWidget() self.tab_plot_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_5) self.tab_plot_grid_layout_5 = Qt.QGridLayout() self.tab_plot_layout_5.addLayout(self.tab_plot_grid_layout_5) self.tab_plot.addTab(self.tab_plot_widget_5, 'Decoded Data (RS)') self.tab_plot_widget_6 = Qt.QWidget() self.tab_plot_layout_6 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_plot_widget_6) self.tab_plot_grid_layout_6 = Qt.QGridLayout() self.tab_plot_layout_6.addLayout(self.tab_plot_grid_layout_6) self.tab_plot.addTab(self.tab_plot_widget_6, 'Decrypted Data') self.top_grid_layout.addWidget(self.tab_plot, 0, 1, 4, 3) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 4): self.top_grid_layout.setColumnStretch(c, 1) self._ss_ted_gain_range_range = Range(1, 1000, 1, 100, 10000) self._ss_ted_gain_range_win = RangeWidget( self._ss_ted_gain_range_range, self.set_ss_ted_gain_range, 'Symbol Sync TED gain', "slider", float) self.tab_control_grid_layout_2.addWidget(self._ss_ted_gain_range_win, 1, 0, 1, 4) for r in range(1, 2): self.tab_control_grid_layout_2.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_2.setColumnStretch(c, 1) self._ss_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000) self._ss_loopbw_range_win = RangeWidget(self._ss_loopbw_range_range, self.set_ss_loopbw_range, 'Symbol Sync LBW', "slider", float) self.tab_control_grid_layout_2.addWidget(self._ss_loopbw_range_win, 0, 0, 1, 4) for r in range(0, 1): self.tab_control_grid_layout_2.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_2.setColumnStretch(c, 1) self._ss_damping_factor_range_range = Range(0.001, 2, 0.001, 0.5, 10000) self._ss_damping_factor_range_win = RangeWidget( self._ss_damping_factor_range_range, self.set_ss_damping_factor_range, 'Symbol Sync DF', "slider", float) self.tab_control_grid_layout_2.addWidget( self._ss_damping_factor_range_win, 2, 0, 1, 4) for r in range(2, 3): self.tab_control_grid_layout_2.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_2.setColumnStretch(c, 1) self._source_option_options = ( (1, 0), (0, 1), ) self._source_option_labels = ( 'AD9361', 'File', ) self._source_option_tool_bar = Qt.QToolBar(self) self._source_option_tool_bar.addWidget(Qt.QLabel('Source From' + ": ")) self._source_option_combo_box = Qt.QComboBox() self._source_option_tool_bar.addWidget(self._source_option_combo_box) for label in self._source_option_labels: self._source_option_combo_box.addItem(label) self._source_option_callback = lambda i: Qt.QMetaObject.invokeMethod( self._source_option_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._source_option_options.index(i))) self._source_option_callback(self.source_option) self._source_option_combo_box.currentIndexChanged.connect( lambda i: self.set_source_option(self._source_option_options[i])) self.tab_control_grid_layout_0.addWidget(self._source_option_tool_bar, 2, 0, 1, 4) for r in range(2, 3): self.tab_control_grid_layout_0.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_0.setColumnStretch(c, 1) self._pll_loopbw_range_range = Range(0.001, 2, 0.001, 0.3, 10000) self._pll_loopbw_range_win = RangeWidget(self._pll_loopbw_range_range, self.set_pll_loopbw_range, 'PLL LBW', "slider", float) self.tab_control_grid_layout_1.addWidget(self._pll_loopbw_range_win, 0, 0, 1, 4) for r in range(0, 1): self.tab_control_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_1.setColumnStretch(c, 1) self._gain_before_tr_range = Range(0.1, 100, 0.1, 30, 1000) self._gain_before_tr_win = RangeWidget(self._gain_before_tr_range, self.set_gain_before_tr, 'Gain', "slider", float) self.tab_control_grid_layout_1.addWidget(self._gain_before_tr_win, 1, 0, 1, 4) for r in range(1, 2): self.tab_control_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_1.setColumnStretch(c, 1) self._f_if_tool_bar = Qt.QToolBar(self) self._f_if_tool_bar.addWidget(Qt.QLabel('IF Frequency' + ": ")) self._f_if_line_edit = Qt.QLineEdit(str(self.f_if)) self._f_if_tool_bar.addWidget(self._f_if_line_edit) self._f_if_line_edit.returnPressed.connect(lambda: self.set_f_if( int(str(self._f_if_line_edit.text().toAscii())))) self.tab_control_grid_layout_0.addWidget(self._f_if_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.tab_control_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.tab_control_grid_layout_0.setColumnStretch(c, 1) self._doppler_tool_bar = Qt.QToolBar(self) self._doppler_tool_bar.addWidget(Qt.QLabel('Doppler' + ": ")) self._doppler_line_edit = Qt.QLineEdit(str(self.doppler)) self._doppler_tool_bar.addWidget(self._doppler_line_edit) self._doppler_line_edit.returnPressed.connect(lambda: self.set_doppler( int(str(self._doppler_line_edit.text().toAscii())))) self.tab_control_grid_layout_0.addWidget(self._doppler_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.tab_control_grid_layout_0.setRowStretch(r, 1) for c in range(2, 4): self.tab_control_grid_layout_0.setColumnStretch(c, 1) self._ad9361_lo_freq_tool_bar = Qt.QToolBar(self) self._ad9361_lo_freq_tool_bar.addWidget( Qt.QLabel('AD9361 LO Frequency' + ": ")) self._ad9361_lo_freq_line_edit = Qt.QLineEdit(str(self.ad9361_lo_freq)) self._ad9361_lo_freq_tool_bar.addWidget(self._ad9361_lo_freq_line_edit) self._ad9361_lo_freq_line_edit.returnPressed.connect( lambda: self.set_ad9361_lo_freq( int(str(self._ad9361_lo_freq_line_edit.text().toAscii())))) self.tab_control_grid_layout_0.addWidget(self._ad9361_lo_freq_tool_bar, 0, 0, 1, 4) for r in range(0, 1): self.tab_control_grid_layout_0.setRowStretch(r, 1) for c in range(0, 4): self.tab_control_grid_layout_0.setColumnStretch(c, 1) self.satellites_decode_rs_general_0 = satellites.decode_rs_general( 285, 0, 1, 32, False, False) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc symb_rate * samp_per_symb, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(waterfall_per) self.qtgui_waterfall_sink_x_0.enable_grid(True) 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 = [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.tab_plot_grid_layout_0.addWidget( self._qtgui_waterfall_sink_x_0_win, 2, 0, 2, 4) for r in range(2, 4): self.tab_plot_grid_layout_0.setRowStretch(r, 1) for c in range(0, 4): self.tab_plot_grid_layout_0.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f( 4144, #size symb_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1, 2) self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len") self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(True) self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False) if not False: self.qtgui_time_sink_x_0_0_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [2, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget) self.tab_plot_grid_layout_3.addWidget( self._qtgui_time_sink_x_0_0_0_0_0_win, 0, 0, 2, 4) for r in range(0, 2): self.tab_plot_grid_layout_3.setRowStretch(r, 1) for c in range(0, 4): self.tab_plot_grid_layout_3.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size symb_rate * samp_per_symb, #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(-20, 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_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(True) 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 = [2, -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.tab_plot_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_number_sink_0_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 2) self.qtgui_number_sink_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0.set_title("Decrypted Frame Counter") labels = ['Counter', 'Rate (bps)', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(2): self.qtgui_number_sink_0_0.set_min(i, -1) self.qtgui_number_sink_0_0.set_max(i, 1) self.qtgui_number_sink_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget) self.tab_stat_grid_layout_0.addWidget(self._qtgui_number_sink_0_0_win, 0, 3, 2, 1) for r in range(0, 2): self.tab_stat_grid_layout_0.setRowStretch(r, 1) for c in range(3, 4): self.tab_stat_grid_layout_0.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 2) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("Received Frame Counter") labels = ['Counter', 'Rate (bps)', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(2): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.tab_stat_grid_layout_0.addWidget(self._qtgui_number_sink_0_win, 0, 2, 2, 1) for r in range(0, 2): self.tab_stat_grid_layout_0.setRowStretch(r, 1) for c in range(2, 3): self.tab_stat_grid_layout_0.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf( sec_dec, firdes.low_pass(1, symb_rate * samp_per_symb * sec_dec, channel_bw, channel_bw / 20, firdes.WIN_HAMMING, 6.76)) self.iustsat_zafar_telemetry_frame_extractor_1 = iustsat.zafar_telemetry_frame_extractor( "pkt_len") self.iustsat_zafar_telemetry_derand_0 = iustsat.zafar_telemetry_derand( "pkt_len") self.iustsat_tag_counter_0 = iustsat.tag_counter('pkt_len') self.iustsat_synch_detect_tag_1 = iustsat.synch_detect_tag( 60, 'pkt_len', 259 * 2 * 8) self.iustsat_rs_to_decrypt_0_0 = iustsat.rs_to_decrypt( 'iv', ([ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, 0xDE, 0xCA, 0xF8, 0x88 ]), 'aad', 'auth_tag') self.iustsat_pdu_to_message_0 = iustsat.pdu_to_message('frm_len') self.iustsat_pdu_debug_0_0 = iustsat.pdu_debug('auth_tag') self.iustsat_frame_analysis_0 = iustsat.frame_analysis('frm_len') self.iio_fmcomms2_source_0 = iio.fmcomms2_source_f32c( '192.168.1.10', ad9361_lo_freq - (f_if + doppler), ad_samp_rate, ad_channel_bw, True, False, 0x8000, True, True, True, "fast_attack", 64.0, "manual", 64.0, "A_BALANCED", '', True) self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([ 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1 ])) self.fir_filter_xxx_0.declare_sample_delay(0) self.fec_async_decoder_0 = fec.async_decoder(dec_cc, True, False, MTU) self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff( digital.TED_GARDNER, samp_per_symb, ss_loopbw_range, ss_damping_factor_range, ss_ted_gain_range, 2, 1, digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128, ([])) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(65536, True) self.crypto_auth_dec_aes_gcm_0_0 = crypto.auth_dec_aes_gcm(([ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08 ]), 16, 96) self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0.set_single_key("") self.blocks_pdu_to_tagged_stream_0_0_0_1 = blocks.pdu_to_tagged_stream( blocks.float_t, 'frm_len') self.blocks_pdu_to_tagged_stream_0_0_0_0 = blocks.pdu_to_tagged_stream( blocks.float_t, 'frm_len') self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream( blocks.float_t, 'frm_len') self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_cc( (source_option, ), gr.TPP_ALL_TO_ALL) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (0.066666667, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, )) self.blocks_multiply_const = blocks.multiply_const_vff( (gain_before_tr, )) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/iust/Documents/zafar_prj/gr-iustsat/examples/Records/REC7_GMSK.bin', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, '/home/iust/Documents/zafar_prj/gr-iustsat/examples/ReceivedData/TelemetryReceivedData.bin', False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 63) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, )) self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf( pll_loopbw_range, 200000 * 6.28 / (ad_samp_rate / sec_dec), -200000 * 6.28 / (ad_samp_rate / sec_dec)) ################################################## # Connections ################################################## self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_frame_analysis_0, 'in')) self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_pdu_debug_0_0, 'pdu_in')) self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_pdu_to_message_0, 'in')) self.msg_connect((self.fec_async_decoder_0, 'out'), (self.iustsat_zafar_telemetry_derand_0, 'in')) self.msg_connect((self.iustsat_frame_analysis_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus')) self.msg_connect((self.iustsat_frame_analysis_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0_1, 'pdus')) self.msg_connect((self.iustsat_pdu_to_message_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0_0, 'pdus')) self.msg_connect((self.iustsat_rs_to_decrypt_0_0, 'out'), (self.crypto_auth_dec_aes_gcm_0_0, 'pdus')) self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'), (self.satellites_decode_rs_general_0, 'in')) self.msg_connect( (self.iustsat_zafar_telemetry_frame_extractor_1, 'out'), (self.fec_async_decoder_0, 'in')) self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.iustsat_rs_to_decrypt_0_0, 'in')) self.connect((self.analog_pll_freqdet_cf_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.blocks_delay_0, 0), (self.iustsat_synch_detect_tag_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_matrix_xx_0, 1)) self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_const, 0), (self.digital_symbol_sync_xx_0, 0)) self.connect((self.blocks_multiply_const, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.qtgui_number_sink_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_1, 0), (self.qtgui_number_sink_0_0, 1)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_matrix_xx_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.digital_symbol_sync_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.iustsat_synch_detect_tag_1, 1)) self.connect((self.iio_fmcomms2_source_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_tag_counter_0, 0)) self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_zafar_telemetry_frame_extractor_1, 0)) self.connect((self.iustsat_synch_detect_tag_1, 0), (self.qtgui_time_sink_x_0_0_0_0_0, 0)) self.connect((self.iustsat_tag_counter_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.iustsat_tag_counter_0, 1), (self.qtgui_number_sink_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.analog_pll_freqdet_cf_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0))