Esempio n. 1
0
    def __init__(self, update_period=32, window=1024, step_size=0.001, num_ports=2):
        gr.hier_block2.__init__(
            self, "Phase Align",
            gr.io_signaturev(num_ports, num_ports, gen_sig_io(num_ports)),
            gr.io_signaturev(num_ports, num_ports, gen_sig_io(num_ports)),
        )
        self.message_port_register_hier_in("Trigger")

        ##################################################
        # Parameters
        ##################################################
        self.update_period = update_period
        self.window = window
        self.step_size = step_size
        self.num_ports = num_ports

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################

        # Const block for reference signal to do nothing
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0, ))
        self.connect((self, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self, 0))

        for p in range(num_ports-1):
            # Create PC object
            object_name_pc = 'wifius_phase_correct_vci_'+str(p)
            setattr(self, object_name_pc, wifius.phase_correct_vci(1024, samp_rate, window, step_size, update_period, False))

            # Add Stream To Vector For Ref
            object_name_vr = 'blocks_stream_to_vector_a_'+str(p)
            setattr(self, object_name_vr, blocks.stream_to_vector(gr.sizeof_gr_complex*1, window))

            # Add Stream To Vector For Next Signal
            object_name_sv = 'blocks_stream_to_vector_b_'+str(p)
            setattr(self, object_name_sv, blocks.stream_to_vector(gr.sizeof_gr_complex*1, window))

            # Add Vector To Stream For Output of PC
            object_name_vs = 'blocks_vector_to_stream_'+str(p)
            setattr(self, object_name_vs, blocks.vector_to_stream(gr.sizeof_gr_complex*1, window))

            # Make Connections
            self.connect((self, 0),   (getattr(self,object_name_vr), 0))
            self.connect((self, p+1), (getattr(self,object_name_sv), 0))

            self.connect((getattr(self,object_name_vr), 0), (getattr(self,object_name_pc), 0))
            self.connect((getattr(self,object_name_sv), 0), (getattr(self,object_name_pc), 1))

            self.connect((getattr(self,object_name_pc), 0), (getattr(self,object_name_vs), 0))

            self.connect((getattr(self,object_name_vs), 0), (self, p+1))

            self.msg_connect((self, 'Trigger'), (getattr(self,object_name_pc), 'set_enable_sync'))
 def test_add_const_vcc_five(self):
     src_data = (1.0 + 2.0j, 3.0 + 4.0j, 5.0 + 6.0j, 7.0 + 8.0j,
                 9.0 + 10.0j)
     op = blocks.add_const_vcc((11.0 + 12.0j, 13.0 + 14.0j, 15.0 + 16.0j,
                                17.0 + 18.0j, 19.0 + 20.0j))
     exp_data = (12.0 + 14.0j, 16.0 + 18.0j, 20.0 + 22.0j, 24.0 + 26.0j,
                 28.0 + 30.0j)
     self.help_const_cc(src_data, exp_data, op)
Esempio n. 3
0
    def __init__(self,
                 phase_noise_mag=0,
                 magbal=0,
                 phasebal=0,
                 q_ofs=0,
                 i_ofs=0,
                 freq_offset=0,
                 gamma=0,
                 beta=0):
        gr.hier_block2.__init__(
            self, "Radio Impairments Model",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.phase_noise_mag = phase_noise_mag
        self.magbal = magbal
        self.phasebal = phasebal
        self.q_ofs = q_ofs
        self.i_ofs = i_ofs
        self.freq_offset = freq_offset
        self.gamma = gamma
        self.beta = beta

        ##################################################
        # Blocks
        ##################################################
        self.phase_noise = phase_noise_gen(10.0**(phase_noise_mag / 20.0), .01)
        self.iq_imbalance = iqbal_gen(magbal, phasebal)
        self.channels_distortion_3_gen_0 = distortion_3_gen(beta)
        self.channels_distortion_2_gen_0 = distortion_2_gen(gamma)
        self.freq_modulator = blocks.multiply_cc()
        self.freq_offset_gen = analog.sig_source_c(1.0, analog.GR_COS_WAVE, freq_offset, 1, 0)
        self.freq_modulator_dcoffs = blocks.multiply_cc()
        self.freq_offset_conj = blocks.conjugate_cc()
        self.dc_offset = blocks.add_const_vcc((i_ofs + q_ofs* 1j, ))

        ##################################################
        # Frequency offset
        self.connect((self, 0), (self.freq_modulator, 1))
        self.connect((self.freq_offset_gen, 0), (self.freq_offset_conj, 0))
        self.connect((self.freq_offset_conj, 0), (self.freq_modulator, 0))
        # Most distortions can be strung in a row
        self.connect(
            (self.freq_modulator, 0),
            (self.phase_noise, 0),
            (self.channels_distortion_3_gen_0, 0),
            (self.channels_distortion_2_gen_0, 0),
            (self.iq_imbalance, 0),
            (self.dc_offset, 0),
        )
        # Frequency offset again
        self.connect((self.freq_offset_gen, 0), (self.freq_modulator_dcoffs, 0))
        self.connect((self.dc_offset, 0), (self.freq_modulator_dcoffs, 1))
        self.connect((self.freq_modulator_dcoffs, 0), (self, 0))
Esempio n. 4
0
    def __init__(self):
        gr.top_block.__init__(self, "Tx Wav")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Tx Wav")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "tx_wav")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3
        self.freq = freq = samp_rate/4
        self.amp = amp = 3

        ##################################################
        # Blocks
        ##################################################
        self._freq_range = Range(1e2, samp_rate/2, 1, samp_rate/4, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float)
        self.top_layout.addWidget(self._freq_win)
        self._amp_range = Range(-40, 20, 1, 3, 200)
        self._amp_win = RangeWidget(self._amp_range, self.set_amp, "amp", "counter_slider", float)
        self.top_layout.addWidget(self._amp_win)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (firdes.complex_band_pass(pow(10.0,amp/10.0),samp_rate,-3000,-300,100,firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0, ))
        self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq, 0.1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, pow(10.0,amp/10.0), 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.fft_filter_xxx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.fft_filter_xxx_0, 0), (self.blocks_add_const_vxx_0, 0))    
Esempio n. 5
0
 def test_add_const_vcc_one(self):
     src_data = [
         1.0 + 2.0j,
     ]
     op = blocks.add_const_vcc((2.0 + 3.0j, ))
     exp_data = [
         3.0 + 5.0j,
     ]
     self.help_const_cc(src_data, exp_data, op)
Esempio n. 6
0
    def __init__(self):
        gr.top_block.__init__(self, "Blade Tx")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 4000000
        self.interpolation = interpolation = 80
        self.wpm = wpm = 15
        self.tune = tune = 100
        self.rf_gain = rf_gain = 10
        self.offset = offset = 200000
        self.cw_vector = cw_vector = (1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0,0,0,0,0, 1,1,1,0,1,0,1, 0,0,0, 1, 0,0,0,0,0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1,0,1,1,1,0,1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0,0,0,0,0, 1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1, 0,0,0, 1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,1,1,0,1, 0,0,0, 1,1,1,0,1,1,1,0,1, 0,0,0,0,0,0,0)
        self.correction = correction = 0
        self.bb_gain = bb_gain = -25
        self.band = band = 432
        self.audio_rate = audio_rate = samp_rate / interpolation

        ##################################################
        # Blocks
        ##################################################
        self.resamp = filter.rational_resampler_ccc(
                interpolation=interpolation,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.out = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.out.set_sample_rate(samp_rate)
        self.out.set_center_freq(band * (1 + correction / 1e6) * 1e6 + 100000 - offset, 0)
        self.out.set_freq_corr(0, 0)
        self.out.set_gain(rf_gain, 0)
        self.out.set_if_gain(0, 0)
        self.out.set_bb_gain(bb_gain, 0)
        self.out.set_antenna("", 0)
        self.out.set_bandwidth(0, 0)
          
        self.offset_osc = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tune * 1000 + 100000, 0.9, 0)
        self.mixer = blocks.multiply_vcc(1)
        self.cw_vector_source = blocks.vector_source_c(cw_vector, False, 1, [])
        self.cw_repeat = blocks.repeat(gr.sizeof_gr_complex*1, int(1.2 * audio_rate / wpm))
        self.click_filter = filter.single_pole_iir_filter_cc(1e-2, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.000001, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.resamp, 0))    
        self.connect((self.click_filter, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.cw_repeat, 0), (self.click_filter, 0))    
        self.connect((self.cw_vector_source, 0), (self.cw_repeat, 0))    
        self.connect((self.mixer, 0), (self.out, 0))    
        self.connect((self.offset_osc, 0), (self.mixer, 0))    
        self.connect((self.resamp, 0), (self.mixer, 1))    
Esempio n. 7
0
    def __init__(self, phase_noise_mag=0, magbal=0, phasebal=0, q_ofs=0, i_ofs=0, freq_offset=0, gamma=0, beta=0):
        gr.hier_block2.__init__(
            self, "Radio Impairments Model",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.phase_noise_mag = phase_noise_mag
        self.magbal = magbal
        self.phasebal = phasebal
        self.q_ofs = q_ofs
        self.i_ofs = i_ofs
        self.freq_offset = freq_offset
        self.gamma = gamma
        self.beta = beta

        ##################################################
        # Blocks
        ##################################################
        self.channels_phase_noise_gen_0_0 = phase_noise_gen(math.pow(10.0,phase_noise_mag/20.0), .01)
        self.channels_iqbal_gen_0 = iqbal_gen(magbal, phasebal)
        self.channels_distortion_3_gen_0 = distortion_3_gen(beta)
        self.channels_distortion_2_gen_0 = distortion_2_gen(gamma)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((i_ofs + q_ofs* 1j, ))
        self.analog_sig_source_x_0 = analog.sig_source_c(1.0, analog.GR_COS_WAVE, freq_offset, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.channels_phase_noise_gen_0_0, 0), (self.channels_distortion_3_gen_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.channels_phase_noise_gen_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.channels_iqbal_gen_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.channels_distortion_3_gen_0, 0), (self.channels_distortion_2_gen_0, 0))
        self.connect((self.channels_distortion_2_gen_0, 0), (self.channels_iqbal_gen_0, 0))
Esempio n. 8
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Hackrfblock")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 20000000
        self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, 20000, 200000, firdes.WIN_HAMMING, 6.76)
        self.base = base = 881000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=base,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=50,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=4096,
        	fft_rate=5,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/xin/BL/bl-interns/xgao/hackrf/881.0.bin", True)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_float*1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-128-128j, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_uchar_to_float_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_deinterleave_0, 0))    
Esempio n. 9
0
    def __init__(self):
        gr.top_block.__init__(self, "Lang Tx")

        ##################################################
        # Variables
        ##################################################
        self.PTT = PTT = False
        self.Mode = Mode = 0
        self.MicGain = MicGain = 5.0
        self.KEY = KEY = False
        self.Filt_Low = Filt_Low = 300
        self.Filt_High = Filt_High = 3000
        self.FMMIC = FMMIC = 50

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=11,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.pluto_sink_0 = iio.pluto_sink('ip:pluto.local', 1000000000,
                                           528000, 2000000, 0x800, False, 0,
                                           '', True)
        self.blocks_mute_xx_0_0 = blocks.mute_cc(bool(not PTT))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_4 = blocks.multiply_const_vcc(
            ((Mode < 4) or (Mode == 5), ))
        self.blocks_multiply_const_vxx_3 = blocks.multiply_const_vcc(
            (Mode == 4, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (FMMIC / 10.0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            ((MicGain / 10.0) * (not (Mode == 2)) * (not (Mode == 3)), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_xx_2 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc(
            ((0.5 * int(Mode == 5)) + (int(Mode == 2) * KEY) +
             (int(Mode == 3) * KEY), ))
        self.band_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 200, 3000, 100, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, 48000, Filt_Low, Filt_High, 100,
                                     firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "hw:CARD=Device,DEV=0",
                                           False)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            48000, analog.GR_COS_WAVE, 0, 1, 0)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=48000,
            quad_rate=48000,
            tau=75e-6,
            max_dev=3000,
            fh=-1,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-1,
                                               1.3 - (0.65 * (int(Mode == 5))),
                                               1.0)
        self.analog_agc2_xx_1.set_max_gain(10)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_1, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_3, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.blocks_multiply_const_vxx_4, 0))
        self.connect((self.band_pass_filter_1, 0), (self.analog_nbfm_tx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_2, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.band_pass_filter_1, 0))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_4, 0),
                     (self.blocks_add_xx_2, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.analog_agc2_xx_1, 0))
        self.connect((self.blocks_mute_xx_0_0, 0), (self.pluto_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_mute_xx_0_0, 0))
Esempio n. 10
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Stereo Receiver")

        ##################################################
        # Variables
        ##################################################
        self.smux_filt_samprate = smux_filt_samprate = 256e3
        self.smux_decim = smux_decim = 8
        self.samp_rate = samp_rate = 2.048e6
        self.right_gain = right_gain = 3
        self.left_gain = left_gain = 3
        self.bpf_base = bpf_base = 23e3
        self.RF_Gain = RF_Gain = 45
        self.CF = CF = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.samp_rate,
        	callback=self.set_samp_rate,
        	label="Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._samp_rate_text_box, 1, 0, 1, 1)
        _right_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._right_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	label="R Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._right_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_right_gain_sizer, 0, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "BB Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Signal")
        self.GridAdd(self.notebook_0, 2, 0, 1, 2)
        _left_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._left_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	label="L Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._left_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_left_gain_sizer, 0, 0, 1, 1)
        _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_Gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._RF_Gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	minimum=0,
        	maximum=100,
        	num_steps=45,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 1, 1, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Baseband Waterfall",
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 3, 0, 1, 2)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.notebook_0.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=32e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=(800,500),
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Difference FFT ",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate/8,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Demodulated FFT",
        	peak_hold=False,
        	size=(800,800),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Baseband FFT",
        	peak_hold=False,
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_fftsink2_0_0.win, 2, 0, 1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Sum FFT",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.rfgain = blocks.multiply_const_vcc((RF_Gain, ))
        self.low_pass_filter_1_0 = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_HAMMING, 1))
        self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass(
        	2, samp_rate/4, 100e3, 500, firdes.WIN_KAISER, 6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ccf((-0.00266, 0.00504, -0.00309, -0.00136, 0.00663, -0.01052, 0.01103, -0.00731, 0.00016, 0.00800, -0.01396, 0.01490, -0.00971, -0.00035, 0.01173, -0.01979, 0.02054, -0.01240, -0.00273, 0.01960, -0.03122, 0.03124, -0.01669, -0.01017, 0.04137, -0.06448, 0.06476, -0.02634, -0.07449, 0.33571, -0.00000, -0.33571, 0.07449, 0.02634, -0.06476, 0.06448, -0.04137, 0.01017, 0.01669, -0.03124, 0.03122, -0.01960, 0.00273, 0.01240, -0.02054, 0.01979, -0.01173, 0.00035, 0.00971, -0.01490, 0.01396, -0.00800, -0.00016, 0.00731, -0.01103, 0.01052, -0.00663, 0.00136, 0.00309, -0.00504, 0.00266
        ), (1 , ), False)
        self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(4, (1,1,1,1))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((right_gain, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((left_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/Users/bretttt/iCloud_drive/16S/engs110/project/radio_dat/IQ_Data_STEREO1", True)
        self.blocks_divide_xx_1 = blocks.divide_cc(1)
        self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex*1, 30)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.1, ))
        self.baseband_LPF = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass(
        	1, smux_filt_samprate, 18000, 20000, 1000, firdes.WIN_KAISER, 1))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, smux_filt_samprate, bpf_base, bpf_base+30e3, 500, firdes.WIN_KAISER, 6.76))
        self.audio_sink_0_0_0_0 = audio.sink(32000, "", True)
        self.analog_pll_refout_cc_0_0 = analog.pll_refout_cc(3.14/100, 0.152*3.14, 0.144*3.14)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        _CF_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CF_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	label="Center Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._CF_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	minimum=80e6,
        	maximum=108e6,
        	num_steps=280,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_CF_sizer, 3, 0, 1, 2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.analog_fm_deemph_0, 0), (self.audio_sink_0_0_0_0, 0))    
        self.connect((self.analog_fm_deemph_0_0, 0), (self.audio_sink_0_0_0_0, 1))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 0))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 1))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.band_pass_filter_0_0_0, 0), (self.analog_pll_refout_cc_0_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_divide_xx_1, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0_0_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.baseband_LPF, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.wxgui_fftsink2_0_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_delay_2, 0), (self.blocks_multiply_conjugate_cc_0, 1))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_delay_2, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_file_source_0_0, 0), (self.rfgain, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_imag_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_fm_deemph_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.analog_fm_deemph_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_fftsink2_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_scopesink2_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_1_0, 0))    
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.fir_filter_xxx_0_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_divide_xx_1, 0))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.rfgain, 0), (self.blocks_throttle_0, 0))    
Esempio n. 11
0
    def __init__(self):
        gr.top_block.__init__(self, "Blade Tx")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 4000000
        self.interpolation = interpolation = 80
        self.wpm = wpm = 15
        self.tune = tune = 100
        self.rf_gain = rf_gain = 10
        self.offset = offset = 200000
        self.cw_vector = cw_vector = (
            1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0,
            0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
            1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1,
            1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0,
            0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1,
            1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
            1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0,
            1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0)
        self.correction = correction = 0
        self.bb_gain = bb_gain = -25
        self.band = band = 432
        self.audio_rate = audio_rate = samp_rate / interpolation

        ##################################################
        # Blocks
        ##################################################
        self.resamp = filter.rational_resampler_ccc(
            interpolation=interpolation,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.out = osmosdr.sink(args="numchan=" + str(1) + " " + "")
        self.out.set_sample_rate(samp_rate)
        self.out.set_center_freq(
            band * (1 + correction / 1e6) * 1e6 + 100000 - offset, 0)
        self.out.set_freq_corr(0, 0)
        self.out.set_gain(rf_gain, 0)
        self.out.set_if_gain(0, 0)
        self.out.set_bb_gain(bb_gain, 0)
        self.out.set_antenna("", 0)
        self.out.set_bandwidth(0, 0)

        self.offset_osc = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE,
                                              tune * 1000 + 100000, 0.9, 0)
        self.mixer = blocks.multiply_vcc(1)
        self.cw_vector_source = blocks.vector_source_c(cw_vector, False, 1, [])
        self.cw_repeat = blocks.repeat(gr.sizeof_gr_complex * 1,
                                       int(1.2 * audio_rate / wpm))
        self.click_filter = filter.single_pole_iir_filter_cc(1e-2, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.000001, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.resamp, 0))
        self.connect((self.click_filter, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.cw_repeat, 0), (self.click_filter, 0))
        self.connect((self.cw_vector_source, 0), (self.cw_repeat, 0))
        self.connect((self.mixer, 0), (self.out, 0))
        self.connect((self.offset_osc, 0), (self.mixer, 0))
        self.connect((self.resamp, 0), (self.mixer, 1))
Esempio n. 12
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.pam4_constellation = pam4_constellation = digital.constellation_calcdist(
            ([0, 1, 3, 2]), ([0, 1, 3, 2]), 4, 1).base()
        self.noiseamp = noiseamp = (10**(-0.9) + 10) / 2
        self.noise_enable = noise_enable = 0
        self.mod_select = mod_select = 1
        self.ebw_range = ebw_range = 0.35
        self.a_src_freq = a_src_freq = 200e3

        ##################################################
        # Blocks
        ##################################################
        self._noiseamp_range = Range(10**(-0.9), 10, 0.001,
                                     (10**(-0.9) + 10) / 2, 200)
        self._noiseamp_win = RangeWidget(self._noiseamp_range,
                                         self.set_noiseamp, "Noise Amplitude",
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._noiseamp_win, 0, 2)
        _noise_enable_check_box = Qt.QCheckBox("Noise Enable")
        self._noise_enable_choices = {True: 1, False: 0}
        self._noise_enable_choices_inv = dict(
            (v, k) for k, v in self._noise_enable_choices.iteritems())
        self._noise_enable_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _noise_enable_check_box, "setChecked",
            Qt.Q_ARG("bool", self._noise_enable_choices_inv[i]))
        self._noise_enable_callback(self.noise_enable)
        _noise_enable_check_box.stateChanged.connect(
            lambda i: self.set_noise_enable(self._noise_enable_choices[bool(i)]
                                            ))
        self.top_grid_layout.addWidget(_noise_enable_check_box, 0, 1)
        self._mod_select_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        self._mod_select_labels = [
            "BPSK", "QPSK", "8PSK", "QAM16", "QAM64", "PAM4", "GFSK", "CPFSK",
            "WBFM", "AM-DSB", "AM-SSB"
        ]
        self._mod_select_tool_bar = Qt.QToolBar(self)
        self._mod_select_tool_bar.addWidget(Qt.QLabel("mod_select" + ": "))
        self._mod_select_combo_box = Qt.QComboBox()
        self._mod_select_tool_bar.addWidget(self._mod_select_combo_box)
        for label in self._mod_select_labels:
            self._mod_select_combo_box.addItem(label)
        self._mod_select_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._mod_select_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._mod_select_options.index(i)))
        self._mod_select_callback(self.mod_select)
        self._mod_select_combo_box.currentIndexChanged.connect(
            lambda i: self.set_mod_select(self._mod_select_options[i]))
        self.top_grid_layout.addWidget(self._mod_select_tool_bar, 0, 0)
        self._a_src_freq_range = Range(44100, 200e3, 10, 200e3, 200)
        self._a_src_freq_win = RangeWidget(self._a_src_freq_range,
                                           self.set_a_src_freq,
                                           "Analog Source Frequency",
                                           "counter_slider", float)
        self.top_layout.addWidget(self._a_src_freq_win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(0, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.sig_source_0 = analog.sig_source_f(samp_rate, analog.GR_TRI_WAVE,
                                                44100, 1, 0)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            2048,  #size
            samp_rate,  #samp_rate
            "Times Series",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 1, 2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Frequency Spectrum",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1,
                                       3)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            2048,  #size
            "Constellation",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(True)
        self.qtgui_const_sink_x_0.enable_grid(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 0, 1,
                                       2)
        self.hilbert_fc_0 = filter.hilbert_fc(401, firdes.WIN_HAMMING, 6.76)
        self.fractional_interpolator_xx_0 = filter.fractional_interpolator_ff(
            0, 44100 / a_src_freq)
        self.digital_qam_mod_0_1 = digital.qam.qam_mod(
            constellation_points=64,
            mod_code="gray",
            differential=True,
            samples_per_symbol=8,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_qam_mod_0_0 = digital.qam.qam_mod(
            constellation_points=16,
            mod_code="gray",
            differential=True,
            samples_per_symbol=8,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_psk_mod_1 = digital.psk.psk_mod(
            constellation_points=8,
            mod_code="gray",
            differential=True,
            samples_per_symbol=8,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_psk_mod_0_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="gray",
            differential=True,
            samples_per_symbol=8,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=4,
            mod_code="gray",
            differential=True,
            samples_per_symbol=8,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
            samples_per_symbol=8,
            sensitivity=0.1,
            bt=ebw_range,
            verbose=False,
            log=False,
        )
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=pam4_constellation,
            differential=True,
            samples_per_symbol=8,
            pre_diff_code=True,
            excess_bw=ebw_range,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_packed_to_unpacked_xx_1 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_LSB_FIRST)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff((0.1, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (1 + 1j, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, ))
        self.blks2_selector_1 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=2,
            num_outputs=1,
            input_index=noise_enable,
            output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=11,
            num_outputs=1,
            input_index=mod_select,
            output_index=0,
        )
        self.analog_wfm_tx_0 = analog.wfm_tx(
            audio_rate=44100,
            quad_rate=220500,
            tau=75e-6,
            max_dev=75e3,
        )
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, a_src_freq, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, a_src_freq, 1, 0)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 64, 8192)), True)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, noiseamp, 31415)
        self.analog_cpfsk_bc_0 = analog.cpfsk_bc(0.5, 1.0, 8)
        self.analog_const_source_x_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blks2_selector_1, 0))
        self.connect((self.analog_const_source_x_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_cpfsk_bc_0, 0), (self.blks2_selector_0, 7))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blks2_selector_1, 1))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_packed_to_unpacked_xx_1, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_wfm_tx_0, 0), (self.blks2_selector_0, 8))
        self.connect((self.blks2_selector_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blks2_selector_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blks2_selector_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1_0, 0),
                     (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blks2_selector_0, 9))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.analog_cpfsk_bc_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_psk_mod_0_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_psk_mod_1, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_qam_mod_0_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_qam_mod_0_1, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_1, 0),
                     (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blks2_selector_0, 5))
        self.connect((self.digital_gfsk_mod_0, 0), (self.blks2_selector_0, 6))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.digital_psk_mod_0_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.digital_psk_mod_1, 0), (self.blks2_selector_0, 2))
        self.connect((self.digital_qam_mod_0_0, 0), (self.blks2_selector_0, 3))
        self.connect((self.digital_qam_mod_0_1, 0), (self.blks2_selector_0, 4))
        self.connect((self.fractional_interpolator_xx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.fractional_interpolator_xx_0, 0),
                     (self.blocks_multiply_const_vxx_1_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blks2_selector_0, 10))
        self.connect((self.sig_source_0, 0), (self.analog_wfm_tx_0, 0))
        self.connect((self.sig_source_0, 0),
                     (self.fractional_interpolator_xx_0, 0))
Esempio n. 13
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Multi Tx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.audio_rate = audio_rate = 48000
        self.wpm = wpm = 15
        self.wbfm_on = wbfm_on = True
        self.usb_on = usb_on = True
        self.samp_rate = samp_rate = audio_rate * 40
        self.q_offset = q_offset = 0
        self.psk_on = psk_on = True
        self.phase = phase = 0
        self.nbfm_on = nbfm_on = True
        self.magnitude = magnitude = 0
        self.lsb_on = lsb_on = True
        self.i_offset = i_offset = 0
        self.gain = gain = 25
        self.cw_on = cw_on = True
        self.center_freq = center_freq = 441000000
        self.am_on = am_on = True

        ##################################################
        # Blocks
        ##################################################
        self._wbfm_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.wbfm_on,
        	callback=self.set_wbfm_on,
        	label="WBFM",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._wbfm_on_check_box, 4, 1, 1, 1)
        self._usb_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.usb_on,
        	callback=self.set_usb_on,
        	label="USB",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._usb_on_check_box, 4, 4, 1, 1)
        _q_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._q_offset_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_q_offset_sizer,
        	value=self.q_offset,
        	callback=self.set_q_offset,
        	label="DC offset Q",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._q_offset_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_q_offset_sizer,
        	value=self.q_offset,
        	callback=self.set_q_offset,
        	minimum=-0.1,
        	maximum=0.1,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_q_offset_sizer, 3, 0, 1, 7)
        self._psk_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.psk_on,
        	callback=self.set_psk_on,
        	label="PSK31",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._psk_on_check_box, 4, 6, 1, 1)
        _phase_sizer = wx.BoxSizer(wx.VERTICAL)
        self._phase_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_phase_sizer,
        	value=self.phase,
        	callback=self.set_phase,
        	label="Phase correction",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._phase_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_phase_sizer,
        	value=self.phase,
        	callback=self.set_phase,
        	minimum=-0.1,
        	maximum=0.1,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_phase_sizer, 0, 0, 1, 7)
        self._nbfm_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.nbfm_on,
        	callback=self.set_nbfm_on,
        	label="NBFM",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._nbfm_on_check_box, 4, 0, 1, 1)
        _magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._magnitude_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_magnitude_sizer,
        	value=self.magnitude,
        	callback=self.set_magnitude,
        	label="Magnitude correction",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._magnitude_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_magnitude_sizer,
        	value=self.magnitude,
        	callback=self.set_magnitude,
        	minimum=-0.1,
        	maximum=0.1,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_magnitude_sizer, 1, 0, 1, 7)
        self._lsb_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.lsb_on,
        	callback=self.set_lsb_on,
        	label="LSB",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._lsb_on_check_box, 4, 3, 1, 1)
        _i_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._i_offset_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_i_offset_sizer,
        	value=self.i_offset,
        	callback=self.set_i_offset,
        	label="DC offset I",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._i_offset_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_i_offset_sizer,
        	value=self.i_offset,
        	callback=self.set_i_offset,
        	minimum=-0.1,
        	maximum=0.1,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_i_offset_sizer, 2, 0, 1, 7)
        self._cw_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.cw_on,
        	callback=self.set_cw_on,
        	label="CW",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._cw_on_check_box, 4, 5, 1, 1)
        self._am_on_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.am_on,
        	callback=self.set_am_on,
        	label="AM",
        	true=True,
        	false=False,
        )
        self.GridAdd(self._am_on_check_box, 4, 2, 1, 1)
        self.root_raised_cosine_filter_1 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	1, audio_rate, 5, 0.35, 200))
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	1, audio_rate, 5, 0.35, 200))
        self.rational_resampler_xxx_3 = filter.rational_resampler_ccc(
                interpolation=192,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_2 = filter.rational_resampler_ccc(
                interpolation=samp_rate,
                decimation=audio_rate,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=samp_rate / audio_rate / 2,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=samp_rate / audio_rate / 4,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(gain, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.low_pass_filter_1 = filter.interp_fir_filter_ccf(1, firdes.low_pass(
        	0.5, audio_rate, 5000, 400, firdes.WIN_HAMMING, 6.76))
        self.iqbalance_fix_cc_0 = iqbalance.fix_cc(magnitude, phase)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=2,
          mod_code="none",
          differential=True,
          samples_per_symbol=8,
          excess_bw=0.35,
          verbose=False,
          log=False,
          )
        self.digital_map_bb_0 = digital.map_bb(([1,0]))
        self.blocks_wavfile_source_0 = blocks.wavfile_source("multi_tx.wav", True)
        self.blocks_vector_source_x_2 = blocks.vector_source_b((0,0, 1,1,0,1,1,0,1, 0,0, 1,0,1,0,1,1, 0,0, 1,1,0,1, 0,0, 1,0,1,1,1, 0,0, 1, 0,0, 1,1,0,1, 0,0, 1,0,1,1,1, 0,0, 1, 0,0, 1,1,0,1,1,0,1,0,1, 0,0, 1,1,1,0,1,1,1, 0,0, 1,1,1,1,1,1,1,1, 0,0, 1,1,1,1,1,1,1, 0,0, 1,0,1,0,1,1,1,1, 0,0, 1,0,1,0,1,1,1,1, 0,0, 1, 0,0, 1,0,1, 0,0, 1,1, 0,0, 1,0,1,1,1, 0,0, 1,0,1, 0,0, 1,1,0,1, 0,0, 1,1,1,1, 0,0, 1,0,1,1,0,1,1, 0,0, 1,0,1,0,1,1,1, 0,0, 1,1,1,0,1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_c((1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0,0,0,0,0, 1,1,1,0,1,0,1, 0,0,0, 1, 0,0,0,0,0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1,0,1,1,1,0,1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0,0,0,0,0, 1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1, 0,0,0, 1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,1,1,0,1, 0,0,0, 1,1,1,0,1,1,1,0,1, 0,0,0,0,0,0,0), True, 1, [])
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, int(1.2 * audio_rate / wpm))
        self.blocks_multiply_xx_6 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_5 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_4 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vcc((i_offset + 1j * q_offset, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.5, ))
        self.band_pass_filter_0_0 = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass(
        	1, audio_rate, -2800, -200, 200, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass(
        	1, audio_rate, 200, 2800, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_tx_0 = analog.wfm_tx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate * 4,
        	tau=75e-6,
        	max_dev=75e3,
        )
        self.analog_sig_source_x_6 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 22000, 1 if psk_on else 0, 0)
        self.analog_sig_source_x_5 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 20000, 1 if cw_on else 0, 0)
        self.analog_sig_source_x_4 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 120000, 1.0 / 7, 0)
        self.analog_sig_source_x_3_0 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 11000, 1.8 if lsb_on else 0, 0)
        self.analog_sig_source_x_3 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 14000, 1.8 if usb_on else 0, 0)
        self.analog_sig_source_x_2 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0)
        self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 0, 1.0 / 7 if wbfm_on else 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -100000, 1.0 / 7 if nbfm_on else 0, 0)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate * 2,
        	tau=75e-6,
        	max_dev=5e3,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0))
        self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_2, 1))
        self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.rational_resampler_xxx_2, 0))
        self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_4, 0), (self.blocks_multiply_xx_4, 1))
        self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_xx_4, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_sig_source_x_3_0, 0), (self.blocks_multiply_xx_3_0, 1))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_3_0, 0))
        self.connect((self.blocks_multiply_xx_3_0, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_3, 0))
        self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_3, 1))
        self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_1, 2))
        self.connect((self.blocks_add_xx_0, 0), (self.iqbalance_fix_cc_0, 0))
        self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_1, 3))
        self.connect((self.analog_sig_source_x_5, 0), (self.blocks_multiply_xx_5, 1))
        self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_multiply_xx_5, 0))
        self.connect((self.analog_sig_source_x_6, 0), (self.blocks_multiply_xx_6, 1))
        self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_1, 4))
        self.connect((self.rational_resampler_xxx_3, 0), (self.blocks_multiply_xx_6, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.rational_resampler_xxx_3, 0))
        self.connect((self.blocks_vector_source_x_2, 0), (self.digital_map_bb_0, 0))
        self.connect((self.digital_map_bb_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.root_raised_cosine_filter_1, 0))
        self.connect((self.root_raised_cosine_filter_1, 0), (self.root_raised_cosine_filter_0, 0))
        self.connect((self.iqbalance_fix_cc_0, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
Esempio n. 14
0
    def test_add_const_vcc_five(self):
	src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
	op = blocks.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
	exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j)
	self.help_const_cc(src_data, exp_data, op)
Esempio n. 15
0
    def test_add_const_vcc_one(self):
	src_data = (1.0+2.0j,)
	op = blocks.add_const_vcc((2.0+3.0j,))
	exp_data = (3.0+5.0j,)
	self.help_const_cc(src_data, exp_data, op)
Esempio n. 16
0
    def __init__(self):
        gr.top_block.__init__(self, "Pal Transmit")

        ##################################################
        # Variables
        ##################################################
        self.samp_visual = samp_visual = 702
        self.samp_rate = samp_rate = samp_visual / (52e-6)
        self.samp_line = samp_line = int((64e-6) * samp_rate)
        self.sub_freq = sub_freq = 4433618.75
        self.samp_visual_delay = samp_visual_delay = int(2.5 / 64 * samp_line)
        self.samp_h_sync = samp_h_sync = int(4.7 / 64 * samp_line)
        self.samp_burst_delay = samp_burst_delay = int(0.9 / 64 * samp_line)
        self.samp_burst = samp_burst = int(2.25 / 64 * samp_line)
        self.rf_gain = rf_gain = 14
        self.lines_visual = lines_visual = 576
        self.lines_half_frame = lines_half_frame = 305
        self.level_blank = level_blank = 0.285
        self.level_black = level_black = 0.339
        self.if_gain = if_gain = 48

        ##################################################
        # Blocks
        ##################################################
        self.stdin = blocks.file_source(gr.sizeof_char * 1, '/dev/stdin',
                                        False)
        self.stdin.set_begin_tag(pmt.PMT_NIL)
        self.short_sync_pulse_0_3_0_1 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0_0_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.osmosdr_sink_0_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                             'hackrf=0')
        self.osmosdr_sink_0_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0_0.set_center_freq(55e6, 0)
        self.osmosdr_sink_0_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0_0.set_bb_gain(24, 0)
        self.osmosdr_sink_0_0.set_antenna('', 0)
        self.osmosdr_sink_0_0.set_bandwidth(0, 0)

        self.long_sync_pulse_0_0 = long_sync_pulse(samp_line=samp_line / 2, )
        self.long_sync_pulse_0 = long_sync_pulse(samp_line=samp_line / 2, )
        self.blocks_vector_to_stream_2_1_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_vector_to_stream_2_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_vector_to_stream_2_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_2 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1_1 = blocks.vector_to_stream(
            gr.sizeof_float * samp_visual, 3 * lines_visual)
        self.blocks_vector_to_stream_1_0_1 = blocks.vector_to_stream(
            gr.sizeof_float * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1_0 = blocks.vector_to_stream(
            gr.sizeof_float * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1 = blocks.vector_to_stream(
            gr.sizeof_float * samp_visual, 3 * lines_visual)
        self.blocks_vector_to_stream_0_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_line)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_sub_xx_0 = blocks.sub_cc(1)
        self.blocks_stream_to_vector_1_0_0_1_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * samp_visual, lines_half_frame)
        self.blocks_stream_to_vector_1_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * samp_visual, lines_half_frame)
        self.blocks_stream_to_vector_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, 3 * samp_visual * lines_visual)
        self.blocks_stream_to_vector_0_1_1_2_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_2 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_1 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_0_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_stream_to_streams_2 = blocks.stream_to_streams(
            gr.sizeof_gr_complex * samp_visual, 2)
        self.blocks_stream_to_streams_1 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual * lines_visual * 3, 2)
        self.blocks_stream_to_streams_0_0_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual, 2)
        self.blocks_stream_to_streams_0_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual, 2)
        self.blocks_stream_to_streams_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * lines_half_frame * samp_visual, 3)
        self.blocks_stream_to_streams_0 = blocks.stream_to_streams(
            gr.sizeof_float * lines_half_frame * samp_visual, 3)
        self.blocks_stream_mux_4 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_burst, (8, 305, 7, 305))
        self.blocks_stream_mux_3_0 = blocks.stream_mux(
            gr.sizeof_float * 702, (9, lines_visual / 2, 8))
        self.blocks_stream_mux_3 = blocks.stream_mux(gr.sizeof_float * 702,
                                                     (8, lines_visual / 2, 9))
        self.blocks_stream_mux_2_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync + samp_burst_delay, samp_burst, samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_2_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync, samp_burst_delay + samp_burst + samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_2 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync, samp_burst_delay + samp_burst + samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_1_1_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_visual, (8, 305, 7, 305))
        self.blocks_stream_mux_1_0_0_0_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_burst, (1, 1))
        self.blocks_stream_mux_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_line / 2,
            (6, 5, 5, 2 * 305, 5, 5, 4, 2 * 305))
        self.blocks_stream_mux_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1, (samp_visual, samp_visual))
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float *
                                                     samp_visual)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float *
                                                   samp_visual)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(samp_burst)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (0.00390625 / 2, ))
        self.blocks_float_to_complex_1_0 = blocks.float_to_complex(
            lines_half_frame * samp_visual)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(
            lines_half_frame * samp_visual)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vcc((level_black, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((level_black, ))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 4433618.75, 0.68, 0)
        self.analog_const_source_x_3_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)
        self.analog_const_source_x_3_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)
        self.analog_const_source_x_3_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_3 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_2 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_0_1 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_2_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, (-1 + 1j) / sqrt(2))
        self.analog_const_source_x_0_0_1_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, (-1 - 1j) / sqrt(2))
        self.analog_const_source_x_0_0_0_0_0_1_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_1_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_1 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1, 0),
                     (self.blocks_stream_mux_2_1, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1_0, 0),
                     (self.blocks_stream_mux_2_1, 4))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1_0_0, 0),
                     (self.blocks_stream_mux_2_1, 2))
        self.connect((self.analog_const_source_x_0_0_1_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_2_0, 0))
        self.connect((self.analog_const_source_x_0_0_2_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_2, 0))
        self.connect((self.analog_const_source_x_0_0_3, 0),
                     (self.blocks_stream_mux_2, 0))
        self.connect((self.analog_const_source_x_0_0_3_0, 0),
                     (self.blocks_stream_mux_2, 1))
        self.connect((self.analog_const_source_x_0_0_3_0_0, 0),
                     (self.blocks_stream_mux_2, 3))
        self.connect((self.analog_const_source_x_0_0_3_0_0_0, 0),
                     (self.blocks_stream_mux_2_0, 3))
        self.connect((self.analog_const_source_x_0_0_3_0_1, 0),
                     (self.blocks_stream_mux_2_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1_0, 0),
                     (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1_1, 0),
                     (self.blocks_stream_to_vector_1_0_0_1, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_0, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_0_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_1, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_1, 0))
        self.connect((self.analog_const_source_x_0_0_3_2, 0),
                     (self.blocks_stream_mux_2_0, 0))
        self.connect((self.analog_const_source_x_3, 0),
                     (self.blocks_stream_to_vector_0_1_1, 0))
        self.connect((self.analog_const_source_x_3_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_0, 0))
        self.connect((self.analog_const_source_x_3_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_1, 0))
        self.connect((self.analog_const_source_x_3_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_stream_mux_2, 2))
        self.connect((self.blocks_add_const_vxx_0_0, 0),
                     (self.blocks_stream_mux_2_0, 2))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_stream_to_vector_0_0_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_stream_mux_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_vector_to_stream_2, 0))
        self.connect((self.blocks_float_to_complex_1_0, 0),
                     (self.blocks_vector_to_stream_2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_stream_to_vector_1_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_2, 0),
                     (self.blocks_vector_to_stream_0_1, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.blocks_stream_mux_2_1, 3))
        self.connect((self.blocks_stream_mux_1, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_stream_mux_1_0_0_0_1, 0),
                     (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_stream_mux_1_1_0, 0),
                     (self.blocks_stream_to_streams_2, 0))
        self.connect((self.blocks_stream_mux_2, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_stream_mux_2_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.blocks_stream_mux_2_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_stream_mux_3, 0),
                     (self.blocks_stream_to_vector_1_0_0_0, 0))
        self.connect((self.blocks_stream_mux_3_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_0_0, 0))
        self.connect((self.blocks_stream_mux_4, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_stream_to_streams_0, 1),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_stream_to_streams_0, 2),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_stream_to_streams_0, 0),
                     (self.blocks_vector_to_stream_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0, 1),
                     (self.blocks_float_to_complex_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0, 2),
                     (self.blocks_float_to_complex_1_0, 1))
        self.connect((self.blocks_stream_to_streams_0_0, 0),
                     (self.blocks_vector_to_stream_1_0_1, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0, 1),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0, 0),
                     (self.blocks_stream_mux_3, 1))
        self.connect((self.blocks_stream_to_streams_0_0_0_0, 0),
                     (self.blocks_null_sink_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0_0, 1),
                     (self.blocks_stream_mux_3_0, 1))
        self.connect((self.blocks_stream_to_streams_1, 0),
                     (self.blocks_vector_to_stream_1, 0))
        self.connect((self.blocks_stream_to_streams_1, 1),
                     (self.blocks_vector_to_stream_1_1, 0))
        self.connect((self.blocks_stream_to_streams_2, 1),
                     (self.blocks_vector_to_stream_2_1, 0))
        self.connect((self.blocks_stream_to_streams_2, 0),
                     (self.blocks_vector_to_stream_2_1_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_stream_mux_1, 3))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.blocks_stream_mux_1, 7))
        self.connect((self.blocks_stream_to_vector_0_0_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 3))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 1))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 2))
        self.connect((self.blocks_stream_to_vector_0_1_1, 0),
                     (self.blocks_stream_mux_4, 0))
        self.connect((self.blocks_stream_to_vector_0_1_1_0, 0),
                     (self.blocks_stream_mux_4, 2))
        self.connect((self.blocks_stream_to_vector_0_1_1_0_0, 0),
                     (self.blocks_stream_mux_4, 3))
        self.connect((self.blocks_stream_to_vector_0_1_1_1, 0),
                     (self.blocks_stream_mux_4, 1))
        self.connect((self.blocks_stream_to_vector_0_1_1_2, 0),
                     (self.blocks_stream_mux_1_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_vector_0_1_1_2_0, 0),
                     (self.blocks_stream_mux_1_0_0_0_1, 1))
        self.connect((self.blocks_stream_to_vector_1_0_0, 0),
                     (self.blocks_stream_to_streams_1, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_0, 0),
                     (self.blocks_stream_to_streams_0, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_0_0, 0),
                     (self.blocks_stream_to_streams_0_0, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_1, 0),
                     (self.blocks_stream_mux_3, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_0, 0),
                     (self.blocks_stream_mux_3, 2))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_0_0, 0),
                     (self.blocks_stream_mux_3_0, 2))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_1, 0),
                     (self.blocks_stream_mux_3_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.osmosdr_sink_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0_1, 0),
                     (self.blocks_stream_mux_2_1, 1))
        self.connect((self.blocks_vector_to_stream_1, 0),
                     (self.blocks_stream_to_streams_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0_1, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_vector_to_stream_1_1, 0),
                     (self.blocks_stream_to_streams_0_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2_1, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_vector_to_stream_2_1_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.long_sync_pulse_0, 0),
                     (self.blocks_stream_mux_1, 1))
        self.connect((self.long_sync_pulse_0_0, 0),
                     (self.blocks_stream_mux_1, 5))
        self.connect((self.short_sync_pulse_0_3_0, 0),
                     (self.blocks_stream_mux_1, 0))
        self.connect((self.short_sync_pulse_0_3_0_0, 0),
                     (self.blocks_stream_mux_1, 2))
        self.connect((self.short_sync_pulse_0_3_0_0_0, 0),
                     (self.blocks_stream_mux_1, 6))
        self.connect((self.short_sync_pulse_0_3_0_1, 0),
                     (self.blocks_stream_mux_1, 4))
        self.connect((self.stdin, 0), (self.blocks_uchar_to_float_0, 0))
Esempio n. 17
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Multi Tx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.audio_rate = audio_rate = 48000
        self.wpm = wpm = 15
        self.wbfm_on = wbfm_on = True
        self.usb_on = usb_on = True
        self.samp_rate = samp_rate = audio_rate * 40
        self.q_offset = q_offset = 0
        self.psk_on = psk_on = True
        self.phase = phase = 0
        self.nbfm_on = nbfm_on = True
        self.magnitude = magnitude = 0
        self.lsb_on = lsb_on = True
        self.i_offset = i_offset = 0
        self.gain = gain = 25
        self.cw_on = cw_on = True
        self.center_freq = center_freq = 441000000
        self.am_on = am_on = True

        ##################################################
        # Blocks
        ##################################################
        self._wbfm_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.wbfm_on,
            callback=self.set_wbfm_on,
            label="WBFM",
            true=True,
            false=False,
        )
        self.GridAdd(self._wbfm_on_check_box, 4, 1, 1, 1)
        self._usb_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.usb_on,
            callback=self.set_usb_on,
            label="USB",
            true=True,
            false=False,
        )
        self.GridAdd(self._usb_on_check_box, 4, 4, 1, 1)
        _q_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._q_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_q_offset_sizer,
            value=self.q_offset,
            callback=self.set_q_offset,
            label="DC offset Q",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._q_offset_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_q_offset_sizer,
            value=self.q_offset,
            callback=self.set_q_offset,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_q_offset_sizer, 3, 0, 1, 7)
        self._psk_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.psk_on,
            callback=self.set_psk_on,
            label="PSK31",
            true=True,
            false=False,
        )
        self.GridAdd(self._psk_on_check_box, 4, 6, 1, 1)
        _phase_sizer = wx.BoxSizer(wx.VERTICAL)
        self._phase_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_phase_sizer,
            value=self.phase,
            callback=self.set_phase,
            label="Phase correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._phase_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_phase_sizer,
            value=self.phase,
            callback=self.set_phase,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_phase_sizer, 0, 0, 1, 7)
        self._nbfm_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.nbfm_on,
            callback=self.set_nbfm_on,
            label="NBFM",
            true=True,
            false=False,
        )
        self.GridAdd(self._nbfm_on_check_box, 4, 0, 1, 1)
        _magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._magnitude_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            label="Magnitude correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._magnitude_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_magnitude_sizer, 1, 0, 1, 7)
        self._lsb_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.lsb_on,
            callback=self.set_lsb_on,
            label="LSB",
            true=True,
            false=False,
        )
        self.GridAdd(self._lsb_on_check_box, 4, 3, 1, 1)
        _i_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._i_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_i_offset_sizer,
            value=self.i_offset,
            callback=self.set_i_offset,
            label="DC offset I",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._i_offset_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_i_offset_sizer,
            value=self.i_offset,
            callback=self.set_i_offset,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_i_offset_sizer, 2, 0, 1, 7)
        self._cw_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.cw_on,
            callback=self.set_cw_on,
            label="CW",
            true=True,
            false=False,
        )
        self.GridAdd(self._cw_on_check_box, 4, 5, 1, 1)
        self._am_on_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.am_on,
            callback=self.set_am_on,
            label="AM",
            true=True,
            false=False,
        )
        self.GridAdd(self._am_on_check_box, 4, 2, 1, 1)
        self.root_raised_cosine_filter_1 = filter.fir_filter_ccf(
            1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200))
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(
            1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200))
        self.rational_resampler_xxx_3 = filter.rational_resampler_ccc(
            interpolation=192,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_2 = filter.rational_resampler_ccc(
            interpolation=samp_rate,
            decimation=audio_rate,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=samp_rate / audio_rate / 2,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=samp_rate / audio_rate / 4,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "")
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(gain, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)

        self.low_pass_filter_1 = filter.interp_fir_filter_ccf(
            1,
            firdes.low_pass(0.5, audio_rate, 5000, 400, firdes.WIN_HAMMING,
                            6.76))
        self.iqbalance_fix_cc_0 = iqbalance.fix_cc(magnitude, phase)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="none",
            differential=True,
            samples_per_symbol=8,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.digital_map_bb_0 = digital.map_bb(([1, 0]))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "multi_tx.wav", True)
        self.blocks_vector_source_x_2 = blocks.vector_source_b(
            (0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0,
             1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1,
             1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0,
             1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,
             0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0,
             1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1,
             0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0,
             0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            (1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0,
             0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
             1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1,
             1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0,
             0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1,
             1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
             1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0,
             1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0), True,
            1, [])
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                             int(1.2 * audio_rate / wpm))
        self.blocks_multiply_xx_6 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_5 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_4 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vcc(
            (i_offset + 1j * q_offset, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.5, ))
        self.band_pass_filter_0_0 = filter.interp_fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, audio_rate, -2800, -200, 200,
                                     firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.interp_fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, audio_rate, 200, 2800, 200,
                                     firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_tx_0 = analog.wfm_tx(
            audio_rate=audio_rate,
            quad_rate=audio_rate * 4,
            tau=75e-6,
            max_dev=75e3,
        )
        self.analog_sig_source_x_6 = analog.sig_source_c(
            audio_rate, analog.GR_COS_WAVE, 22000, 1 if psk_on else 0, 0)
        self.analog_sig_source_x_5 = analog.sig_source_c(
            audio_rate, analog.GR_COS_WAVE, 20000, 1 if cw_on else 0, 0)
        self.analog_sig_source_x_4 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 120000, 1.0 / 7, 0)
        self.analog_sig_source_x_3_0 = analog.sig_source_c(
            audio_rate, analog.GR_COS_WAVE, 11000, 1.8 if lsb_on else 0, 0)
        self.analog_sig_source_x_3 = analog.sig_source_c(
            audio_rate, analog.GR_COS_WAVE, 14000, 1.8 if usb_on else 0, 0)
        self.analog_sig_source_x_2 = analog.sig_source_c(
            audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 0, 1.0 / 7 if wbfm_on else 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -100000, 1.0 / 7 if nbfm_on else 0,
            0)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=audio_rate,
            quad_rate=audio_rate * 2,
            tau=75e-6,
            max_dev=5e3,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.analog_nbfm_tx_0, 0))
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_tx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.analog_wfm_tx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_2, 0))
        self.connect((self.analog_sig_source_x_2, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.low_pass_filter_1, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_4, 0),
                     (self.blocks_multiply_xx_4, 1))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_multiply_xx_4, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_sig_source_x_3_0, 0),
                     (self.blocks_multiply_xx_3_0, 1))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 0))
        self.connect((self.blocks_multiply_xx_3_0, 0),
                     (self.blocks_add_xx_1, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_3, 0))
        self.connect((self.analog_sig_source_x_3, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_1, 2))
        self.connect((self.blocks_add_xx_0, 0), (self.iqbalance_fix_cc_0, 0))
        self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_1, 3))
        self.connect((self.analog_sig_source_x_5, 0),
                     (self.blocks_multiply_xx_5, 1))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.blocks_multiply_xx_5, 0))
        self.connect((self.analog_sig_source_x_6, 0),
                     (self.blocks_multiply_xx_6, 1))
        self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_1, 4))
        self.connect((self.rational_resampler_xxx_3, 0),
                     (self.blocks_multiply_xx_6, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.rational_resampler_xxx_3, 0))
        self.connect((self.blocks_vector_source_x_2, 0),
                     (self.digital_map_bb_0, 0))
        self.connect((self.digital_map_bb_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.blocks_repeat_0, 0),
                     (self.root_raised_cosine_filter_1, 0))
        self.connect((self.root_raised_cosine_filter_1, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.iqbalance_fix_cc_0, 0),
                     (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_add_const_vxx_1, 0),
                     (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.band_pass_filter_0, 0))
Esempio n. 18
0
    def __init__(self):
        gr.top_block.__init__(self, "RX logic")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 192000
        self.mode = mode = 2
        self.bw = bw = 3200
        self.aud_rate = aud_rate = 22050
        self.visualsq = visualsq = 1
        self.st = st = 1
        self.sq = sq = -700
        self.sb_pos = sb_pos = ((bw*mode==2)-(bw*mode==3))
        self.rec = rec = 1
        self.laj_0 = laj_0 = 0
        self.laj = laj = 0
        self.lai_0 = lai_0 = 0
        self.lai = lai = 0
        self.freq = freq = 98500000
        self.device = device = "fcd=0,type=2"
        self.dev = dev = 19000
        self.decimation = decimation = samp_rate/aud_rate
        self.batswitch = batswitch = 0
        self.batido = batido = 2950
        self.VEC = VEC = 1280

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="nchan=" + str(1) + " " + device )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(7, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(0, 0)
        self.rtlsdr_source_0.set_gain(14, 0)
        self.rtlsdr_source_0.set_if_gain(14, 0)
        self.rtlsdr_source_0.set_bb_gain(14, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.probe_st = analog.probe_avg_mag_sqrd_f(10, 1)
        self.low_pass_filter_0_2 = filter.fir_filter_ccf(decimation, firdes.low_pass(
        	1, samp_rate, bw*(2+(mode==2)+(mode==3)), 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	30, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	visualsq, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.fractional_resampler_xx_0_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_ff(0, (samp_rate/decimation)/48000.0)
        self.fft_vxx_0 = fft.fft_vcc(VEC, True, (window.blackmanharris(1024)), True, 1)
        self.fft_probe = blocks.probe_signal_vf(VEC)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/tmp/CAPTURE.WAV", 2, 48000, 16)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, VEC)
        self.blocks_multiply_xx_0_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0_0_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(VEC)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-complex(lai,laj), ))
        self.blks2_valve_0_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_valve_0_0_1 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=5))
        self.blks2_valve_0_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(0))
        self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=4))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_selector_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=(mode==3),
        	output_index=0,
        )
        self.blks2_selector_0_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0_1 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=4,
        	num_outputs=1,
        	input_index=mode,
        	output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=1,
        	num_outputs=4,
        	input_index=0,
        	output_index=mode,
        )
        self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	250, samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	120, samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "dmix:CARD=Pro,DEV=0", False)
        self.analog_wfm_rcv_1 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=1,
        )
        self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate/decimation, analog.GR_COS_WAVE, -bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, dev+(bw*mode==2)+(bw*mode==3), 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.25)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
        	channel_rate=samp_rate,
        	audio_decim=samp_rate/48000,
        	deviation=50000,
        	audio_pass=15000,
        	audio_stop=16000,
        	gain=3.0,
        	tau=50e-6,
        )
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(64, 0.9)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=samp_rate/decimation,
        	audio_decim=samp_rate/decimation/aud_rate,
        	audio_pass=(samp_rate/decimation/2)-500,
        	audio_stop=(samp_rate/decimation/2)-100,
        )
        self.analog_agc3_xx_0 = analog.agc3_cc(0.0001, 0.0001, 0.9, 0.1)
        self.analog_agc3_xx_0.set_max_gain(200)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.fft_probe, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_valve_0_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_deemph_0, 0))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.low_pass_filter_0_1, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.low_pass_filter_0_1_0_0_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.analog_agc3_xx_0, 0), (self.analog_wfm_rcv_1, 0))
        self.connect((self.blks2_valve_0_0_1, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_1, 0))
        self.connect((self.blocks_multiply_xx_0_1_0, 0), (self.low_pass_filter_0_1_0_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 2))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.fractional_resampler_xx_0_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fractional_resampler_xx_0_0, 0))
        self.connect((self.blks2_valve_0_0, 0), (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_2, 0))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 3))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 2))
        self.connect((self.blks2_selector_0_1_0, 0), (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_complex_to_real_0_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.analog_am_demod_cf_0, 0), (self.blks2_selector_0_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blks2_selector_0_0, 1))
        self.connect((self.blks2_selector_0, 1), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blks2_selector_0_0, 0), (self.low_pass_filter_0_0_0_0, 0))
        self.connect((self.blks2_selector_0, 2), (self.high_pass_filter_0, 0))
        self.connect((self.blks2_selector_0, 3), (self.low_pass_filter_0_0_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.blks2_selector_0_1_0, 0))
        self.connect((self.low_pass_filter_0_0_0, 0), (self.blks2_selector_0_1_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1_0, 1))
        self.connect((self.fractional_resampler_xx_0_0_0, 0), (self.blks2_selector_0_0_1_0, 2))
        self.connect((self.fractional_resampler_xx_0_0, 0), (self.blks2_selector_0_0_1, 2))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.audio_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_valve_0, 0), (self.blocks_wavfile_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.blks2_valve_0, 0))
        self.connect((self.blks2_selector_0_0_1, 0), (self.blks2_valve_0_1, 0))
        self.connect((self.blks2_valve_0_1, 0), (self.blocks_wavfile_sink_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1, 0))
        self.connect((self.low_pass_filter_0_2, 0), (self.analog_feedforward_agc_cc_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0_0_0_0, 0), (self.fractional_resampler_xx_0, 0))
        self.connect((self.analog_feedforward_agc_cc_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.probe_st, 0))
Esempio n. 19
0
    def __init__(self):
        gr.top_block.__init__(self, "Lang Tx")

        ##################################################
        # Variables
        ##################################################
        plutoip = os.environ.get('PLUTO_IP')
        if plutoip == None:
            plutoip = 'pluto.local'
        plutoip = 'ip:' + plutoip
        self.ToneBurst = ToneBurst = False
        self.PTT = PTT = False
        self.Mode = Mode = 0
        self.MicGain = MicGain = 5.0
        self.KEY = KEY = False
        self.Filt_Low = Filt_Low = 300
        self.Filt_High = Filt_High = 3000
        self.FMMIC = FMMIC = 50
        self.FFTEn = FFTEn = 0

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=11,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.pluto_sink_0 = iio.pluto_sink(plutoip, 1000000000, 528000,
                                           2000000, 0x800, False, 0, '', True)
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
            sample_rate=48000,
            fft_size=512,
            ref_scale=2,
            frame_rate=15,
            avg_alpha=0.9,
            average=True,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_float * 512,
                                                 '127.0.0.1', 7374, 1472,
                                                 False)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 512)
        self.blocks_mute_xx_0_0 = blocks.mute_cc(bool(not PTT))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_4 = blocks.multiply_const_vcc(
            ((Mode < 4) or (Mode == 5), ))
        self.blocks_multiply_const_vxx_3 = blocks.multiply_const_vcc(
            (Mode == 4, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (FMMIC / 5.0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            ((MicGain / 10.0) * (not (Mode == 2)) * (not (Mode == 3)), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_xx_2 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc(
            ((0.5 * int(Mode == 5)) + (int(Mode == 2) * KEY) +
             (int(Mode == 3) * KEY), ))
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_float * 512,
            num_inputs=1,
            num_outputs=2,
            input_index=0,
            output_index=FFTEn,
        )
        self.band_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 200, 3500, 100, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, 48000, Filt_Low, Filt_High, 100,
                                     firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "hw:CARD=Device,DEV=0",
                                           False)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            48000, analog.GR_COS_WAVE, 1750, 1.0 * ToneBurst, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            48000, analog.GR_COS_WAVE, 0, 1, 0)
        self.analog_rail_ff_0 = analog.rail_ff(-1, 1)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=48000,
            quad_rate=48000,
            tau=1000e-6,
            max_dev=250,
            fh=-1,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-1,
                                               1.3 - (0.65 * (int(Mode == 5))),
                                               1.0)
        self.analog_agc2_xx_1.set_max_gain(10)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_1, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_3, 0))
        self.connect((self.analog_rail_ff_0, 0), (self.band_pass_filter_1, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.blocks_multiply_const_vxx_4, 0))
        self.connect((self.band_pass_filter_1, 0), (self.analog_nbfm_tx_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.blks2_selector_0, 1), (self.blocks_udp_sink_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.analog_rail_ff_0, 0))
        self.connect((self.blocks_add_xx_2, 0), (self.logpwrfft_x_0, 0))
        self.connect((self.blocks_add_xx_2, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_4, 0),
                     (self.blocks_add_xx_2, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.analog_agc2_xx_1, 0))
        self.connect((self.blocks_mute_xx_0_0, 0), (self.pluto_sink_0, 0))
        self.connect((self.logpwrfft_x_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_mute_xx_0_0, 0))
Esempio n. 20
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.excess_bw = excess_bw = 0.35
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(1, sps, 1, excess_bw, 45)
        self.qpsk = qpsk = digital.constellation_rect(([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base()

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
        	200, #size
        	samp_rate, #samp_rate
        	'', #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-2, 2)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
          self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['Re{Unfiltered}', 'Im{Unfiltered}', 'Re{Filtered Square}', 'Im{Filtered Square}', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "cyan", "magenta", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [0.5, 0.5, 0.5, 0.5, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(4):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	'', #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-150, 0)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['Unfiltered', 'Filtered Square', '', '', '',
                  '', '', '', '', '']
        widths = [2, 2, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [0.6, 0.6, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024*4, #size
        	'', #name
        	2 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
          self.qtgui_const_sink_x_0.disable_legend()

        labels = ['Unfiltered', 'Filtered Square', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [0.75, 0.5, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.digital_constellation_modulator_0 = digital.generic_mod(
          constellation=qpsk,
          differential=True,
          samples_per_symbol=sps,
          pre_diff_code=True,
          excess_bw=excess_bw,
          verbose=False,
          log=False,
          )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_threshold_ff_1 = blocks.threshold_ff(-0.6, 0.6, 0)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.6, 0.6, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((2, ))
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_float_to_complex_2 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, 'C:\\Users\\Jason Zhou\\Documents\\GitHub\\EE470FinalProject\\Test.txt', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-0.5-0.5j, ))
        self.asc_2_sym_1 = asc_2_sym(
            a_bpsym=2,
            b_eds=1,
            c_pol=0,
            d_inv=0,
            e_true_asc=0,
        )



        ##################################################
        # Connections
        ##################################################
        self.connect((self.asc_2_sym_1, 0), (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_threshold_ff_1, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_2, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_uchar_0, 0), (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_const_sink_x_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_freq_sink_x_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_complex_2, 0))
        self.connect((self.blocks_threshold_ff_1, 0), (self.blocks_float_to_complex_2, 1))
        self.connect((self.blocks_throttle_0, 0), (self.asc_2_sym_1, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0_0, 0))
Esempio n. 21
0
    def __init__(self):
        gr.top_block.__init__(self, "Multitransmit for RpiTX")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Multitransmit for RpiTX")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "gr_multitransmit_rpitx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.wfm_on = wfm_on = False
        self.usb_on = usb_on = False
        self.test_tone_frequency = test_tone_frequency = 1000
        self.rpitx_frequency_correction = rpitx_frequency_correction = 0
        self.ptt_lock = ptt_lock = False
        self.ptt = ptt = False
        self.nfm_on = nfm_on = False
        self.lsb_on = lsb_on = False
        self.low_frequency_cutoff = low_frequency_cutoff = 200
        self.high_frequency_cutoff = high_frequency_cutoff = 2500
        self.enable_tone = enable_tone = False
        self.enable_test_tone = enable_test_tone = False
        self.ctcss_tone = ctcss_tone = 100
        self.audio_rate = audio_rate = 48000
        self.am_on = am_on = False

        ##################################################
        # Blocks
        ##################################################
        _wfm_on_check_box = Qt.QCheckBox('WFM')
        self._wfm_on_choices = {True: True, False: False}
        self._wfm_on_choices_inv = dict((v,k) for k,v in self._wfm_on_choices.iteritems())
        self._wfm_on_callback = lambda i: Qt.QMetaObject.invokeMethod(_wfm_on_check_box, "setChecked", Qt.Q_ARG("bool", self._wfm_on_choices_inv[i]))
        self._wfm_on_callback(self.wfm_on)
        _wfm_on_check_box.stateChanged.connect(lambda i: self.set_wfm_on(self._wfm_on_choices[bool(i)]))
        self.top_grid_layout.addWidget(_wfm_on_check_box, 4,0)
        _usb_on_check_box = Qt.QCheckBox('USB')
        self._usb_on_choices = {True: True, False: False}
        self._usb_on_choices_inv = dict((v,k) for k,v in self._usb_on_choices.iteritems())
        self._usb_on_callback = lambda i: Qt.QMetaObject.invokeMethod(_usb_on_check_box, "setChecked", Qt.Q_ARG("bool", self._usb_on_choices_inv[i]))
        self._usb_on_callback(self.usb_on)
        _usb_on_check_box.stateChanged.connect(lambda i: self.set_usb_on(self._usb_on_choices[bool(i)]))
        self.top_grid_layout.addWidget(_usb_on_check_box, 5,0)
        self._test_tone_frequency_range = Range(0, audio_rate, 1, 1000, 200)
        self._test_tone_frequency_win = RangeWidget(self._test_tone_frequency_range, self.set_test_tone_frequency, 'Tone Frequency', "counter", float)
        self.top_grid_layout.addWidget(self._test_tone_frequency_win, 11,1)
        self._rpitx_frequency_correction_range = Range(-24, 24, .1, 0, 200)
        self._rpitx_frequency_correction_win = RangeWidget(self._rpitx_frequency_correction_range, self.set_rpitx_frequency_correction, 'RpiTX Frequency Correction', "counter_slider", float)
        self.top_grid_layout.addWidget(self._rpitx_frequency_correction_win, 13,0)
        _ptt_lock_check_box = Qt.QCheckBox('PTT Lock')
        self._ptt_lock_choices = {True: True, False: False}
        self._ptt_lock_choices_inv = dict((v,k) for k,v in self._ptt_lock_choices.iteritems())
        self._ptt_lock_callback = lambda i: Qt.QMetaObject.invokeMethod(_ptt_lock_check_box, "setChecked", Qt.Q_ARG("bool", self._ptt_lock_choices_inv[i]))
        self._ptt_lock_callback(self.ptt_lock)
        _ptt_lock_check_box.stateChanged.connect(lambda i: self.set_ptt_lock(self._ptt_lock_choices[bool(i)]))
        self.top_grid_layout.addWidget(_ptt_lock_check_box, 0,1)
        _ptt_push_button = Qt.QPushButton('Push To Talk')
        self._ptt_choices = {'Pressed': True, 'Released': False}
        _ptt_push_button.pressed.connect(lambda: self.set_ptt(self._ptt_choices['Pressed']))
        _ptt_push_button.released.connect(lambda: self.set_ptt(self._ptt_choices['Released']))
        self.top_grid_layout.addWidget(_ptt_push_button, 0,0)
        _nfm_on_check_box = Qt.QCheckBox('NFM')
        self._nfm_on_choices = {True: True, False: False}
        self._nfm_on_choices_inv = dict((v,k) for k,v in self._nfm_on_choices.iteritems())
        self._nfm_on_callback = lambda i: Qt.QMetaObject.invokeMethod(_nfm_on_check_box, "setChecked", Qt.Q_ARG("bool", self._nfm_on_choices_inv[i]))
        self._nfm_on_callback(self.nfm_on)
        _nfm_on_check_box.stateChanged.connect(lambda i: self.set_nfm_on(self._nfm_on_choices[bool(i)]))
        self.top_grid_layout.addWidget(_nfm_on_check_box, 3,0)
        _lsb_on_check_box = Qt.QCheckBox('LSB')
        self._lsb_on_choices = {True: True, False: False}
        self._lsb_on_choices_inv = dict((v,k) for k,v in self._lsb_on_choices.iteritems())
        self._lsb_on_callback = lambda i: Qt.QMetaObject.invokeMethod(_lsb_on_check_box, "setChecked", Qt.Q_ARG("bool", self._lsb_on_choices_inv[i]))
        self._lsb_on_callback(self.lsb_on)
        _lsb_on_check_box.stateChanged.connect(lambda i: self.set_lsb_on(self._lsb_on_choices[bool(i)]))
        self.top_grid_layout.addWidget(_lsb_on_check_box, 6,0)
        self._low_frequency_cutoff_range = Range(1, audio_rate/2, 1, 200, 100)
        self._low_frequency_cutoff_win = RangeWidget(self._low_frequency_cutoff_range, self.set_low_frequency_cutoff, 'Low Frequency Cutoff', "counter_slider", float)
        self.top_grid_layout.addWidget(self._low_frequency_cutoff_win, 7,0)
        self._high_frequency_cutoff_range = Range(1, audio_rate/2, 1, 2500, 100)
        self._high_frequency_cutoff_win = RangeWidget(self._high_frequency_cutoff_range, self.set_high_frequency_cutoff, 'High Frequency Cutoff', "counter_slider", float)
        self.top_grid_layout.addWidget(self._high_frequency_cutoff_win, 7,1)
        _enable_tone_check_box = Qt.QCheckBox('CTCSS Tone Enable')
        self._enable_tone_choices = {True: True, False: False}
        self._enable_tone_choices_inv = dict((v,k) for k,v in self._enable_tone_choices.iteritems())
        self._enable_tone_callback = lambda i: Qt.QMetaObject.invokeMethod(_enable_tone_check_box, "setChecked", Qt.Q_ARG("bool", self._enable_tone_choices_inv[i]))
        self._enable_tone_callback(self.enable_tone)
        _enable_tone_check_box.stateChanged.connect(lambda i: self.set_enable_tone(self._enable_tone_choices[bool(i)]))
        self.top_grid_layout.addWidget(_enable_tone_check_box, 10,0)
        _enable_test_tone_check_box = Qt.QCheckBox('Test Tone')
        self._enable_test_tone_choices = {True: True, False: False}
        self._enable_test_tone_choices_inv = dict((v,k) for k,v in self._enable_test_tone_choices.iteritems())
        self._enable_test_tone_callback = lambda i: Qt.QMetaObject.invokeMethod(_enable_test_tone_check_box, "setChecked", Qt.Q_ARG("bool", self._enable_test_tone_choices_inv[i]))
        self._enable_test_tone_callback(self.enable_test_tone)
        _enable_test_tone_check_box.stateChanged.connect(lambda i: self.set_enable_test_tone(self._enable_test_tone_choices[bool(i)]))
        self.top_grid_layout.addWidget(_enable_test_tone_check_box, 11,0)
        self._ctcss_tone_range = Range(67, 254.1, .1, 100, 200)
        self._ctcss_tone_win = RangeWidget(self._ctcss_tone_range, self.set_ctcss_tone, 'CTCSS Tone', "counter", float)
        self.top_grid_layout.addWidget(self._ctcss_tone_win, 10,1)
        _am_on_check_box = Qt.QCheckBox('AM')
        self._am_on_choices = {True: True, False: False}
        self._am_on_choices_inv = dict((v,k) for k,v in self._am_on_choices.iteritems())
        self._am_on_callback = lambda i: Qt.QMetaObject.invokeMethod(_am_on_check_box, "setChecked", Qt.Q_ARG("bool", self._am_on_choices_inv[i]))
        self._am_on_callback(self.am_on)
        _am_on_check_box.stateChanged.connect(lambda i: self.set_am_on(self._am_on_choices[bool(i)]))
        self.top_grid_layout.addWidget(_am_on_check_box, 2,0)
        self.rational_resampler_wfm = filter.rational_resampler_ccc(
                interpolation=audio_rate,
                decimation=audio_rate*4,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_nbfm = filter.rational_resampler_ccc(
                interpolation=audio_rate,
                decimation=audio_rate*2,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_rpitx = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	audio_rate, #bw
        	"rpitx signal (I/Q)", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_rpitx.set_update_time(0.01)
        self.qtgui_waterfall_sink_rpitx.enable_grid(False)
        self.qtgui_waterfall_sink_rpitx.enable_axis_labels(True)
        
        if not True:
          self.qtgui_waterfall_sink_rpitx.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_rpitx.set_plot_pos_half(not True)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_rpitx.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_rpitx.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_rpitx.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_rpitx.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_rpitx.set_intensity_range(-140, 10)
        
        self._qtgui_waterfall_sink_rpitx_win = sip.wrapinstance(self.qtgui_waterfall_sink_rpitx.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_rpitx_win, 1,1)
        self.qtgui_sink_transmit = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_HAMMING, #wintype
        	0, #fc
        	audio_rate, #bw
        	"Transmitted Signal (I/Q)", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_transmit.set_update_time(1.0/100)
        self._qtgui_sink_transmit_win = sip.wrapinstance(self.qtgui_sink_transmit.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_transmit_win, 1,0)
        
        self.qtgui_sink_transmit.enable_rf_freq(False)
        
        
          
        self.low_pass_filter_nbfm = filter.fir_filter_fff(1, firdes.low_pass(
        	1, audio_rate, 4e3, 500, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_rpitx = filter.freq_xlating_fir_filter_ccc(1, ([1]), -rpitx_frequency_correction*1000, 48000)
        self.blocks_multiply_usb = blocks.multiply_vcc(1)
        self.blocks_multiply_lsb = blocks.multiply_vcc(1)
        self.blocks_multiply_const_wfm = blocks.multiply_const_vcc((wfm_on, ))
        self.blocks_multiply_const_test = blocks.multiply_const_vff((enable_test_tone, ))
        self.blocks_multiply_const_rpitx = blocks.multiply_const_vcc((ptt or ptt_lock, ))
        self.blocks_multiply_const_nbfm = blocks.multiply_const_vcc((nfm_on, ))
        self.blocks_multiply_const_ctcss = blocks.multiply_const_vff((enable_tone, ))
        self.blocks_multiply_am = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_am_ssb = blocks.float_to_complex(1)
        self.blocks_add_nbfm = blocks.add_vff(1)
        self.blocks_add_fm = blocks.add_vcc(1)
        self.blocks_add_const_am = blocks.add_const_vcc((.5, ))
        self.blocks_add_am_ssb_fm = blocks.add_vcc(1)
        self.blocks_add_am_ssb = blocks.add_vcc(1)
        self.blocks_add = blocks.add_vff(1)
        self.blks_tcp_sink_rpitx = grc_blks2.tcp_sink(
        	itemsize=gr.sizeof_gr_complex*1,
        	addr='localhost',
        	port=8011,
        	server=False,
        )
        self.band_pass_filter_usb = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass(
        	1, audio_rate, low_frequency_cutoff, high_frequency_cutoff, 200, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_lsb = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass(
        	1, audio_rate, -high_frequency_cutoff, -low_frequency_cutoff, 200, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_am = filter.fir_filter_ccf(1, firdes.band_pass(
        	1, audio_rate, low_frequency_cutoff, high_frequency_cutoff, 400, firdes.WIN_HAMMING, 6.76))
        self.audio_source = audio.source(48000, '', True)
        self.analog_wfm_tx = analog.wfm_tx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate * 4,
        	tau=75e-6,
        	max_dev=75e3,
        	fh=-1.0,
        )
        self.analog_sig_source_usb = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 0, 1.8 if usb_on else 0, 0)
        self.analog_sig_source_test = analog.sig_source_f(audio_rate, analog.GR_SIN_WAVE, test_tone_frequency, .3, 0)
        self.analog_sig_source_lsb = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 0, 1.8 if lsb_on else 0, 0)
        self.analog_sig_source_ctcss = analog.sig_source_f(audio_rate, analog.GR_COS_WAVE, ctcss_tone, 0.1, 0)
        self.analog_sig_source_am = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0)
        self.analog_nbfm_tx = analog.nbfm_tx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate*2,
        	tau=75e-6,
        	max_dev=5e3,
        	fh=-1.0,
                )
        self.analog_const_source = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source, 0), (self.blocks_float_to_complex_am_ssb, 1))    
        self.connect((self.analog_nbfm_tx, 0), (self.blocks_multiply_const_nbfm, 0))    
        self.connect((self.analog_sig_source_am, 0), (self.blocks_multiply_am, 1))    
        self.connect((self.analog_sig_source_ctcss, 0), (self.blocks_multiply_const_ctcss, 0))    
        self.connect((self.analog_sig_source_lsb, 0), (self.blocks_multiply_lsb, 1))    
        self.connect((self.analog_sig_source_test, 0), (self.blocks_multiply_const_test, 0))    
        self.connect((self.analog_sig_source_usb, 0), (self.blocks_multiply_usb, 1))    
        self.connect((self.analog_wfm_tx, 0), (self.blocks_multiply_const_wfm, 0))    
        self.connect((self.audio_source, 0), (self.blocks_add, 0))    
        self.connect((self.band_pass_filter_am, 0), (self.blocks_add_const_am, 0))    
        self.connect((self.band_pass_filter_lsb, 0), (self.blocks_multiply_lsb, 0))    
        self.connect((self.band_pass_filter_usb, 0), (self.blocks_multiply_usb, 0))    
        self.connect((self.blocks_add, 0), (self.analog_wfm_tx, 0))    
        self.connect((self.blocks_add, 0), (self.blocks_add_nbfm, 1))    
        self.connect((self.blocks_add, 0), (self.blocks_float_to_complex_am_ssb, 0))    
        self.connect((self.blocks_add_am_ssb, 0), (self.blocks_add_am_ssb_fm, 1))    
        self.connect((self.blocks_add_am_ssb_fm, 0), (self.blocks_multiply_const_rpitx, 0))    
        self.connect((self.blocks_add_const_am, 0), (self.blocks_multiply_am, 0))    
        self.connect((self.blocks_add_fm, 0), (self.blocks_add_am_ssb_fm, 0))    
        self.connect((self.blocks_add_nbfm, 0), (self.low_pass_filter_nbfm, 0))    
        self.connect((self.blocks_float_to_complex_am_ssb, 0), (self.band_pass_filter_am, 0))    
        self.connect((self.blocks_float_to_complex_am_ssb, 0), (self.band_pass_filter_lsb, 0))    
        self.connect((self.blocks_float_to_complex_am_ssb, 0), (self.band_pass_filter_usb, 0))    
        self.connect((self.blocks_multiply_am, 0), (self.blocks_add_am_ssb, 0))    
        self.connect((self.blocks_multiply_const_ctcss, 0), (self.blocks_add_nbfm, 0))    
        self.connect((self.blocks_multiply_const_nbfm, 0), (self.rational_resampler_nbfm, 0))    
        self.connect((self.blocks_multiply_const_rpitx, 0), (self.freq_xlating_fir_filter_rpitx, 0))    
        self.connect((self.blocks_multiply_const_rpitx, 0), (self.qtgui_sink_transmit, 0))    
        self.connect((self.blocks_multiply_const_test, 0), (self.blocks_add, 1))    
        self.connect((self.blocks_multiply_const_wfm, 0), (self.rational_resampler_wfm, 0))    
        self.connect((self.blocks_multiply_lsb, 0), (self.blocks_add_am_ssb, 1))    
        self.connect((self.blocks_multiply_usb, 0), (self.blocks_add_am_ssb, 2))    
        self.connect((self.freq_xlating_fir_filter_rpitx, 0), (self.blks_tcp_sink_rpitx, 0))    
        self.connect((self.freq_xlating_fir_filter_rpitx, 0), (self.qtgui_waterfall_sink_rpitx, 0))    
        self.connect((self.low_pass_filter_nbfm, 0), (self.analog_nbfm_tx, 0))    
        self.connect((self.rational_resampler_nbfm, 0), (self.blocks_add_fm, 0))    
        self.connect((self.rational_resampler_wfm, 0), (self.blocks_add_fm, 1))    
Esempio n. 22
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Stereo Receiver")

        ##################################################
        # Variables
        ##################################################
        self.smux_filt_samprate = smux_filt_samprate = 256e3
        self.smux_decim = smux_decim = 8
        self.samp_rate = samp_rate = 2.048e6
        self.right_gain = right_gain = 3
        self.left_gain = left_gain = 3
        self.bpf_base = bpf_base = 23e3
        self.RF_Gain = RF_Gain = 45
        self.CF = CF = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.samp_rate,
            callback=self.set_samp_rate,
            label=
            "Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._samp_rate_text_box, 1, 0, 1, 1)
        _right_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._right_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_right_gain_sizer,
            value=self.right_gain,
            callback=self.set_right_gain,
            label="R Audio Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._right_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_right_gain_sizer,
            value=self.right_gain,
            callback=self.set_right_gain,
            minimum=0,
            maximum=5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_right_gain_sizer, 0, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "BB Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Demod Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Stereo Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Stereo Signal")
        self.GridAdd(self.notebook_0, 2, 0, 1, 2)
        _left_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._left_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_left_gain_sizer,
            value=self.left_gain,
            callback=self.set_left_gain,
            label="L Audio Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._left_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_left_gain_sizer,
            value=self.left_gain,
            callback=self.set_left_gain,
            minimum=0,
            maximum=5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_left_gain_sizer, 0, 0, 1, 1)
        _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_Gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_RF_Gain_sizer,
            value=self.RF_Gain,
            callback=self.set_RF_Gain,
            label="RF Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._RF_Gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_RF_Gain_sizer,
            value=self.RF_Gain,
            callback=self.set_RF_Gain,
            minimum=0,
            maximum=100,
            num_steps=45,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 1, 1, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Baseband Waterfall",
            size=(800, 100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 3,
                                           0, 1, 2)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=32e3,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
            size=(800, 500),
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=32e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Difference FFT ",
            peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / 8,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Demodulated FFT",
            peak_hold=False,
            size=(800, 800),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Baseband FFT",
            peak_hold=False,
            size=(800, 100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_fftsink2_0_0.win, 2, 0,
                                           1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=32e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Sum FFT",
            peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.rfgain = blocks.multiply_const_vcc((RF_Gain, ))
        self.low_pass_filter_1_0 = filter.fir_filter_fff(
            smux_decim,
            firdes.low_pass(1, smux_filt_samprate, 15e3, 500,
                            firdes.WIN_HAMMING, 1))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            2,
            firdes.low_pass(2, samp_rate / 4, 100e3, 500, firdes.WIN_KAISER,
                            6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ccf(
            (-0.00266, 0.00504, -0.00309, -0.00136, 0.00663, -0.01052, 0.01103,
             -0.00731, 0.00016, 0.00800, -0.01396, 0.01490, -0.00971, -0.00035,
             0.01173, -0.01979, 0.02054, -0.01240, -0.00273, 0.01960, -0.03122,
             0.03124, -0.01669, -0.01017, 0.04137, -0.06448, 0.06476, -0.02634,
             -0.07449, 0.33571, -0.00000, -0.33571, 0.07449, 0.02634, -0.06476,
             0.06448, -0.04137, 0.01017, 0.01669, -0.03124, 0.03122, -0.01960,
             0.00273, 0.01240, -0.02054, 0.01979, -0.01173, 0.00035, 0.00971,
             -0.01490, 0.01396, -0.00800, -0.00016, 0.00731, -0.01103, 0.01052,
             -0.00663, 0.00136, 0.00309, -0.00504, 0.00266), (1, ), False)
        self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(4, (1, 1, 1, 1))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (right_gain, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (left_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/Users/bretttt/iCloud_drive/16S/engs110/project/radio_dat/IQ_Data_STEREO1",
            True)
        self.blocks_divide_xx_1 = blocks.divide_cc(1)
        self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex * 1, 30)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.1, ))
        self.baseband_LPF = filter.fir_filter_fff(
            smux_decim,
            firdes.low_pass(1, smux_filt_samprate, 15e3, 500,
                            firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_fcc(
            1,
            firdes.complex_band_pass(1, smux_filt_samprate, 18000, 20000, 1000,
                                     firdes.WIN_KAISER, 1))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, smux_filt_samprate, bpf_base, bpf_base + 30e3,
                             500, firdes.WIN_KAISER, 6.76))
        self.audio_sink_0_0_0_0 = audio.sink(32000, "", True)
        self.analog_pll_refout_cc_0_0 = analog.pll_refout_cc(
            3.14 / 100, 0.152 * 3.14, 0.144 * 3.14)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=samp_rate / 8,
                                                     tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate / 8, tau=75e-6)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        _CF_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CF_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_CF_sizer,
            value=self.CF,
            callback=self.set_CF,
            label="Center Frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._CF_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_CF_sizer,
            value=self.CF,
            callback=self.set_CF,
            minimum=80e6,
            maximum=108e6,
            num_steps=280,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_CF_sizer, 3, 0, 1, 2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_fm_deemph_0, 0),
                     (self.audio_sink_0_0_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0),
                     (self.audio_sink_0_0_0_0, 1))
        self.connect((self.analog_pll_refout_cc_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.analog_pll_refout_cc_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0),
                     (self.analog_pll_refout_cc_0_0, 0))
        self.connect((self.baseband_LPF, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.baseband_LPF, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_divide_xx_1, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.band_pass_filter_0_0_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.baseband_LPF, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_delay_2, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_delay_2, 0))
        self.connect((self.blocks_divide_xx_1, 0), (self.iir_filter_xxx_0, 0))
        self.connect((self.blocks_file_source_0_0, 0), (self.rfgain, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_fm_deemph_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.analog_fm_deemph_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.wxgui_fftsink2_0_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.iir_filter_xxx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_divide_xx_1, 0))
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.rfgain, 0), (self.blocks_throttle_0, 0))
Esempio n. 23
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Cellband")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 20e6
        self.center_freq = center_freq = 1725000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=center_freq,
        	dynamic_range=60,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=center_freq,
        	y_per_div=10,
        	y_divs=6,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
          
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-128-128j, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.blocks_add_const_vxx_0, 0))    
Esempio n. 24
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dsbfc Am Modulation Demodulation")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 320000

        ##################################################
        # Blocks
        ##################################################
        self.lab2_part1 = self.lab2_part1 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "scope")
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "fft")
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "fft1")
        self.Add(self.lab2_part1)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
        	self.lab2_part1.GetPage(0).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.lab2_part1.GetPage(0).Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
        	self.lab2_part1.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.lab2_part1.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.lab2_part1.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.lab2_part1.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 30000, 100, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.5, ))
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, ))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0))
Esempio n. 25
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000
        self.decimation = decimation = 10
        self.symbol_rate = symbol_rate = 38400
        self.input_rate = input_rate = samp_rate / decimation
        self.window_symbols = window_symbols = 1
        self.symbol_taps_length = symbol_taps_length = int(
            (float(input_rate) / symbol_rate))
        self.samples_per_symbol = samples_per_symbol = float(
            input_rate) / symbol_rate
        self.grab_freq = grab_freq = 868200000
        self.symbol_taps = symbol_taps = (1, ) * symbol_taps_length
        self.offset_sign2 = offset_sign2 = (-34780 * grab_freq) / 868200000
        self.offset_sign1 = offset_sign1 = (11600 * grab_freq) / 868200000
        self.gain_mu = gain_mu = 0.4 / samples_per_symbol
        self.fsk_deviation_hz = fsk_deviation_hz = 5200
        self.average_window = average_window = int(
            (input_rate * window_symbols / symbol_rate))

        ##################################################
        # Blocks
        ##################################################
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            samples_per_symbol * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5,
            gain_mu, 0.02)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            average_window, 1.0 / average_window, 4000)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       sys.argv[1], False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, '/home/fraschi/gfskQuadDemod.data', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_float * 1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-128 - 128j, ))
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(40, 1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.FXFIR1 = filter.freq_xlating_fir_filter_ccc(
            decimation, (1, ), -14e3, samp_rate)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.FXFIR1, 0), (self.analog_simple_squelch_cc_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.analog_simple_squelch_cc_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.FXFIR1, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
Esempio n. 26
0
    def amGen(self, type, noiseLevel):

        ##################################################
        # Variables
        ##################################################
        self.add = add = 0  # set to 1 if not suppressing carrier
        if type == "DSBFC":
            add = 1

        self.samp_rate = samp_rate = 300000

        ##################################################
        # Blocks
        ##################################################
        self.sink = blocks.vector_sink_c(1)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[3], True)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((add, ))
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate)  #, True)
        self.channel = channels.channel_model(
            noise_voltage=
            noiseLevel,  # AWGN noise level as a voltage (edit depending on SNR)
            frequency_offset=0.0,  # No frequency offset
            epsilon=
            1.0,  # 1.0 to keep no difference between sampling rates of clocks of transmitter and receiver
            noise_seed=0,  # Normal random number generator for noise
            block_tags=False  # Only needed for multipath
        )
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(1, samp_rate, 100000, 150000, 10000,
                             firdes.WIN_KAISER, 6.76))  # used only for SSB
        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        if type == "SSB":
            self.connect((self.blocks_multiply_xx_0, 0),
                         (self.band_pass_filter_0, 0))
            self.connect((self.band_pass_filter_0, 0),
                         (self.blocks_throttle_0, 0))
        else:
            self.connect((self.blocks_multiply_xx_0, 0),
                         (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.channel, 0))
        self.connect((self.channel, 0), (self.sink, 0))
        return self.sink
Esempio n. 27
0
    def __init__(self, port=65400, address="addr=192.168.10.2", seed1=1088):
        gr.top_block.__init__(self, "Ue")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Ue")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "UE")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.port = port
        self.address = address
        self.seed1 = seed1

        ##################################################
        # Variables
        ##################################################
        self.seed2 = seed2 = seed1 + 384
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.occupied_carriers = occupied_carriers = (
            range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) +
            range(8, 21) + range(22, 27), )
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.fft_len = fft_len = 64
        self.sync_word2 = sync_word2 = [
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1,
            1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1,
            1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1,
            -1, 0, 0, 0, 0, 0
        ]
        self.sync_word1 = sync_word1 = [
            0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0.,
            -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            0., 0., 0., 0., 0.
        ]
        self.seed6 = seed6 = seed1 + 4590
        self.seed5 = seed5 = seed2 + 851
        self.seed4 = seed4 = seed1 + 9027
        self.seed3 = seed3 = seed1 + 2791
        self.samp_rate = samp_rate = 500000
        self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, payload_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.packet_length_tag_key = packet_length_tag_key = "packet_len"
        self.packet_len = packet_len = 12
        self.noise_power = noise_power = 0
        self.length_tag_key = length_tag_key = "frame_len"
        self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, header_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.h_2 = h_2 = 0
        self.h_1 = h_1 = 0
        self.h_0 = h_0 = 1

        ##################################################
        # Blocks
        ##################################################
        self.s_2 = blocks.probe_signal_c()
        self.s_1 = blocks.probe_signal_c()
        self.s_0 = blocks.probe_signal_c()
        self.noise_variance = blocks.probe_signal_f()

        def _noise_power_probe():
            while True:
                val = self.noise_variance.level()
                try:
                    self.set_noise_power(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _noise_power_thread = threading.Thread(target=_noise_power_probe)
        _noise_power_thread.daemon = True
        _noise_power_thread.start()

        def _h_2_probe():
            while True:
                val = self.s_2.level()
                try:
                    self.set_h_2(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_2_thread = threading.Thread(target=_h_2_probe)
        _h_2_thread.daemon = True
        _h_2_thread.start()

        def _h_1_probe():
            while True:
                val = self.s_1.level()
                try:
                    self.set_h_1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_1_thread = threading.Thread(target=_h_1_probe)
        _h_1_thread.daemon = True
        _h_1_thread.start()

        def _h_0_probe():
            while True:
                val = self.s_0.level()
                try:
                    self.set_h_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_0_thread = threading.Thread(target=_h_0_probe)
        _h_0_thread.daemon = True
        _h_0_thread.start()
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(450e6, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)

        if complex == type(float()):
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.projectGT_variance_cc_0 = projectGT.variance_cc(5000)
        self.projectGT_IA_vectors_vcvc_0 = projectGT.IA_vectors_vcvc(
            fft_len, noise_power, 1, 2, (15, 25, 40, 45), length_tag_key)
        self.ofdm_rx_phase_1_0 = ofdm_rx_phase_1(
            pilot_symbols=pilot_symbols,
            header_mod=header_mod,
            payload_mod=payload_mod,
            sync_word2=sync_word2,
            sync_word1=sync_word1,
            fft_len=fft_len,
            packet_len=packet_len,
            occupied_carriers=occupied_carriers,
            pilot_carriers=pilot_carriers,
            samp_rate=samp_rate,
        )
        self.channels_channel_model_4_0 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed6,
            block_tags=False)
        self.channels_channel_model_4 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed4,
            block_tags=False)
        self.channels_channel_model_3_0 = channels.channel_model(
            noise_voltage=0.05,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed5,
            block_tags=False)
        self.channels_channel_model_3 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed3,
            block_tags=False)
        self.channels_channel_model_2 = channels.channel_model(
            noise_voltage=0.11,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed2,
            block_tags=False)
        self.channels_channel_model_1 = channels.channel_model(
            noise_voltage=0.12,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed1,
            block_tags=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.000,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=((h_0, h_1, h_2)),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_to_stream_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                 "134.214.146.135", port, 1472,
                                                 True)
        self.blocks_tag_debug_3 = blocks.tag_debug(gr.sizeof_gr_complex * 1,
                                                   "IA", "")
        self.blocks_tag_debug_3.set_display(True)
        self.blocks_tag_debug_1 = blocks.tag_debug(
            gr.sizeof_gr_complex * fft_len, "chnl_intrf", "")
        self.blocks_tag_debug_1.set_display(False)
        self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1,
                                                   "Payload_intrf", "")
        self.blocks_tag_debug_0.set_display(False)
        self.blocks_null_source_3_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_3 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_2_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_2 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_1 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_float_to_complex_1_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_3_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_3 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_2_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_2 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_1_0 = blocks.add_const_vcc((0.0, ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vcc((0.1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.8, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.s_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.s_1, 0))
        self.connect((self.blocks_add_const_vxx_1_0, 0), (self.s_2, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_complex_to_mag_2, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_complex_to_mag_2_0, 0),
                     (self.blocks_float_to_complex_1_0, 0))
        self.connect((self.blocks_complex_to_mag_3, 0),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_complex_to_mag_3_0, 0),
                     (self.blocks_float_to_complex_1_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_float_to_complex_1_0, 0),
                     (self.blocks_add_const_vxx_1_0, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.channels_channel_model_1, 0))
        self.connect((self.blocks_null_source_1, 0),
                     (self.channels_channel_model_2, 0))
        self.connect((self.blocks_null_source_2, 0),
                     (self.channels_channel_model_3, 0))
        self.connect((self.blocks_null_source_2_0, 0),
                     (self.channels_channel_model_3_0, 0))
        self.connect((self.blocks_null_source_3, 0),
                     (self.channels_channel_model_4, 0))
        self.connect((self.blocks_null_source_3_0, 0),
                     (self.channels_channel_model_4_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_vector_to_stream_1, 0),
                     (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ofdm_rx_phase_1_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.projectGT_variance_cc_0, 0))
        self.connect((self.channels_channel_model_1, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.channels_channel_model_2, 0),
                     (self.blocks_complex_to_mag_1, 0))
        self.connect((self.channels_channel_model_3, 0),
                     (self.blocks_complex_to_mag_2, 0))
        self.connect((self.channels_channel_model_3_0, 0),
                     (self.blocks_complex_to_mag_2_0, 0))
        self.connect((self.channels_channel_model_4, 0),
                     (self.blocks_complex_to_mag_3, 0))
        self.connect((self.channels_channel_model_4_0, 0),
                     (self.blocks_complex_to_mag_3_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 2), (self.blocks_tag_debug_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0), (self.blocks_tag_debug_1, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1),
                     (self.blocks_vector_to_stream_1, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_tag_debug_3, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.projectGT_variance_cc_0, 0),
                     (self.noise_variance, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1),
                     (self.projectGT_IA_vectors_vcvc_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0),
                     (self.projectGT_IA_vectors_vcvc_0, 1))
    def __init__(self):
        gr.top_block.__init__(self, "Example Corr Est")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example Corr Est")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "example_corr_est")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4

        self.hdr_const = hdr_const = digital.constellation_calcdist((digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base()

        self.hdr_const.gen_soft_dec_lut(8)
        self.eb = eb = 0.22
        self.rxmod = rxmod = digital.generic_mod(hdr_const, False, sps, True, eb, False, False)

        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(sps, sps, 1.0, eb, 11*sps)

        self.ac_hex = ac_hex = [0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc]
        self.time_off = time_off = 1.0
        self.samp_rate = samp_rate = 10e3

        self.rx_psf_taps = rx_psf_taps = firdes.root_raised_cosine(1, sps, 1.0, eb, 15*sps)

        self.path_loss = path_loss = 10
        self.noise = noise = -50
        self.modulated_sync_word = modulated_sync_word = digital.modulate_vector_bc(rxmod .to_basic_block(), (ac_hex), ([1]))
        self.mark_delay = mark_delay = 38
        self.freq_off = freq_off = 0
        self.filt_delay = filt_delay = 1+(len(rrc_taps)-1)/2
        self.ac = ac = map(lambda x: int(x), list(digital.packet_utils.default_access_code))

        ##################################################
        # Blocks
        ##################################################
        self._time_off_range = Range(0.9999, 1.0001, 0.00001, 1.0, 200)
        self._time_off_win = RangeWidget(self._time_off_range, self.set_time_off, 'Time Off.', "counter_slider", float)
        self.top_grid_layout.addWidget(self._time_off_win, 1, 1, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._path_loss_range = Range(0, 140, 5, 10, 200)
        self._path_loss_win = RangeWidget(self._path_loss_range, self.set_path_loss, 'Path Loss (dB)', "counter_slider", float)
        self.top_grid_layout.addWidget(self._path_loss_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._noise_range = Range(-50, 10, 1, -50, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise Power', "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._freq_off_range = Range(-0.25, 0.25, 0.0001, 0, 200)
        self._freq_off_win = RangeWidget(self._freq_off_range, self.set_freq_off, 'Freq. Off.', "counter_slider", float)
        self.top_grid_layout.addWidget(self._freq_off_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.tab0 = Qt.QTabWidget()
        self.tab0_widget_0 = Qt.QWidget()
        self.tab0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_0)
        self.tab0_grid_layout_0 = Qt.QGridLayout()
        self.tab0_layout_0.addLayout(self.tab0_grid_layout_0)
        self.tab0.addTab(self.tab0_widget_0, 'Corr')
        self.tab0_widget_1 = Qt.QWidget()
        self.tab0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_1)
        self.tab0_grid_layout_1 = Qt.QGridLayout()
        self.tab0_layout_1.addLayout(self.tab0_grid_layout_1)
        self.tab0.addTab(self.tab0_widget_1, '|Corr|^2')
        self.top_grid_layout.addWidget(self.tab0)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
        	512, #size
        	1, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-100, 4000)

        self.qtgui_time_sink_x_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0, 15, 0, 'corr_est')
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win, 4, 0, 1, 2)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
        	512, #size
        	1, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-100, 100)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0, 15, 0, 'corr_est')
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 3, 0, 1, 2)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	512, #size
        	1, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1.5, 1.5)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 15, 0, 'corr_start')
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1, 2)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(sps, (rrc_taps))
        self.interp_fir_filter_xxx_0.declare_sample_delay(filt_delay)
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(1, (rx_psf_taps))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_corr_est_cc_0 = digital.corr_est_cc((modulated_sync_word), sps, mark_delay, 0.999)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=sps * 10.0**(noise/10.0),
        	frequency_offset=freq_off,
        	epsilon=time_off,
        	taps=(10.0**(-path_loss/20.0), ),
        	noise_seed=0,
        	block_tags=True
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_c([1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0] + ac, True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, 1, len(ac)+16, "packet_len")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((2, ))
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-1, ))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.digital_corr_est_cc_0, 0))
        self.connect((self.digital_corr_est_cc_0, 1), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.digital_corr_est_cc_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.digital_corr_est_cc_0, 1), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.channels_channel_model_0, 0))
Esempio n. 29
0
    def __init__(self,
                 phase_noise_mag=0,
                 magbal=0,
                 phasebal=0,
                 q_ofs=0,
                 i_ofs=0,
                 freq_offset=0,
                 gamma=0,
                 beta=0):
        gr.hier_block2.__init__(
            self,
            "Radio Impairments Model",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.phase_noise_mag = phase_noise_mag
        self.magbal = magbal
        self.phasebal = phasebal
        self.q_ofs = q_ofs
        self.i_ofs = i_ofs
        self.freq_offset = freq_offset
        self.gamma = gamma
        self.beta = beta

        ##################################################
        # Blocks
        ##################################################
        self.channels_phase_noise_gen_0_0 = phase_noise_gen(
            math.pow(10.0, phase_noise_mag / 20.0), .01)
        self.channels_iqbal_gen_0 = iqbal_gen(magbal, phasebal)
        self.channels_distortion_3_gen_0 = distortion_3_gen(beta)
        self.channels_distortion_2_gen_0 = distortion_2_gen(gamma)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc(
            (i_ofs + q_ofs * 1j, ))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            1.0, analog.GR_COS_WAVE, freq_offset, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.channels_phase_noise_gen_0_0, 0),
                     (self.channels_distortion_3_gen_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.channels_phase_noise_gen_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.channels_iqbal_gen_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.channels_distortion_3_gen_0, 0),
                     (self.channels_distortion_2_gen_0, 0))
        self.connect((self.channels_distortion_2_gen_0, 0),
                     (self.channels_iqbal_gen_0, 0))
Esempio n. 30
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.tuning = tuning = 450000000
        self.squelch = squelch = -50
        self.samp_rate = samp_rate = 20000000
        self.q_offset = q_offset = -0.005
        self.phase = phase = -0.045
        self.magnitude = magnitude = 0.032
        self.i_offset = i_offset = 0.002

        ##################################################
        # Blocks
        ##################################################
        _q_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._q_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_q_offset_sizer,
            value=self.q_offset,
            callback=self.set_q_offset,
            label="DC offset Q",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._q_offset_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_q_offset_sizer,
            value=self.q_offset,
            callback=self.set_q_offset,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_q_offset_sizer, 3, 0, 1, 7)
        _magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._magnitude_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            label="Magnitude correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._magnitude_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_magnitude_sizer, 1, 0, 1, 7)
        _i_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._i_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_i_offset_sizer,
            value=self.i_offset,
            callback=self.set_i_offset,
            label="DC offset I",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._i_offset_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_i_offset_sizer,
            value=self.i_offset,
            callback=self.set_i_offset,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_i_offset_sizer, 2, 0, 1, 7)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        _tuning_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tuning_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tuning_sizer,
            value=self.tuning,
            callback=self.set_tuning,
            label="LO Tuning",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._tuning_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tuning_sizer,
            value=self.tuning,
            callback=self.set_tuning,
            minimum=300000000,
            maximum=3800000000,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.GridAdd(_tuning_sizer, 4, 0, 1, 7)
        _squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_squelch_sizer,
            value=self.squelch,
            callback=self.set_squelch,
            label="squelch",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._squelch_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_squelch_sizer,
            value=self.squelch,
            callback=self.set_squelch,
            minimum=-150,
            maximum=-50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_squelch_sizer)
        _phase_sizer = wx.BoxSizer(wx.VERTICAL)
        self._phase_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_phase_sizer,
            value=self.phase,
            callback=self.set_phase,
            label="Phase correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._phase_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_phase_sizer,
            value=self.phase,
            callback=self.set_phase,
            minimum=-0.1,
            maximum=0.1,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_phase_sizer, 0, 0, 1, 7)
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "")
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(441000000, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(10, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)

        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            ((1 + magnitude) + (1j - magnitude), ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vcc(
            (i_offset + 1j * q_offset, ))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_SIN_WAVE, 100000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0),
                     (self.osmosdr_sink_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_1, 0))
Esempio n. 31
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1024000
        self.decimation = decimation = 10
        self.symbol_rate = symbol_rate = 38400
        self.input_rate = input_rate = samp_rate / decimation
        self.window_symbols = window_symbols = 1
        self.symbol_taps_length = symbol_taps_length = int(
            (float(input_rate) / symbol_rate))
        self.samples_per_symbol = samples_per_symbol = float(
            input_rate) / symbol_rate
        self.grab_freq = grab_freq = 868200000
        self.symbol_taps = symbol_taps = (1, ) * symbol_taps_length
        self.offset_sign2 = offset_sign2 = (-34780 * grab_freq) / 868200000
        self.offset_sign1 = offset_sign1 = (11600 * grab_freq) / 868200000
        self.gain_mu = gain_mu = 0.4 / samples_per_symbol
        self.fsk_deviation_hz = fsk_deviation_hz = 5200
        self.average_window = average_window = int(
            (input_rate * window_symbols / symbol_rate))

        ##################################################
        # Blocks
        ##################################################
        self.urmetEasyRead_urmetEasyRead_0 = urmetEasyRead.urmetEasyRead()
        self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb(
            '11010011100100011101001110010001', 1)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            samples_per_symbol, 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.02)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(
            gr.msg_queue(1), False, True, True, True)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_char * 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       sys.argv[1], False)
        self.blocks_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_float * 1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-128 - 128j, ))
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(40, 1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.FXFIR1 = filter.freq_xlating_fir_filter_ccc(
            decimation, (1, ), -14e3, samp_rate)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.FXFIR1, 0), (self.analog_simple_squelch_cc_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_simple_squelch_cc_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.FXFIR1, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0),
                     (self.urmetEasyRead_urmetEasyRead_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.digital_correlate_access_code_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0, 0),
                     (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.urmetEasyRead_urmetEasyRead_0, 0),
                     (self.blocks_null_sink_1, 0))
Esempio n. 32
0
    def __init__(self):
        gr.top_block.__init__(self, "Test Signal.  Adds a tone in 1 MHz band")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Test Signal.  Adds a tone in 1 MHz band")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "NsfTest")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.OffsetMHz = OffsetMHz = 0.111
        self.FreqMHz = FreqMHz = 1437
        self.Bandwidth = Bandwidth = 1.e6
        self.samp_rate = samp_rate = int(Bandwidth)
        self.fftsize = fftsize = 1024
        self.Offset = Offset = OffsetMHz * 1.E6
        self.H1 = H1 = 1420.406E6
        self.Gain1 = Gain1 = 75
        self.Frequency = Frequency = FreqMHz * 1.E6
        self.Attn1 = Attn1 = 80

        ##################################################
        # Blocks
        ##################################################
        self._Gain1_tool_bar = Qt.QToolBar(self)
        self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1' + ": "))
        self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1))
        self._Gain1_tool_bar.addWidget(self._Gain1_line_edit)
        self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1(
            eng_notation.str_to_num(str(self._Gain1_line_edit.text().toAscii())
                                    )))
        self.top_grid_layout.addWidget(self._Gain1_tool_bar, 0, 0, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._Attn1_tool_bar = Qt.QToolBar(self)
        self._Attn1_tool_bar.addWidget(Qt.QLabel('Attn1' + ": "))
        self._Attn1_line_edit = Qt.QLineEdit(str(self.Attn1))
        self._Attn1_tool_bar.addWidget(self._Attn1_line_edit)
        self._Attn1_line_edit.returnPressed.connect(lambda: self.set_Attn1(
            eng_notation.str_to_num(str(self._Attn1_line_edit.text().toAscii())
                                    )))
        self.top_grid_layout.addWidget(self._Attn1_tool_bar, 1, 0, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.radio_astro_vmedian_0_2_0 = radio_astro.vmedian(fftsize, 4)
        self.radio_astro_vmedian_0_2 = radio_astro.vmedian(fftsize, 4)
        self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4)
        self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4)
        self.qtgui_vector_sink_f_0_0 = qtgui.vector_sink_f(
            fftsize,
            float(Frequency - (Bandwidth / 2.)) * 1.e-6,
            float(Bandwidth * 1.e-6 / fftsize),
            "Frequency (MHz)",
            'Intensity',
            "",
            1  # Number of inputs
        )
        self.qtgui_vector_sink_f_0_0.set_update_time(.5)
        self.qtgui_vector_sink_f_0_0.set_y_axis(0, 1.)
        self.qtgui_vector_sink_f_0_0.enable_autoscale(False)
        self.qtgui_vector_sink_f_0_0.enable_grid(False)
        self.qtgui_vector_sink_f_0_0.set_x_axis_units("")
        self.qtgui_vector_sink_f_0_0.set_y_axis_units("")
        self.qtgui_vector_sink_f_0_0.set_ref_level(0)

        labels = ['Latest', 'Median', 'Hot', 'Cold', 'Ref', '', '', '', '', '']
        widths = [1, 3, 2, 2, 3, 1, 1, 1, 1, 1]
        colors = [
            "black", "dark green", "red", "blue", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [2., 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_vector_sink_f_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_vector_sink_f_0_0.set_line_label(i, labels[i])
            self.qtgui_vector_sink_f_0_0.set_line_width(i, widths[i])
            self.qtgui_vector_sink_f_0_0.set_line_color(i, colors[i])
            self.qtgui_vector_sink_f_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_vector_sink_f_0_0_win = sip.wrapinstance(
            self.qtgui_vector_sink_f_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_0_win, 2, 2,
                                       4, 3)
        for r in range(2, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f(
            fftsize, 100, -.4, .4, "", 2)

        self.qtgui_histogram_sink_x_0.set_update_time(1.)
        self.qtgui_histogram_sink_x_0.enable_autoscale(True)
        self.qtgui_histogram_sink_x_0.enable_accumulate(False)
        self.qtgui_histogram_sink_x_0.enable_grid(False)
        self.qtgui_histogram_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_histogram_sink_x_0.disable_legend()

        labels = ['I', 'Q', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_histogram_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_histogram_sink_x_0_win = sip.wrapinstance(
            self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 2,
                                       0, 3, 2)
        for r in range(2, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.pluto_source_0 = iio.pluto_source('192.168.2.1',
                                               int(int(Frequency)),
                                               int(int(Bandwidth)),
                                               int(20000000), 0x8000, False,
                                               False, True, "manual",
                                               float(Gain1), '', True)
        self.pluto_sink_0 = iio.pluto_sink('', int(float(Frequency + Offset)),
                                           int(float(Bandwidth)),
                                           int(20000000), 0x8000, False,
                                           float(Attn1), '', True)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, Bandwidth, .1E6, .025E6, firdes.WIN_HAMMING,
                            6.76))
        self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)),
                                     True, 1)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, fftsize)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(fftsize)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, ))
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 30, 0)
        self._OffsetMHz_tool_bar = Qt.QToolBar(self)
        self._OffsetMHz_tool_bar.addWidget(Qt.QLabel('OffsetMHz)' + ": "))
        self._OffsetMHz_line_edit = Qt.QLineEdit(str(self.OffsetMHz))
        self._OffsetMHz_tool_bar.addWidget(self._OffsetMHz_line_edit)
        self._OffsetMHz_line_edit.returnPressed.connect(
            lambda: self.set_OffsetMHz(
                eng_notation.str_to_num(
                    str(self._OffsetMHz_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._OffsetMHz_tool_bar, 1, 2, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._FreqMHz_tool_bar = Qt.QToolBar(self)
        self._FreqMHz_tool_bar.addWidget(Qt.QLabel('Freq (MHz)' + ": "))
        self._FreqMHz_line_edit = Qt.QLineEdit(str(self.FreqMHz))
        self._FreqMHz_tool_bar.addWidget(self._FreqMHz_line_edit)
        self._FreqMHz_line_edit.returnPressed.connect(lambda: self.set_FreqMHz(
            eng_notation.str_to_num(
                str(self._FreqMHz_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._FreqMHz_tool_bar, 0, 2, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.pluto_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.qtgui_histogram_sink_x_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.qtgui_histogram_sink_x_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.radio_astro_vmedian_0_2, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.pluto_source_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.pluto_source_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.radio_astro_vmedian_0, 0),
                     (self.qtgui_vector_sink_f_0_0, 0))
        self.connect((self.radio_astro_vmedian_0_0, 0),
                     (self.radio_astro_vmedian_0, 0))
        self.connect((self.radio_astro_vmedian_0_2, 0),
                     (self.radio_astro_vmedian_0_2_0, 0))
        self.connect((self.radio_astro_vmedian_0_2_0, 0),
                     (self.radio_astro_vmedian_0_0, 0))