Exemple #1
0
    def __init__(self, sample_rate, symbol_rate):
        gr.hier_block2.__init__(
            self,
            "dvb_s_demodulator_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        omega = sample_rate / symbol_rate
        gain_omega = omega * omega / 4.0
        freq_beta = freq_alpha * freq_alpha / 4.0
        mu = 0.0
        gain_mu = 0.05
        omega_relative_limit = 0.005

        # Automatic gain control
        self.agc = gr.agc2_cc(
            0.06,  # Attack rate
            0.001,  # Decay rate
            1,  # Reference
            1,  # Initial gain
            100)  # Max gain

        # Frequency correction with band-edge filters FLL
        freq_beta = freq_alpha * freq_alpha / 4
        self.freq_recov = gr.fll_band_edge_cc(omega,
                                              dvb_swig.RRC_ROLLOFF_FACTOR,
                                              11 * int(omega), freq_alpha,
                                              freq_beta)
        self.receiver = gr.mpsk_receiver_cc(M, 0, freq_alpha, freq_beta, fmin,
                                            fmax, mu, gain_mu, omega,
                                            gain_omega, omega_relative_limit)
        self.rotate = gr.multiply_const_cc(0.707 + 0.707j)

        self.connect(self, self.agc, self.freq_recov, self.receiver,
                     self.rotate, self)
Exemple #2
0
	def __init__(self, sample_rate, symbol_rate):
		gr.hier_block2.__init__(self, "dvb_s_demodulator_cc",
				gr.io_signature(1, 1, gr.sizeof_gr_complex),	# Input signature
				gr.io_signature(1, 1, gr.sizeof_gr_complex))	# Output signature

		omega = sample_rate / symbol_rate
		gain_omega = omega * omega / 4.0
		freq_beta = freq_alpha * freq_alpha / 4.0
		mu = 0.0
		gain_mu = 0.05
		omega_relative_limit = 0.005

		# Automatic gain control
		self.agc = gr.agc2_cc(
				0.06,				# Attack rate
				0.001,				# Decay rate
				1,					# Reference
				1,					# Initial gain
				100)				# Max gain

		# Frequency correction with band-edge filters FLL
		freq_beta = freq_alpha * freq_alpha / 4
		self.freq_recov = gr.fll_band_edge_cc(omega, dvb_swig.RRC_ROLLOFF_FACTOR, 11 * int(omega), freq_alpha, freq_beta)
		self.receiver = gr.mpsk_receiver_cc(M, 0, freq_alpha, freq_beta, fmin, fmax, mu, gain_mu, omega, gain_omega, omega_relative_limit)
		self.rotate = gr.multiply_const_cc(0.707 + 0.707j)

		self.connect(self, self.agc, self.freq_recov, self.receiver, self.rotate, self)
Exemple #3
0
    def __init__(self, sample_rate, symbol_rate):
        gr.hier_block2.__init__(
            self,
            "dvb_s_demodulator2_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        samples_per_symbol = sample_rate / symbol_rate

        # Automatic gain control
        self.agc = gr.agc2_cc(
            0.06,  # Attack rate
            0.001,  # Decay rate
            1,  # Reference
            1,  # Initial gain
            100)  # Max gain

        # Frequency correction with band-edge filters FLL
        freq_beta = freq_alpha * freq_alpha / 4
        self.freq_recov = gr.fll_band_edge_cc(
            samples_per_symbol,
            dvb_swig.RRC_ROLLOFF_FACTOR,
            11 * int(samples_per_symbol),  # Size of the filter in taps
            freq_alpha,
            freq_beta)

        # Symbol timing recovery with RRC data filter
        ntaps = 11 * int(samples_per_symbol * nfilts)
        rrc_taps = gr.firdes.root_raised_cosine(nfilts, nfilts,
                                                1.0 / samples_per_symbol,
                                                dvb_swig.RRC_ROLLOFF_FACTOR,
                                                ntaps)
        self.time_recov = gr.pfb_clock_sync_ccf(
            samples_per_symbol,  # Samples per second in the incoming signal
            timing_alpha,  # Alpha gain of control loop
            rrc_taps,  # The filter taps
            nfilts,  # Number of filters in the filter bank
            nfilts /
            2)  # Initial phase to look at (or which filter to start with)
        self.time_recov.set_beta(timing_beta)

        # Perform phase / fine frequency correction using Costas PLL
        phase_beta = phase_alpha * phase_alpha / 4
        self.phase_recov = gr.costas_loop_cc(phase_alpha, phase_beta, fmax,
                                             fmin, M)

        self.connect(self, self.agc, self.freq_recov, self.time_recov,
                     self.phase_recov, self)
Exemple #4
0
	def __init__(self, sample_rate, symbol_rate):
		gr.hier_block2.__init__(self, "dvb_s_demodulator2_cc",
				gr.io_signature(1, 1, gr.sizeof_gr_complex),	# Input signature
				gr.io_signature(1, 1, gr.sizeof_gr_complex))	# Output signature

		samples_per_symbol = sample_rate / symbol_rate

		# Automatic gain control
		self.agc = gr.agc2_cc(
				0.06,				# Attack rate
				0.001,				# Decay rate
				1,					# Reference
				1,					# Initial gain
				100)				# Max gain

		# Frequency correction with band-edge filters FLL
		freq_beta = freq_alpha * freq_alpha / 4
		self.freq_recov = gr.fll_band_edge_cc(
				samples_per_symbol,
				dvb_swig.RRC_ROLLOFF_FACTOR,
				11 * int(samples_per_symbol),	# Size of the filter in taps
				freq_alpha, freq_beta)

		# Symbol timing recovery with RRC data filter
		ntaps = 11 * int(samples_per_symbol * nfilts)
		rrc_taps = gr.firdes.root_raised_cosine(nfilts, nfilts,
				1.0 / samples_per_symbol, dvb_swig.RRC_ROLLOFF_FACTOR, ntaps)
		self.time_recov = gr.pfb_clock_sync_ccf(
				samples_per_symbol,				# Samples per second in the incoming signal
				timing_alpha,					# Alpha gain of control loop
				rrc_taps,						# The filter taps
				nfilts,							# Number of filters in the filter bank
				nfilts / 2)						# Initial phase to look at (or which filter to start with)
		self.time_recov.set_beta(timing_beta)

		# Perform phase / fine frequency correction using Costas PLL
		phase_beta  = phase_alpha * phase_alpha / 4
		self.phase_recov = gr.costas_loop_cc(phase_alpha, phase_beta, fmax, fmin, M)

		self.connect(self, self.agc, self.freq_recov, self.time_recov, self.phase_recov, self)
Exemple #5
0
    def __init__(self,
                 samples_per_symbol=_def_samples_per_symbol,
                 excess_bw=_def_excess_bw,
                 freq_alpha=_def_freq_alpha,
                 phase_alpha=_def_phase_alpha,
                 timing_alpha=_def_timing_alpha,
                 timing_max_dev=_def_timing_max_dev,
                 gray_code=_def_gray_code,
                 verbose=_def_verbose,
                 log=_def_log,
                 sync_out=False):
        """
	Hierarchical block for RRC-filtered DQPSK demodulation

	The input is the complex modulated signal at baseband.
	The output is a stream of bits packed 1 bit per byte (LSB)

	@param samples_per_symbol: samples per symbol >= 2
	@type samples_per_symbol: float
	@param excess_bw: Root-raised cosine filter excess bandwidth
	@type excess_bw: float
        @param freq_alpha: loop filter gain for frequency recovery
        @type freq_alpha: float
        @param phase_alpha: loop filter gain
        @type phase_alphas: float
        @param timing_alpha: timing loop alpha gain
        @type timing_alpha: float
        @param timing_max: timing loop maximum rate deviations
        @type timing_max: float
        @param gray_code: Tell modulator to Gray code the bits
        @type gray_code: bool
        @param verbose: Print information about modulator?
        @type verbose: bool
        @param log: Print modualtion data to files?
        @type log: bool
        @param sync_out: Output a sync signal on :1?
        @type sync_out: bool
	"""
        if sync_out:
            io_sig_out = gr.io_signaturev(
                2, 2, (gr.sizeof_char, gr.sizeof_gr_complex))
        else:
            io_sig_out = gr.io_signature(1, 1, gr.sizeof_char)

        gr.hier_block2.__init__(
            self,
            "dqpsk2_demod",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            io_sig_out)  # Output signature

        self._samples_per_symbol = samples_per_symbol
        self._excess_bw = excess_bw
        self._freq_alpha = freq_alpha
        self._freq_beta = 0.25 * self._freq_alpha**2
        self._phase_alpha = phase_alpha
        self._timing_alpha = timing_alpha
        self._timing_beta = _def_timing_beta
        self._timing_max_dev = timing_max_dev
        self._gray_code = gray_code

        if samples_per_symbol < 2:
            raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol

        arity = pow(2, self.bits_per_symbol())

        # Automatic gain control
        self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
        #self.agc = gr.feedforward_agc_cc(16, 2.0)

        # Frequency correction
        self.freq_recov = gr.fll_band_edge_cc(
            self._samples_per_symbol, self._excess_bw,
            11 * int(self._samples_per_symbol), self._freq_alpha,
            self._freq_beta)

        # symbol timing recovery with RRC data filter
        nfilts = 32
        ntaps = 11 * int(samples_per_symbol * nfilts)
        taps = gr.firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(self._samples_per_symbol),
            self._excess_bw, ntaps)
        self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
                                                self._timing_alpha, taps,
                                                nfilts, nfilts / 2,
                                                self._timing_max_dev)
        self.time_recov.set_beta(self._timing_beta)

        # Perform phase / fine frequency correction
        self._phase_beta = 0.25 * self._phase_alpha * self._phase_alpha
        # Allow a frequency swing of +/- half of the sample rate
        fmin = -0.5
        fmax = 0.5

        self.phase_recov = gr.costas_loop_cc(self._phase_alpha,
                                             self._phase_beta, fmax, fmin,
                                             arity)

        # Perform Differential decoding on the constellation
        self.diffdec = gr.diff_phasor_cc()

        # find closest constellation point
        rot = 1
        rotated_const = map(lambda pt: pt * rot, psk.constellation[arity])
        self.slicer = gr.constellation_decoder_cb(rotated_const, range(arity))

        if self._gray_code:
            self.symbol_mapper = gr.map_bb(psk.gray_to_binary[arity])
        else:
            self.symbol_mapper = gr.map_bb(psk.ungray_to_binary[arity])

        # unpack the k bit vector into a stream of bits
        self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol())

        if verbose:
            self._print_verbage()

        if log:
            self._setup_logging()

        # Connect
        self.connect(self, self.agc, self.freq_recov, self.time_recov,
                     self.phase_recov, self.diffdec, self.slicer,
                     self.symbol_mapper, self.unpack, self)
        if sync_out: self.connect(self.time_recov, (self, 1))
Exemple #6
0
    def __init__(self,
                 samples_per_symbol=_def_samples_per_symbol,
                 excess_bw=_def_excess_bw,
                 freq_alpha=_def_freq_alpha,
                 phase_alpha=_def_phase_alpha,
                 timing_alpha=_def_timing_alpha,
                 timing_max_dev=_def_timing_max_dev,
                 gray_code=_def_gray_code,
                 verbose=_def_verbose,
                 log=_def_log,
                 sync_out=False):
        """
	Hierarchical block for RRC-filtered differential BPSK demodulation

	The input is the complex modulated signal at baseband.
	The output is a stream of bits packed 1 bit per byte (LSB)

	@param samples_per_symbol: samples per symbol >= 2
	@type samples_per_symbol: float
	@param excess_bw: Root-raised cosine filter excess bandwidth
	@type excess_bw: float
        @param freq_alpha: loop filter gain for frequency recovery
        @type freq_alpha: float
        @param phase_alpha: loop filter gain for phase/fine frequency recovery
        @type phase_alpha: float
        @param timing_alpha: loop alpha gain for timing recovery
        @type timing_alpha: float
        @param timing_max: timing loop maximum rate deviations
        @type timing_max: float
        @param gray_code: Tell modulator to Gray code the bits
        @type gray_code: bool
        @param verbose: Print information about modulator?
        @type verbose: bool
        @param log: Print modualtion data to files?
        @type log: bool
        @param sync_out: Output a sync signal on :1?
        @type sync_out: bool
	"""
	if sync_out: io_sig_out = gr.io_signaturev(2, 2, (gr.sizeof_char, gr.sizeof_gr_complex))
	else: io_sig_out = gr.io_signature(1, 1, gr.sizeof_char)

	gr.hier_block2.__init__(self, "dqpsk2_demod",
			        gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
			        io_sig_out)       # Output signature

        self._samples_per_symbol = samples_per_symbol
        self._excess_bw = excess_bw
        self._freq_alpha = freq_alpha
        self._freq_beta = 0.10*self._freq_alpha
        self._phase_alpha = phase_alpha
        self._timing_alpha = timing_alpha
        self._timing_beta = _def_timing_beta
        self._timing_max_dev=timing_max_dev
        self._gray_code = gray_code
        
        if samples_per_symbol < 2:
            raise TypeError, "samples_per_symbol must be >= 2, is %r" % (samples_per_symbol,)

        arity = pow(2,self.bits_per_symbol())

        # Automatic gain control
        self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
        #self.agc = gr.feedforward_agc_cc(16, 1.0)

        # Frequency correction
        self.freq_recov = gr.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw,
                                              11*int(self._samples_per_symbol),
                                              self._freq_alpha, self._freq_beta)

        # symbol timing recovery with RRC data filter
        nfilts = 32
        ntaps = 11 * int(self._samples_per_symbol*nfilts)
        taps = gr.firdes.root_raised_cosine(nfilts, nfilts,
                                            1.0/float(self._samples_per_symbol),
                                            self._excess_bw, ntaps)
        self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
                                                self._timing_alpha,
                                                taps, nfilts, nfilts/2, self._timing_max_dev)
        self.time_recov.set_beta(self._timing_beta)

        # Perform phase / fine frequency correction
        self._phase_beta  = 0.25 * self._phase_alpha * self._phase_alpha
        # Allow a frequency swing of +/- half of the sample rate
        fmin = -0.5
        fmax = 0.5
        
        self.phase_recov = gr.costas_loop_cc(self._phase_alpha,
                                             self._phase_beta,
                                             fmax, fmin, arity)

        # Do differential decoding based on phase change of symbols
        self.diffdec = gr.diff_phasor_cc()

        # find closest constellation point
        rot = 1
        rotated_const = map(lambda pt: pt * rot, psk.constellation[arity])
        self.slicer = gr.constellation_decoder_cb(rotated_const, range(arity))

        if self._gray_code:
            self.symbol_mapper = gr.map_bb(psk.gray_to_binary[arity])
        else:
            self.symbol_mapper = gr.map_bb(psk.ungray_to_binary[arity])
        
        # unpack the k bit vector into a stream of bits
        self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol())

        if verbose:
            self._print_verbage()

        if log:
            self._setup_logging()

        # Connect
        self.connect(self, self.agc,
                     self.freq_recov, self.time_recov, self.phase_recov,
                     self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self)
        if sync_out: self.connect(self.time_recov, (self, 1))