On Thu, Mar 24, 2011 at 6:29 AM, Patrik Eliardsson <[email protected]
> wrote:

> Hi,
>
> I've tried the new stream tags and like them, but when I've a block in my
> flowgraph that change the stream rate I'm not sure how the absolute sample
> number is calculated.
>
> Consider the flowgraph below where B0, B1 and B4 are gr_sync_block and B2
> is a gr_block that increases the stream rate in the flowgraph.
> B0 -> B1 -> B2 -> B4
>
> If I set tags on sample 0 and 200 in block B0 and check the tags in block
> B1 everything is correct, I find them at sample 0 and 200. But if I check
> the tags in block B4 I find them at 0 and 400 while I expected to find them
> on 0 at 527. The B2 block consumes 200 samples and produces 527 samples,
> this is a rate of 2.635 and the tag absolute sample number is increased by a
> ratio of 2. How is the absolute sample number calculated?
>


Patrik, glad you've gotten into using the stream tags. To answer your
question, the sample numbers are changed based on the relative rate you set
for your block. When you use a gr_sync_decimator with a decimation rate of
D, the relative_rate of that block is set in the constructor to be
1.0/(float)D. Likewise, when using a gr_sync_interpolator, the relative rate
is set to (float)I.

When a stream tag is passed between blocks, the schedule looks at the
relative rate, and if it is not 1.0, it will adjust the value by multiplying
by relative_rate.

It strikes me that possible block B2 is having its relative_rate set
incorrectly. It could be a casting problem that has truncated the math to 2
instead of 2.635. You can ask a block it's rate with relative_rate() to see
what it thinks its rate is.


> I found that it is possible to change the policy of how the tags propagate
> between blocks. My default setting was TPP_ALL_TO_ALL. When I changed it to
> TPP_ONE_TO_ONE I got the following error "gr_block_executor:
> propagation_policy 'ONE_TO_ONE' requires ninputs == noutputs", I tested it
> on the flowgraph above. With the TPP_ONE_TO_ONE policy, shouldn't the tags
> only propagate from B0 to B1?
>

Yes, you are correct in how it should work, so I can't say why it is
failing. Basically, if you have a graph with a single path, then
TPP_ALL_TO_ALL should function the same as TPP_ONE_TO_ONE. The differences
occur when you have multiply inputs and multiply outputs. For example, a
block with 1 in and 2 outs will not work with TPP_ONE_TO_ONE, but with
TPP_ALL_TO_ALL, all tags appearing on input(0) will be sent to output(0) and
output(1).

The TPP_ONE_TO_ONE says that if you have 2 inputs and 2 outputs, then tags
flow:
input(0) --> output(0)
input(1) --> output(1)

While the TPP_ALL_TO_ALL would send this:
input(0) --> output(0)
input(0) --> output(1)
input(1) --> output(0)
input(1) --> output(1)

We have code that checks both cases out, but either something is wrong or
not obvious in your case. If you can provide more details about what you are
doing, we can work to track this down.


BR,
> Patrik Eliardsson


Thanks!
Tom
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to