Forum: GNU Radio Constructing a signal processing block

Posted by virgil passas (Guest)
on 2012-12-10 11:24
(Received via mailing list)
Hi all,

I want to create a signal processing block that it will have variable 
number of inputs/outputs AND variable type of inputs/outputs depending 
the needs of the user. (Example1: 3 inputs/ports [complex,double,int] 
and the same outputs/ports. Example2: 4 inputs/ports 
[double,double,short,complex]and the same outputs/ports.) My problems 
are:
  1. How to create an instance of this block with the appropriate size 
(gr.sizeof_double +gr.sizeof_complex is ok?)
  2. In function work() how to define the different type of inputs 
(every time that the block is called the type of inputs will be 
different) before passing them to the function that I want.
  3. How to connect in python two or more blocks to a third block.

Any thoughts?

Thanks in advance,
Virgilios Passas
Posted by Martin Braun (CEL) (Guest)
on 2012-12-10 13:02
(Received via mailing list)
On Mon, Dec 10, 2012 at 10:23:32AM +0000, virgil passas wrote:
> I want to create a signal processing block that it will have variable number of
> inputs/outputs AND variable type of inputs/outputs depending the needs of the
> user. (Example1: 3 inputs/ports [complex,double,int] and the same outputs/
> ports. Example2: 4 inputs/ports [double,double,short,complex]  and the same
> outputs/ports.) My problems are:

OK, to get this straight:
You can have variable number of inputs/outputs (all of what you're
describing is possible), but you CANNOT change that during runtime.

Also, how would you drive this kind of block? The input data type would
have to change, as well.

What *is* quite common is that the block can serve different data types,
which is configured during instantiation. You must have some kind of
check in the constructor, and then pass different io_signatures
depending on your use case.
In the work() function, run the same check again. All the input_items
pointers are void pointers, after all--so you simply cast them to
whatever you set in the constructor.

>  1. How to create an instance of this block with the appropriate size
>     (gr.sizeof_double + gr.sizeof_complex is ok?)

You need to return different io_signatures depending on your config.
Read these:
http://gnuradio.org/doc/doxygen/gr__io__signature_8h.html
http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials

>  2. In function work() how to define the different type of inputs (every time
>     that the block is called the type of inputs will be different) before
>     passing them to the function that I want.

See above.

>  3. How to connect in python two or more blocks to a third block.

This is the same as usual, and is covered in the tutorials.

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.