Dear Kevin,
Thank you for your response. Here are the answers to the questions you
asked.
Does it happen if you only stop and start the flow graph without actually
changing any connections? Yes. It still gives the same error when only stop
and start the flow graph. When I do the reconfiguration without stop and
start I do not get any error. However, I do not see any reconfigured
parameters applied(i.e., it still runs with the previous configuration)
Does it happen if you lock(), change, unlock() — instead of stop(), change,
start()? Yes, still get the same error
Does it happen if you do some reconfiguration but less than your
application actually needs — e.g. replace a block with a newly-constructed
identical block (should have no effect)? Yes, even for simpler applications
that use tag streams. (I have used the [stop--> change block --> start]
and [lock --> change parameter --> unlock] without any error before I
introduce OFDM blocks and tagged streams. I started to get the error after
introducing OFDM block and tagged streams.
Herewith I have attached a flow graph where I simply try to lock the flow
graph print a statement and unlock it. I still get the same error. To run
please change the file name in the file source block and run the python
file.
If you can help me to figure the problem I really appreciate it.
Best regards,
Damindra
On Sat, Dec 24, 2016 at 10:35 AM, Kevin Reid <[email protected]> wrote:
> On Sat, Dec 24, 2016 at 9:46 AM, Damindra Bandara <
> [email protected]> wrote:
>>
>> Also, I get the error only when I try to reconfigure a flow graph. Could
>> you please let me know the correct way to reconfigure a flow graph when
>> they are using tags.
>>
>
> Both reconfiguration and tags are lesser-used features (reconfiguration
> even less), and based on my experience with reconfiguration, there might
> well be a bug in a particular block's interaction with reconfiguration. I
> would suggest taking a troubleshooting/debugging approach to finding out
> what is sufficient to cause the problem:
>
> - Does it happen if you only stop and start the flow graph without
> actually changing any connections?
>
> - Does it happen if you lock(), change, unlock() — instead of stop(),
> change, start()?
>
> - Does it happen if you do some reconfiguration but less than your
> application actually needs — e.g. replace a block with a newly-constructed
> identical block (should have no effect)?
>
> It would be great if (if there actually is a bug here) you can narrow it
> down to a simple example and file a bug report.
>
> I might be able to help with the narrowing down if you have some
> reasonably-sized Python/GRC code you could share, as I've gone through this
> process several times. (I develop a reconfiguration-heavy application.)
>
--
Damindra Savithri Bandara,
Ph.D. in Information Technology (Candidate)
George Mason University,
Fairfax,
Virginia
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Test1
# Generated: Sat Dec 24 13:33:36 2016
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from PyQt4 import Qt
from gnuradio import blocks
from gnuradio import digital
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import qtgui
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import sip
import sys
import time
class test1(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Test1")
Qt.QWidget.__init__(self)
self.setWindowTitle("Test1")
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "test1")
self.restoreGeometry(self.settings.value("geometry").toByteArray())
##################################################
# Variables
##################################################
self.tx_gain1 = tx_gain1 = 20
self.tx_freq1 = tx_freq1 = 900000000
self.sync_word2 = sync_word2 = [0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0]
self.sync_word1 = sync_word1 = [0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0.]
self.samp_rate = samp_rate = 32000
self.pilot_symbols = pilot_symbols = ((1, 1, 1, -1,),)
self.pilot_carriers = pilot_carriers = ((-21, -7, 7, 21,),)
self.packet_len = packet_len = 160
self.occupied_carriers = occupied_carriers = (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27),)
self.len_tag_key = len_tag_key = "packet_len"
self.fft_len = fft_len = 64
##################################################
# Blocks
##################################################
self.usrp_sink = uhd.usrp_sink(
",".join(("", "")),
uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.usrp_sink.set_samp_rate(samp_rate)
self.usrp_sink.set_center_freq(tx_freq1, 0)
self.usrp_sink.set_gain(tx_gain1, 0)
self.tagged_stream1 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, packet_len, len_tag_key)
self.qtgui_const_sink1 = qtgui.const_sink_c(
1024, #size
"TX1 constellation", #name
1 #number of inputs
)
self.qtgui_const_sink1.set_update_time(0.10)
self.qtgui_const_sink1.set_y_axis(-2, 2)
self.qtgui_const_sink1.set_x_axis(-2, 2)
self.qtgui_const_sink1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
self.qtgui_const_sink1.enable_autoscale(False)
self.qtgui_const_sink1.enable_grid(False)
self.qtgui_const_sink1.enable_axis_labels(True)
if not True:
self.qtgui_const_sink1.disable_legend()
labels = ['', '', '', '', '',
'', '', '', '', '']
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "red", "red", "red",
"red", "red", "red", "red", "red"]
styles = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0]
markers = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0]
alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0]
for i in xrange(1):
if len(labels[i]) == 0:
self.qtgui_const_sink1.set_line_label(i, "Data {0}".format(i))
else:
self.qtgui_const_sink1.set_line_label(i, labels[i])
self.qtgui_const_sink1.set_line_width(i, widths[i])
self.qtgui_const_sink1.set_line_color(i, colors[i])
self.qtgui_const_sink1.set_line_style(i, styles[i])
self.qtgui_const_sink1.set_line_marker(i, markers[i])
self.qtgui_const_sink1.set_line_alpha(i, alphas[i])
self._qtgui_const_sink1_win = sip.wrapinstance(self.qtgui_const_sink1.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_const_sink1_win)
self.ofdm_tx1 = digital.ofdm_tx(
fft_len=fft_len, cp_len=fft_len/4,
packet_length_tag_key=len_tag_key,
occupied_carriers=occupied_carriers,
pilot_carriers=pilot_carriers,
pilot_symbols=pilot_symbols,
sync_word1=sync_word1,
sync_word2=sync_word2,
bps_header=1,
bps_payload=1,
rolloff=0,
debug_log=False,
scramble_bits=True
)
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/radio/Desktop/top_block.py', True)
##################################################
# Connections
##################################################
self.connect((self.blocks_file_source_0, 0), (self.tagged_stream1, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.usrp_sink, 0))
self.connect((self.ofdm_tx1, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.ofdm_tx1, 1), (self.qtgui_const_sink1, 0))
self.connect((self.tagged_stream1, 0), (self.ofdm_tx1, 0))
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "test1")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
def get_tx_gain1(self):
return self.tx_gain1
def set_tx_gain1(self, tx_gain1):
self.tx_gain1 = tx_gain1
self.usrp_sink.set_gain(self.tx_gain1, 0)
def get_tx_freq1(self):
return self.tx_freq1
def set_tx_freq1(self, tx_freq1):
self.tx_freq1 = tx_freq1
self.usrp_sink.set_center_freq(self.tx_freq1, 0)
def get_sync_word2(self):
return self.sync_word2
def set_sync_word2(self, sync_word2):
self.sync_word2 = sync_word2
def get_sync_word1(self):
return self.sync_word1
def set_sync_word1(self, sync_word1):
self.sync_word1 = sync_word1
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.usrp_sink.set_samp_rate(self.samp_rate)
def get_pilot_symbols(self):
return self.pilot_symbols
def set_pilot_symbols(self, pilot_symbols):
self.pilot_symbols = pilot_symbols
def get_pilot_carriers(self):
return self.pilot_carriers
def set_pilot_carriers(self, pilot_carriers):
self.pilot_carriers = pilot_carriers
def get_packet_len(self):
return self.packet_len
def set_packet_len(self, packet_len):
self.packet_len = packet_len
self.tagged_stream1.set_packet_len(self.packet_len)
self.tagged_stream1.set_packet_len_pmt(self.packet_len)
def get_occupied_carriers(self):
return self.occupied_carriers
def set_occupied_carriers(self, occupied_carriers):
self.occupied_carriers = occupied_carriers
def get_len_tag_key(self):
return self.len_tag_key
def set_len_tag_key(self, len_tag_key):
self.len_tag_key = len_tag_key
def get_fft_len(self):
return self.fft_len
def set_fft_len(self, fft_len):
self.fft_len = fft_len
def main(top_block_cls=test1, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
for x in range(0, 100):
print "We're on time %d" % (x)
tb.lock()
print "TB stopped"
tb.unlock()
print "TB started"
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
if __name__ == '__main__':
main()
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio