Exemplo n.º 1
0
 def __init__(self, modulator, audio_rate, rf_rate, freq):
     modulator = IModulator(modulator)
     
     gr.hier_block2.__init__(
         self, 'SimulatedChannel',
         gr.io_signature(1, 1, gr.sizeof_float * 1),
         gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
     )
     
     self.__freq = freq
     self.__rf_rate = rf_rate
     self.__modulator = modulator
     
     modulator_input_type = modulator.get_input_type()
     if modulator_input_type.get_kind() == 'MONO':
         audio_resampler = make_resampler(audio_rate, modulator_input_type.get_sample_rate())
         self.connect(self, audio_resampler, modulator)
     elif modulator_input_type.get_kind() == 'NONE':
         self.connect(self, blocks.null_sink(gr.sizeof_float))
     else:
         raise Exception('don\'t know how to supply input of type %s' % modulator_input_type)
     
     rf_resampler = rational_resampler.rational_resampler_ccf(
         interpolation=int(rf_rate),
         decimation=int(modulator.get_output_type().get_sample_rate()))
     self.__rotator = blocks.rotator_cc(rotator_inc(rate=rf_rate, shift=freq))
     self.__mult = blocks.multiply_const_cc(dB(-10))
     self.connect(modulator, rf_resampler, self.__rotator, self.__mult, self)
Exemplo n.º 2
0
    def __init__(self, modulator, audio_rate, rf_rate, freq):
        modulator = IModulator(modulator)

        gr.hier_block2.__init__(
            self,
            'SimulatedChannel',
            gr.io_signature(1, 1, gr.sizeof_float * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        self.__freq = freq
        self.__rf_rate = rf_rate
        self.__modulator = modulator

        modulator_input_type = modulator.get_input_type()
        if modulator_input_type.get_kind() == 'MONO':
            audio_resampler = make_resampler(
                audio_rate, modulator_input_type.get_sample_rate())
            self.connect(self, audio_resampler, modulator)
        elif modulator_input_type.get_kind() == 'NONE':
            self.connect(self, blocks.null_sink(gr.sizeof_float))
        else:
            raise Exception('don\'t know how to supply input of type %s' %
                            modulator_input_type)

        rf_resampler = rational_resampler.rational_resampler_ccf(
            interpolation=int(rf_rate),
            decimation=int(modulator.get_output_type().get_sample_rate()))
        self.__rotator = blocks.rotator_cc(
            rotator_inc(rate=rf_rate, shift=freq))
        self.__mult = blocks.multiply_const_cc(dB(-10))
        self.connect(modulator, rf_resampler, self.__rotator, self.__mult,
                     self)
Exemplo n.º 3
0
 def __update_rotator(self):
     offset = self.rec_freq - self.input_center_freq
     if self.__demod_tunable:
         self.demodulator.set_rec_freq(offset)
     else:
         self.__rotator.set_phase_inc(
             rotator_inc(rate=self.input_rate, shift=-offset))
Exemplo n.º 4
0
 def __update_rotator(self):
     device = self.__get_device()
     sample_rate = device.get_rx_driver().get_output_type().get_sample_rate()
     offset = self.rec_freq - self.__get_device().get_freq()
     if self.__demod_tunable:
         self.__demodulator.set_rec_freq(offset)
     else:
         self.__rotator.set_phase_inc(rotator_inc(rate=sample_rate, shift=-offset))
Exemplo n.º 5
0
 def __update_rotator(self):
     device = self.__get_device()
     sample_rate = device.get_rx_driver().get_output_type().get_sample_rate(
     )
     if self.__demod_tunable:
         # TODO: Method should perhaps be renamed to convey that it is relative
         self.__demodulator.set_rec_freq(self.__freq_relative)
     else:
         self.__rotator.set_phase_inc(
             rotator_inc(rate=sample_rate, shift=-self.__freq_relative))
Exemplo n.º 6
0
	def __init__(self, modulator, audio_rate, rf_rate, freq):
		modulator = IModulator(modulator)
		
		gr.hier_block2.__init__(
			self, 'SimulatedChannel',
			gr.io_signature(1, 1, gr.sizeof_float * 1),
			gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
		)
		
		self.__freq = freq
		self.__rf_rate = rf_rate
		
		self.modulator = modulator  # exported
		
		audio_resampler = make_resampler(audio_rate, modulator.get_input_type().get_sample_rate())
		rf_resampler = rational_resampler.rational_resampler_ccf(
			interpolation=int(rf_rate),
			decimation=int(modulator.get_output_type().get_sample_rate()))
		self.__rotator = blocks.rotator_cc(rotator_inc(rate=rf_rate, shift=freq))
		self.__mult = blocks.multiply_const_cc(10.0 ** -1)
		self.connect(self, audio_resampler, modulator, rf_resampler, self.__rotator, self.__mult, self)
Exemplo n.º 7
0
 def set_freq(self, value):
     self.__freq = float(value)
     self.__rotator.set_phase_inc(rotator_inc(rate=self.__rf_rate, shift=self.__freq))
Exemplo n.º 8
0
 def _set_sim_freq(self, freq):
     self.__rotator.set_phase_inc(rotator_inc(rate=self.rf_rate, shift=-freq))
Exemplo n.º 9
0
 def set_freq(self, value):
     self.__freq = float(value)
     self.__rotator.set_phase_inc(
         rotator_inc(rate=self.__rf_rate, shift=self.__freq))
Exemplo n.º 10
0
 def _set_sim_freq(self, freq):
     self.__rotator.set_phase_inc(
         rotator_inc(rate=self.rf_rate, shift=-freq))
Exemplo n.º 11
0
	def __update_rotator(self):
		offset = self.rec_freq - self.input_center_freq
		if self.__demod_tunable:
			self.demodulator.set_rec_freq(offset)
		else:
			self.__rotator.set_phase_inc(rotator_inc(rate=self.input_rate, shift=-offset))