Search code examples
gnuradiognuradio-companion

Why doesn't throttled file source data display in GUI time sink for GNU radio?


I have a flow graph with a file source (with repeat off) and a GUI Time Sink. The graph is throttled by a throttle block at 2 samples / sec. I expect to see two new samples in my GUI Time Sink every second. However, instead of 1-second updates, the GUI Time Sink doesn't display anything at all. If I turn repeat on on the file source, the GUI Time Sink does update. Why doesn't it update when repeat is off?

My question is similar to this one. In my case, I also have a file source throttled down to a very slow sample rate. However, my sink is a GUI Time Sink, not a file sink--I see no option for an "Unbuffered" parameter on the Time Sink.

My flow graph Flow graph

Repeat off

Repeat off

Repeat On

enter image description here


Solution

  • This is actually multiple problems in one:

    1. You're assuming the time sink will show two new values when they come in. That's not true: it will only update the display when it has (at least) as many new items as you configured it to show in number of points.
    2. You're assuming GNU Radio will happily read single items (or two) at a time. Typically, that is not the case: it will ask the file source for as many items as there is space in the output buffer, something like 8192 (not fixed). And typically,
    3. Throttle doesn't work like you think. It takes the number of input samples it gets in each call to its work function (e.g. 8192) and divides that number by the throttle rate you set and then just blocks for that amount of seconds. Throttle regulates the average rate, on a longer time scale, or in your really minimal rate case, a very long time scale.

    You can limit the number of items in an output buffer, but not below a page size (4kB); for complexes that is 1024 items at least.

    I think the classical graphical GNU Radio sinks might just not be the right thing to analyze files sample-by-sample.

    I recommend trying the example flow graphs that come with Tim O'Shea's gr-pyqt. They are very handy for this kind of analysis.