Wednesday, October 17, 2012

Quick & Dirty Part-4 : Running two classes one by one

In the previous three "Quick & Dirty" sections I made only a single class i.e.
rx_cfile_block1 and ran that.

Today I will make two classes with different parameters and then run them one by one from a single flow graph.

Here I wont explain much in detail as I did in the last three posts, but I would like you to refer them

http://sumitgnuradio.blogspot.in/2012/10/quick-dirty-part-3-getting-data-from.html
http://sumitgnuradio.blogspot.in/2012/10/quick-dirty-part-2-data-dumping-into.html
http://sumitgnuradio.blogspot.in/2012/10/quick-dirty-getting-data-from-usrp.html

Step-1 Copy the class definition section from the program of the post
http://sumitgnuradio.blogspot.in/2012/10/quick-dirty-getting-data-from-usrp.html
and paste it in a separate file

Step-2 In that separate file rename the class as rx_cfile_block2

Step-3 Change the class properties as you want i.e. usrp(type,serial number)center frequency, gain, sampling rate, number of samples, subdevices, antennas etc

Step-4 paste this class definition just before the line if __name__ == '__main__':   in the program

Step-5 Write "import time" just after from gnuradio import uhd

# Time is a python module which will enable us to use the time funcitons

Step-6 Refer to the lines after if __name__ == '__main__':

Step-7 After tb.run(), put time.sleep(5)

# This will make the program sleep for 5 seconds before executing next lines

Step-8 Write following lines after time.sleep(5)

tb = rx_cfile_block2()
tb.run()

# So at the begining the class rx_cfile_block1 will called after 5 seconds of it end the another class i.e. rx_cfile_block2 will be called.

# For cross checking if the program is working properly or not, put the file names different in the two classes or change their path


Program :

http://www.2shared.com/file/LxYFf2YG/pgm_4.html

4 comments:

  1. Sumit Kumar,


    You kick ass my friend.

    Thank you!

    Please send me a email to give me a update about your book and the training you guys were going to do in India.

    Awaiting your reply and please keep up the excellent work!

    Sincerely,


    Martin

    ReplyDelete
  2. Hi Martin..as of now concentrating to put all the find outs on this blog itself.. no plans of book. Surely will let you know if some training we are able to arrange

    ReplyDelete
  3. Hi,guy

    Do you know how to execute two WX GUI in GRC at the same time? I have two sources in one GRC: USRP sources and File sources. However, when I run it, the windows be halted,then I need force quit the window. If I execute these two WX GUI one by one, it will work.

    Thanks

    Sincerely,

    Andy

    ReplyDelete
  4. I think you are overloading your processor. Did you try using throttle blocks in the simulation. OR may be time to increase your RAM :)

    ReplyDelete