From 977b0e098fc602e61b7cb40791d53dde0adf63aa Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 20 Dec 2009 22:16:51 -0500 Subject: Adding FLL to QT loopback example. --- .../python/digital/benchmark_qt_loopback2.py | 46 ++-- .../python/digital/qt_digital_window2.py | 184 ++++++------- .../python/digital/qt_digital_window2.ui | 305 ++++++++++----------- 3 files changed, 267 insertions(+), 268 deletions(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py index 101dd68d6..9e4e8c712 100755 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py +++ b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py @@ -54,7 +54,7 @@ class dialog_box(QtGui.QMainWindow): 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_alpha_phase(self.fg.rx_phase_gain_alpha()) # Add the qtsnk widgets to the hlayout box self.gui.sinkLayout.addWidget(snkTx) @@ -79,8 +79,8 @@ class dialog_box(QtGui.QMainWindow): 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.alphaPhaseEdit, QtCore.SIGNAL("editingFinished()"), + self.alphaPhaseEditText) # Build a timer to update the packet number and PER fields self.update_delay = 250 # time between updating packet rate fields @@ -151,13 +151,13 @@ class dialog_box(QtGui.QMainWindow): 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 alphaPhaseEditText(self): try: - alpha = self.gui.alphaFreqEdit.text().toDouble()[0] - self.fg.set_rx_freq_gain_alpha(alpha) + alpha = self.gui.alphaPhaseEdit.text().toDouble()[0] + self.fg.set_rx_phase_gain_alpha(alpha) except RuntimeError: pass @@ -220,7 +220,7 @@ class my_top_block(gr.top_block): # 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._phase_gain_alpha = self.rxpath.packet_receiver._demodulator._costas_alpha if channelon: self.channel = gr.channel_model(self._noise_voltage, @@ -257,14 +257,16 @@ class my_top_block(gr.top_block): # Connect to the QT sinks # FIXME: make better exposure to receiver from rxpath - self.freq_recov = self.rxpath.packet_receiver._demodulator.clock_recov + 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._freq_gain_alpha) - self.freq_recov.set_beta(0.25*self._freq_gain_alpha*self._freq_gain_alpha) + self.phase_recov.set_alpha(self._phase_gain_alpha) + self.phase_recov.set_beta(0.25*self._phase_gain_alpha*self._phase_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) @@ -335,17 +337,17 @@ class my_top_block(gr.top_block): self._timing_gain_beta = gain self.time_recov.set_beta(self._timing_gain_beta) - def rx_freq_gain_alpha(self): - return self._freq_gain_alpha + def rx_phase_gain_alpha(self): + return self._phase_gain_alpha - def rx_freq_gain_beta(self): - return self._freq_gain_beta + def rx_phase_gain_beta(self): + return self._phase_gain_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_phase_gain_alpha(self, alpha): + self._phase_gain_alpha = alpha + self._phase_gain_beta = .25 * self._phase_gain_alpha * self._phase_gain_alpha + self.phase_recov.set_alpha(self._phase_gain_alpha) + self.phase_recov.set_beta(self._phase_gain_beta) diff --git a/gnuradio-examples/python/digital/qt_digital_window2.py b/gnuradio-examples/python/digital/qt_digital_window2.py index f111e3772..20502508d 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: Sun Dec 20 22:08:51 2009 # by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -17,67 +17,21 @@ 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) + 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_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) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) - self.sinkFrame.setSizePolicy(sizePolicy) - self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) - self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) - self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) - self.sinkFrame.setObjectName("sinkFrame") - self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) - self.gridLayout_2.setObjectName("gridLayout_2") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) - self.verticalLayout_5.addWidget(self.sinkFrame) - self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) + 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.channelModeBox = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -119,6 +73,48 @@ 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_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) + spacerItem1 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_2.addItem(spacerItem1) + self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1) self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -160,23 +156,27 @@ class Ui_DigitalWindow(object): self.perEdit.setObjectName("perEdit") self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) 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) - 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) + spacerItem2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem2, 2, 4, 1, 1) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout.setObjectName("sinkLayout") + self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) + self.verticalLayout_5.addWidget(self.sinkFrame) + self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) self.rxBox = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -195,19 +195,19 @@ class Ui_DigitalWindow(object): 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.alphaPhaseLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.alphaPhaseLabel.setObjectName("alphaPhaseLabel") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.alphaPhaseLabel) 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.alphaPhaseEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.alphaPhaseEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.alphaPhaseEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.alphaPhaseEdit.setObjectName("alphaPhaseEdit") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.alphaPhaseEdit) self.betaTimeEdit = QtGui.QLineEdit(self.formLayoutWidget_3) self.betaTimeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.betaTimeEdit.setObjectName("betaTimeEdit") @@ -240,21 +240,21 @@ 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.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", 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.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_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.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.alphaPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: phase", None, QtGui.QApplication.UnicodeUTF8)) self.betaTimeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Beta: time", 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..d261cbae1 100644 --- a/gnuradio-examples/python/digital/qt_digital_window2.ui +++ b/gnuradio-examples/python/digital/qt_digital_window2.ui @@ -14,100 +14,29 @@ - - + + - - - - 0 - 0 - - + - 240 - 60 + 80 + 0 - 240 + 80 16777215 - - System Parameters + + Pause - - - - 10 - 20 - 211 - 31 - - - - - QLayout::SetFixedSize - - - 20 - - - - - - 0 - 0 - - - - - 60 - 26 - - - - - 80 - 26 - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 20 - - - - Sample Rate (sps) - - - - - - + Qt::Vertical @@ -122,35 +51,23 @@ - - - - - - - - 0 - 0 - - + - 500 - 550 + 80 + 0 - - QFrame::StyledPanel + + + 80 + 16777215 + - - QFrame::Raised + + Close - - - - - @@ -265,10 +182,118 @@ - formLayoutWidget_2 - rxBox + + + + + + + 0 + 0 + + + + + 240 + 60 + + + + + 240 + 16777215 + + + + System Parameters + + + + + 10 + 20 + 211 + 31 + + + + + QLayout::SetFixedSize + + + 20 + + + + + + 0 + 0 + + + + + 60 + 26 + + + + + 80 + 26 + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 20 + + + + Sample Rate (sps) + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + + + @@ -384,7 +409,6 @@ pktsRcvdEdit pktsCorrectEdit perEdit - rxBox @@ -401,60 +425,33 @@ - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - Pause - - - + + - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 60 - + + + + 0 + 0 + - - - - - 80 - 0 + 500 + 550 - - - 80 - 16777215 - + + QFrame::StyledPanel - - Close + + QFrame::Raised + + + + + @@ -503,9 +500,9 @@ - + - Alpha: freq + Alpha: phase @@ -526,7 +523,7 @@ - + 60 -- cgit From 4f03e43efdc8736c39ff6dad10052d0e31aca62f Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 2 Jan 2010 16:33:13 -0500 Subject: Adding a routine to exercise the new DBPSK receiver code with the QT GUI. --- .../python/digital/benchmark_qt_rx2.py | 474 +++++++++++++++++++++ 1 file changed, 474 insertions(+) create mode 100755 gnuradio-examples/python/digital/benchmark_qt_rx2.py (limited to 'gnuradio-examples') 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 -- cgit From 991ffe1dcc5ddacc4e2083d8494a9e92034aa70a Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 2 Jan 2010 16:34:20 -0500 Subject: UIC files to go along with previous commit (for QT receiver code). --- gnuradio-examples/python/digital/qt_rx_window2.py | 179 ++++++++++ gnuradio-examples/python/digital/qt_rx_window2.ui | 379 ++++++++++++++++++++++ 2 files changed, 558 insertions(+) create mode 100644 gnuradio-examples/python/digital/qt_rx_window2.py create mode 100644 gnuradio-examples/python/digital/qt_rx_window2.ui (limited to 'gnuradio-examples') 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 @@ + + DigitalWindow + + + + 0 + 0 + 1000 + 816 + + + + MainWindow + + + + + + + QLayout::SetFixedSize + + + + + + 0 + 0 + + + + + 250 + 190 + + + + + 250 + 250 + + + + Receiver Parameters + + + + + + Frequency (Hz) + + + + + + + + + + Gain (dB) + + + + + + + + + + Decimation + + + + + + + + + + Clock Loop Gain + + + + + + + + + + Phase Loop Gain + + + + + + + + + + + + + Freq. Loop Gain + + + + + + + + + + + + true + + + + 0 + 0 + + + + + 250 + 130 + + + + + 250 + 130 + + + + + 50 + false + + + + Received Packet Info + + + + + 120 + 30 + 113 + 23 + + + + + + + 10 + 30 + 111 + 20 + + + + Packets Rcvd. + + + + + + 120 + 60 + 113 + 23 + + + + + + + 10 + 60 + 111 + 20 + + + + Packets Correct + + + + + + 10 + 90 + 111 + 20 + + + + PER + + + + + + 120 + 90 + 113 + 23 + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 80 + 30 + + + + + 80 + 30 + + + + Close + + + + + + + + + + + + 0 + 1 + + + + + 800 + 500 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + sinkFrame + verticalSpacer + + + + + 0 + 0 + 1000 + 24 + + + + + &File + + + + + + + + + E&xit + + + + + + + actionExit + triggered() + DigitalWindow + close() + + + -1 + -1 + + + 617 + 327 + + + + + closeButton + clicked() + DigitalWindow + close() + + + 960 + 694 + + + 66 + 561 + + + + + -- cgit From dafe4d73fec32dfa4cbc687e3b4489784c33db92 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 2 Jan 2010 16:47:00 -0500 Subject: Fixing up loopback benchmark program for new DBPSK receiver. --- .../python/digital/benchmark_qt_loopback2.py | 117 ++++---- .../python/digital/qt_digital_window2.py | 216 +++++++-------- .../python/digital/qt_digital_window2.ui | 302 ++++++++++----------- 3 files changed, 327 insertions(+), 308 deletions(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py index 9e4e8c712..4050d498b 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_phase(self.fg.rx_phase_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.alphaPhaseEdit, QtCore.SIGNAL("editingFinished()"), - self.alphaPhaseEditText) + 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,6 +145,16 @@ 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)) @@ -154,24 +164,24 @@ class dialog_box(QtGui.QMainWindow): def set_alpha_phase(self, alpha): self.gui.alphaPhaseEdit.setText(QtCore.QString("%1").arg(alpha)) - def alphaPhaseEditText(self): + def gainPhaseEditText(self): try: - alpha = self.gui.alphaPhaseEdit.text().toDouble()[0] - self.fg.set_rx_phase_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(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._phase_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,16 +264,18 @@ class my_top_block(gr.top_block): self.snk_tx.set_frequency_axis(-80, 0) self.snk_rx.set_frequency_axis(-60, 20) - - # Connect to the QT sinks - # FIXME: make better exposure to receiver from rxpath + 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.phase_recov.set_alpha(self._phase_gain_alpha) - self.phase_recov.set_beta(0.25*self._phase_gain_alpha*self._phase_gain_alpha) - self.time_recov.set_alpha(self._timing_gain_alpha) - self.time_recov.set_beta(self._timing_gain_beta) + 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.connect(self.channel, self.snk_tx) self.connect(self.phase_recov, self.snk_rx) #self.connect(self.freq_recov, self.snk_rx) @@ -323,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_phase_gain_alpha(self): - return self._phase_gain_alpha + def rx_gain_phase(self): + return self._gain_phase - def rx_phase_gain_beta(self): - return self._phase_gain_beta + def rx_gain_phase_beta(self): + return self._gain_phase_beta - def set_rx_phase_gain_alpha(self, alpha): - self._phase_gain_alpha = alpha - self._phase_gain_beta = .25 * self._phase_gain_alpha * self._phase_gain_alpha - self.phase_recov.set_alpha(self._phase_gain_alpha) - self.phase_recov.set_beta(self._phase_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/qt_digital_window2.py b/gnuradio-examples/python/digital/qt_digital_window2.py index 20502508d..98745dfe8 100644 --- a/gnuradio-examples/python/digital/qt_digital_window2.py +++ b/gnuradio-examples/python/digital/qt_digital_window2.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'qt_digital_window2.ui' # -# Created: Sun Dec 20 22:08:51 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,21 +17,25 @@ class Ui_DigitalWindow(object): self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") - 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.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout.setObjectName("sinkLayout") + self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) + self.verticalLayout_5.addWidget(self.sinkFrame) + self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) self.channelModeBox = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -73,48 +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_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) - spacerItem1 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_2.addItem(spacerItem1) - self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 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) @@ -156,27 +133,50 @@ class Ui_DigitalWindow(object): self.perEdit.setObjectName("perEdit") self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) self.gridLayout.addWidget(self.rxBox_2, 2, 3, 1, 1) - spacerItem2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem2, 2, 4, 1, 1) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.sinkFrame = QtGui.QFrame(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem1, 2, 4, 1, 1) + 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.sinkFrame.sizePolicy().hasHeightForWidth()) - self.sinkFrame.setSizePolicy(sizePolicy) - self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) - self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) - self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) - self.sinkFrame.setObjectName("sinkFrame") - self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) - self.gridLayout_2.setObjectName("gridLayout_2") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) - self.verticalLayout_5.addWidget(self.sinkFrame) - self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) + 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_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.alphaPhaseLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.alphaPhaseLabel.setObjectName("alphaPhaseLabel") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.alphaPhaseLabel) - 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.alphaPhaseEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.alphaPhaseEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.alphaPhaseEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.alphaPhaseEdit.setObjectName("alphaPhaseEdit") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.alphaPhaseEdit) - 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.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", 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.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.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.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.alphaPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: phase", 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 d261cbae1..4e87ff058 100644 --- a/gnuradio-examples/python/digital/qt_digital_window2.ui +++ b/gnuradio-examples/python/digital/qt_digital_window2.ui @@ -14,60 +14,33 @@ - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - Pause - - - + + - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 60 - + + + + 0 + 0 + - - - - - 80 - 0 + 500 + 550 - - - 80 - 16777215 - + + QFrame::StyledPanel - - Close + + QFrame::Raised + + + + + @@ -184,100 +157,29 @@ - - + + - - - - 0 - 0 - - + - 240 - 60 + 80 + 0 - 240 + 80 16777215 - - System Parameters + + Pause - - - - 10 - 20 - 211 - 31 - - - - - QLayout::SetFixedSize - - - 20 - - - - - - 0 - 0 - - - - - 60 - 26 - - - - - 80 - 26 - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 20 - - - - Sample Rate (sps) - - - - - - + Qt::Vertical @@ -292,6 +194,25 @@ + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + Close + + + @@ -425,35 +346,114 @@ - - + + - + - + 0 0 - 500 - 550 + 240 + 60 - - QFrame::StyledPanel + + + 240 + 16777215 + - - QFrame::Raised + + System Parameters - - - - - + + + + 10 + 20 + 211 + 31 + + + + + QLayout::SetFixedSize + + + 20 + + + + + + 0 + 0 + + + + + 60 + 26 + + + + + 80 + 26 + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 20 + + + + Sample Rate (sps) + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + @@ -484,7 +484,7 @@ 10 10 - 161 + 164 101 @@ -493,21 +493,21 @@ QLayout::SetFixedSize - + - Alpha: time + Clock Loop Gain - + - Alpha: phase + Freq. Loop Gain - + 60 @@ -523,7 +523,7 @@ - + 60 @@ -539,7 +539,7 @@ - + 80 @@ -549,9 +549,9 @@ - + - Beta: time + Phase Loop Gain -- cgit From b484d4b751bc08e9324425eadd269e85932f7149 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 17 Jan 2010 19:18:39 -0500 Subject: Playing with using the resampler to allow any bit rate requested. --- gnuradio-examples/python/digital/usrp_transmit_path.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gnuradio-examples') 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) -- cgit From cf4e5e40a77a0579f97e4306d2d51860b3b3a3f0 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 17 Jan 2010 19:19:40 -0500 Subject: Doing the same with the resampler on the receiver side. --- gnuradio-examples/python/digital/usrp_receive_path.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gnuradio-examples') 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): -- cgit From e6e29a45df8a97c80a213645968ac01fda904777 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 31 Jan 2010 17:10:18 -0500 Subject: Preventing an error message by casting an integer (0) to the requested float. --- gnuradio-examples/python/digital/benchmark_qt_loopback2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py index 4050d498b..1cb95198e 100755 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py +++ b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py @@ -196,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, 0, 'e', 4)) + self.gui.perEdit.setText(QtCore.QString("%1").arg(float(per), 0, 'e', 4)) -- cgit From 9fc527b4735db31acb967ed1309b86fd76003b03 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 1 Feb 2010 18:55:24 -0500 Subject: Using PFB resampler to generate the pulse shaping filtered signal. --- gnuradio-examples/grc/demod/pam_timing.grc | 612 +++++++++++++---------------- 1 file changed, 266 insertions(+), 346 deletions(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/grc/demod/pam_timing.grc b/gnuradio-examples/grc/demod/pam_timing.grc index 149e4c706..02130f481 100644 --- a/gnuradio-examples/grc/demod/pam_timing.grc +++ b/gnuradio-examples/grc/demod/pam_timing.grc @@ -1,6 +1,6 @@ - Sat Oct 31 10:26:48 2009 + Mon Feb 1 18:54:46 2010 options @@ -172,29 +172,6 @@ 0 - - variable - - id - rrctaps - - - _enabled - True - - - value - firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts)) - - - _coordinate - (513, 679) - - - _rotation - 0 - - random_source_x @@ -327,45 +304,6 @@ 0 - - gr_channel_model - - id - gr_channel_model_0 - - - _enabled - True - - - noise_voltage - noise_amp - - - freq_offset - freq_offset - - - epsilon - interpratio - - - taps - 1.0 - - - seed - 42 - - - _coordinate - (59, 543) - - - _rotation - 0 - - notebook @@ -401,73 +339,6 @@ 0 - - wxgui_scopesink2 - - id - wxgui_scopesink2_0_0_1 - - - _enabled - True - - - type - complex - - - title - Error - - - samp_rate - samp_rate - - - v_scale - .5 - - - v_offset - 0 - - - t_scale - 0 - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - win_size - - - - grid_pos - - - - notebook - notebook_0,3 - - - _coordinate - (1115, 358) - - - _rotation - 0 - - gr_add_xx @@ -530,29 +401,6 @@ 0 - - gr_float_to_complex - - id - gr_float_to_complex_0 - - - _enabled - True - - - vlen - 1 - - - _coordinate - (590, 184) - - - _rotation - 0 - - variable @@ -686,29 +534,6 @@ 180 - - variable - - id - spb_gen - - - _enabled - True - - - value - 4 - - - _coordinate - (119, 841) - - - _rotation - 0 - - variable_slider @@ -820,50 +645,45 @@ - root_raised_cosine_filter + variable id - root_raised_cosine_filter_0 + pam_amp _enabled True - type - interp_fir_filter_ccf - - - decim - 1 - - - interp - spb_gen + value + 2 - gain - 2*spb_gen + _coordinate + (223, 9) - samp_rate - 1.0 + _rotation + 0 + + + variable - sym_rate - 1./spb_gen + id + sig_amp - alpha - 0.35 + _enabled + True - ntaps - 11*spb_gen + value + 1 _coordinate - (834, 157) + (315, 9) _rotation @@ -871,61 +691,66 @@ - blks2_pfb_arb_resampler_ccf + wxgui_scopesink2 id - blks2_pfb_arb_resampler_ccf_0 + wxgui_scopesink2_0 _enabled True - rate - float(spb)/float(spb_gen) + type + complex - taps - firdes.low_pass(128, 128, 0.45, 0.1) + title + Scope Plot - size - 128 + samp_rate + samp_rate - _coordinate - (617, 374) + v_scale + 0 - _rotation + v_offset 0 - - - gr_multiply_const_vxx - id - gr_multiply_const_vxx_0 + t_scale + 0 - _enabled - True + ac_couple + False - type - complex + xy_mode + False - const - sig_amp + num_inputs + 1 - vlen - 1 + win_size + + + + grid_pos + + + + notebook + _coordinate - (1096, 197) + (1116, 500) _rotation @@ -933,22 +758,30 @@ - variable + gr_throttle id - pam_amp + gr_throttle_0 _enabled True - value - 2 - + type + complex + + + samples_per_second + samp_rate + + + vlen + 1 + _coordinate - (223, 9) + (290, 575) _rotation @@ -956,45 +789,66 @@ - variable + wxgui_scopesink2 id - spb + wxgui_scopesink2_0_0 _enabled True - value - 4.1 + type + float - _coordinate - (32, 842) + title + Error - _rotation + samp_rate + samp_rate + + + v_scale + 3 + + + v_offset 0 - - - variable - id - sig_amp + t_scale + 0 - _enabled - True + ac_couple + False - value + xy_mode + False + + + num_inputs 1 + + win_size + + + + grid_pos + + + + notebook + notebook_0,0 + _coordinate - (315, 9) + (1110, 651) _rotation @@ -1005,7 +859,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0 + wxgui_scopesink2_0_0_0 _enabled @@ -1013,7 +867,7 @@ type - complex + float title @@ -1025,7 +879,7 @@ v_scale - 0 + 9 v_offset @@ -1057,11 +911,11 @@ notebook - + notebook_0,1 _coordinate - (1116, 500) + (1112, 881) _rotation @@ -1069,10 +923,33 @@ - gr_throttle + variable id - gr_throttle_0 + rrctaps + + + _enabled + True + + + value + firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts)) + + + _coordinate + (513, 679) + + + _rotation + 0 + + + + gr_pfb_clock_sync_xxx + + id + gr_pfb_clock_sync_xxx_0 _enabled @@ -1080,19 +957,39 @@ type - complex + ccf - samples_per_second - samp_rate + sps + spb - vlen - 1 + alpha + alpha + + + beta + beta + + + taps + rrctaps + + + filter_size + nfilts + + + init_phase + 16 + + + max_dev + 1.5 _coordinate - (290, 575) + (512, 527) _rotation @@ -1103,7 +1000,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0 + wxgui_scopesink2_0_0_0_0 _enabled @@ -1115,7 +1012,7 @@ title - Error + Scope Plot samp_rate @@ -1123,7 +1020,7 @@ v_scale - 3 + 1.25 v_offset @@ -1155,11 +1052,11 @@ notebook - notebook_0,0 + notebook_0,2 _coordinate - (1110, 651) + (1111, 767) _rotation @@ -1170,7 +1067,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0_0_0 + wxgui_scopesink2_0_0_1 _enabled @@ -1178,11 +1075,11 @@ type - float + complex title - Scope Plot + Error samp_rate @@ -1190,7 +1087,7 @@ v_scale - 1.25 + .5 v_offset @@ -1222,11 +1119,11 @@ notebook - notebook_0,2 + notebook_0,3 _coordinate - (1111, 767) + (1115, 358) _rotation @@ -1234,50 +1131,53 @@ - gr_pfb_clock_sync_xxx + gr_float_to_complex id - gr_pfb_clock_sync_xxx_0 + gr_float_to_complex_0 _enabled True - type - ccf + vlen + 1 - sps - spb + _coordinate + (590, 184) - alpha - alpha + _rotation + 0 + + + blks2_pfb_arb_resampler_ccf - beta - beta + id + blks2_pfb_arb_resampler_ccf_0 - taps - rrctaps + _enabled + True - filter_size - nfilts + rate + spb - init_phase - 16 + taps + firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32) - max_dev - 1.5 + size + 32 _coordinate - (512, 527) + (816, 181) _rotation @@ -1285,66 +1185,92 @@ - wxgui_scopesink2 + gr_channel_model id - wxgui_scopesink2_0_0_0 + gr_channel_model_0 _enabled True - type - float + noise_voltage + noise_amp - title - Scope Plot + freq_offset + freq_offset - samp_rate - samp_rate + epsilon + interpratio - v_scale - 9 + taps + 1.0 - v_offset - 0 + seed + 42 - t_scale + _coordinate + (59, 543) + + + _rotation 0 + + + gr_multiply_const_vxx - ac_couple - False + id + gr_multiply_const_vxx_0 - xy_mode - False + _enabled + True - num_inputs + type + complex + + + const + sig_amp + + + vlen 1 - win_size - + _coordinate + (714, 382) - grid_pos - + _rotation + 0 + + + + variable + + id + spb - notebook - notebook_0,1 + _enabled + True + + + value + 4.2563 _coordinate - (1112, 881) + (42, 840) _rotation @@ -1387,18 +1313,6 @@ 0 0 - - blks2_pfb_arb_resampler_ccf_0 - gr_channel_model_0 - 0 - 0 - - - blks2_pfb_arb_resampler_ccf_0 - wxgui_scopesink2_0_0_1 - 0 - 0 - gr_channel_model_0 gr_throttle_0 @@ -1418,51 +1332,57 @@ 1 - gr_float_to_complex_0 - root_raised_cosine_filter_0 + gr_pfb_clock_sync_xxx_0 + wxgui_scopesink2_0 0 0 - root_raised_cosine_filter_0 - gr_multiply_const_vxx_0 + gr_throttle_0 + gr_pfb_clock_sync_xxx_0 0 0 - gr_multiply_const_vxx_0 - blks2_pfb_arb_resampler_ccf_0 - 0 + gr_pfb_clock_sync_xxx_0 + wxgui_scopesink2_0_0 + 1 0 gr_pfb_clock_sync_xxx_0 - wxgui_scopesink2_0 - 0 + wxgui_scopesink2_0_0_0 + 3 0 - gr_throttle_0 - gr_pfb_clock_sync_xxx_0 + gr_pfb_clock_sync_xxx_0 + wxgui_scopesink2_0_0_0_0 + 2 + 0 + + + gr_multiply_const_vxx_0 + wxgui_scopesink2_0_0_1 0 0 - gr_pfb_clock_sync_xxx_0 - wxgui_scopesink2_0_0 - 1 + gr_float_to_complex_0 + blks2_pfb_arb_resampler_ccf_0 + 0 0 - gr_pfb_clock_sync_xxx_0 - wxgui_scopesink2_0_0_0_0 - 2 + blks2_pfb_arb_resampler_ccf_0 + gr_multiply_const_vxx_0 + 0 0 - gr_pfb_clock_sync_xxx_0 - wxgui_scopesink2_0_0_0 - 3 + gr_multiply_const_vxx_0 + gr_channel_model_0 + 0 0 -- cgit From 8d4804c546be699a3c3088edc7de25cfee620562 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 1 Feb 2010 18:58:37 -0500 Subject: Simplifying and using PFB resampler to generate pusle shape filtered signal. --- gnuradio-examples/grc/demod/pam_sync.grc | 606 ++++++++++++++----------------- 1 file changed, 263 insertions(+), 343 deletions(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/grc/demod/pam_sync.grc b/gnuradio-examples/grc/demod/pam_sync.grc index fc1186894..80a7aef0c 100644 --- a/gnuradio-examples/grc/demod/pam_sync.grc +++ b/gnuradio-examples/grc/demod/pam_sync.grc @@ -1,6 +1,6 @@ - Tue Dec 15 23:06:57 2009 + Mon Feb 1 18:58:32 2010 options @@ -366,29 +366,6 @@ 0 - - gr_float_to_complex - - id - gr_float_to_complex_0 - - - _enabled - True - - - vlen - 1 - - - _coordinate - (590, 184) - - - _rotation - 0 - - variable @@ -522,60 +499,6 @@ 180 - - variable - - id - spb_gen - - - _enabled - True - - - value - 4 - - - _coordinate - (119, 841) - - - _rotation - 0 - - - - gr_multiply_const_vxx - - id - gr_multiply_const_vxx_0 - - - _enabled - True - - - type - complex - - - const - sig_amp - - - vlen - 1 - - - _coordinate - (1096, 197) - - - _rotation - 0 - - variable @@ -645,80 +568,6 @@ 0 - - root_raised_cosine_filter - - id - root_raised_cosine_filter_0 - - - _enabled - True - - - type - interp_fir_filter_ccf - - - decim - 1 - - - interp - spb_gen - - - gain - 2*spb_gen - - - samp_rate - 1.0 - - - sym_rate - 1./spb_gen - - - alpha - rolloff - - - ntaps - 11*spb_gen - - - _coordinate - (834, 157) - - - _rotation - 0 - - - - variable - - id - spb - - - _enabled - True - - - value - 4.0 - - - _coordinate - (32, 842) - - - _rotation - 0 - - gr_throttle @@ -1080,57 +929,6 @@ 180 - - gr_pfb_clock_sync_xxx - - id - gr_pfb_clock_sync_xxx_0 - - - _enabled - True - - - type - ccf - - - sps - spb - - - alpha - time_alpha - - - beta - time_beta - - - taps - rrctaps - - - filter_size - nfilts - - - init_phase - 16 - - - max_dev - 1.5 - - - _coordinate - (655, 527) - - - _rotation - 0 - - gr_costas_loop_cc @@ -1237,37 +1035,6 @@ 0 - - blks2_pfb_arb_resampler_ccf - - id - blks2_pfb_arb_resampler_ccf_0 - - - _enabled - True - - - rate - float(spb)/float(spb_gen) - - - taps - firdes.low_pass(128, 128, 0.45, 0.1) - - - size - 128 - - - _coordinate - (596, 326) - - - _rotation - 0 - - variable @@ -1291,49 +1058,6 @@ 0 - - gr_fll_band_edge_cc - - id - gr_fll_band_edge_cc_0 - - - _enabled - True - - - type - cc - - - samps_per_sym - spb_gen - - - rolloff - rolloff - - - filter_size - 44 - - - alpha - freq_alpha - - - beta - freq_beta - - - _coordinate - (429, 543) - - - _rotation - 0 - - notebook @@ -1547,49 +1271,10 @@ - gr_channel_model + virtual_sink id - gr_channel_model_0 - - - _enabled - True - - - noise_voltage - noise_amp - - - freq_offset - freq_offset - - - epsilon - interpratio - - - taps - 1.0 - - - seed - 42 - - - _coordinate - (60, 443) - - - _rotation - 0 - - - - virtual_sink - - id - virtual_sink_0 + virtual_sink_0 _enabled @@ -1688,7 +1373,248 @@ _coordinate - (655, 686) + (663, 687) + + + _rotation + 0 + + + + gr_pfb_clock_sync_xxx + + id + gr_pfb_clock_sync_xxx_0 + + + _enabled + True + + + type + ccf + + + sps + spb + + + alpha + time_alpha + + + beta + time_beta + + + taps + rrctaps + + + filter_size + nfilts + + + init_phase + 16 + + + max_dev + 1.5 + + + _coordinate + (662, 527) + + + _rotation + 0 + + + + gr_float_to_complex + + id + gr_float_to_complex_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (592, 184) + + + _rotation + 0 + + + + gr_channel_model + + id + gr_channel_model_0 + + + _enabled + True + + + noise_voltage + noise_amp + + + freq_offset + freq_offset + + + epsilon + interpratio + + + taps + 1.0 + + + seed + 42 + + + _coordinate + (60, 443) + + + _rotation + 0 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx_0 + + + _enabled + True + + + type + complex + + + const + sig_amp + + + vlen + 1 + + + _coordinate + (670, 322) + + + _rotation + 0 + + + + blks2_pfb_arb_resampler_ccf + + id + blks2_pfb_arb_resampler_ccf_0 + + + _enabled + True + + + rate + spb + + + taps + firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32) + + + size + 32 + + + _coordinate + (778, 180) + + + _rotation + 0 + + + + gr_fll_band_edge_cc + + id + gr_fll_band_edge_cc_0 + + + _enabled + True + + + type + cc + + + samps_per_sym + spb + + + rolloff + rolloff + + + filter_size + 44 + + + alpha + freq_alpha + + + beta + freq_beta + + + _coordinate + (429, 528) + + + _rotation + 0 + + + + variable + + id + spb + + + _enabled + True + + + value + 4.0 + + + _coordinate + (40, 829) _rotation @@ -1719,12 +1645,6 @@ 0 0 - - blks2_pfb_arb_resampler_ccf_0 - gr_channel_model_0 - 0 - 0 - gr_channel_model_0 gr_throttle_0 @@ -1743,24 +1663,6 @@ 0 1 - - gr_float_to_complex_0 - root_raised_cosine_filter_0 - 0 - 0 - - - root_raised_cosine_filter_0 - gr_multiply_const_vxx_0 - 0 - 0 - - - gr_multiply_const_vxx_0 - blks2_pfb_arb_resampler_ccf_0 - 0 - 0 - gr_uchar_to_float_0 gr_add_xx_0 @@ -1821,4 +1723,22 @@ 0 0 + + gr_float_to_complex_0 + blks2_pfb_arb_resampler_ccf_0 + 0 + 0 + + + blks2_pfb_arb_resampler_ccf_0 + gr_multiply_const_vxx_0 + 0 + 0 + + + gr_multiply_const_vxx_0 + gr_channel_model_0 + 0 + 0 + -- cgit From cafa42f500337c3b4b9d54b8af1c9101727267b9 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 1 Feb 2010 18:59:56 -0500 Subject: Minor adjustments to FLL example --- gnuradio-examples/grc/demod/digital_freq_lock.grc | 80 +++++++++++------------ 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/grc/demod/digital_freq_lock.grc b/gnuradio-examples/grc/demod/digital_freq_lock.grc index a7324a070..37ee8123e 100644 --- a/gnuradio-examples/grc/demod/digital_freq_lock.grc +++ b/gnuradio-examples/grc/demod/digital_freq_lock.grc @@ -1,6 +1,6 @@ - Tue Dec 15 22:45:39 2009 + Fri Jan 29 18:10:00 2010 options @@ -910,45 +910,6 @@ 0 - - gr_channel_model - - id - gr_channel_model_0 - - - _enabled - True - - - noise_voltage - noise_amp - - - freq_offset - freq_offset - - - epsilon - 1.0 - - - taps - 1.0 - - - seed - 42 - - - _coordinate - (346, 491) - - - _rotation - 0 - - variable @@ -1222,6 +1183,45 @@ 0 + + gr_channel_model + + id + gr_channel_model_0 + + + _enabled + True + + + noise_voltage + noise_amp + + + freq_offset + freq_offset + + + epsilon + 1.0 + + + taps + 1.0 + + + seed + 42 + + + _coordinate + (618, 376) + + + _rotation + 0 + + random_source_x_0 gr_uchar_to_float_0 -- cgit From 83369a926b2b23280ac4709335b0115f4c145602 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 1 Feb 2010 19:05:43 -0500 Subject: Changing Makefile so the new PAM examples are installed --- gnuradio-examples/grc/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnuradio-examples') diff --git a/gnuradio-examples/grc/Makefile.am b/gnuradio-examples/grc/Makefile.am index f8a26bace..118ecd593 100644 --- a/gnuradio-examples/grc/Makefile.am +++ b/gnuradio-examples/grc/Makefile.am @@ -31,7 +31,9 @@ dist_audiodata_DATA = \ demoddatadir = $(grc_examples_prefix)/demod dist_demoddata_DATA = \ demod/mpsk_demod.grc \ - demod/pam_timing.grc + demod/pam_timing.grc \ + demod/pam_sync.grc \ + demod/digital_freq_lock.grc simpledatadir = $(grc_examples_prefix)/simple dist_simpledata_DATA = \ -- cgit