On 03/21/2013 03:45 PM, Manu T S wrote:
I'm trying to make a block for fading channel model using hierarchical block.


class channel(gr.hier_block2):
    def __init__(self):
        gr.hier_block2.__init__(self, "channel",
                gr.io_signature(1, 1, gr.sizeof_float),
                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.taps = generate_taps()
        self.filt = filter.fir_filter_ccc(1, self.taps)
        self.connect(self, self.filt, self)

    def generate_taps():
        n_taps = random.randint(1, 10)
        r_taps = random.rand(n_taps)
        i_taps = random.rand(n_taps)
        return r_taps + 1j*i_taps


I want the block to be able to update the channel filter taps in run time. Can I do that? Can I define a function in the class so that the filter taps are updated for every 5 seconds?

The set_taps function gives you access to this from the top_block level. In that case, your main thread would be updating the block's taps using a while loop with sleep(5). You could also make a block class that inherits from fir_filter_ccc or channel_model and change the taps within the work function every N seconds: every time (ninput_items / samp_rate) % N == 0. I hope that's enough info to point you in the right direction.
Thank you.

--
Manu T S


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


------------------------------

*Sean M. Nowlan*
Research Engineer I
ICL/CNSD
Georgia Tech Research Institute
250 14th St NW, Suite 470
Atlanta, GA 30318

404.407.7952
sean.now...@gtri.gatech.edu
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to