discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How to call another blocks in custom out-of-tree


From: address@hidden
Subject: Re: [Discuss-gnuradio] How to call another blocks in custom out-of-tree module
Date: Wed, 6 Nov 2013 11:55:00 +0000

Thank you for your concern.

I will tell you more detail about my problem.

 

I'm trying to make frequency hopping system.

It start from some source like a file or UDP message,

And data is fragmented and encoded to a frame(for example 60bit per frame)

Every frame will use different frequency band.

Between transition, there is a ramp up and ramp down for 2bit time.

 

So I break it down to 3 block.

      Main Block   : master block

       Sub Tx Block : make frame, call Hopper Block, and make ramp-up/ramp-down shaping

      Sub_tx_hopper : pulse shape, frequency modulation, hopping

 

[Main Blcok]

When this work, waterfall sink will show frequency hopping result.

Finally waterfall sink will be replaced with URSP-sink.

   [ File Source ]-–-[ Throttle ]----[ Sub Tx Block ]----[ QT GUI Waterfall Sink ]

 

[Sub Tx Block] : python code

Sub Tx block is my own code based on to Out-Of-Tree document (Python version)

In this block, it decide hopping frequency, set frequency and then trying to call another hopping hier-block.

class sub_tx(gr.interp_block):

    def __init__(self, ndata=60, ndumm=2):

        gr.interp_block.__init__(

            self, name = "sub_tx",

            in_sig = [numpy.float32],

            out_sig = [numpy.complex64],

            interp=10)  

        #

        self.hopper = sub_tx_hopper(bit_rate=20000, hop_freq=0, sps=10, tail=10)

        self.set_output_multiple(10*62) # 10(interpolation), 62=60bit+2bit…

 

    def work(self, input_items, output_items):

        # set hop freq

        self.hopper.set_hop_freq(self.hop_num)

        # make input data with 10 zero, because pulse shaping FIR filter is 10symbols long

       new_Input_items = input_items + ([0]*10) # ç I didn’t tested yet

 

       # call sub_tx_hopper

       How to call  # <========================= HELP HERE ======

 

       # ramp-up/ramp-down

       Do some how 

       Ramp_start_index = 4*10

       Ramp_end_index = (62)*10 + Ramp_start_index

 

       # copy output to real-output

       Output_items = result[ ramp_start_index : ramp_down_index] ç I didn’t tested yet

 

 

[sub_tx_hopper Block]

I made some hopping module using GRC(named sub_tx_hopper). // Hier_Block

  [ Pad Source ]----[ Interpolation FIR Filter ]----[ Frequency Mod ]----[ Frequency Xlating FIR Filter ]----[ Pad Sink ]

 

 

 

 

-----Original Message-----
From: discuss-gnuradio-bounces+address@hidden [mailto:discuss-gnuradio-bounces+address@hidden On Behalf Of Martin Braun (CEL)
Sent: Tuesday, November 05, 2013 10:11 PM
To: address@hidden
Subject: Re: [Discuss-gnuradio] How to call another blocks in custom out-of-tree module

 

On Tue, Nov 05, 2013 at 12:56:24PM +0000, address@hidden wrote:

> I want to call another gnu-blocks (or another hier-block) in work function.

> (Line 14~16)

>

> 1)     How to connect input item to another block’s input

>

> 2)     How to connect local array to another block’s output

 

In GNU Radio's 'block' terminology, you will *never* call another block from within one block's work function. You always connect the output of one block the input of the next.

 

What exactly are you trying to do? Are you simply trying to outsource some signal processing code out of your block?

We do this quite a lot, but then the object we call from the work function is not a GNU Radio block, but rather a generic object. Of course, you can include any Python module or object into your own Python blocks.

 

Or are you trying to call another, existing GNU Radio block? In this case, you might want to think about splitting your block up such that you can connect your block and existing blocks through the regular mechanism (i.e. top_block.connect()).

 

> Please help me.

>

> Actually I need to make my own sub block.

>

> But I need gnuradio blocks during processing my own block.

 

Perhaps a hier block will solve your problem?

 

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]