On Wed, Jun 4, 2014 at 2:22 PM, xianda <wangxianda920...@163.com> wrote:
> Hi all: > I want to know something about the forecast(). > I have already known that forcast() can tell scheduler how many > input items are required for each output item. > 1.But now i have read two example: > The first one: > void your_block::forecast(int > noutput_items,gr_vector_int &ninput_items_required){ > > ninput_items_required[0]=100 * > noutput_items; > ninput_items_required[1]=100 * > noutput_items; } > > In your first example above, you have exactly two input ports. That's why you need to specify "ninput_items_required[0]" and "ninput_items_required[1]", there are in total 2 ports. In fact in this example the value of "ninput_items_required.size()" is 2. In alternative, you could also replace above two lines with: for (unsigned i=0; i < 2; i++) ninput_items_required[i] = 100 * noutput_items; Or, to be more generic, you could also use this: for (unsigned i=0; i < ninput_items_required.size(); i++) ninput_items_required[i] = 100 * noutput_items; > > 2.I want to know if we use the general_work().Is it means that > we must use the forcast()?Thanks. > Best regards > > If you use "general" block, you need to specify "forecast()". "General" block has "general_work()" function but not "general()" function. If you use sync block, decim, interpolation block etc, you have "work()" but not "general_work()", and you don't need to write "forecast()". This is very straight-forward.
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio