Hi Activecat,

to answer question 1):
grepping for "min_noutput_items" instantly shows that in 
gnuradio-runtime/lib/block_executor.cc line 299, your block's min_noutput_items() is 
called every iteration. If there isn't enough space, the block thread sleeps until there 
is more. So yes, it works on the fly.

I remember there was something with returning 0, and I know that producing 0 
items used to mark a source as done, but this mechanism was commented out about 
a year ago (l. 483ff, I think for some good reason), but I can't remember that 
being an issue for a non-source block; have you tried it and did you run into 
problems?

Greetings,
Marcus


On 03/07/2014 02:26 AM, Activecat wrote:
Dear Sir,

Let me explain the reason of why to use the function: set_min_noutput_items().

I am creating a custom interpolator block.
Says, the interpolation factor is 1000.  Hence it is important to call 
set_output_multiple(1000).

Meanwhile, for this block the interpolation factor depends on Sample Rate 
(samp_rate). In this flow-graph the samp_rate could be changed by the user 
during runtime. This means the interpolation factor may change during runtime, 
and hence we need to call set_output_multile() with different values during 
runtime !

The problem arisen when there is no guarantee that set_output_multiple() will 
work if you change it on the fly.
(Refer http://lists.gnu.org/archive/html/discuss-gnuradio/2010-11/msg00504.html)

The workaround is to use set_min_noutput_items() if it work on the fly.
Says, after changing samp_rate, the new interpolation factor is recalculated as 
800.
If the set_output_multiple(800) doesn't work, the general_work() can still 
consume 1 input and produce 800 output if the noutput_items is at least 800. 
This enables the flow graph continue to work.

If the noutput_items is less than 800, the only correct thing the 
general_work() can do is to consume_each(0) and return 0. This may be 
problematic and can cause unforeseen behavior. So it is important to make sure 
the noutput_items is at least 800.  Hence I call:  set_min_noutput_items(800)

This means we can make use of set_min_noutput_items() as a workaround, if 
set_output_multiple() doesn't change on the fly.

The questions are:
1).  Can we use this to change setting on the fly:  set_min_noutput_items()
2).  Is there any better workaround for this?

Regards,
Activecat







On Thu, Mar 6, 2014 at 11:36 PM, Tom Rondeau <t...@trondeau.com 
<mailto:t...@trondeau.com>> wrote:

    On Thu, Mar 6, 2014 at 2:12 AM, Activecat <active...@gmail.com 
<mailto:active...@gmail.com>> wrote:
    > Dear Sir,
    >
    > In c++ we have:  set_min_noutput_items()
    > What is it equivalent syntax in python ?
    >
    > I try this:
    >   self.set_min_noutput_items()
    >
    > Error message:
    >   AttributeError: 'quadrator_upconverter_python1' object has no attribute
    > 'set_min_noutput_items'
    >
    > Note:
    > The self.set_output_multiple() in python seems accepted, is it functional
    > ..?
    >
    > Regards,
    > Activecat

    Looks like when this feature was added, it didn't make it into the
    block.i swig file. I'll push a patch for this soon.

    But before you try and use this, be very careful. This is an advanced
    issue that's really only meant to be used if you a) really really need
    it and b) really really know what you are doing and why.

    Tom




_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to