From 22cb5e1844547220d000a0eb0b56f5b7a043ecd5 Mon Sep 17 00:00:00 2001 From: Manolis Surligas Date: Thu, 11 Jan 2018 02:25:23 +0200 Subject: [PATCH] Fix METEOR flowgraph * Set the METEOR flowgraph in non-X mode * Reduce the stored bandwidth by a factor of 2. Captures have shown that twice the bandwidth of the METEOR is enough for RRC and clock recovery --- apps/flowgraphs/satellites/meteor_decoder.grc | 336 +----------------- .../satellites/satnogs_meteor_decoder.py | 125 +------ 2 files changed, 11 insertions(+), 450 deletions(-) diff --git a/apps/flowgraphs/satellites/meteor_decoder.grc b/apps/flowgraphs/satellites/meteor_decoder.grc index ac38b18..c552d0b 100644 --- a/apps/flowgraphs/satellites/meteor_decoder.grc +++ b/apps/flowgraphs/satellites/meteor_decoder.grc @@ -38,7 +38,7 @@ generate_options - qt_gui + no_gui hier_block_src_path @@ -105,34 +105,7 @@ value - 4*80000.0 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (239, 75) - - - _rotation - 0 - - - id - samp_rate_lcm - - - value - satnogs.lcm(filter_rate, int(samp_rate_rx / int(samp_rate_rx/filter_rate))) + 2*80000.0 @@ -2193,305 +2166,6 @@ we shift the LO a little further 0 - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - axislabels - True - - - bw - filter_rate - - - alias - - - - fc - 0 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - 1024 - - - _coordinate - (1037, 590) - - - gui_hint - - - - _rotation - 0 - - - grid - False - - - id - qtgui_freq_sink_x_0 - - - legend - True - - - alpha1 - 1.0 - - - color1 - "blue" - - - label1 - - - - width1 - 1 - - - alpha10 - 1.0 - - - color10 - "dark blue" - - - label10 - - - - width10 - 1 - - - alpha2 - 1.0 - - - color2 - "red" - - - label2 - - - - width2 - 1 - - - alpha3 - 1.0 - - - color3 - "green" - - - label3 - - - - width3 - 1 - - - alpha4 - 1.0 - - - color4 - "black" - - - label4 - - - - width4 - 1 - - - alpha5 - 1.0 - - - color5 - "cyan" - - - label5 - - - - width5 - 1 - - - alpha6 - 1.0 - - - color6 - "magenta" - - - label6 - - - - width6 - 1 - - - alpha7 - 1.0 - - - color7 - "yellow" - - - label7 - - - - width7 - 1 - - - alpha8 - 1.0 - - - color8 - "dark red" - - - label8 - - - - width8 - 1 - - - alpha9 - 1.0 - - - color9 - "dark green" - - - label9 - - - - width9 - 1 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - name - "" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - label - Relative Gain - - - ymax - 10 - - - ymin - -140 - - - units - dB - - parameter @@ -2927,12 +2601,6 @@ we shift the LO a little further 0 0 - - pfb_arb_resampler_xxx_0 - qtgui_freq_sink_x_0 - 0 - 0 - pfb_arb_resampler_xxx_0 satnogs_iq_sink_0 diff --git a/apps/flowgraphs/satellites/satnogs_meteor_decoder.py b/apps/flowgraphs/satellites/satnogs_meteor_decoder.py index dd09cbb..51c3506 100755 --- a/apps/flowgraphs/satellites/satnogs_meteor_decoder.py +++ b/apps/flowgraphs/satellites/satnogs_meteor_decoder.py @@ -5,61 +5,25 @@ # Title: METEOR Demodulation # Author: Manolis Surligas (surligas@gmail.com) # Description: A METEOR weather satellite decoder -# Generated: Mon Jan 8 19:06:02 2018 +# Generated: Thu Jan 11 02:21:20 2018 ################################################## -if __name__ == '__main__': - import ctypes - import sys - if sys.platform.startswith('linux'): - try: - x11 = ctypes.cdll.LoadLibrary('libX11.so') - x11.XInitThreads() - except: - print "Warning: failed to XInitThreads()" - -from PyQt4 import Qt from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr -from gnuradio import qtgui from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.filter import pfb from optparse import OptionParser import osmosdr import satnogs -import sip -import sys import time -from gnuradio import qtgui -class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): +class satnogs_meteor_decoder(gr.top_block): def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=20, enable_iq_dump=0, file_path='test.ogg', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): gr.top_block.__init__(self, "METEOR Demodulation") - Qt.QWidget.__init__(self) - self.setWindowTitle("METEOR Demodulation") - 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", "satnogs_meteor_decoder") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters @@ -85,9 +49,8 @@ class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): # Variables ################################################## self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate'] - self.filter_rate = filter_rate = 4*80000.0 self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate_rx, 80000, 25000, firdes.WIN_HAMMING, 6.76) - self.samp_rate_lcm = samp_rate_lcm = satnogs.lcm(filter_rate, int(samp_rate_rx / int(samp_rate_rx/filter_rate))) + self.filter_rate = filter_rate = 2*80000.0 ################################################## # Blocks @@ -96,49 +59,6 @@ class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000/doppler_correction_per_sec, 1500) self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False, enable_iq_dump) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) - self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - filter_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(-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_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( filter_rate / int(samp_rate_rx / int(samp_rate_rx/filter_rate)), taps=None, @@ -166,16 +86,10 @@ class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) - self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.satnogs_iq_sink_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.satnogs_waterfall_sink_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) - def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "satnogs_meteor_decoder") - self.settings.setValue("geometry", self.saveGeometry()) - event.accept() - def get_antenna(self): return self.antenna @@ -292,20 +206,10 @@ class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): def set_samp_rate_rx(self, samp_rate_rx): self.samp_rate_rx = samp_rate_rx self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate_rx, 80000, 25000, firdes.WIN_HAMMING, 6.76)) - self.set_samp_rate_lcm(satnogs.lcm(self.filter_rate, int(self.samp_rate_rx / int(self.samp_rate_rx/self.filter_rate)))) self.pfb_arb_resampler_xxx_0.set_rate(self.filter_rate / int(self.samp_rate_rx / int(self.samp_rate_rx/self.filter_rate))) self.osmosdr_source_0.set_sample_rate(self.samp_rate_rx) self.osmosdr_source_0.set_bandwidth(self.samp_rate_rx, 0) - def get_filter_rate(self): - return self.filter_rate - - def set_filter_rate(self, filter_rate): - self.filter_rate = filter_rate - self.set_samp_rate_lcm(satnogs.lcm(self.filter_rate, int(self.samp_rate_rx / int(self.samp_rate_rx/self.filter_rate)))) - self.qtgui_freq_sink_x_0.set_frequency_range(0, self.filter_rate) - self.pfb_arb_resampler_xxx_0.set_rate(self.filter_rate / int(self.samp_rate_rx / int(self.samp_rate_rx/self.filter_rate))) - def get_xlate_filter_taps(self): return self.xlate_filter_taps @@ -313,11 +217,12 @@ class satnogs_meteor_decoder(gr.top_block, Qt.QWidget): self.xlate_filter_taps = xlate_filter_taps self.freq_xlating_fir_filter_xxx_0.set_taps((self.xlate_filter_taps)) - def get_samp_rate_lcm(self): - return self.samp_rate_lcm + def get_filter_rate(self): + return self.filter_rate - def set_samp_rate_lcm(self, samp_rate_lcm): - self.samp_rate_lcm = samp_rate_lcm + def set_filter_rate(self, filter_rate): + self.filter_rate = filter_rate + self.pfb_arb_resampler_xxx_0.set_rate(self.filter_rate / int(self.samp_rate_rx / int(self.samp_rate_rx/self.filter_rate))) def argument_parser(): @@ -378,21 +283,9 @@ def main(top_block_cls=satnogs_meteor_decoder, options=None): if options is None: options, _ = argument_parser().parse_args() - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - style = gr.prefs().get_string('qtgui', 'style', 'raster') - Qt.QApplication.setGraphicsSystem(style) - qapp = Qt.QApplication(sys.argv) - tb = top_block_cls(antenna=options.antenna, bb_gain=options.bb_gain, decoded_data_file_path=options.decoded_data_file_path, dev_args=options.dev_args, doppler_correction_per_sec=options.doppler_correction_per_sec, enable_iq_dump=options.enable_iq_dump, file_path=options.file_path, if_gain=options.if_gain, iq_file_path=options.iq_file_path, lo_offset=options.lo_offset, ppm=options.ppm, rf_gain=options.rf_gain, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) tb.start() - tb.show() - - def quitting(): - tb.stop() - tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) - qapp.exec_() + tb.wait() if __name__ == '__main__':