discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] question about data types while creating blocks


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] question about data types while creating blocks
Date: Sun, 07 Jun 2015 10:54:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hi David,
> I'm trying to create a new block, which one of its output variables is
> string. 

to be honest, processing strings does sound more like a message passing
instead of a sample streaming kind of thing.
But:
> This output is a vector of size 8, each with three characters:
aha! Your strings aren't the typical, variable length string! their
8-tuples of 3-tuples of characters!
Basically, what you want seems to be a block that emits bytes, in
multiples of 24.
There's two ways to achieve that: you can either define the io_signature
of the block to let the item size be 1 byte (==sizeof(char), and then
use set_output_multiple(24), or you can have an io_signature with an
item size of 24.

But: I don't think you're giving us the whole picture, considering your
example strings look all very specific. Maybe you want to explain a bit
of what your block should do?

> Also, i would like to know if i can transmit a double variable using the
> float type output.
No. But you can still have a block outputting doubles!

To explain: GNU Radio doesn't actually care about what kind of data you
put into your block's output items. It just needs to know how big (in
bytes) each item is. Floats are 4 byte long, doubles (well...) 8 bytes.
Hence, a double is worth two float output items.
You can just set the io_signature of your block to sizeof(double)
instead of (float) and GNU Radio will know that you want to exchange 8
byte items instead of4 byte items.

However, there's a reason you don't see the double type being used very
often in GNU Radio: SNR and dynamic range of the systems described are
seldom limited by the single precision floating point's numerical
accuracy, and so almost all things just work on floats. Again: Maybe you
have some insight in what you want to do, that you might want to share?

Best regards,
Marcus


On 06/07/2015 08:42 AM, dcardona wrote:
> Hello
>
> I'm trying to create a new block, which one of its output variables is
> string. I would like to know if that it's possible or if i should convert it
> to a integer type.
> This output is a vector of size 8, each with three characters:
> v[1] = '222'
> v[2] ='223'
> v[3] ='232'
> v[4] ='233'
> v[5] ='333'
> v[6] ='322'
> v[7] ='323'
> v[8] ='332'
>
> Also, i would like to know if i can transmit a double variable using the
> float type output.
>
> Thank you
> David.
>
>
>
> --
> View this message in context: 
> http://gnuradio.4.n7.nabble.com/question-about-data-types-while-creating-blocks-tp54075.html
> Sent from the GnuRadio mailing list archive at Nabble.com.
>
> _______________________________________________
> 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]