discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Understanding tags_demo.cc example in gr-uhd


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Understanding tags_demo.cc example in gr-uhd
Date: Sat, 23 Jul 2016 12:02:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

Stressing "average rate"! In GNU Radio, samples are processed in as much
space there's output buffer and/or how many samples a block wants to
consume or produce at once.

In the case of throttle, a single call to its work() method takes all
the input there is (let's say it's 8000 samples in this round; the value
depends on how the flow graph operates, and can and will change from
iteration to iteration!), copies it to the output buffer (the sync_block
idiom in GNU Radio ensures that there's always at least as much output
space available as input, so the min(input available, output space
available) is handed to the work() function), and then  just waits as
long as it needs to wait: simply n_samples_copied * sampling_rate. That
means that if you set the sampling rate to 1, the throttle will block
execution for 8000s, and then the downstream block will be informed that
there are 8000 new items to be processed. A common misconception is that
setting a sampling rate would make throttle emit 1 sample every
1/sampling rate, which is not the case.

This, by the way, is the reason why it's *always* bad to have a throttle
block connected to some hardware sink, even if the hardware sink's
sampling rate is lower than the throttle's rate; the "chunky" nature of
passing samples makes it likely that the samples simply don't reach the
hardware sink in time.

Best regards,

Marcus


On 23.07.2016 03:51, Martin Braun wrote:
> On 07/22/2016 04:38 PM, Lakshay Narula wrote:
>> Thanks Martin, that was exactly what I was looking for. 
>>
>> Would the following statement be correct: the GNU Radio flowgraph always
>> produces samples as fast as the CPU can (irrespective of the set sample
>> rate or throttle), and stops producing whenever the USRP sink buffer is
>> full.
> Yup.
>
>> Also, does the throttle block work in a similar fashion?
> That block blocks work() such that the average rate through it is what
> it's set to to.
>
> M
>> Thanks again,
>> Lakshay.
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




reply via email to

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