discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Problems writing an OOT block


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] Problems writing an OOT block
Date: Fri, 17 May 2019 10:08:49 -0400
User-agent: Cyrus-JMAP/3.1.6-549-ge400f56-fmstable-20190516v3

Hi mehtap - You can certainly do what you're asking for, but I'd wonder if there isn't a better algorithm to do whatever it is you require. Here are my thoughts based on personal experience implementing something like what you're trying to do (and, thus, why I ask whether there might be a better algorithm).

I'd say to inherit from "gr::block" and then yes you'll need to implement "forecast" to get things going. If you implement using the "naive" approach (literally just what you wrote), what you'll find is that you'll end up with virtually all "1"s (for when no input), and very little "inverse of the input". Throttling will be required either within your block or external and immediately downstream, to keep the "1"s from totally saturation the rest of the flowgraph.

The more clever approach is to add a settable parameter for how many "1"s to produce during any specific all to "work"  when there is no input; this value will of course maximally be whatever actual output buffer space allows. This parameter is for how often to look at the inputs to see if there's anything there: the smaller the number, the more often checked and the more CPU time spent looping through this cycle (and, related, the lower the possible data throughput through the block); the higher the number the less often checked & the less CPU time spent looping (and, related, the higher the possible data throughput through the block). This parameter should generally be about 1/10 of the nominal sample rate of the data expected downstream, excepting of course when 1/10 is way above the output buffer size -- in which case increase the output buffer size && decrease this value of this parameter as a "happy medium".

If you insist on going this route, give the above a try & then if you need more assistance provide us with a public repo we can view to see and test your actual code.

Hope this is useful! - MLD

On Fri, May 17, 2019, at 12:20 AM, mehtap özkan wrote:
Dear All,
 I want to write ablock where:
The output is the the Inverse of the input,
The output is "1" if there is no input.(It acts like a source)

I am confused how to implement the part where the Block behaves like a Source.
In one mode you need an Input to produce an output (ninput_items_required=1)
and in one mode you need no Input to produce an output (ninput_items_required=0) .
I have looked at the forecast() function where the "relationship between noutput_items and the requirements for each input stream" is defined.
Also I could not figure out how the next block requests samples from the curent block.
Can anybody help?
_______________________________________________
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]