Refactor flowgraph into hierarchical block

This commit creates air_modes.rx_path, which is the common portion
of the flowgraph once the sample source and possible resampler are
created.  It takes baseband I/Q and emits Mode-S packets into the
supplied message queue.
This commit is contained in:
Johnathan Corgan
2012-10-15 09:27:22 -07:00
parent 85da74b43a
commit 62304ff59e
5 changed files with 58 additions and 24 deletions

View File

@@ -409,23 +409,15 @@ class adsb_rx_block (gr.top_block):
else:
raise NotImplementedError
self.demod = gr.complex_to_mag()
self.avg = gr.moving_average_ff(100, 1.0/100, 400)
self.preamble = air_modes.modes_preamble(int(rate), float(options["threshold"]))
self.slicer = air_modes.modes_slicer(int(rate), queue)
self.rx_path = air_modes.rx_path(rate, options["threshold"], queue)
if use_resampler:
self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
self.resample = blks2.rational_resampler_ccf(interpolation=5, decimation=4, taps=self.lpfiltcoeffs)
self.connect(self.u, self.resample, self.demod)
self.connect(self.u, self.resample, self.rx_path)
else:
self.connect(self.u, self.demod)
self.connect(self.u, self.rx_path)
self.connect(self.demod, self.avg)
self.connect(self.demod, (self.preamble, 0))
self.connect(self.avg, (self.preamble, 1))
self.connect(self.preamble, self.slicer)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)

View File

@@ -110,24 +110,14 @@ class adsb_rx_block (gr.top_block):
if options.output_all :
pass_all = 1
self.demod = gr.complex_to_mag()
self.avg = gr.moving_average_ff(100, 1.0/100, 400)
self.preamble = air_modes.modes_preamble(rate, options.threshold)
#self.framer = air_modes.modes_framer(rate)
self.slicer = air_modes.modes_slicer(rate, queue)
self.rx_path = air_modes.rx_path(rate, options.threshold, queue)
if use_resampler:
self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
self.resample = blks2.rational_resampler_ccf(interpolation=5, decimation=4, taps=self.lpfiltcoeffs)
self.connect(self.u, self.resample, self.demod)
self.connect(self.u, self.resample, self.rx_path)
else:
self.connect(self.u, self.demod)
self.connect(self.demod, self.avg)
self.connect(self.demod, (self.preamble, 0))
self.connect(self.avg, (self.preamble, 1))
self.connect((self.preamble, 0), (self.slicer, 0))
self.connect(self.u, self.rx_path)
def tune(self, freq):
result = self.u.set_center_freq(freq, 0)