discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Enabling a block during runtime?


From: Kevin Reid
Subject: Re: [Discuss-gnuradio] Enabling a block during runtime?
Date: Fri, 9 Aug 2019 18:04:35 -0700

On Fri, Aug 9, 2019 at 3:38 PM Vladimir Marinov <address@hidden> wrote:
I wanted to make the option of running the software without the SDR plugged into the computer, for testing purposes, … My plan was to have the SDR Sink Block inside the GRC file but disabled, and have the button enable it during runtime after the testing has been done and the SDR is plugged in. 

After some research though I have the impression that this is impossible to do. Am I missing something? Is there a way to enable a block after the program has been started, with a button for example?

When you generate code using GNU Radio Companion, the set of blocks instantiated is fixed. In order to choose whether or not to instantiate a block, you need to write your own Python (or C++) code. You can take the GRC generated Python code and use it as a starting point to customize. Or, you can write a "hierarchical block" in Python which presents itself as a sink and internally sets up the real sink block, and use that custom block within your GRC flow graph (this way you can still use GRC to modify the overall structure).

With either approach, a caveat is that some GNU Radio blocks (mostly sources and sinks) don't react well to re-configuration of the flow graph — it's not a commonly-used and well-tested feature. If all you are doing is introducing a new hardware sink where previously you had a throttle+null sink, this should not be a problem.

Another possibility for your specific application is to arrange so that the sink block is created, but you transmit nothing, because your signal goes through "Multiply Const" by zero before it goes to the sink. Then change the multiplication factor to actually start transmitting. There will likely be some amount of RF emitted anyway, depending on the hardware, but it may be acceptable. The advantage of this approach is that you've connected everything and the samples are flowing exactly as normal (except that they're zeroed out) so that enabling the transmission is as little disruptive it can be.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]