summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/digital
diff options
context:
space:
mode:
authorTom2010-02-01 19:21:54 -0500
committerTom2010-02-01 19:21:54 -0500
commit4640708a2cb9740c41f0e27a6ce865a85473a4a0 (patch)
treef95c41a7c24ef25c5be1b23893f06de5cb14818b /gnuradio-examples/python/digital
parent824aa242f143a088f04031840bc36ed54de74005 (diff)
parent3bac2fa547168ca52352892e5f9db3335724682e (diff)
downloadgnuradio-4640708a2cb9740c41f0e27a6ce865a85473a4a0.tar.gz
gnuradio-4640708a2cb9740c41f0e27a6ce865a85473a4a0.tar.bz2
gnuradio-4640708a2cb9740c41f0e27a6ce865a85473a4a0.zip
Merge branch 'fll'
Diffstat (limited to 'gnuradio-examples/python/digital')
-rwxr-xr-xgnuradio-examples/python/digital/benchmark_qt_loopback2.py125
-rwxr-xr-xgnuradio-examples/python/digital/benchmark_qt_rx2.py474
-rw-r--r--gnuradio-examples/python/digital/qt_digital_window2.py178
-rw-r--r--gnuradio-examples/python/digital/qt_digital_window2.ui299
-rw-r--r--gnuradio-examples/python/digital/qt_rx_window2.py179
-rw-r--r--gnuradio-examples/python/digital/qt_rx_window2.ui379
-rw-r--r--gnuradio-examples/python/digital/usrp_receive_path.py14
-rw-r--r--gnuradio-examples/python/digital/usrp_transmit_path.py15
8 files changed, 1368 insertions, 295 deletions
diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
index 101dd68d6..1cb95198e 100755
--- a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
+++ b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
@@ -52,9 +52,9 @@ class dialog_box(QtGui.QMainWindow):
self.set_frequency(self.fg.frequency_offset())
self.set_time_offset(self.fg.timing_offset())
- self.set_alpha_time(self.fg.rx_timing_gain_alpha())
- self.set_beta_time(self.fg.rx_timing_gain_beta())
- self.set_alpha_freq(self.fg.rx_freq_gain_alpha())
+ self.set_gain_clock(self.fg.rx_gain_clock())
+ self.set_gain_phase(self.fg.rx_gain_phase())
+ self.set_gain_freq(self.fg.rx_gain_freq())
# Add the qtsnk widgets to the hlayout box
self.gui.sinkLayout.addWidget(snkTx)
@@ -75,12 +75,12 @@ class dialog_box(QtGui.QMainWindow):
self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"),
self.timeEditText)
- self.connect(self.gui.alphaTimeEdit, QtCore.SIGNAL("editingFinished()"),
- self.alphaTimeEditText)
- self.connect(self.gui.betaTimeEdit, QtCore.SIGNAL("editingFinished()"),
- self.betaTimeEditText)
- self.connect(self.gui.alphaFreqEdit, QtCore.SIGNAL("editingFinished()"),
- self.alphaFreqEditText)
+ self.connect(self.gui.gainClockEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainClockEditText)
+ self.connect(self.gui.gainPhaseEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainPhaseEditText)
+ self.connect(self.gui.gainFreqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainFreqEditText)
# Build a timer to update the packet number and PER fields
self.update_delay = 250 # time between updating packet rate fields
@@ -145,33 +145,43 @@ class dialog_box(QtGui.QMainWindow):
# Accessor functions for Gui to manipulate receiver parameters
+ def set_gain_clock(self, gain):
+ self.gui.gainClockEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_gain_phase(self, gain_phase):
+ self.gui.gainPhaseEdit.setText(QtCore.QString("%1").arg(gain_phase))
+
+ def set_gain_freq(self, gain_freq):
+ self.gui.gainFreqEdit.setText(QtCore.QString("%1").arg(gain_freq))
+
+
def set_alpha_time(self, alpha):
self.gui.alphaTimeEdit.setText(QtCore.QString("%1").arg(alpha))
def set_beta_time(self, beta):
self.gui.betaTimeEdit.setText(QtCore.QString("%1").arg(beta))
- def set_alpha_freq(self, alpha):
- self.gui.alphaFreqEdit.setText(QtCore.QString("%1").arg(alpha))
+ def set_alpha_phase(self, alpha):
+ self.gui.alphaPhaseEdit.setText(QtCore.QString("%1").arg(alpha))
- def alphaFreqEditText(self):
+ def gainPhaseEditText(self):
try:
- alpha = self.gui.alphaFreqEdit.text().toDouble()[0]
- self.fg.set_rx_freq_gain_alpha(alpha)
+ gain_phase = self.gui.gainPhaseEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_phase(gain_phase)
except RuntimeError:
pass
- def alphaTimeEditText(self):
+ def gainClockEditText(self):
try:
- alpha = self.gui.alphaTimeEdit.text().toDouble()[0]
- self.fg.set_rx_timing_gain_alpha(alpha)
+ gain = self.gui.gainClockEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_clock(gain)
except RuntimeError:
pass
- def betaTimeEditText(self):
+ def gainFreqEditText(self):
try:
- beta = self.gui.betaTimeEdit.text().toDouble()[0]
- self.fg.set_rx_timing_gain_beta(beta)
+ gain = self.gui.gainFreqEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_freq(gain)
except RuntimeError:
pass
@@ -186,7 +196,7 @@ class dialog_box(QtGui.QMainWindow):
per = 0
self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd))
self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right))
- self.gui.perEdit.setText(QtCore.QString("%1").arg(per))
+ self.gui.perEdit.setText(QtCore.QString("%1").arg(float(per), 0, 'e', 4))
@@ -218,9 +228,9 @@ class my_top_block(gr.top_block):
self.rxpath = receive_path(demod_class, rx_callback, options)
# FIXME: do better exposure to lower issues for control
- self._timing_gain_alpha = self.rxpath.packet_receiver._demodulator._timing_alpha
- self._timing_gain_beta = self.rxpath.packet_receiver._demodulator._timing_beta
- self._freq_gain_alpha = self.rxpath.packet_receiver._demodulator._costas_alpha
+ self._gain_clock = self.rxpath.packet_receiver._demodulator._timing_alpha
+ self._gain_phase = self.rxpath.packet_receiver._demodulator._costas_alpha
+ self._gain_freq = self.rxpath.packet_receiver._demodulator._freq_alpha
if channelon:
self.channel = gr.channel_model(self._noise_voltage,
@@ -254,17 +264,21 @@ class my_top_block(gr.top_block):
self.snk_tx.set_frequency_axis(-80, 0)
self.snk_rx.set_frequency_axis(-60, 20)
-
+
+ self.freq_recov = self.rxpath.packet_receiver._demodulator.freq_recov
+ self.phase_recov = self.rxpath.packet_receiver._demodulator.phase_recov
+ self.time_recov = self.rxpath.packet_receiver._demodulator.time_recov
+ self.freq_recov.set_alpha(self._gain_freq)
+ self.phase_recov.set_alpha(self._gain_phase)
+ self.phase_recov.set_beta(0.25*self._gain_phase*self._gain_phase)
+ self.time_recov.set_alpha(self._gain_clock)
+ self.time_recov.set_beta(0.25*self._gain_clock*self._gain_clock)
+
# Connect to the QT sinks
# FIXME: make better exposure to receiver from rxpath
- self.freq_recov = self.rxpath.packet_receiver._demodulator.clock_recov
- self.time_recov = self.rxpath.packet_receiver._demodulator.time_recov
- self.freq_recov.set_alpha(self._freq_gain_alpha)
- self.freq_recov.set_beta(0.25*self._freq_gain_alpha*self._freq_gain_alpha)
- self.time_recov.set_alpha(self._timing_gain_alpha)
- self.time_recov.set_beta(self._timing_gain_beta)
self.connect(self.channel, self.snk_tx)
- self.connect(self.time_recov, self.snk_rx)
+ self.connect(self.phase_recov, self.snk_rx)
+ #self.connect(self.freq_recov, self.snk_rx)
pyTxQt = self.snk_tx.pyqwidget()
pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget)
@@ -321,32 +335,39 @@ class my_top_block(gr.top_block):
# Receiver Parameters
- def rx_timing_gain_alpha(self):
- return self._timing_gain_alpha
+ def rx_gain_clock(self):
+ return self._gain_clock
- def rx_timing_gain_beta(self):
- return self._timing_gain_beta
-
- def set_rx_timing_gain_alpha(self, gain):
- self._timing_gain_alpha = gain
- self.time_recov.set_alpha(self._timing_gain_alpha)
+ def rx_gain_clock_beta(self):
+ return self._gain_clock_beta
- def set_rx_timing_gain_beta(self, gain):
- self._timing_gain_beta = gain
- self.time_recov.set_beta(self._timing_gain_beta)
+ def set_rx_gain_clock(self, gain):
+ self._gain_clock = gain
+ self._gain_clock_beta = .25 * self._gain_clock * self._gain_clock
+ self.rxpath.packet_receiver._demodulator.time_recov.set_alpha(self._gain_clock)
+ self.rxpath.packet_receiver._demodulator.time_recov.set_beta(self._gain_clock_beta)
- def rx_freq_gain_alpha(self):
- return self._freq_gain_alpha
+ def rx_gain_phase(self):
+ return self._gain_phase
- def rx_freq_gain_beta(self):
- return self._freq_gain_beta
+ def rx_gain_phase_beta(self):
+ return self._gain_phase_beta
- def set_rx_freq_gain_alpha(self, alpha):
- self._freq_gain_alpha = alpha
- self._freq_gain_beta = .25 * self._freq_gain_alpha * self._freq_gain_alpha
- self.freq_recov.set_alpha(self._freq_gain_alpha)
- self.freq_recov.set_beta(self._freq_gain_beta)
+ def set_rx_gain_phase(self, gain_phase):
+ self._gain_phase = gain_phase
+ self._gain_phase_beta = .25 * self._gain_phase * self._gain_phase
+ self.rxpath.packet_receiver._demodulator.phase_recov.set_alpha(self._gain_phase)
+ self.rxpath.packet_receiver._demodulator.phase_recov.set_beta(self._gain_phase_beta)
+
+
+ def rx_gain_freq(self):
+ return self._gain_freq
+ def set_rx_gain_freq(self, gain_freq):
+ self._gain_freq = gain_freq
+ #self._gain_freq_beta = .25 * self._gain_freq * self._gain_freq
+ self.rxpath.packet_receiver._demodulator.freq_recov.set_alpha(self._gain_freq)
+ #self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_fre_beta)
# /////////////////////////////////////////////////////////////////////////////
diff --git a/gnuradio-examples/python/digital/benchmark_qt_rx2.py b/gnuradio-examples/python/digital/benchmark_qt_rx2.py
new file mode 100755
index 000000000..cabbecb6f
--- /dev/null
+++ b/gnuradio-examples/python/digital/benchmark_qt_rx2.py
@@ -0,0 +1,474 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gru, modulation_utils
+from gnuradio import usrp
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+from gnuradio import usrp_options
+
+import random
+import struct
+import sys
+
+# from current dir
+from receive_path import receive_path
+from pick_bitrate import pick_rx_bitrate
+
+try:
+ from gnuradio.qtgui import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Please install gr-qtgui."
+ sys.exit(1)
+
+try:
+ from qt_rx_window2 import Ui_DigitalWindow
+except ImportError:
+ print "Error: could not find qt_rx_window2.py:"
+ print "\tYou must first build this from qt_rx_window2.ui with the following command:"
+ print "\t\"pyuic4 qt_rx_window2.ui -o qt_rx_window2.py\""
+ sys.exit(1)
+
+#import os
+#print os.getpid()
+#raw_input('Attach and press enter: ')
+
+# ////////////////////////////////////////////////////////////////////
+# Define the QT Interface and Control Dialog
+# ////////////////////////////////////////////////////////////////////
+
+
+class dialog_box(QtGui.QMainWindow):
+ def __init__(self, snkRxIn, snkRx, fg, parent=None):
+
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_DigitalWindow()
+ self.gui.setupUi(self)
+
+ self.fg = fg
+
+ self.set_frequency(self.fg.frequency())
+ self.set_gain(self.fg.gain())
+ self.set_decim(self.fg.decim())
+ self.set_gain_clock(self.fg.rx_gain_clock())
+ self.set_gain_phase(self.fg.rx_gain_phase())
+ self.set_gain_freq(self.fg.rx_gain_freq())
+
+ # Add the qtsnk widgets to the hlayout box
+ self.gui.sinkLayout.addWidget(snkRxIn)
+ self.gui.sinkLayout.addWidget(snkRx)
+
+
+ # Connect up some signals
+ self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.freqEditText)
+ self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainEditText)
+ self.connect(self.gui.decimEdit, QtCore.SIGNAL("editingFinished()"),
+ self.decimEditText)
+ self.connect(self.gui.gainClockEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainClockEditText)
+ self.connect(self.gui.gainPhaseEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainPhaseEditText)
+ self.connect(self.gui.gainFreqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainFreqEditText)
+
+ # Build a timer to update the packet number and PER fields
+ self.update_delay = 250 # time between updating packet rate fields
+ self.pkt_timer = QtCore.QTimer(self)
+ self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"),
+ self.updatePacketInfo)
+ self.pkt_timer.start(self.update_delay)
+
+
+ # Accessor functions for Gui to manipulate receiver parameters
+ def set_frequency(self, fo):
+ self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo))
+
+ def set_gain(self, gain):
+ self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_decim(self, decim):
+ self.gui.decimEdit.setText(QtCore.QString("%1").arg(decim))
+
+ def set_gain_clock(self, gain):
+ self.gui.gainClockEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_gain_phase(self, gain_phase):
+ self.gui.gainPhaseEdit.setText(QtCore.QString("%1").arg(gain_phase))
+
+ def set_gain_freq(self, gain_freq):
+ self.gui.gainFreqEdit.setText(QtCore.QString("%1").arg(gain_freq))
+
+ def freqEditText(self):
+ try:
+ freq = self.gui.freqEdit.text().toDouble()[0]
+ self.fg.set_freq(freq)
+ except RuntimeError:
+ pass
+
+ def gainEditText(self):
+ try:
+ gain = self.gui.gainEdit.text().toDouble()[0]
+ self.fg.set_gain(gain)
+ except RuntimeError:
+ pass
+
+ def decimEditText(self):
+ try:
+ decim = self.gui.decimEdit.text().toInt()[0]
+ self.fg.set_decim(decim)
+ except RuntimeError:
+ pass
+
+ def gainPhaseEditText(self):
+ try:
+ gain_phase = self.gui.gainPhaseEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_phase(gain_phase)
+ except RuntimeError:
+ pass
+
+ def gainClockEditText(self):
+ try:
+ gain = self.gui.gainClockEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_clock(gain)
+ except RuntimeError:
+ pass
+
+ def gainFreqEditText(self):
+ try:
+ gain = self.gui.gainFreqEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_freq(gain)
+ except RuntimeError:
+ pass
+
+
+ # Accessor function for packet error reporting
+ def updatePacketInfo(self):
+ # Pull these globals in from the main thread
+ global n_rcvd, n_right, pktno
+
+ per = float(n_rcvd - n_right)/float(pktno)
+ self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd))
+ self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right))
+ self.gui.perEdit.setText(QtCore.QString("%1").arg(per, 0, 'e', 4))
+
+
+
+# ////////////////////////////////////////////////////////////////////
+# Define the GNU Radio Top Block
+# ////////////////////////////////////////////////////////////////////
+
+
+class my_top_block(gr.top_block):
+ def __init__(self, demodulator, rx_callback, options):
+ gr.top_block.__init__(self)
+
+ self._rx_freq = options.rx_freq # receiver's center frequency
+ self._rx_gain = options.rx_gain # receiver's gain
+ self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to use
+ self._decim = options.decim # Decimating rate for the USRP (prelim)
+ self._bitrate = options.bitrate
+ self._samples_per_symbol = options.samples_per_symbol
+ self._demod_class = demodulator
+ self.gui_on = options.gui
+
+ if self._rx_freq is None:
+ sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
+ raise SystemExit
+
+ # Set up USRP source
+ self._setup_usrp_source(options)
+
+ # copy the final answers back into options for use by demodulator
+ options.samples_per_symbol = self._samples_per_symbol
+ options.bitrate = self._bitrate
+ options.decim = self._decim
+
+ ok = self.set_freq(self._rx_freq)
+ if not ok:
+ print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq))
+ raise ValueError, eng_notation.num_to_str(self._rx_freq)
+
+ self.set_gain(options.rx_gain)
+
+ # Set up receive path
+ self.rxpath = receive_path(demodulator, rx_callback, options)
+
+ # FIXME: do better exposure to lower issues for control
+ self._gain_clock = self.rxpath.packet_receiver._demodulator._timing_alpha
+ self._gain_phase = self.rxpath.packet_receiver._demodulator._costas_alpha
+ self._gain_freq = self.rxpath.packet_receiver._demodulator._freq_alpha
+
+ self.connect(self.u, self.rxpath)
+
+ if self.gui_on:
+ self.qapp = QtGui.QApplication(sys.argv)
+ fftsize = 2048
+
+ bw_in = self.u.adc_rate() / self.decim()
+ self.snk_rxin = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ self._rx_freq, bw_in,
+ "Received", True, True, False, True, True, False)
+ self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, self._bitrate,
+ "Post-Synchronizer", True, True, False, True, True, False)
+
+ self.snk_rxin.set_frequency_axis(-140, 20)
+ self.snk_rx.set_frequency_axis(-80, 20)
+ self.snk_rxin.set_time_domain_axis(-2000,2000)
+
+ # Connect to the QT sinks
+ # FIXME: make better exposure to receiver from rxpath
+ #self.receiver = self.rxpath.packet_receiver._demodulator.phase_recov
+ self.receiver = self.rxpath.packet_receiver._demodulator.freq_recov
+ self.connect(self.u, self.snk_rxin)
+ self.connect(self.receiver, self.snk_rx)
+
+ pyRxInQt = self.snk_rxin.pyqwidget()
+ pyRxIn = sip.wrapinstance(pyRxInQt, QtGui.QWidget)
+
+ pyRxQt = self.snk_rx.pyqwidget()
+ pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget)
+
+ self.snk_freq = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, self._bitrate,
+ "FLL", True, False, False, True, False, False)
+
+ self.main_box = dialog_box(pyRxIn, pyRx, self)
+ self.main_box.show()
+
+ def _setup_usrp_source(self, options):
+ self.u = usrp_options.create_usrp_source(options)
+ adc_rate = self.u.adc_rate()
+
+ self.u.set_decim(self._decim)
+
+ (self._bitrate, self._samples_per_symbol, self._decim) = \
+ pick_rx_bitrate(self._bitrate, self._demod_class.bits_per_symbol(), \
+ self._samples_per_symbol, self._decim, adc_rate, \
+ self.u.get_decim_rates())
+
+ self.u.set_decim(self._decim)
+ self.set_auto_tr(True) # enable Auto Transmit/Receive switching
+
+ def set_freq(self, target_freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @rypte: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital up converter.
+ """
+ return self.u.set_center_freq(target_freq)
+
+ def set_gain(self, gain):
+ """
+ Sets the analog gain in the USRP
+ """
+ if gain is None:
+ r = self.u.gain_range()
+ gain = (r[0] + r[1])/2 # set gain to midpoint
+ self._rx_gain = gain
+ ret = self.u.set_gain(self._rx_gain)
+ return ret
+
+ def set_auto_tr(self, enable):
+ return self.u.set_auto_tr(enable)
+
+ def set_decim(self, decim):
+ self._decim = decim
+ self.u.set_decim(self._decim)
+
+ if(self.gui_on):
+ bw_in = self.u.adc_rate() / self._decim
+ self._bitrate = bw_in / self._samples_per_symbol
+ self.snk_rxin.set_frequency_range(0, bw_in)
+ self.snk_rx.set_frequency_range(0, self._bitrate)
+
+ def frequency(self):
+ return self._rx_freq
+
+ def gain(self):
+ return self._rx_gain
+
+ def decim(self):
+ return self._decim
+
+ def rx_gain_clock(self):
+ return self._gain_clock
+
+ def rx_gain_clock_beta(self):
+ return self._gain_clock_beta
+
+ def set_rx_gain_clock(self, gain):
+ self._gain_clock = gain
+ self._gain_clock_beta = .25 * self._gain_clock * self._gain_clock
+ self.rxpath.packet_receiver._demodulator.time_recov.set_alpha(self._gain_clock)
+ self.rxpath.packet_receiver._demodulator.time_recov.set_beta(self._gain_clock_beta)
+
+ def rx_gain_phase(self):
+ return self._gain_phase
+
+ def rx_gain_phase_beta(self):
+ return self._gain_phase_beta
+
+ def set_rx_gain_phase(self, gain_phase):
+ self._gain_phase = gain_phase
+ self._gain_phase_beta = .25 * self._gain_phase * self._gain_phase
+ self.rxpath.packet_receiver._demodulator.phase_recov.set_alpha(self._gain_phase)
+ self.rxpath.packet_receiver._demodulator.phase_recov.set_beta(self._gain_phase_beta)
+
+
+ def rx_gain_freq(self):
+ return self._gain_freq
+
+ def set_rx_gain_freq(self, gain_freq):
+ self._gain_freq = gain_freq
+ #self._gain_freq_beta = .25 * self._gain_freq * self._gain_freq
+ self.rxpath.packet_receiver._demodulator.freq_recov.set_alpha(self._gain_freq)
+ #self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_fre_beta)
+
+
+ def add_options(normal, expert):
+ """
+ Adds usrp-specific options to the Options Parser
+ """
+ add_freq_option(normal)
+ normal.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
+ help="select USRP Rx side A or B")
+ normal.add_option("", "--rx-gain", type="eng_float", default=None, metavar="GAIN",
+ help="set receiver gain in dB [default=midpoint]. See also --show-rx-gain-range")
+ normal.add_option("", "--show-rx-gain-range", action="store_true", default=False,
+ help="print min and max Rx gain available on selected daughterboard")
+ normal.add_option("-v", "--verbose", action="store_true", default=False)
+ normal.add_option("-G", "--gui", action="store_true", default=False,
+ help="Turn on the GUI [default=%default]")
+
+ expert.add_option("", "--rx-freq", type="eng_float", default=None,
+ help="set Rx frequency to FREQ [default=%default]", metavar="FREQ")
+ expert.add_option("-d", "--decim", type="intx", default=128,
+ help="set fpga decimation rate to DECIM [default=%default]")
+ expert.add_option("", "--snr", type="eng_float", default=30,
+ help="set the SNR of the channel in dB [default=%default]")
+
+
+ # Make a static method to call before instantiation
+ add_options = staticmethod(add_options)
+
+
+def add_freq_option(parser):
+ """
+ Hackery that has the -f / --freq option set both tx_freq and rx_freq
+ """
+ def freq_callback(option, opt_str, value, parser):
+ parser.values.rx_freq = value
+ parser.values.tx_freq = value
+
+ if not parser.has_option('--freq'):
+ parser.add_option('-f', '--freq', type="eng_float",
+ action="callback", callback=freq_callback,
+ help="set Tx and/or Rx frequency to FREQ [default=%default]",
+ metavar="FREQ")
+
+
+# /////////////////////////////////////////////////////////////////////////////
+# main
+# /////////////////////////////////////////////////////////////////////////////
+
+global n_rcvd, n_right
+
+def main():
+ global n_rcvd, n_right, pktno
+
+ n_rcvd = 0
+ n_right = 0
+ pktno = 1
+
+ def rx_callback(ok, payload):
+ global n_rcvd, n_right, pktno
+ (pktno,) = struct.unpack('!H', payload[0:2])
+ n_rcvd += 1
+ if ok:
+ n_right += 1
+
+ if not options.gui:
+ print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (
+ ok, pktno, n_rcvd, n_right)
+
+
+ demods = modulation_utils.type_1_demods()
+
+ # Create Options Parser:
+ parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
+ expert_grp = parser.add_option_group("Expert")
+
+ parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(),
+ default='dbpsk',
+ help="Select modulation from: %s [default=%%default]"
+ % (', '.join(demods.keys()),))
+
+ my_top_block.add_options(parser, expert_grp)
+ receive_path.add_options(parser, expert_grp)
+ usrp_options.add_rx_options(parser)
+
+ for mod in demods.values():
+ mod.add_options(expert_grp)
+
+ (options, args) = parser.parse_args ()
+
+ if len(args) != 0:
+ parser.print_help(sys.stderr)
+ sys.exit(1)
+
+ if options.rx_freq is None:
+ sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
+ parser.print_help(sys.stderr)
+ sys.exit(1)
+
+
+ # build the graph
+ tb = my_top_block(demods[options.modulation], rx_callback, options)
+
+ r = gr.enable_realtime_scheduling()
+ if r != gr.RT_OK:
+ print "Warning: Failed to enable realtime scheduling."
+
+ tb.start() # start flow graph
+
+ if(options.gui):
+ tb.qapp.exec_()
+ else:
+ tb.wait() # wait for it to finish
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/gnuradio-examples/python/digital/qt_digital_window2.py b/gnuradio-examples/python/digital/qt_digital_window2.py
index f111e3772..98745dfe8 100644
--- a/gnuradio-examples/python/digital/qt_digital_window2.py
+++ b/gnuradio-examples/python/digital/qt_digital_window2.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'qt_digital_window.ui'
+# Form implementation generated from reading ui file 'qt_digital_window2.ui'
#
-# Created: Mon Oct 12 12:10:54 2009
+# Created: Sat Jan 2 16:42:30 2010
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
@@ -17,48 +17,6 @@ class Ui_DigitalWindow(object):
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtGui.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
- self.verticalLayout_2 = QtGui.QVBoxLayout()
- self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.sysBox = QtGui.QGroupBox(self.centralwidget)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth())
- self.sysBox.setSizePolicy(sizePolicy)
- self.sysBox.setMinimumSize(QtCore.QSize(240, 60))
- self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215))
- self.sysBox.setObjectName("sysBox")
- self.formLayoutWidget = QtGui.QWidget(self.sysBox)
- self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31))
- self.formLayoutWidget.setObjectName("formLayoutWidget")
- self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
- self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
- self.formLayout.setVerticalSpacing(20)
- self.formLayout.setObjectName("formLayout")
- self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth())
- self.sampleRateEdit.setSizePolicy(sizePolicy)
- self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26))
- self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26))
- self.sampleRateEdit.setObjectName("sampleRateEdit")
- self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
- self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth())
- self.sampleRateLabel.setSizePolicy(sizePolicy)
- self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20))
- self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20))
- self.sampleRateLabel.setObjectName("sampleRateLabel")
- self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
- self.verticalLayout_2.addWidget(self.sysBox)
- spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
- self.verticalLayout_2.addItem(spacerItem)
- self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1)
self.verticalLayout_5 = QtGui.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.sinkFrame = QtGui.QFrame(self.centralwidget)
@@ -119,6 +77,21 @@ class Ui_DigitalWindow(object):
self.timeEdit.setObjectName("timeEdit")
self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit)
self.gridLayout.addWidget(self.channelModeBox, 2, 1, 1, 1)
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.pauseButton = QtGui.QPushButton(self.centralwidget)
+ self.pauseButton.setMinimumSize(QtCore.QSize(80, 0))
+ self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.pauseButton.setObjectName("pauseButton")
+ self.verticalLayout.addWidget(self.pauseButton)
+ spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
+ self.verticalLayout.addItem(spacerItem)
+ self.closeButton = QtGui.QPushButton(self.centralwidget)
+ self.closeButton.setMinimumSize(QtCore.QSize(80, 0))
+ self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.closeButton.setObjectName("closeButton")
+ self.verticalLayout.addWidget(self.closeButton)
+ self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1)
self.rxBox_2 = QtGui.QGroupBox(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -162,21 +135,48 @@ class Ui_DigitalWindow(object):
self.gridLayout.addWidget(self.rxBox_2, 2, 3, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 2, 4, 1, 1)
- self.verticalLayout = QtGui.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
- self.pauseButton = QtGui.QPushButton(self.centralwidget)
- self.pauseButton.setMinimumSize(QtCore.QSize(80, 0))
- self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215))
- self.pauseButton.setObjectName("pauseButton")
- self.verticalLayout.addWidget(self.pauseButton)
+ self.verticalLayout_2 = QtGui.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.sysBox = QtGui.QGroupBox(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth())
+ self.sysBox.setSizePolicy(sizePolicy)
+ self.sysBox.setMinimumSize(QtCore.QSize(240, 60))
+ self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215))
+ self.sysBox.setObjectName("sysBox")
+ self.formLayoutWidget = QtGui.QWidget(self.sysBox)
+ self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31))
+ self.formLayoutWidget.setObjectName("formLayoutWidget")
+ self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
+ self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
+ self.formLayout.setVerticalSpacing(20)
+ self.formLayout.setObjectName("formLayout")
+ self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth())
+ self.sampleRateEdit.setSizePolicy(sizePolicy)
+ self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26))
+ self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26))
+ self.sampleRateEdit.setObjectName("sampleRateEdit")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
+ self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth())
+ self.sampleRateLabel.setSizePolicy(sizePolicy)
+ self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20))
+ self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20))
+ self.sampleRateLabel.setObjectName("sampleRateLabel")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
+ self.verticalLayout_2.addWidget(self.sysBox)
spacerItem2 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
- self.verticalLayout.addItem(spacerItem2)
- self.closeButton = QtGui.QPushButton(self.centralwidget)
- self.closeButton.setMinimumSize(QtCore.QSize(80, 0))
- self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215))
- self.closeButton.setObjectName("closeButton")
- self.verticalLayout.addWidget(self.closeButton)
- self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1)
+ self.verticalLayout_2.addItem(spacerItem2)
+ self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1)
self.rxBox = QtGui.QGroupBox(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -187,34 +187,34 @@ class Ui_DigitalWindow(object):
self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215))
self.rxBox.setObjectName("rxBox")
self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox)
- self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 10, 161, 101))
+ self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 10, 164, 101))
self.formLayoutWidget_3.setObjectName("formLayoutWidget_3")
self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3)
self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize)
self.formLayout_3.setObjectName("formLayout_3")
- self.alphaTimeLabel = QtGui.QLabel(self.formLayoutWidget_3)
- self.alphaTimeLabel.setObjectName("alphaTimeLabel")
- self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.alphaTimeLabel)
- self.alphaFreqLabel = QtGui.QLabel(self.formLayoutWidget_3)
- self.alphaFreqLabel.setObjectName("alphaFreqLabel")
- self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.alphaFreqLabel)
- self.alphaTimeEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
- self.alphaTimeEdit.setMinimumSize(QtCore.QSize(60, 0))
- self.alphaTimeEdit.setMaximumSize(QtCore.QSize(80, 16777215))
- self.alphaTimeEdit.setObjectName("alphaTimeEdit")
- self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.alphaTimeEdit)
- self.alphaFreqEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
- self.alphaFreqEdit.setMinimumSize(QtCore.QSize(60, 0))
- self.alphaFreqEdit.setMaximumSize(QtCore.QSize(80, 16777215))
- self.alphaFreqEdit.setObjectName("alphaFreqEdit")
- self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.alphaFreqEdit)
- self.betaTimeEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
- self.betaTimeEdit.setMaximumSize(QtCore.QSize(80, 16777215))
- self.betaTimeEdit.setObjectName("betaTimeEdit")
- self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.betaTimeEdit)
- self.betaTimeLabel = QtGui.QLabel(self.formLayoutWidget_3)
- self.betaTimeLabel.setObjectName("betaTimeLabel")
- self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.betaTimeLabel)
+ self.gainClockLabel = QtGui.QLabel(self.formLayoutWidget_3)
+ self.gainClockLabel.setObjectName("gainClockLabel")
+ self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainClockLabel)
+ self.gainPhaseLabel = QtGui.QLabel(self.formLayoutWidget_3)
+ self.gainPhaseLabel.setObjectName("gainPhaseLabel")
+ self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel)
+ self.gainClockEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
+ self.gainClockEdit.setMinimumSize(QtCore.QSize(60, 0))
+ self.gainClockEdit.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.gainClockEdit.setObjectName("gainClockEdit")
+ self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainClockEdit)
+ self.gainFreqEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
+ self.gainFreqEdit.setMinimumSize(QtCore.QSize(60, 0))
+ self.gainFreqEdit.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.gainFreqEdit.setObjectName("gainFreqEdit")
+ self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.gainFreqEdit)
+ self.gainPhaseEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
+ self.gainPhaseEdit.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.gainPhaseEdit.setObjectName("gainPhaseEdit")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainPhaseEdit)
+ self.gainPhaseLabel_2 = QtGui.QLabel(self.formLayoutWidget_3)
+ self.gainPhaseLabel_2.setObjectName("gainPhaseLabel_2")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel_2)
self.gridLayout.addWidget(self.rxBox, 2, 2, 1, 1)
DigitalWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(DigitalWindow)
@@ -240,22 +240,22 @@ class Ui_DigitalWindow(object):
def retranslateUi(self, DigitalWindow):
DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
- self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
- self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8))
self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8))
self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8))
self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8))
+ self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8))
+ self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))
self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8))
self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8))
self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8))
self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8))
- self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8))
- self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))
+ self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8))
- self.alphaTimeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: time", None, QtGui.QApplication.UnicodeUTF8))
- self.alphaFreqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: freq", None, QtGui.QApplication.UnicodeUTF8))
- self.betaTimeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Beta: time", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainClockLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Clock Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Freq. Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainPhaseLabel_2.setText(QtGui.QApplication.translate("DigitalWindow", "Phase Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
diff --git a/gnuradio-examples/python/digital/qt_digital_window2.ui b/gnuradio-examples/python/digital/qt_digital_window2.ui
index dc20ed798..4e87ff058 100644
--- a/gnuradio-examples/python/digital/qt_digital_window2.ui
+++ b/gnuradio-examples/python/digital/qt_digital_window2.ui
@@ -14,116 +14,6 @@
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" name="gridLayout" >
- <item row="2" column="0" >
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="QGroupBox" name="sysBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize" >
- <size>
- <width>240</width>
- <height>60</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>240</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="title" >
- <string>System Parameters</string>
- </property>
- <widget class="QWidget" name="formLayoutWidget" >
- <property name="geometry" >
- <rect>
- <x>10</x>
- <y>20</y>
- <width>211</width>
- <height>31</height>
- </rect>
- </property>
- <layout class="QFormLayout" name="formLayout" >
- <property name="sizeConstraint" >
- <enum>QLayout::SetFixedSize</enum>
- </property>
- <property name="verticalSpacing" >
- <number>20</number>
- </property>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="sampleRateEdit" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize" >
- <size>
- <width>60</width>
- <height>26</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>80</width>
- <height>26</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="sampleRateLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize" >
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>20</height>
- </size>
- </property>
- <property name="text" >
- <string>Sample Rate (sps)</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>60</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
<item row="0" column="0" colspan="6" >
<layout class="QVBoxLayout" name="verticalLayout_5" >
<item>
@@ -265,10 +155,66 @@
</item>
</layout>
</widget>
- <zorder>formLayoutWidget_2</zorder>
- <zorder>rxBox</zorder>
</widget>
</item>
+ <item row="2" column="5" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QPushButton" name="pauseButton" >
+ <property name="minimumSize" >
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Pause</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton" >
+ <property name="minimumSize" >
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="2" column="3" >
<widget class="QGroupBox" name="rxBox_2" >
<property name="sizePolicy" >
@@ -384,7 +330,6 @@
<zorder>pktsRcvdEdit</zorder>
<zorder>pktsCorrectEdit</zorder>
<zorder>perEdit</zorder>
- <zorder>rxBox</zorder>
</widget>
</widget>
</item>
@@ -401,29 +346,100 @@
</property>
</spacer>
</item>
- <item row="2" column="5" >
- <layout class="QVBoxLayout" name="verticalLayout" >
+ <item row="2" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
- <widget class="QPushButton" name="pauseButton" >
+ <widget class="QGroupBox" name="sysBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize" >
<size>
- <width>80</width>
- <height>0</height>
+ <width>240</width>
+ <height>60</height>
</size>
</property>
<property name="maximumSize" >
<size>
- <width>80</width>
+ <width>240</width>
<height>16777215</height>
</size>
</property>
- <property name="text" >
- <string>Pause</string>
+ <property name="title" >
+ <string>System Parameters</string>
</property>
+ <widget class="QWidget" name="formLayoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>211</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="formLayout" >
+ <property name="sizeConstraint" >
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <property name="verticalSpacing" >
+ <number>20</number>
+ </property>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="sampleRateEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>60</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>80</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="sampleRateLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Sample Rate (sps)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
<item>
- <spacer name="verticalSpacer" >
+ <spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
@@ -438,25 +454,6 @@
</property>
</spacer>
</item>
- <item>
- <widget class="QPushButton" name="closeButton" >
- <property name="minimumSize" >
- <size>
- <width>80</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>80</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text" >
- <string>Close</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item row="2" column="2" >
@@ -487,7 +484,7 @@
<rect>
<x>10</x>
<y>10</y>
- <width>161</width>
+ <width>164</width>
<height>101</height>
</rect>
</property>
@@ -496,21 +493,21 @@
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0" >
- <widget class="QLabel" name="alphaTimeLabel" >
+ <widget class="QLabel" name="gainClockLabel" >
<property name="text" >
- <string>Alpha: time</string>
+ <string>Clock Loop Gain</string>
</property>
</widget>
</item>
<item row="2" column="0" >
- <widget class="QLabel" name="alphaFreqLabel" >
+ <widget class="QLabel" name="gainPhaseLabel" >
<property name="text" >
- <string>Alpha: freq</string>
+ <string>Freq. Loop Gain</string>
</property>
</widget>
</item>
<item row="0" column="1" >
- <widget class="QLineEdit" name="alphaTimeEdit" >
+ <widget class="QLineEdit" name="gainClockEdit" >
<property name="minimumSize" >
<size>
<width>60</width>
@@ -526,7 +523,7 @@
</widget>
</item>
<item row="2" column="1" >
- <widget class="QLineEdit" name="alphaFreqEdit" >
+ <widget class="QLineEdit" name="gainFreqEdit" >
<property name="minimumSize" >
<size>
<width>60</width>
@@ -542,7 +539,7 @@
</widget>
</item>
<item row="1" column="1" >
- <widget class="QLineEdit" name="betaTimeEdit" >
+ <widget class="QLineEdit" name="gainPhaseEdit" >
<property name="maximumSize" >
<size>
<width>80</width>
@@ -552,9 +549,9 @@
</widget>
</item>
<item row="1" column="0" >
- <widget class="QLabel" name="betaTimeLabel" >
+ <widget class="QLabel" name="gainPhaseLabel_2" >
<property name="text" >
- <string>Beta: time</string>
+ <string>Phase Loop Gain</string>
</property>
</widget>
</item>
diff --git a/gnuradio-examples/python/digital/qt_rx_window2.py b/gnuradio-examples/python/digital/qt_rx_window2.py
new file mode 100644
index 000000000..14c961ab2
--- /dev/null
+++ b/gnuradio-examples/python/digital/qt_rx_window2.py
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'qt_rx_window2.ui'
+#
+# Created: Sat Jan 2 12:54:51 2010
+# by: PyQt4 UI code generator 4.4.3
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_DigitalWindow(object):
+ def setupUi(self, DigitalWindow):
+ DigitalWindow.setObjectName("DigitalWindow")
+ DigitalWindow.resize(1000, 816)
+ self.centralwidget = QtGui.QWidget(DigitalWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridLayout = QtGui.QGridLayout(self.centralwidget)
+ self.gridLayout.setObjectName("gridLayout")
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.rxBox = QtGui.QGroupBox(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth())
+ self.rxBox.setSizePolicy(sizePolicy)
+ self.rxBox.setMinimumSize(QtCore.QSize(250, 190))
+ self.rxBox.setMaximumSize(QtCore.QSize(250, 250))
+ self.rxBox.setObjectName("rxBox")
+ self.formLayout = QtGui.QFormLayout(self.rxBox)
+ self.formLayout.setObjectName("formLayout")
+ self.freqLabel = QtGui.QLabel(self.rxBox)
+ self.freqLabel.setObjectName("freqLabel")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.freqLabel)
+ self.freqEdit = QtGui.QLineEdit(self.rxBox)
+ self.freqEdit.setObjectName("freqEdit")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.freqEdit)
+ self.gainLabel = QtGui.QLabel(self.rxBox)
+ self.gainLabel.setObjectName("gainLabel")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainLabel)
+ self.gainEdit = QtGui.QLineEdit(self.rxBox)
+ self.gainEdit.setObjectName("gainEdit")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainEdit)
+ self.decimLabel = QtGui.QLabel(self.rxBox)
+ self.decimLabel.setObjectName("decimLabel")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.decimLabel)
+ self.decimEdit = QtGui.QLineEdit(self.rxBox)
+ self.decimEdit.setObjectName("decimEdit")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.decimEdit)
+ self.gainClockLabel = QtGui.QLabel(self.rxBox)
+ self.gainClockLabel.setObjectName("gainClockLabel")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.gainClockLabel)
+ self.gainClockEdit = QtGui.QLineEdit(self.rxBox)
+ self.gainClockEdit.setObjectName("gainClockEdit")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.gainClockEdit)
+ self.gainPhaseLabel = QtGui.QLabel(self.rxBox)
+ self.gainPhaseLabel.setObjectName("gainPhaseLabel")
+ self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel)
+ self.gainPhaseEdit = QtGui.QLineEdit(self.rxBox)
+ self.gainPhaseEdit.setObjectName("gainPhaseEdit")
+ self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.gainPhaseEdit)
+ self.gainFreqEdit = QtGui.QLineEdit(self.rxBox)
+ self.gainFreqEdit.setObjectName("gainFreqEdit")
+ self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.gainFreqEdit)
+ self.gainFreqLabel = QtGui.QLabel(self.rxBox)
+ self.gainFreqLabel.setObjectName("gainFreqLabel")
+ self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.gainFreqLabel)
+ self.horizontalLayout.addWidget(self.rxBox)
+ self.verticalLayout_3 = QtGui.QVBoxLayout()
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.rxPacketBox = QtGui.QGroupBox(self.centralwidget)
+ self.rxPacketBox.setEnabled(True)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.rxPacketBox.sizePolicy().hasHeightForWidth())
+ self.rxPacketBox.setSizePolicy(sizePolicy)
+ self.rxPacketBox.setMinimumSize(QtCore.QSize(250, 130))
+ self.rxPacketBox.setMaximumSize(QtCore.QSize(250, 130))
+ font = QtGui.QFont()
+ font.setWeight(50)
+ font.setBold(False)
+ self.rxPacketBox.setFont(font)
+ self.rxPacketBox.setObjectName("rxPacketBox")
+ self.pktsRcvdEdit = QtGui.QLineEdit(self.rxPacketBox)
+ self.pktsRcvdEdit.setGeometry(QtCore.QRect(120, 30, 113, 23))
+ self.pktsRcvdEdit.setObjectName("pktsRcvdEdit")
+ self.pktsRcvdLabel = QtGui.QLabel(self.rxPacketBox)
+ self.pktsRcvdLabel.setGeometry(QtCore.QRect(10, 30, 111, 20))
+ self.pktsRcvdLabel.setObjectName("pktsRcvdLabel")
+ self.pktsCorrectEdit = QtGui.QLineEdit(self.rxPacketBox)
+ self.pktsCorrectEdit.setGeometry(QtCore.QRect(120, 60, 113, 23))
+ self.pktsCorrectEdit.setObjectName("pktsCorrectEdit")
+ self.pktsCorrectLabel = QtGui.QLabel(self.rxPacketBox)
+ self.pktsCorrectLabel.setGeometry(QtCore.QRect(10, 60, 111, 20))
+ self.pktsCorrectLabel.setObjectName("pktsCorrectLabel")
+ self.perLabel = QtGui.QLabel(self.rxPacketBox)
+ self.perLabel.setGeometry(QtCore.QRect(10, 90, 111, 20))
+ self.perLabel.setObjectName("perLabel")
+ self.perEdit = QtGui.QLineEdit(self.rxPacketBox)
+ self.perEdit.setGeometry(QtCore.QRect(120, 90, 113, 23))
+ self.perEdit.setObjectName("perEdit")
+ self.verticalLayout_3.addWidget(self.rxPacketBox)
+ spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
+ self.verticalLayout_3.addItem(spacerItem)
+ self.horizontalLayout.addLayout(self.verticalLayout_3)
+ spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout.addItem(spacerItem1)
+ self.verticalLayout_5 = QtGui.QVBoxLayout()
+ self.verticalLayout_5.setObjectName("verticalLayout_5")
+ spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout_5.addItem(spacerItem2)
+ self.closeButton = QtGui.QPushButton(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth())
+ self.closeButton.setSizePolicy(sizePolicy)
+ self.closeButton.setMinimumSize(QtCore.QSize(80, 30))
+ self.closeButton.setMaximumSize(QtCore.QSize(80, 30))
+ self.closeButton.setObjectName("closeButton")
+ self.verticalLayout_5.addWidget(self.closeButton)
+ self.horizontalLayout.addLayout(self.verticalLayout_5)
+ self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
+ self.sinkFrame = QtGui.QFrame(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(1)
+ sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth())
+ self.sinkFrame.setSizePolicy(sizePolicy)
+ self.sinkFrame.setMinimumSize(QtCore.QSize(800, 500))
+ self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised)
+ self.sinkFrame.setObjectName("sinkFrame")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout(self.sinkFrame)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.sinkLayout = QtGui.QHBoxLayout()
+ self.sinkLayout.setObjectName("sinkLayout")
+ self.horizontalLayout_2.addLayout(self.sinkLayout)
+ self.gridLayout.addWidget(self.sinkFrame, 0, 0, 1, 1)
+ DigitalWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtGui.QMenuBar(DigitalWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 24))
+ self.menubar.setObjectName("menubar")
+ self.menuFile = QtGui.QMenu(self.menubar)
+ self.menuFile.setObjectName("menuFile")
+ DigitalWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(DigitalWindow)
+ self.statusbar.setObjectName("statusbar")
+ DigitalWindow.setStatusBar(self.statusbar)
+ self.actionExit = QtGui.QAction(DigitalWindow)
+ self.actionExit.setObjectName("actionExit")
+ self.menuFile.addAction(self.actionExit)
+ self.menubar.addAction(self.menuFile.menuAction())
+
+ self.retranslateUi(DigitalWindow)
+ QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close)
+ QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close)
+ QtCore.QMetaObject.connectSlotsByName(DigitalWindow)
+
+ def retranslateUi(self, DigitalWindow):
+ DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
+ self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.decimLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Decimation", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainClockLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Clock Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Phase Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainFreqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Freq. Loop Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.rxPacketBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8))
+ self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8))
+ self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8))
+ self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8))
+ self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+ self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/gnuradio-examples/python/digital/qt_rx_window2.ui b/gnuradio-examples/python/digital/qt_rx_window2.ui
new file mode 100644
index 000000000..5a83471b8
--- /dev/null
+++ b/gnuradio-examples/python/digital/qt_rx_window2.ui
@@ -0,0 +1,379 @@
+<ui version="4.0" >
+ <class>DigitalWindow</class>
+ <widget class="QMainWindow" name="DigitalWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1000</width>
+ <height>816</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="sizeConstraint" >
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="rxBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>250</width>
+ <height>190</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>250</width>
+ <height>250</height>
+ </size>
+ </property>
+ <property name="title" >
+ <string>Receiver Parameters</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="freqLabel" >
+ <property name="text" >
+ <string>Frequency (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="freqEdit" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="gainLabel" >
+ <property name="text" >
+ <string>Gain (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="gainEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="decimLabel" >
+ <property name="text" >
+ <string>Decimation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="decimEdit" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="gainClockLabel" >
+ <property name="text" >
+ <string>Clock Loop Gain</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="gainClockEdit" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="gainPhaseLabel" >
+ <property name="text" >
+ <string>Phase Loop Gain</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QLineEdit" name="gainPhaseEdit" />
+ </item>
+ <item row="5" column="1" >
+ <widget class="QLineEdit" name="gainFreqEdit" />
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="gainFreqLabel" >
+ <property name="text" >
+ <string>Freq. Loop Gain</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QGroupBox" name="rxPacketBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>250</width>
+ <height>130</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>250</width>
+ <height>130</height>
+ </size>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="title" >
+ <string>Received Packet Info</string>
+ </property>
+ <widget class="QLineEdit" name="pktsRcvdEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsRcvdLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Packets Rcvd.</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="pktsCorrectEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsCorrectLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Packets Correct</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="perLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>PER</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="perEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>90</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5" >
+ <item>
+ <spacer name="verticalSpacer_3" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>80</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>80</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QFrame" name="sinkFrame" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>800</width>
+ <height>500</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <layout class="QHBoxLayout" name="sinkLayout" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ <zorder>sinkFrame</zorder>
+ <zorder>verticalSpacer</zorder>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1000</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>&amp;File</string>
+ </property>
+ <addaction name="actionExit" />
+ </widget>
+ <addaction name="menuFile" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionExit" >
+ <property name="text" >
+ <string>E&amp;xit</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>617</x>
+ <y>327</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>960</x>
+ <y>694</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>66</x>
+ <y>561</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gnuradio-examples/python/digital/usrp_receive_path.py b/gnuradio-examples/python/digital/usrp_receive_path.py
index e28eb0a8c..517825cc1 100644
--- a/gnuradio-examples/python/digital/usrp_receive_path.py
+++ b/gnuradio-examples/python/digital/usrp_receive_path.py
@@ -63,15 +63,22 @@ class usrp_receive_path(gr.hier_block2):
for attr in dir(rx_path): #forward the methods
if not attr.startswith('_') and not hasattr(self, attr):
setattr(self, attr, getattr(rx_path, attr))
+
#setup usrp
self._demod_class = demod_class
self._setup_usrp_source(options)
+
+ # Set up resampler based on rate determined by _setup_usrp_source
+ rs_taps = gr.firdes.low_pass_2(32, 32, 0.45, 0.1, 60)
+ self.resampler = gr.pfb_arb_resampler_ccf(self.rs_rate, rs_taps)
+
#connect
- self.connect(self.u, rx_path)
+ self.connect(self.u, self.resampler, rx_path)
def _setup_usrp_source(self, options):
self.u = usrp_options.create_usrp_source(options)
adc_rate = self.u.adc_rate()
+ self.rs_rate = options.bitrate
if options.verbose:
print 'USRP Source:', self.u
(self._bitrate, self._samples_per_symbol, self._decim) = \
@@ -79,6 +86,11 @@ class usrp_receive_path(gr.hier_block2):
options.samples_per_symbol, options.decim, adc_rate, \
self.u.get_decim_rates())
+ # Calculate resampler rate based on requested and actual rates
+ self.rs_rate = 1.0 /(self._bitrate / self.rs_rate)
+
+ print "Resampling by %f to get bitrate of %ssps" % ( self.rs_rate, eng_notation.num_to_str(self._bitrate/self.rs_rate))
+
self.u.set_decim(self._decim)
if not self.u.set_center_freq(options.rx_freq):
diff --git a/gnuradio-examples/python/digital/usrp_transmit_path.py b/gnuradio-examples/python/digital/usrp_transmit_path.py
index ad9f741a6..ee63dcd2b 100644
--- a/gnuradio-examples/python/digital/usrp_transmit_path.py
+++ b/gnuradio-examples/python/digital/usrp_transmit_path.py
@@ -62,12 +62,18 @@ class usrp_transmit_path(gr.hier_block2):
for attr in dir(tx_path): #forward the methods
if not attr.startswith('_') and not hasattr(self, attr):
setattr(self, attr, getattr(tx_path, attr))
+
#setup usrp
self._modulator_class = modulator_class
self._setup_usrp_sink(options)
- #connect
- self.connect(tx_path, self.u)
+ # Set up resampler based on rate determined by _setup_usrp_sink
+ rs_taps = gr.firdes.low_pass_2(32, 32, 0.45, 0.1, 60)
+ self.resampler = gr.pfb_arb_resampler_ccf(self.rs_rate, rs_taps)
+
+ #connect
+ self.connect(tx_path, self.resampler, self.u)
+
def _setup_usrp_sink(self, options):
"""
Creates a USRP sink, determines the settings for best bitrate,
@@ -75,6 +81,7 @@ class usrp_transmit_path(gr.hier_block2):
"""
self.u = usrp_options.create_usrp_sink(options)
dac_rate = self.u.dac_rate()
+ self.rs_rate = options.bitrate # Store requested bit rate
if options.verbose:
print 'USRP Sink:', self.u
(self._bitrate, self._samples_per_symbol, self._interp) = \
@@ -82,6 +89,10 @@ class usrp_transmit_path(gr.hier_block2):
options.samples_per_symbol, options.interp, dac_rate, \
self.u.get_interp_rates())
+ # Calculate resampler rate based on requested and actual rates
+ self.rs_rate = self._bitrate / self.rs_rate
+ print "Resampling by %f to get bitrate of %ssps" % (self.rs_rate, eng_notation.num_to_str(self._bitrate/self.rs_rate))
+
self.u.set_interp(self._interp)
self.u.set_auto_tr(True)