From f4e4bdba9bf42f3f250656c8850e0916c5b920dc Mon Sep 17 00:00:00 2001 From: Manolis Surligas Date: Fri, 23 Jun 2017 15:41:55 +0300 Subject: [PATCH] Add staged filtering on NOAA decoder --- .../satellites/noaa_apt_decoder.grc | 156 +++++++++++++++++- .../satellites/satnogs_noaa_apt_decoder.py | 41 +++-- 2 files changed, 180 insertions(+), 17 deletions(-) diff --git a/apps/flowgraphs/satellites/noaa_apt_decoder.grc b/apps/flowgraphs/satellites/noaa_apt_decoder.grc index 128632e..44876bd 100644 --- a/apps/flowgraphs/satellites/noaa_apt_decoder.grc +++ b/apps/flowgraphs/satellites/noaa_apt_decoder.grc @@ -109,6 +109,83 @@ the quadrature demodulation 2 + + variable + + comment + The first stage decimation tries to decrease +the sampling rate of the device in order to keep +the CPU utilization of the next processing blocks +in acceptable levels especially for embedded devices. + + + _enabled + True + + + _coordinate + (1306, 460) + + + _rotation + 0 + + + id + first_stage_decimation + + + value + 2 + + + + variable_low_pass_filter_taps + + beta + 6.76 + + + comment + + + + cutoff_freq + 0.2 + + + _enabled + True + + + _coordinate + (16, 689) + + + _rotation + 0 + + + gain + 1.0 + + + id + first_stage_filter_taps + + + samp_rate + 1.0 + + + width + 0.1 + + + win + firdes.WIN_HAMMING + + variable @@ -256,7 +333,7 @@ TX sampling rate quad_rate - samp_rate_rx / int(samp_rate_rx / initial_bandwidth) + samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) @@ -327,7 +404,7 @@ TX sampling rate samp_rate - (samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation + samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation width @@ -440,7 +517,7 @@ TX sampling rate decim - int(samp_rate_rx / initial_bandwidth) + int(samp_rate_rx/ first_stage_decimation / initial_bandwidth) _enabled @@ -448,7 +525,7 @@ TX sampling rate _coordinate - (719, 123) + (721, 124) _rotation @@ -534,6 +611,65 @@ TX sampling rate fff + + freq_xlating_fir_filter_xxx + + alias + + + + center_freq + lo_offset + + + comment + + + + affinity + + + + decim + first_stage_decimation + + + _enabled + True + + + _coordinate + (296, 312) + + + _rotation + 0 + + + id + freq_xlating_fir_filter_xxx_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + samp_rate + samp_rate_rx + + + taps + first_stage_filter_taps + + + type + ccc + + hilbert_fc @@ -2138,7 +2274,7 @@ we shift the LO a little further decim - int(((samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation) / 2) + int((samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2) _enabled @@ -2409,7 +2545,7 @@ we shift the LO a little further sampling_rate - samp_rate_rx + samp_rate_rx /first_stage_decimation target_freq @@ -2560,6 +2696,12 @@ we shift the LO a little further 0 0 + + freq_xlating_fir_filter_xxx_0 + satnogs_coarse_doppler_correction_cc_0 + 0 + 0 + hilbert_fc_0 blocks_complex_to_mag_0 @@ -2568,7 +2710,7 @@ we shift the LO a little further osmosdr_source_0 - satnogs_coarse_doppler_correction_cc_0 + freq_xlating_fir_filter_xxx_0 0 0 diff --git a/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py b/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py index 40bc2ad..4d4d2f3 100755 --- a/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py +++ b/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py @@ -5,7 +5,7 @@ # Title: NOAA APT Decoder # Author: Manolis Surligas, George Vardakis # Description: A NOAA APT Decoder with automatic image synchronization -# Generated: Fri Jun 23 02:28:46 2017 +# Generated: Fri Jun 23 15:41:33 2017 ################################################## from gnuradio import analog @@ -45,6 +45,10 @@ class satnogs_noaa_apt_decoder(gr.top_block): self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(1.0, 1.0, 0.17, 0.02, firdes.WIN_HAMMING, 6.76) self.initial_bandwidth = initial_bandwidth = 100e3 + + self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76) + + self.first_stage_decimation = first_stage_decimation = 2 self.audio_decimation = audio_decimation = 2 ################################################## @@ -52,7 +56,7 @@ class satnogs_noaa_apt_decoder(gr.top_block): ################################################## self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(image_file_path, 2080, 1500, True, False, False) - self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) + self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx /first_stage_decimation) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=4160, decimation=9600, @@ -61,7 +65,7 @@ class satnogs_noaa_apt_decoder(gr.top_block): ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=9600, - decimation=int(((samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation) / 2), + decimation=int((samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2), taps=None, fractional_bw=None, ) @@ -79,15 +83,16 @@ class satnogs_noaa_apt_decoder(gr.top_block): self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) + self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(first_stage_decimation, (first_stage_filter_taps), lo_offset, samp_rate_rx) self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5])) self.fir_filter_xxx_1.declare_sample_delay(0) - self.fir_filter_xxx_0 = filter.fir_filter_ccc(int(samp_rate_rx / initial_bandwidth), (noaa_filter_taps)) + self.fir_filter_xxx_0 = filter.fir_filter_ccc(int(samp_rate_rx/ first_stage_decimation / initial_bandwidth), (noaa_filter_taps)) self.fir_filter_xxx_0.declare_sample_delay(0) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass( - 6, (samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) + 6, samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) self.analog_wfm_rcv_0 = analog.wfm_rcv( - quad_rate=samp_rate_rx / int(samp_rate_rx / initial_bandwidth), + quad_rate=samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)), audio_decimation=audio_decimation, ) @@ -100,8 +105,9 @@ class satnogs_noaa_apt_decoder(gr.top_block): self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.satnogs_noaa_apt_sink_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.fir_filter_xxx_0, 0)) @@ -124,6 +130,7 @@ class satnogs_noaa_apt_decoder(gr.top_block): def set_lo_offset(self, lo_offset): self.lo_offset = lo_offset self.osmosdr_source_0.set_center_freq(self.rx_freq - self.lo_offset, 0) + self.freq_xlating_fir_filter_xxx_0.set_center_freq(self.lo_offset) def get_ppm(self): return self.ppm @@ -164,7 +171,7 @@ class satnogs_noaa_apt_decoder(gr.top_block): self.samp_rate_rx = samp_rate_rx self.osmosdr_source_0.set_sample_rate(self.samp_rate_rx) self.osmosdr_source_0.set_bandwidth(self.samp_rate_rx, 0) - self.band_pass_filter_0.set_taps(firdes.band_pass(6, (self.samp_rate_rx / int(self.samp_rate_rx / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) + self.band_pass_filter_0.set_taps(firdes.band_pass(6, self.samp_rate_rx/ ( self.first_stage_decimation * int(self.samp_rate_rx/ self.first_stage_decimation / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) def get_noaa_filter_taps(self): return self.noaa_filter_taps @@ -178,14 +185,28 @@ class satnogs_noaa_apt_decoder(gr.top_block): def set_initial_bandwidth(self, initial_bandwidth): self.initial_bandwidth = initial_bandwidth - self.band_pass_filter_0.set_taps(firdes.band_pass(6, (self.samp_rate_rx / int(self.samp_rate_rx / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) + self.band_pass_filter_0.set_taps(firdes.band_pass(6, self.samp_rate_rx/ ( self.first_stage_decimation * int(self.samp_rate_rx/ self.first_stage_decimation / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) + + def get_first_stage_filter_taps(self): + return self.first_stage_filter_taps + + def set_first_stage_filter_taps(self, first_stage_filter_taps): + self.first_stage_filter_taps = first_stage_filter_taps + self.freq_xlating_fir_filter_xxx_0.set_taps((self.first_stage_filter_taps)) + + def get_first_stage_decimation(self): + return self.first_stage_decimation + + def set_first_stage_decimation(self, first_stage_decimation): + self.first_stage_decimation = first_stage_decimation + self.band_pass_filter_0.set_taps(firdes.band_pass(6, self.samp_rate_rx/ ( self.first_stage_decimation * int(self.samp_rate_rx/ self.first_stage_decimation / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) def get_audio_decimation(self): return self.audio_decimation def set_audio_decimation(self, audio_decimation): self.audio_decimation = audio_decimation - self.band_pass_filter_0.set_taps(firdes.band_pass(6, (self.samp_rate_rx / int(self.samp_rate_rx / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) + self.band_pass_filter_0.set_taps(firdes.band_pass(6, self.samp_rate_rx/ ( self.first_stage_decimation * int(self.samp_rate_rx/ self.first_stage_decimation / self.initial_bandwidth)) / self.audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) def argument_parser():