discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Dynamically Changing the File Name for the File S


From: Kevin Reid
Subject: Re: [Discuss-gnuradio] Dynamically Changing the File Name for the File Sink
Date: Mon, 5 Sep 2016 06:54:38 -0700

On Sun, Sep 4, 2016 at 11:10 PM, Hasini Abeywickrama <address@hidden> wrote:
I have a flowgraph that users a USRP to receive signal and writes it to a file using a file sink.

I want to start writing to the file and a specific time precisely. I modified the code to start running the flowgraph at a specific time but booting up the USRP and setting up the flowgraph takes time so writing to the file starts considerably late.

Would it be possible to change the file that data is being written dynamically while the flowgraph is running? That way I would be able to start writing to one file and then switch to another file at a specific time. Or is there any other way of doing it?

You can “change the file” by reconfiguring the flow graph (replacing the file sink as you say), but that is not any faster than what I am about to propose:

The slow part of "booting up the USRP" happens when the UHD source block is created, not when the flow graph is started. So what you want to do is delay the start. Assuming the code you're starting with came from GNU Radio Companion, you should see a line that says either “tb.start()” or “tb.run()”. Insert your waiting just before that line.


A way that would be even quicker and smoother than delaying the start would be to start up the flow graph but prevent any output until the right time. You would do this by inserting a Copy (gnuradio.blocks.copy) block with its "enabled" property set to False. Then start the flow graph (which will create the file but not write any data), wait until the right time, and set "enabled" to True.

In order to do this you have to avoid using tb.run() and use tb.start() as that method blocks the calling thread — the sequence would look like this:

tb.start()
...wait until the time is right...
tb.blocks_copy_0.set_enabled(True)
tb.wait()
tb.stop()


Finally, I think there might be ways to tell the USRP to start receiving at a specific time, or write a file which may start sooner but contains timing information so you can truncate it after the fact, but I'm less familiar with USRP-specific programming than GNU Radio in general and can't tell you exactly how to do this.


reply via email to

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