Dear Marcus,

Thanks for pointing out, I've corrected it to std::max.
It still doesn't seem to produce correct output when the d_iFactor changes
on the fly.

BTW this flow graph consists of other built-in blocks like Low Pass Filter,
Signal Source etc, whose outputs also depends on the instantaneous Sample
Rate (samp_rate). If one of these built-in blocks doesn't work well when
samp_rate changes on the fly, then that could cause the flow graph to
produce wrong result too.

My main concern is whether set_output_multiple() and
set_min_noutput_items() works on the fly in general.
As your answer is yes to both, then I think that is good enough for this
thread.

The general_work() is called repeatedly and problematically only if it
return 0 and consume 0.  With the set_min_noutput_items() works on the fly,
this problem doesn't happen anymore.  Now the problem is the incorrect
output when the d_iFactor changes on the fly.

Meanwhile, as you had advised, I had tried to see the parameters that
forecast() and general_work() are called with. Refer below verbose message.
When the flow chart started, the initial values are samp_rate=32k,
change_rate=64; hence d_iFactor = 32k/64 = 500.
At line 24 the samp_rate is changed to 64k on the fly by the user. So now
d_iFactor = 64k/64 = 1000.
Every parameters and return values seem to be correct, but the flow graph
output becomes wrong after line 24.

1  forecast():  ninput_items_required[0] is set to 16   while noutput_items
is 8000 ,  d_iFactor is 500
2   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
3  forecast():  ninput_items_required[0] is set to 16   while noutput_items
is 8000 ,  d_iFactor is 500
4   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
5  forecast():  ninput_items_required[0] is set to 16   while noutput_items
is 8000 ,  d_iFactor is 500
6   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
7  forecast():  ninput_items_required[0] is set to 16   while noutput_items
is 8000 ,  d_iFactor is 500
8   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
9  forecast():  ninput_items_required[0] is set to 16   while noutput_items
is 8000 ,  d_iFactor is 500
10   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
11  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
12   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
13  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
14   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
15  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
16   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
17  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
18   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
19  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
20   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
21  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
22   general_work():  consumed 16 at port 0,  noutput_items is 8000 ,
d_iFactor is 500
23  forecast():  ninput_items_required[0] is set to 16   while
noutput_items is 8000 ,  d_iFactor is 500
24   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
25  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
26   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
27  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
28   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
29  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
30   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
31  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
32  forecast():  ninput_items_required[0] is set to 4   while noutput_items
is 4000 ,  d_iFactor is 1000
33  forecast():  ninput_items_required[0] is set to 2   while noutput_items
is 2000 ,  d_iFactor is 1000
34  forecast():  ninput_items_required[0] is set to 1   while noutput_items
is 1000 ,  d_iFactor is 1000
35  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
36  forecast():  ninput_items_required[0] is set to 4   while noutput_items
is 4000 ,  d_iFactor is 1000
37  forecast():  ninput_items_required[0] is set to 2   while noutput_items
is 2000 ,  d_iFactor is 1000
38  forecast():  ninput_items_required[0] is set to 1   while noutput_items
is 1000 ,  d_iFactor is 1000
39  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
40   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
41  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
42   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
43  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
44   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
45  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
46   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
47  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
48   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
49  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
50   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
51  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
52   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
53  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
54   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
55  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
56   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
57  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
58   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
59  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
60   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
61  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
62   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
63  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
64   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
65  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
66   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
67  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
68   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
69  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
70   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
71  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
72   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
73  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
74   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
75  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000
76   general_work():  consumed 8 at port 0,  noutput_items is 8000 ,
d_iFactor is 1000
77  forecast():  ninput_items_required[0] is set to 8   while noutput_items
is 8000 ,  d_iFactor is 1000

>>> Done


On Sat, Mar 8, 2014 at 7:43 PM, Marcus Müller <mar...@hostalia.de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Activecat,
>
> your std::min should be a std::max :) would you try with that?
>
> On 08.03.2014 12:30, Activecat wrote:
>
> > BTW I thought it is redundant to do this change, because as long
> > as set_min_noutput_items(d_iFactor) works on the fly, the scheduler
> > will not ask for less than iFactor samples. Correct..?
> Yes, in that case the block_executor iteration should return the magic
> value "BLKD_OUT", which will tell the thread scheduler to sleep until
> there is more output space available. (refer to min_available_space, l.70)
> However, what you're seeing is a repeated call of your work, so
> *something* goes wrong here :/
> What you could try is do some output of the parameters that forecast
> and work are called with, and what they returned.
> Otherwise, I'm kind of at the end of my ideas how to pinpoint the
> problem...
>
> Greetings,
> Marcus
>
> >
> > Regards, Activecat
> >
> >
> >
> > On Sat, Mar 8, 2014 at 5:41 PM, Marcus Müller <mar...@hostalia.de>
> > wrote:
> >
> >> Hi activecat, The scheduler might be confused if he asked for
> >> less than iFactor samples, because then your forecast tells him
> >> you need 0 input to produce that... The joys of Integer division
> >> Can you modify it so that it always demands at least 1 input?
> >>
> >> -- Sent from my Android device with K-9 Mail. Please excuse my
> >> brevity.
> >
> >
> >
> > _______________________________________________ Discuss-gnuradio
> > mailing list Discuss-gnuradio@gnu.org
> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJTGwJWAAoJEBQ6EdjyzlHtaEUIAIU/xwUUg4dUfzpv3cvCBTyM
> gT8u9uMw/9vFRXsDRnj/QZvlgkc2EtW1vwyVrjgh165Jm9Vl8AY9SIKlPryOfFMK
> 7fg8G5hNuXm8wIIL2iCj15Kom9qp+Gh9YK8ULD/ElHh/z2zkSTftsp647DbNcget
> miKrjPfEIkN6JQdz5xpEWUvgblGjHUKclI100A2kGajPAcY7YWZczAZ0LxIy/rKZ
> CjOpRsHRgIa/hd1WvC5PiaqtFJxoyGHK3weFgPZAAi6IYL2rH5LSmrFTeGQrYgYH
> CvXEq8GjbPLwUEv8ubyUWNv95h0fvDJUhMchVUY17v/ZnHdZqE8Bkd6VNELZO3c=
> =GUvF
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> 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