Exemplo n.º 1
0
	def __init__(self):
		gr.top_block.__init__(self)

		usage = "%prog: [options] samples_file"
		parser = OptionParser(option_class=eng_option, usage=usage)
  		parser.add_option("-m", "--dab-mode", type="int", default=1,
        	     	help="DAB mode [default=%default]")
		parser.add_option("-F", "--filter-input", action="store_true", default=False,
                          help="Enable FFT filter at input")
  		parser.add_option("-s", "--resample-fixed", type="eng_float", default=1,
			help="resample by a fixed factor (fractional interpolation)")
		parser.add_option("-S", "--autocorrect-sample-rate", action="store_true", default=False,
                          help="Estimate sample rate offset and resample (dynamic fractional interpolation)")
  		parser.add_option('-u', '--usrp-source', action="store_true", default=False,
	     		help="Samples from USRP (-> adjust params for 2 MSPS)")
  		parser.add_option('-d', '--debug', action="store_true", default=False,
	     		help="Write output to files")
  		parser.add_option('-v', '--verbose', action="store_true", default=False,
	     		help="Print status messages")
		(options, args) = parser.parse_args ()
	
		if options.usrp_source:
			dp = dab.dab_parameters(options.dab_mode, verbose=options.verbose, sample_rate=2000000)
		else:
			dp = dab.dab_parameters(options.dab_mode, verbose=options.verbose)

		rp = dab.receiver_parameters(options.dab_mode, softbits=True, input_fft_filter=options.filter_input, autocorrect_sample_rate=options.autocorrect_sample_rate, sample_rate_correction_factor=options.resample_fixed, correct_ffe=True, equalize_magnitude=True, verbose=options.verbose)

		if len(args)<1:
			print "error: need file with samples"
			sys.exit(1)
		else:
			filename = args[0]
			if options.verbose: print "--> using samples from file " + filename
			self.src = gr.file_source(gr.sizeof_gr_complex, filename, False)

		
		self.dab_demod = dab.ofdm_demod(dp, rp, verbose=options.verbose, debug=options.debug)
		self.fic_dec   = dab.fic_decode(dp, verbose=options.verbose, debug=options.debug)
		
		self.connect(self.src, self.dab_demod, self.fic_dec)
		self.connect((self.dab_demod,1), (self.fic_dec,1))
Exemplo n.º 2
0
	def __init__(self):
		gr.top_block.__init__(self)

		usage = "%prog: [options] samples_file"
		parser = OptionParser(option_class=eng_option, usage=usage)
  		parser.add_option("-m", "--dab-mode", type="int", default=1,
        	     	help="DAB mode [default=%default]")
		parser.add_option("-F", "--filter-input", action="store_true", default=False,
                          help="Enable FFT filter at input")
  		parser.add_option("-s", "--resample-fixed", type="eng_float", default=1,
			help="resample by a fixed factor (fractional interpolation)")
		parser.add_option("-S", "--autocorrect-sample-rate", action="store_true", default=False,
                          help="Estimate sample rate offset and resample (dynamic fractional interpolation)")
  		parser.add_option('-u', '--usrp-source', action="store_true", default=False,
	     		help="Samples from USRP (-> adjust params for 2 MSPS)")
  		parser.add_option('-d', '--debug', action="store_true", default=False,
	     		help="Write output to files")
  		parser.add_option('-v', '--verbose', action="store_true", default=False,
	     		help="Print status messages")
		(options, args) = parser.parse_args ()
	
		if options.usrp_source:
			dp = dab.dab_parameters(options.dab_mode, verbose=options.verbose, sample_rate=2000000)
		else:
			dp = dab.dab_parameters(options.dab_mode, verbose=options.verbose)

		rp = dab.receiver_parameters(options.dab_mode, softbits=True, input_fft_filter=options.filter_input, autocorrect_sample_rate=options.autocorrect_sample_rate, sample_rate_correction_factor=options.resample_fixed, correct_ffe=True, equalize_magnitude=True, verbose=options.verbose)

		if len(args)<1:
			print "error: need file with samples"
			sys.exit(1)
		else:
			filename = args[0]
			if options.verbose: print "--> using samples from file " + filename
			self.src = gr.file_source(gr.sizeof_gr_complex, filename, False)

		
		self.dab_demod = dab.ofdm_demod(dp, rp, verbose=options.verbose, debug=options.debug)
		self.fic_dec   = dab.fic_decode(dp, verbose=options.verbose, debug=options.debug)
		
		self.connect(self.src, self.dab_demod, self.fic_dec)
		self.connect((self.dab_demod,1), (self.fic_dec,1))
Exemplo n.º 3
0
	def __init__(self, autocorrect_sample_rate=False, input_filter=True, ber_sink=False):
		gr.top_block.__init__(self)
		self.dp = dab.dab_parameters(1)
		self.rp = dab.receiver_parameters(1, softbits=False, input_fft_filter=input_filter, autocorrect_sample_rate=autocorrect_sample_rate, correct_ffe=True, equalize_magnitude=False)
		self.ber_sink = ber_sink
		os.environ['GR_SCHEDULER'] = "STS" # need single threaded scheduler for use with concatenate_signals