Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- ##################################################
- # Gnuradio Python Flow Graph
- # Title: Top Block
- # Generated: Sat Feb 15 23:55:08 2014
- ##################################################
- from gnuradio import analog
- from gnuradio import blocks
- from gnuradio import eng_notation
- from gnuradio import gr
- from gnuradio.eng_option import eng_option
- from gnuradio.filter import firdes
- from optparse import OptionParser
- import math
- class top_block(gr.top_block):
- def __init__(self):
- gr.top_block.__init__(self, "Top Block")
- ##################################################
- # Variables
- ##################################################
- self.samp_rate = samp_rate = 128000
- ##################################################
- # Blocks
- ##################################################
- self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex*1, "127.0.0.1", 1234, 1472, True)
- self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, "127.0.0.1", 1234, 1472, True)
- self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate/4)
- self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
- self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
- self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
- ##################################################
- # Connections
- ##################################################
- self.connect((self.analog_sig_source_x_0, 0), (self.blocks_udp_sink_0, 0))
- self.connect((self.blocks_udp_source_0, 0), (self.analog_quadrature_demod_cf_0, 0))
- self.connect((self.blocks_throttle_0, 0), (self.blocks_null_sink_0, 0))
- self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_throttle_0, 0))
- # QT sink close method reimplementation
- def get_samp_rate(self):
- return self.samp_rate
- def set_samp_rate(self, samp_rate):
- self.samp_rate = samp_rate
- self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
- self.blocks_throttle_0.set_sample_rate(self.samp_rate/4)
- if __name__ == '__main__':
- parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
- (options, args) = parser.parse_args()
- tb = top_block()
- tb.start()
- raw_input('Press Enter to quit: ')
- tb.stop()
- tb.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement