Merge remote-tracking branch 'jcorgan/pmf2'

This commit is contained in:
Nick Foster 2012-10-29 17:56:25 -07:00
commit 3cfeb5d705
4 changed files with 35 additions and 9 deletions

View File

@ -242,6 +242,7 @@ class mainwindow(QtGui.QMainWindow):
options["gain"] = float(self.ui.line_gain.text())
options["threshold"] = float(self.ui.line_threshold.text())
options["filename"] = str(self.ui.line_inputfile.text())
options["pmf"] = self.ui.check_pmf.checkState()
self.fg = adsb_rx_block(options, self.queue) #create top RX block
self.runner = top_block_runner(self.fg) #spawn new thread to do RX
@ -423,7 +424,7 @@ class adsb_rx_block (gr.top_block):
else:
raise NotImplementedError
self.rx_path = air_modes.rx_path(rate, options["threshold"], queue)
self.rx_path = air_modes.rx_path(rate, options["threshold"], queue, options["pmf"])
if use_resampler:
self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)

View File

@ -110,7 +110,7 @@ class adsb_rx_block (gr.top_block):
if options.output_all :
pass_all = 1
self.rx_path = air_modes.rx_path(rate, options.threshold, queue)
self.rx_path = air_modes.rx_path(rate, options.threshold, queue, options.pmf)
if use_resampler:
self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
@ -163,6 +163,8 @@ if __name__ == '__main__':
help="FlightGear server to send aircraft data, in format host:port")
parser.add_option("-d","--rtlsdr", action="store_true", default=False,
help="Use RTLSDR dongle instead of UHD source")
parser.add_option("-p","--pmf", action="store_true", default=False,
help="Use pulse matched filtering")
(options, args) = parser.parse_args()

View File

@ -24,7 +24,7 @@ import air_modes_swig
class rx_path(gr.hier_block2):
def __init__(self, rate, threshold, queue):
def __init__(self, rate, threshold, queue, use_pmf=False):
gr.hier_block2.__init__(self, "modes_rx_path",
gr.io_signature(1, 1, gr.sizeof_gr_complex),
gr.io_signature(0,0,0))
@ -32,12 +32,20 @@ class rx_path(gr.hier_block2):
self._rate = int(rate)
self._threshold = threshold
self._queue = queue
self._spc = int(rate/2e6)
# Convert incoming I/Q baseband to amplitude
self._demod = gr.complex_to_mag()
self._bb = self._demod
# Pulse matched filter for 0.5us pulses
if use_pmf:
self._pmf = gr.moving_average_ff(self._spc, 1.0/self._spc, self._rate)
self.connect(self._demod, self._pmf)
self._bb = self._pmf
# Establish baseline amplitude (noise, interference)
self._avg = gr.moving_average_ff(100, 1.0/100, 400) # FIXME
self._avg = gr.moving_average_ff(48*self._spc, 1.0/(48*self._spc), self._rate) # 3 preambles
# Synchronize to Mode-S preamble
self._sync = air_modes_swig.modes_preamble(self._rate, self._threshold)
@ -45,6 +53,8 @@ class rx_path(gr.hier_block2):
# Slice Mode-S bits and send to message queue
self._slicer = air_modes_swig.modes_slicer(self._rate, self._queue)
self.connect(self, self._demod, (self._sync, 0))
self.connect(self._demod, self._avg, (self._sync, 1))
# Wire up the flowgraph
self.connect(self, self._demod)
self.connect(self._bb, (self._sync, 0))
self.connect(self._bb, self._avg, (self._sync, 1))
self.connect(self._sync, self._slicer)

View File

@ -85,7 +85,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="setup">
<property name="sizePolicy">
@ -103,7 +103,7 @@
<x>10</x>
<y>20</y>
<width>236</width>
<height>193</height>
<height>251</height>
</rect>
</property>
<property name="title">
@ -214,7 +214,7 @@
</rect>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page_rf">
<widget class="QComboBox" name="combo_ant">
@ -303,6 +303,19 @@
</widget>
</widget>
</widget>
<widget class="QCheckBox" name="check_pmf">
<property name="geometry">
<rect>
<x>10</x>
<y>200</y>
<width>221</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Use Pulse Matched Filtering</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_output">
<property name="geometry">