discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] looping with work() function


From: Sumedha Goyal
Subject: [Discuss-gnuradio] looping with work() function
Date: Tue, 11 Mar 2014 10:40:01 +0530

Hello

I am executing a flowgraph where I pass different parameters to the work() function of my block in every iteration.

1. I would like my flowgraph to execute once with a certain set of parameters and on satisfying a certain condition, it should stop execution (even if the queue/buffer of the block is not empty). 
2. The control should come back to the main() function and the next iteration should start with a new set of parameters and again upon satisfying a certain condition the flowgraph should exit.

The work() function is of the block "test_demo":
############new_test_tx.py#################
class test_demo(gras.Block):
 def__init__(self,parameters):
gras.Block.__init__(self,name="test",
in_sig = [numpy.uint8,numpy.uint8,numpy.uint8],
            out_sig = [numpy.uint8,numpy.uint8])

def work(self, ins, outs):
--some process here

The top_block is as following and has code for all the connections(not shown here):

class top_block(grc_wxgui.top_block_gui):

def __init__(self,options,llr):
grc_wxgui.top_block_gui.__init__(self, title="Top Block")
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

          self.=new_test_tx.test_demo(options.parameters)
def main():

parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
parser.add_option("", "--args",default="",
                 help="set the address of usrp_device [default='']")
        (options, args) = parser.parse_args ()
# build the graph
tb=top_block(options,param)
        tb.Run(True)
if __name__=="__main__":
main()

I am able to execute the flowgraph once and then the main() function exits.
I would like to perform this action for some 1000 iterations. It is a kind of for loop that I use during C/Python programming. How can I use it with GNURadio and Python.


Thanks and Regards,
Sumedha

reply via email to

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