コード例 #1
0
 def setUp (self):
     self.tb = gr.top_block ()
     self.c = phy(slow_rate=True)
     self.dqcsk_mapper = ieee802_15_4.dqcsk_mapper_fc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqcsk_demapper = ieee802_15_4.dqcsk_demapper_cc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqpsk_mapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=True)
     self.dqpsk_demapper = ieee802_15_4.dqpsk_soft_demapper_cc(framelen=self.c.nsym_frame)
     self.qpsk_mapper = ieee802_15_4.qpsk_mapper_if() 
     self.qpsk_demapper = ieee802_15_4.qpsk_demapper_fi() 
     self.preamble_sfd_prefixer_I = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_I = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.preamble_sfd_prefixer_Q = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_Q = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.interleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.interleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.deinterleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.deinterleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.codeword_mapper_I = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_mapper_Q = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_I = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_Q = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.demux = blocks.deinterleave(gr.sizeof_char*1,1)
     self.mux = blocks.interleave(gr.sizeof_char*1,1)
     self.zeropadding = ieee802_15_4.zeropadding_b(self.c.padded_zeros)
     self.zeropadding_removal = ieee802_15_4.zeropadding_removal_b(self.c.phy_packetsize_bytes*8+len(self.c.PHR), self.c.padded_zeros)
     self.phr_prefixer = ieee802_15_4.phr_prefixer(self.c.PHR)
     self.phr_removal = ieee802_15_4.phr_removal(self.c.PHR)
     self.fragmentation = ieee802_15_4.fragmentation(self.c.phy_packetsize_bytes)
コード例 #2
0
ファイル: blocks.py プロジェクト: QRAAT/QRAAT
    def __init__(self, channels, be_param, directory = "./det_files"):

        gr.hier_block2.__init__(self, "record_backend",
                                gr.io_signature(4, 4, gr.sizeof_gr_complex), # Input signature
                                gr.io_signature(0, 0, 0))                    # Output signature

        self.band_rate = be_param.bw*be_param.num_bands
        print "Number of Bands: 1"
        print "Band sampling rate: ",self.band_rate



        self.directory = directory

        filename = os.path.join(self.directory, "placeholder.tdat")

        interleaver = gr_blocks.interleave(gr.sizeof_gr_complex)
        self.file_sink = gr_blocks.file_sink(gr.sizeof_gr_complex, filename)
        self.file_sink.close()
        # Connect filter outputs to each detector.             
        for k in range(channels):
            self.connect((self,k),(interleaver,k))

        self.connect(interleaver, self.file_sink)

        #: Band set of current tuning. 
        self.current_bands = None
コード例 #3
0
    def __init__(self, size, factor, itemsize=gr.sizeof_gr_complex):
        """
        size: (int) vector size (FFT size) of next block
        factor: (int) output will have this many more samples than input
        
        If size is not divisible by factor, then the output will necessarily have jitter.
        """
        size = int(size)
        factor = int(factor)
        # assert size % factor == 0
        offset = size // factor

        gr.hier_block2.__init__(
            self, type(self).__name__,
            gr.io_signature(1, 1, itemsize),
            gr.io_signature(1, 1, itemsize),
        )
        
        if factor == 1:
            # No duplication needed; simplify flowgraph
            # GR refused to connect self to self, so insert a dummy block
            self.connect(self, blocks.copy(itemsize), self)
        else:
            interleave = blocks.interleave(itemsize * size)
            self.connect(
                interleave,
                blocks.vector_to_stream(itemsize, size),
                self)
        
            for i in xrange(0, factor):
                self.connect(
                    self,
                    blocks.delay(itemsize, (factor - 1 - i) * offset),
                    blocks.stream_to_vector(itemsize, size),
                    (interleave, i))
コード例 #4
0
 def setUp (self):
     self.tb = gr.top_block ()
     self.c = phy(slow_rate=True)
     self.dqcsk_mapper = ieee802_15_4.dqcsk_mapper_fc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqcsk_demapper = ieee802_15_4.dqcsk_demapper_cf(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)   
     self.dqpsk_mapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=True)
     self.dqpsk_demapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=False) 
     self.qpsk_mapper = ieee802_15_4.qpsk_mapper_if() 
     self.qpsk_demapper = ieee802_15_4.qpsk_demapper_fi() 
     self.preamble_sfd_prefixer_I = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_I = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.preamble_sfd_prefixer_Q = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_Q = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.interleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.interleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.deinterleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.deinterleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.codeword_mapper_I = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_mapper_Q = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_I = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_Q = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.demux = blocks.deinterleave(gr.sizeof_char*1,1)
     self.mux = blocks.interleave(gr.sizeof_char*1,1)
     self.zeropadding = ieee802_15_4.zeropadding_b(self.c.padded_zeros)
     self.zeropadding_removal = ieee802_15_4.zeropadding_removal_b(self.c.phy_packetsize_bytes*8+len(self.c.PHR), self.c.padded_zeros)
     self.phr_prefixer = ieee802_15_4.phr_prefixer(self.c.PHR)
     self.phr_removal = ieee802_15_4.phr_removal(self.c.PHR)
     self.fragmentation = ieee802_15_4.fragmentation(self.c.phy_packetsize_bytes)
コード例 #5
0
ファイル: threaded_decoder.py プロジェクト: danbar/gnuradio
    def __init__(self, decoder_list_0, input_size, output_size):
        gr.hier_block2.__init__(
            self, "Threaded Decoder",
            gr.io_signature(1, 1, input_size*1),
            gr.io_signature(1, 1, output_size*1))

        self.decoder_list_0 = decoder_list_0

        self.deinterleave_0 = blocks.deinterleave(input_size,
                                                  fec.get_decoder_input_size(decoder_list_0[0]))

        self.generic_decoders_0 = []
        for i in range(len(decoder_list_0)):
            self.generic_decoders_0.append(fec.decoder(decoder_list_0[i],
                                                       input_size, output_size))

        self.interleave_0 = blocks.interleave(output_size,
                                              fec.get_decoder_output_size(decoder_list_0[0]))

        for i in range(len(decoder_list_0)):
            self.connect((self.deinterleave_0, i), (self.generic_decoders_0[i], 0))

        for i in range(len(decoder_list_0)):
            self.connect((self.generic_decoders_0[i], 0), (self.interleave_0, i))


        self.connect((self, 0), (self.deinterleave_0, 0))
        self.connect((self.interleave_0, 0), (self, 0))
コード例 #6
0
    def __init__(self, parent,
                 y_per_div=1, y_divs=8, ref_level=50, x_vals=numpy.arange(10), ninputs=1,
                 size=default_curvesink_size,
                 title='', x_units='', y_units='', legends=[], **kwargs):
        self.x_vals=x_vals;
        self.legends=legends
        gr.hier_block2.__init__(self, "curve_sink_f",
                                gr.io_signature(ninputs, ninputs, gr.sizeof_float),
                                gr.io_signature(0,0,0))

        curve_sink_base.__init__(self, input_is_real=True,
                                 y_per_div=y_per_div, y_divs=y_divs, ref_level=ref_level,
                                 title=title, x_units=x_units, y_units=y_units)
                               
        self.s2p = [];
        
        for i in range(0, ninputs):
            self.s2p.append(blocks.stream_to_vector(gr.sizeof_float, len(x_vals)))
        #self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
         #                                max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
        self.interleave = blocks.interleave(gr.sizeof_float * len(x_vals));
        
        self.s2v = blocks.stream_to_vector(gr.sizeof_float * len(x_vals), ninputs);
        
        self.sink = blocks.message_sink(gr.sizeof_float * len(x_vals) * ninputs, self.msgq, True);
        
        for i in range(0, ninputs):
            self.connect((self, i), self.s2p[i], (self.interleave, i))
        self.connect(self.interleave, self.s2v, self.sink);

        self.win=curve_window(self, parent, size=size, x_units=self.x_units, y_units=self.y_units, ninputs=ninputs)
コード例 #7
0
ファイル: run_buf_flowgraph.py プロジェクト: shrin18/gr-sched
    def create_diamond(self):

        src = blocks.null_source(gr.sizeof_float)
        head = blocks.head(gr.sizeof_float, self.samples)
        self.connect(src, head)
        ends = []

        for pipe in range(self.pipes):
            block = filter.fir_filter_fff(1, self.taps)
            self.connect(head, block)
            self.fir_blocks.append(block)

            for stage in range(1, self.stages):
                block = filter.fir_filter_fff(1, self.taps)
                self.connect(self.fir_blocks[-1], block)
                self.fir_blocks.append(block)

            ends.append(block)

        interleave = blocks.interleave(gr.sizeof_float, 1)
        for i, b in enumerate(ends):
            self.connect((b, 0), (interleave, i))

        sink = blocks.null_sink(gr.sizeof_float)
        self.connect(interleave, sink)
コード例 #8
0
ファイル: threaded_encoder.py プロジェクト: yxw027/gnuradio
    def __init__(self, encoder_list_0, input_size, output_size):
        gr.hier_block2.__init__(
            self, "Threaded Encoder",
            gr.io_signature(1, 1, input_size*1),
            gr.io_signature(1, 1, output_size*1))

        self.encoder_list_0 = encoder_list_0

        self.fec_deinterleave_0 = blocks.deinterleave(input_size,
                                                      fec.get_encoder_input_size(encoder_list_0[0]))

        self.generic_encoders_0 = [];
        for i in range(len(encoder_list_0)):
            self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
                                                       input_size, output_size))

        self.fec_interleave_0 = blocks.interleave(output_size,
                                               fec.get_encoder_output_size(encoder_list_0[0]))

        for i in range(len(encoder_list_0)):
            self.connect((self.fec_deinterleave_0, i), (self.generic_encoders_0[i], 0))

        for i in range(len(encoder_list_0)):
            self.connect((self.generic_encoders_0[i], 0), (self.fec_interleave_0, i))

        self.connect((self, 0), (self.fec_deinterleave_0, 0))
        self.connect((self.fec_interleave_0, 0), (self, 0))
コード例 #9
0
	def __init__(self, target_id, packet_size=8192, number_channel=1, channels = "1"):
		gr.hier_block2.__init__(self, "rtdex_sink",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0),)


		self._target_id = target_id
		self._packet_size = packet_size
		self._number_channel = number_channel
		self._channels = channels

		self.sink = nutaq.rtdex_sink(self._target_id,gr.sizeof_short,self._number_channel,3)
		self.sink.set_type(0)
		self.sink.set_packet_size(self._packet_size)
		self.sink.set_channels(self._channels)

		self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
		self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
		self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
		self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

		self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
		self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
		self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
		self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
		self.connect((self.blocks_interleave_0, 0), (self.sink, 0))       

		self.connect(self,self.blocks_complex_to_float_0)
コード例 #10
0
    def test_int_002(self):
        blksize = 4
        lenx = 64

        def plusup_big(a):
            return a + (blksize * 4)

        def plusup_little(a):
            return a + blksize

        a_vec = list(range(0, blksize))
        for i in range(0, (lenx // (4 * blksize)) - 1):
            a_vec += list(map(plusup_big, a_vec[len(a_vec) - blksize:]))

        b_vec = list(map(plusup_little, a_vec))
        c_vec = list(map(plusup_little, b_vec))
        d_vec = list(map(plusup_little, c_vec))

        src0 = blocks.vector_source_f(a_vec)
        src1 = blocks.vector_source_f(b_vec)
        src2 = blocks.vector_source_f(c_vec)
        src3 = blocks.vector_source_f(d_vec)
        op = blocks.interleave(gr.sizeof_float, blksize)
        dst = blocks.vector_sink_f()

        self.tb.connect(src0, (op, 0))
        self.tb.connect(src1, (op, 1))
        self.tb.connect(src2, (op, 2))
        self.tb.connect(src3, (op, 3))
        self.tb.connect(op, dst)
        self.tb.run()
        expected_result = tuple(range(lenx))
        result_data = dst.data()

        self.assertFloatTuplesAlmostEqual(expected_result, result_data)
コード例 #11
0
ファイル: matrix_interleaver.py プロジェクト: sdh11/gnuradio
    def set_rowsandcols(self, rows, cols, deint):
        self.disconnect_all()

        self.passthrough = None
        self.interleaver = None
        self.deinterleaver = None

        ##################################################
        # Parameters
        ##################################################
        self.rows = rows
        self.cols = cols
        self.deint = deint

        ##################################################
        # Blocks
        ##################################################
        # short circuit for unitary rows / columns
        if rows == 1 or cols == 1:
          self.passthrough = blocks.copy(self.itemsize)
          self.connect((self, 0), (self.passthrough, 0), (self, 0))
          return

        self.deinterleaver = blocks.deinterleave(self.itemsize, 1 if deint else cols)
        self.interleaver = blocks.interleave(self.itemsize, cols if deint else 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.deinterleaver, 0))
        for n in range(rows):
            self.connect((self.deinterleaver, n), (self.interleaver, n))
        self.connect((self.interleaver, 0), (self, 0))
コード例 #12
0
    def test_int_002 (self):
        blksize = 4
        lenx = 64
        plusup_big = lambda a: a + (blksize * 4)
        plusup_little = lambda a: a + blksize
        a_vec = range(0,blksize)
        for i in range(0,(lenx/(4 * blksize)) - 1):
            a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:])

        b_vec = map(plusup_little, a_vec)
        c_vec = map(plusup_little, b_vec)
        d_vec = map(plusup_little, c_vec)

        src0 = blocks.vector_source_f (a_vec)
        src1 = blocks.vector_source_f (b_vec)
        src2 = blocks.vector_source_f (c_vec)
        src3 = blocks.vector_source_f (d_vec)
        op = blocks.interleave (gr.sizeof_float, blksize)
        dst = blocks.vector_sink_f ()

        self.tb.connect (src0, (op, 0))
        self.tb.connect (src1, (op, 1))
        self.tb.connect (src2, (op, 2))
        self.tb.connect (src3, (op, 3))
        self.tb.connect (op, dst)
        self.tb.run ()
        expected_result = tuple (range (lenx))
        result_data = dst.data ()

        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
コード例 #13
0
ファイル: hd_tx_rtl_file.py プロジェクト: cn0xroot/gr-nrsc5
    def __init__(self):
        gr.top_block.__init__(self, "Hd Tx Rtl File")

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=2,
                decimation=1,
                taps=None,
                fractional_bw=None)
        self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD')
        self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist')
        self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176)
        self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1)
        self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000)
        self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1)
        self.blocks_wavfile_source_0 = blocks.wavfile_source('sample.wav', True)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048)
        self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048-112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, [])
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*2048, 2)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.5)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_float*1, 1)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, 'hd-generated.raw', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_ff(127.5)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0))
        self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0))
        self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1))
        self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0))
コード例 #14
0
ファイル: curvesink_nongl.py プロジェクト: sqf-ice/fecapi
    def __init__(self,
                 parent,
                 y_per_div=1,
                 y_divs=8,
                 ref_level=50,
                 x_vals=numpy.arange(10),
                 ninputs=1,
                 size=default_curvesink_size,
                 title='',
                 x_units='',
                 y_units='',
                 legends=[],
                 **kwargs):
        self.x_vals = x_vals
        self.legends = legends
        gr.hier_block2.__init__(
            self, "curve_sink_f",
            gr.io_signature(ninputs, ninputs, gr.sizeof_float),
            gr.io_signature(0, 0, 0))

        curve_sink_base.__init__(self,
                                 input_is_real=True,
                                 y_per_div=y_per_div,
                                 y_divs=y_divs,
                                 ref_level=ref_level,
                                 title=title,
                                 x_units=x_units,
                                 y_units=y_units)

        self.s2p = []

        for i in range(0, ninputs):
            self.s2p.append(
                blocks.stream_to_vector(gr.sizeof_float, len(x_vals)))
        #self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
        #                                max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
        self.interleave = blocks.interleave(gr.sizeof_float * len(x_vals))

        self.s2v = blocks.stream_to_vector(gr.sizeof_float * len(x_vals),
                                           ninputs)

        self.sink = blocks.message_sink(
            gr.sizeof_float * len(x_vals) * ninputs, self.msgq, True)

        for i in range(0, ninputs):
            self.connect((self, i), self.s2p[i], (self.interleave, i))
        self.connect(self.interleave, self.s2v, self.sink)

        self.win = curve_window(self,
                                parent,
                                size=size,
                                x_units=self.x_units,
                                y_units=self.y_units,
                                ninputs=ninputs)
コード例 #15
0
    def __init__(self,
                 esno=numpy.arange(0.0, 3.0, .25),
                 samp_rate=32000,
                 encoder_list=0,
                 decoder_list=0,
                 berminerrors=100,
                 berlimit=-7.0,
                 threading='capillary',
                 puncpat='11'):
        gr.hier_block2.__init__(
            self,
            "Bercurve",
            gr.io_signature(0, 0, 0),
            gr.io_signature(1, 1, gr.sizeof_float * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.esno = esno
        self.samp_rate = samp_rate
        self.encoder_list = encoder_list
        self.decoder_list = decoder_list
        self.berminerrors = berminerrors
        self.berlimit = berlimit
        self.puncpat = puncpat

        ##################################################
        # Blocks
        ##################################################
        self.gr_interleave_0 = blocks.interleave(gr.sizeof_float * 1)
        self.ber_generators = []
        for i in range(0, len(esno)):
            ber_generator_temp = ber_generator(generic_encoder=encoder_list[i],
                                               generic_decoder=decoder_list[i],
                                               esno=esno[i],
                                               samp_rate=samp_rate,
                                               berminerrors=berminerrors,
                                               berlimit=berlimit,
                                               threading=threading,
                                               puncpat=puncpat)
            self.ber_generators.append(ber_generator_temp)
        ##################################################
        # Connections
        ##################################################
        for i in range(0, len(esno)):
            self.connect((self.ber_generators[i], 0),
                         (self.gr_interleave_0, i))
        self.connect((self.gr_interleave_0, 0), (self, 0))
コード例 #16
0
    def __init__(self, syncword_threshold=None, options=None):
        gr.hier_block2.__init__(
            self,
            'k2sat_deframer',
            gr.io_signature(1, 1, gr.sizeof_float),
            gr.io_signature(0, 0, 0))
        options_block.__init__(self, options)

        self.message_port_register_hier_out('out')

        if syncword_threshold is None:
            syncword_threshold = self.options.syncword_threshold

        # For QPKS 90º abiguity
        self.deinterleave = blocks.deinterleave(gr.sizeof_float, 1)
        self.invert = blocks.multiply_const_ff(-1, 1)
        self.interleave = blocks.interleave(gr.sizeof_float, 1)

        self.cc0 = fec.cc_decoder.make(
            80, 7, 2, [79, 109], 0, -1, fec.CC_STREAMING, False)
        self.cc1 = fec.cc_decoder.make(
            80, 7, 2, [79, 109], 0, -1, fec.CC_STREAMING, False)
        self.viterbi0 = fec.extended_decoder(
            decoder_obj_list=self.cc0, threading=None, ann=None,
            puncpat='11')
        self.viterbi1 = fec.extended_decoder(
            decoder_obj_list=self.cc1, threading=None, ann=None,
            puncpat='11')
        self.diff0 = digital.diff_decoder_bb(2)
        self.diff1 = digital.diff_decoder_bb(2)
        self.scrambler0 = descrambler308()
        self.scrambler1 = descrambler308()
        self.deframer0 = sync_to_pdu_packed(
            packlen=2200, sync=_syncword, threshold=syncword_threshold)
        self.deframer1 = sync_to_pdu_packed(
            packlen=2200, sync=_syncword, threshold=syncword_threshold)
        self.deframer = deframer()

        self.connect(self, self.viterbi0, self.diff0,
                     self.scrambler0, self.deframer0)
        self.connect(self, self.deinterleave)
        self.connect((self.deinterleave, 0), (self.interleave, 1))
        self.connect((self.deinterleave, 1), self.invert, (self.interleave, 0))
        self.connect(self.interleave, self.viterbi1, self.diff1,
                     self.scrambler1, self.deframer1)

        self.msg_connect((self.deframer0, 'out'), (self.deframer, 'in'))
        self.msg_connect((self.deframer1, 'out'), (self.deframer, 'in'))
        self.msg_connect((self.deframer, 'out'), (self, 'out'))
コード例 #17
0
ファイル: mode_s.py プロジェクト: WindyCitySDR/shinysdr
    def __init__(self, mode="MODE-S", input_rate=0, audio_rate=0, context=None):
        assert input_rate > 0
        gr.hier_block2.__init__(
            self,
            "Mode S/ADS-B/1090 demodulator",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            # TODO: Add generic support for demodulators with no audio output
            gr.io_signature(2, 2, gr.sizeof_float * 1),
        )
        self.mode = mode
        self.input_rate = input_rate

        # Subprocess
        self.dump1090 = SubprocessSink(args=["dump1090", "--ifile", "-"], itemsize=gr.sizeof_char)

        # Output
        self.band_filter_block = filter = MultistageChannelFilter(
            input_rate=input_rate,
            output_rate=pipe_rate,  # expected by dump1090
            cutoff_freq=pipe_rate / 2,
            transition_width=transition_width,
        )  # TODO optimize filter band
        interleaver = blocks.interleave(gr.sizeof_char)
        self.connect(
            self,
            filter,
            blocks.complex_to_real(1),
            blocks.multiply_const_ff(255.0 / 2),
            blocks.add_const_ff(255.0 / 2),
            blocks.float_to_uchar(),
            (interleaver, 0),
            self.dump1090,
        )

        self.connect(
            filter,
            blocks.complex_to_imag(1),
            blocks.multiply_const_ff(255.0 / 2),
            blocks.add_const_ff(255.0 / 2),
            blocks.float_to_uchar(),
            (interleaver, 1),
        )
        # Dummy audio
        zero = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.throttle = blocks.throttle(gr.sizeof_float, audio_rate)
        self.connect(zero, self.throttle)
        self.connect(self.throttle, (self, 0))
        self.connect(self.throttle, (self, 1))
コード例 #18
0
ファイル: bercurve_generate.py プロジェクト: trondeau/fecapi
	def __init__(self, esno=numpy.arange(0.0, 3.0, .25), samp_rate=32000, encoder_list=0, decoder_list=0, berminerrors=100, berlimit=-7.0, threading='capillary', puncpat='11'):
		gr.hier_block2.__init__(
			self, "Bercurve",
			gr.io_signature(0, 0, 0),
			gr.io_signature(1, 1, gr.sizeof_float*1),
		)

		##################################################
		# Parameters
		##################################################
		self.esno = esno
		self.samp_rate = samp_rate
		self.encoder_list = encoder_list
		self.decoder_list = decoder_list
		self.berminerrors = berminerrors
		self.berlimit = berlimit
		self.puncpat = puncpat

		##################################################
		# Blocks
		##################################################
		self.gr_interleave_0 = blocks.interleave(gr.sizeof_float*1)
		self.ber_generators = []
		for i in range(0, len(esno)):
                        if(generic_encoder == None):
                                ber_generator_temp = ber_raw_generator(
                                        esno=esno[i],
                                        samp_rate=samp_rate,
                                        berminerrors=berminerrors,
                                        berlimit=berlimit)
                        else:
                                ber_generator_temp = ber_generator(
                                        generic_encoder=encoder_list[i],
                                        generic_decoder=decoder_list[i],
                                        esno=esno[i],
                                        samp_rate=samp_rate,
                                        berminerrors=berminerrors,
                                        berlimit=berlimit,
                                        threading=threading,
                                        puncpat=puncpat)
			self.ber_generators.append(ber_generator_temp);
		##################################################
		# Connections
		##################################################
		for i in range(0, len(esno)):			
			self.connect((self.ber_generators[i], 0), (self.gr_interleave_0, i));
		self.connect((self.gr_interleave_0, 0), (self, 0))
コード例 #19
0
    def __init__(self,
                 type='BER',
                 win_size=default_win_size,
                 bits_per_symbol=2):
        """
        Error rate constructor.

        Args:
            type: a string 'BER' or 'SER'
            win_size: the number of samples to calculate over
            bits_per_symbol: the number of information bits per symbol (BER only)
        """
        #init
        gr.hier_block2.__init__(
            self,
            'error_rate',
            gr.io_signature(2, 2, gr.sizeof_char),
            gr.io_signature(1, 1, gr.sizeof_float),
        )

        print "Warning: the blks2.error_rate is deprecated."

        assert type in ('BER', 'SER')
        self._max_samples = win_size
        self._bits_per_symbol = bits_per_symbol
        #setup message queue
        msg_source = blocks.message_source(gr.sizeof_float, 1)
        self._msgq_source = msg_source.msgq()
        msgq_sink = gr.msg_queue(2)
        msg_sink = blocks.message_sink(gr.sizeof_char, msgq_sink,
                                       False)  #False -> blocking
        inter = blocks.interleave(gr.sizeof_char)
        #start thread
        self._num_errs = 0
        self._err_index = 0
        self._num_samps = 0
        self._err_array = numpy.zeros(self._max_samples, numpy.int8)
        if type == 'BER':
            input_watcher(msgq_sink, self._handler_ber)
        elif type == 'SER':
            input_watcher(msgq_sink, self._handler_ser)
        #connect
        self.connect(msg_source, self)
        self.connect((self, 0), (inter, 0))
        self.connect((self, 1), (inter, 1))
        self.connect(inter, msg_sink)
コード例 #20
0
    def test_int_001(self):
        lenx = 64
        src0 = blocks.vector_source_f(list(range(0, lenx, 4)))
        src1 = blocks.vector_source_f(list(range(1, lenx, 4)))
        src2 = blocks.vector_source_f(list(range(2, lenx, 4)))
        src3 = blocks.vector_source_f(list(range(3, lenx, 4)))
        op = blocks.interleave(gr.sizeof_float)
        dst = blocks.vector_sink_f()

        self.tb.connect(src0, (op, 0))
        self.tb.connect(src1, (op, 1))
        self.tb.connect(src2, (op, 2))
        self.tb.connect(src3, (op, 3))
        self.tb.connect(op, dst)
        self.tb.run()
        expected_result = tuple(range(lenx))
        result_data = dst.data()
        self.assertFloatTuplesAlmostEqual(expected_result, result_data)
コード例 #21
0
    def test_int_001 (self):
        lenx = 64
        src0 = blocks.vector_source_f (range (0, lenx, 4))
        src1 = blocks.vector_source_f (range (1, lenx, 4))
        src2 = blocks.vector_source_f (range (2, lenx, 4))
        src3 = blocks.vector_source_f (range (3, lenx, 4))
        op = blocks.interleave (gr.sizeof_float)
        dst = blocks.vector_sink_f ()

        self.tb.connect (src0, (op, 0))
        self.tb.connect (src1, (op, 1))
        self.tb.connect (src2, (op, 2))
        self.tb.connect (src3, (op, 3))
        self.tb.connect (op, dst)
        self.tb.run ()
        expected_result = tuple (range (lenx))
        result_data = dst.data ()
        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
コード例 #22
0
    def test_002_t(self):
        self.tb2 = gr.top_block()
        N_rb_dl = 50
        phich_dur = 0
        phich_res = 1.0
        N_ant = 2
        data = []
        test_len = 100
        my_res = []
        for i in range(test_len):
            mib = lte_test.pack_mib(N_rb_dl, phich_dur, phich_res, i)
            crc = lte_test.crc_checksum(mib, N_ant)
            conv = lte_test.convolutional_encoder_sorted(crc)
            convit = lte_test.convolutional_encoder(crc)
            my_res.extend(lte_test.nrz_encoding(convit))
            rated = lte_test.rate_match(conv)
            nrz = lte_test.nrz_encoding(rated)
            data.extend(nrz)

        srcf = blocks.vector_source_f(data, False, 120)
        snkf = blocks.file_sink(gr.sizeof_float * 120,
                                "/home/johannes/tests/rated.dat")
        self.tb2.connect(srcf, snkf)

        src1 = blocks.vector_source_f(data, False, 120)

        vts0 = blocks.vector_to_stream(40 * gr.sizeof_float, 3)
        sts0 = blocks.stream_to_streams(40 * gr.sizeof_float, 3)
        self.tb2.connect(src1, vts0, sts0)

        inter = blocks.interleave(gr.sizeof_float)
        for i in range(3):
            deint = lte.subblock_deinterleaver_vfvf(40, 1)
            vts1 = blocks.vector_to_stream(1 * gr.sizeof_float, 40)
            self.tb2.connect((sts0, i), deint, vts1, (inter, i))
        stv = blocks.stream_to_vector(1 * gr.sizeof_float, 120)
        snk = blocks.vector_sink_f(120)
        self.tb2.connect(inter, stv, snk)

        self.tb2.run()
        res = snk.data()
        print res[110:130]

        self.assertFloatTuplesAlmostEqual(tuple(my_res), res)
コード例 #23
0
 def test_002_t(self):
     self.tb2 = gr.top_block()
     N_rb_dl = 50
     phich_dur = 0
     phich_res = 1.0
     N_ant = 2
     data = []
     test_len = 100
     my_res = []
     for i in range(test_len):
         mib = lte_test.pack_mib(N_rb_dl, phich_dur, phich_res, i)
         crc = lte_test.crc_checksum(mib, N_ant)
         conv = lte_test.convolutional_encoder_sorted(crc)
         convit = lte_test.convolutional_encoder(crc)
         my_res.extend(lte_test.nrz_encoding(convit) )
         rated = lte_test.rate_match(conv)
         nrz = lte_test.nrz_encoding(rated)
         data.extend(nrz)
     
     srcf = blocks.vector_source_f(data, False, 120)
     snkf = blocks.file_sink(gr.sizeof_float*120, "/home/johannes/tests/rated.dat")
     self.tb2.connect(srcf, snkf)
     
     src1 = blocks.vector_source_f(data, False, 120)
             
     vts0 = blocks.vector_to_stream(40*gr.sizeof_float, 3)
     sts0 = blocks.stream_to_streams(40*gr.sizeof_float, 3)        
     self.tb2.connect(src1, vts0, sts0)
     
     
     inter = blocks.interleave(gr.sizeof_float)
     for i in range(3):
         deint = lte.subblock_deinterleaver_vfvf(40, 1)
         vts1 = blocks.vector_to_stream(1*gr.sizeof_float, 40)
         self.tb2.connect( (sts0, i), deint, vts1, (inter, i))
     stv = blocks.stream_to_vector(1*gr.sizeof_float, 120)
     snk = blocks.vector_sink_f(120)        
     self.tb2.connect(inter, stv, snk)
     
     self.tb2.run()
     res = snk.data()
     print res[110:130]
     
     self.assertFloatTuplesAlmostEqual(tuple(my_res), res)
コード例 #24
0
ファイル: error_rate.py プロジェクト: Flamewires/gnuradio
    def __init__(self, type='BER', win_size=default_win_size, bits_per_symbol=2):
        """
        Error rate constructor.

        Args:
            type: a string 'BER' or 'SER'
            win_size: the number of samples to calculate over
            bits_per_symbol: the number of information bits per symbol (BER only)
        """
        #init
        gr.hier_block2.__init__(
            self, 'error_rate',
            gr.io_signature(2, 2, gr.sizeof_char),
            gr.io_signature(1, 1, gr.sizeof_float),
        )

        print "Warning: the blks2.error_rate is deprecated."

        assert type in ('BER', 'SER')
        self._max_samples = win_size
        self._bits_per_symbol = bits_per_symbol
        #setup message queue
        msg_source = blocks.message_source(gr.sizeof_float, 1)
        self._msgq_source = msg_source.msgq()
        msgq_sink = gr.msg_queue(2)
        msg_sink = blocks.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking
        inter = blocks.interleave(gr.sizeof_char)
        #start thread
        self._num_errs = 0
        self._err_index = 0
        self._num_samps = 0
        self._err_array = numpy.zeros(self._max_samples, numpy.int8)
        if type == 'BER':
            input_watcher(msgq_sink, self._handler_ber)
        elif type == 'SER':
            input_watcher(msgq_sink, self._handler_ser)
        #connect
        self.connect(msg_source, self)
        self.connect((self, 0), (inter, 0))
        self.connect((self, 1), (inter, 1))
        self.connect(inter, msg_sink)
コード例 #25
0
    def __init__(self,
                 target_id,
                 packet_size=8192,
                 number_channel=1,
                 channels="1"):
        gr.hier_block2.__init__(
            self,
            "rtdex_sink",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(0, 0, 0),
        )

        self._target_id = target_id
        self._packet_size = packet_size
        self._number_channel = number_channel
        self._channels = channels

        self.sink = nutaq.rtdex_sink(self._target_id, gr.sizeof_short,
                                     self._number_channel, 3)
        self.sink.set_type(0)
        self.sink.set_packet_size(self._packet_size)
        self.sink.set_channels(self._channels)

        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0), (self.sink, 0))

        self.connect(self, self.blocks_complex_to_float_0)
コード例 #26
0
    def __init__(self, vlen):
        gr.hier_block2.__init__(
            self,
            "xcorrelate_fft_vcf",
            gr.io_signature(2, 2,
                            gr.sizeof_gr_complex * vlen),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_float * vlen))  # Output signature

        # Multiply conjugate
        mult_conj = blocks.multiply_conjugate_cc(vlen)

        # Reverse FFT, vec_len, Reverse, [1.0,]]*vec_len, no shift
        rev_fft = fft.fft_vcc(vlen, False, [
            1.0,
        ] * vlen, False, 1)

        # Complex to mag - vlen
        cc_to_mag = blocks.complex_to_mag(vlen)

        # Vector to stream
        vec_to_stream = blocks.vector_to_stream(gr.sizeof_float, vlen)

        # De-interleave
        deinterleave = blocks.deinterleave(gr.sizeof_float * 1, int(vlen / 2))

        # Cross de-interleave into interleave to swap FFT
        interleave = blocks.interleave(gr.sizeof_float * 1, int(vlen / 2))

        # Stream to Vector - vlen
        stream_to_vec = blocks.stream_to_vector(gr.sizeof_float * 1, vlen)

        # Make all the connections
        self.connect((self, 0), (mult_conj, 0))
        self.connect((self, 1), (mult_conj, 1))
        self.connect(mult_conj, rev_fft, cc_to_mag, vec_to_stream,
                     deinterleave)
        self.connect((deinterleave, 0), (interleave, 1))
        self.connect((deinterleave, 1), (interleave, 0))
        self.connect(interleave, stream_to_vec, self)
コード例 #27
0
ファイル: top_block.py プロジェクト: juanduncan/cognitive
    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 = 500000
        self.period = period = 1000
        self.pdu_length = pdu_length = 100
        self.packet_size = packet_size = 1024
        self.out_buf_size = out_buf_size = 96000
        self.encoding = encoding = 0
        self.decimation = decimation = 40
        self.RF_freq_0 = RF_freq_0 = 943e6
        self.RF_freq = RF_freq = 943e6

        ##################################################
        # Blocks
        ##################################################
        self._period_range = Range(1, 10000, 1, 1000, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider")
        self.top_layout.addWidget(self._period_win)
        self._pdu_length_range = Range(10, 1500, 1, 100, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider")
        self.top_layout.addWidget(self._pdu_length_win)
        self._encoding_options = (0, 1, 2, )
        self._encoding_labels = ("BPSK 1/2"  , "BPSK 3/4", "QPSK 1/2", )
        self._encoding_tool_bar = Qt.QToolBar(self)
        self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding"+": "))
        self._encoding_combo_box = Qt.QComboBox()
        self._encoding_tool_bar.addWidget(self._encoding_combo_box)
        for label in self._encoding_labels: self._encoding_combo_box.addItem(label)
        self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i)))
        self._encoding_callback(self.encoding)
        self._encoding_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_encoding(self._encoding_options[i]))
        self.top_layout.addWidget(self._encoding_tool_bar)
        self.wifi_PHY_tx_hier_1 = wifi_PHY_tx_hier(
            chan_est=1,
            encoding=ieee802_11.BPSK_1_2,
        )
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-5)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(25)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(10)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(1)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(800)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_default_value(int((4e6)/samp_rate/40*(2**32)))
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",1)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(0.01)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.103")
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255]))
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length)) + "1234"), period)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_min_output_buffer(8192)
        (self.blocks_complex_to_float_0).set_max_output_buffer(8192)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))    
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_PHY_tx_hier_1, 'mac_in'))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.wifi_PHY_tx_hier_1, 0), (self.blocks_throttle_0_0, 0))    
コード例 #28
0
ファイル: perseus_mimo.py プロジェクト: juanduncan/cognitive
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus MIMO")
        _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 = 14.40e6/2
        self.freq2 = freq2 = 1e6
        self.freq1 = freq1 = 500e3

        ##################################################
        # Blocks
        ##################################################
        _freq2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq2_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq2_sizer,
        	value=self.freq2,
        	callback=self.set_freq2,
        	label='freq2',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq2_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq2_sizer,
        	value=self.freq2,
        	callback=self.set_freq2,
        	minimum=-samp_rate/2,
        	maximum=samp_rate/2,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq2_sizer)
        _freq1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq1_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq1_sizer,
        	value=self.freq1,
        	callback=self.set_freq1,
        	label='freq1',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq1_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq1_sizer,
        	value=self.freq1,
        	callback=self.set_freq1,
        	minimum=-samp_rate/2,
        	maximum=samp_rate/2,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq1_sizer)
        self.wxgui_fftsink_1 = 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,
        	size=(200,200),
        )
        self.GridAdd(self.wxgui_fftsink_1.win, 1, 1, 1, 1)
        self.wxgui_fftsink_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,
        	win=window.blackmanharris,
        	size=(200, 200),
        )
        self.GridAdd(self.wxgui_fftsink_0.win, 1, 2, 1, 1)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_short,2,5)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("1,2")
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,2,4)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("1,2")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 2, 2)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(953e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(953e6)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(953e6)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(953e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",7)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",6)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(6)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102")
        self.blocks_short_to_float_0_1 = blocks.short_to_float(1, 2**11-1)
        self.blocks_short_to_float_0_0_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_interleave_0_0 = blocks.interleave(gr.sizeof_short*1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1)
        self.blocks_float_to_short_0_0_1 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        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_deinterleave_0_0 = blocks.deinterleave(gr.sizeof_short*1)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq2, 0.95, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq1, 0.95, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_fftsink_1, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0), (self.wxgui_fftsink_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_complex_to_float_0_0, 0))
        self.connect((self.blocks_interleave_0_0, 0), (self.nutaq_rtdex_sink_0, 1))
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_short_to_float_0_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 1), (self.blocks_deinterleave_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 1), (self.blocks_short_to_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 0), (self.blocks_short_to_float_0_1, 0))
        self.connect((self.blocks_short_to_float_0_1, 0), (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0, 0), (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.blocks_float_to_short_0_0_0_0, 0), (self.blocks_interleave_0_0, 1))
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.blocks_float_to_short_0_0_1, 0))
        self.connect((self.blocks_float_to_short_0_0_1, 0), (self.blocks_interleave_0_0, 0))
        self.connect((self.blocks_complex_to_float_0_0, 1), (self.blocks_float_to_short_0_0_0_0, 0))
コード例 #29
0
    def __init__(self, decoder_list_0, input_size, output_size):
        gr.hier_block2.__init__(
            self, "Capillary Threaded Decoder",
            gr.io_signature(1, 1, input_size*1),
            gr.io_signature(1, 1, output_size*1))

        self.decoder_list_0 = decoder_list_0

        check = math.log10(len(self.decoder_list_0)) / math.log10(2.0)
        if(abs(check - int(check)) > 0):
            gr.log.info("fec.capillary_threaded_decoder: number of decoders must be a power of 2.")
            raise AttributeError

        self.deinterleaves_0 = []
        for i in range(int(math.log(len(decoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.deinterleaves_0.append(blocks.deinterleave(input_size,
                                                                fec.get_decoder_input_size(decoder_list_0[0])))

        self.generic_decoders_0 = []
        for i in range(len(decoder_list_0)):
            self.generic_decoders_0.append(fec.decoder(decoder_list_0[i], input_size, output_size))

        self.interleaves_0 = []
        for i in range(int(math.log(len(decoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.interleaves_0.append(blocks.interleave(output_size,
                                                            fec.get_decoder_output_size(decoder_list_0[0])))

        rootcount = 0
        branchcount = 1
        for i in range(int(math.log(len(decoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.deinterleaves_0[rootcount], 0), (self.deinterleaves_0[branchcount], 0))
                self.connect((self.deinterleaves_0[rootcount], 1), (self.deinterleaves_0[branchcount + 1], 0))
                rootcount += 1
                branchcount += 2

        codercount = 0
        for i in range(len(decoder_list_0) // 2):
            self.connect((self.deinterleaves_0[rootcount], 0), (self.generic_decoders_0[codercount], 0))
            self.connect((self.deinterleaves_0[rootcount], 1), (self.generic_decoders_0[codercount + 1], 0))
            rootcount += 1
            codercount += 2

        rootcount = 0
        branchcount = 1
        for i in range(int(math.log(len(decoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.interleaves_0[branchcount], 0), (self.interleaves_0[rootcount], 0))
                self.connect((self.interleaves_0[branchcount + 1], 0), (self.interleaves_0[rootcount], 1))
                rootcount += 1
                branchcount += 2

        codercount = 0
        for i in range(len(decoder_list_0) // 2):
            self.connect((self.generic_decoders_0[codercount], 0), (self.interleaves_0[rootcount], 0))
            self.connect((self.generic_decoders_0[codercount + 1], 0), (self.interleaves_0[rootcount], 1))
            rootcount += 1
            codercount += 2

        if ((len(self.decoder_list_0)) > 1):
            self.connect((self, 0), (self.deinterleaves_0[0], 0))
            self.connect((self.interleaves_0[0], 0), (self, 0))
        else:
            self.connect((self, 0), (self.generic_decoders_0[0], 0))
            self.connect((self.generic_decoders_0[0], 0), (self, 0))
コード例 #30
0
    def __init__(self, chan_est=0):
        gr.top_block.__init__(self, "Top Block Waveforms")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block Waveforms")
        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_waveforms")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.chan_est = chan_est

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.threshold = threshold = 1000
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 5e5
        self.period = period = 300
        self.pdu_length = pdu_length = 1000
        self.out_buf_size = out_buf_size = 96000
        self.freq_sin = freq_sin = 1000
        self.freq = freq = 943e6
        self.decimation = decimation = 40

        ##################################################
        # Blocks
        ##################################################
        self._period_range = Range(1, 10000, 1, 300, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float)
        self.top_layout.addWidget(self._period_win)
        self._pdu_length_range = Range(10, 1500, 1, 1000, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int)
        self.top_layout.addWidget(self._pdu_length_win)
        self.wifi_PHY_tx_hier_1 = wifi_PHY_tx_hier(
            chan_est=1,
            encoding=ieee802_11.BPSK_1_2,
        )
        (self.wifi_PHY_tx_hier_1).set_min_output_buffer(262144)
        self.qtgui_time_sink_x_2_0 = qtgui.time_sink_f(
        	128, #size
        	100, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_2_0.set_update_time(0.10)
        self.qtgui_time_sink_x_2_0.set_y_axis(-1, 110)
        
        self.qtgui_time_sink_x_2_0.set_y_label("Frame error rata", "")
        
        self.qtgui_time_sink_x_2_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_2_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_2_0.enable_autoscale(False)
        self.qtgui_time_sink_x_2_0.enable_grid(True)
        self.qtgui_time_sink_x_2_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_2_0.disable_legend()
        
        labels = ["Packets Reveiced", "", "", "", "",
                  "", "", "", "", ""]
        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_2_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_2_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_2_0_win = sip.wrapinstance(self.qtgui_time_sink_x_2_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_2_0_win)
        (self.qtgui_time_sink_x_2_0).set_processor_affinity([3])
        self.qtgui_time_sink_x_1 = qtgui.time_sink_c(
        	64, #size
        	1, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.050)
        self.qtgui_time_sink_x_1.set_y_axis(-20, 20)
        
        self.qtgui_time_sink_x_1.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_1.enable_tags(-1, False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.5, 0, 0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1.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 = [0, 0, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [0, 0, -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_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c(
        	2**16, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.1, 1000)
        
        self.qtgui_time_sink_x_0_0_0_1.set_y_label("Received Samples", "")
        
        self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, False)
        self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 5e-3, 0, "FISTOR")
        self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0_0_1.disable_legend()
        
        labels = ["correlation I", "correlation Q", "correlation_big", "", "",
                  "", "", "", "", ""]
        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_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win)
        self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16)
        (self.ofdm_80211_short_MF_v2_0).set_processor_affinity([2])
        (self.ofdm_80211_short_MF_v2_0).set_min_output_buffer(131072)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_int,1,0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8600)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_min_output_buffer(2048)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-20)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0_2.set_index(0)
        self.nutaq_custom_register_0_2.set_default_value(int((4e6)/samp_rate/40*(2**32)))
        self.nutaq_custom_register_0_2.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0_1.set_index(2)
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0_1.set_index(3)
        self.nutaq_custom_register_0_0_1.set_default_value(7)
        self.nutaq_custom_register_0_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0_0.set_index(6)
        self.nutaq_custom_register_0_0_0.set_default_value(600)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102")
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False)
        (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True)
        (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255]))
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False)
        (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False)
        (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False)
        (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000)
        self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200)
        self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float)
        self.top_layout.addWidget(self._freq_sin_win)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1)
        (self.fft_vxx_0).set_processor_affinity([3])
        (self.fft_vxx_0).set_min_output_buffer(96000)
        self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False)
        (self.carajito).set_processor_affinity([2])
        (self.carajito).set_min_output_buffer(131072)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 64)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64)
        (self.blocks_stream_to_vector_0).set_processor_affinity([3])
        (self.blocks_stream_to_vector_0).set_min_output_buffer(96000)
        self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len")
        (self.blocks_pdu_to_tagged_stream_0_0).set_processor_affinity([3])
        (self.blocks_pdu_to_tagged_stream_0_0).set_min_output_buffer(96000)
        self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("Hello__" +"".join("x" for i in range(pdu_length)) + "1234"), period)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        (self.blocks_interleave_0).set_min_output_buffer(262144)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**8-1)
        (self.blocks_float_to_short_0_0_0).set_min_output_buffer(262144)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**8-1)
        (self.blocks_float_to_short_0_0).set_min_output_buffer(262144)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length)
        (self.blocks_delay_0).set_processor_affinity([3])
        (self.blocks_delay_0).set_min_output_buffer(96000)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int*1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_min_output_buffer(262144)
        self.COWN_tx_valve_0 = COWN.tx_valve()
        self.COWN_syncher2_0 = COWN.syncher2()
        (self.COWN_syncher2_0).set_min_output_buffer(16384)
        self.COWN_resta_0 = COWN.resta()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))    
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in'))    
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_PHY_tx_hier_1, 'mac_in'))    
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus'))    
        self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0))    
        self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0))    
        self.connect((self.COWN_tx_valve_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_1, 0))    
        self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_1, 1))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1))    
        self.connect((self.blocks_float_to_complex_1, 0), (self.ofdm_80211_short_MF_v2_0, 0))    
        self.connect((self.blocks_float_to_complex_1, 0), (self.qtgui_time_sink_x_0_0_0_1, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.qtgui_time_sink_x_2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_1, 0))    
        self.connect((self.carajito, 0), (self.blocks_delay_0, 0))    
        self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0))    
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0))    
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))    
        self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1, 0))    
        self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0))    
        self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1))    
        self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2))    
        self.connect((self.wifi_PHY_tx_hier_1, 0), (self.COWN_tx_valve_0, 0))    
コード例 #31
0
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_s_sensing")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.variable_funcion = variable_funcion = 2.5e6
        self.show_test_statistics = show_test_statistics = False
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.funcion_prove_showts_edge = funcion_prove_showts_edge = 0
        self.freq_offset = freq_offset = variable_funcion
        self.decimation = decimation = 40
        self.cosenito = cosenito = 20e3
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 2000
        self.ENABLE_TX1_variable_check_box = ENABLE_TX1_variable_check_box = True

        ##################################################
        # Blocks
        ##################################################
        _show_test_statistics_check_box = Qt.QCheckBox("Show Test Statistics (ReL and Rs)")
        self._show_test_statistics_choices = {True: True, False: False}
        self._show_test_statistics_choices_inv = dict((v,k) for k,v in self._show_test_statistics_choices.iteritems())
        self._show_test_statistics_callback = lambda i: Qt.QMetaObject.invokeMethod(_show_test_statistics_check_box, "setChecked", Qt.Q_ARG("bool", self._show_test_statistics_choices_inv[i]))
        self._show_test_statistics_callback(self.show_test_statistics)
        _show_test_statistics_check_box.stateChanged.connect(lambda i: self.set_show_test_statistics(self._show_test_statistics_choices[bool(i)]))
        self.top_layout.addWidget(_show_test_statistics_check_box)
        self.probe = blocks.probe_signal_f()
        def _variable_funcion_probe():
            while True:
                val = self.probe.level()
                try:
                    self.set_variable_funcion(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.01))
        _variable_funcion_thread = threading.Thread(target=_variable_funcion_probe)
        _variable_funcion_thread.daemon = True
        _variable_funcion_thread.start()
        self.spectsensing_ss_edge_plot_0 = spectsensing.ss_edge_plot(show_test_statistics, " " )
        self._spectsensing_ss_edge_plot_0_win = self.spectsensing_ss_edge_plot_0;
        self.top_layout.addWidget(self._spectsensing_ss_edge_plot_0_win) 
        
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1;
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_subband_selector_0 = spectsensing.subband_selector(40, "Selection", 2.5e6 , samp_rate)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(nfft, samp_rate, 1024 )
        self.spectsensing_compute_statistics_0 = spectsensing.compute_statistics(nfft, samp_rate, 0.0065, 1e-9, 1e-9, 40, 54)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	8E3, #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(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          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(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_c(
        	2**15, #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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_S_S = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,3)
        self.nutaq_rtdex_source_S_S.set_type(0)
        self.nutaq_rtdex_source_S_S.set_packet_size(1200)
        self.nutaq_rtdex_source_S_S.set_channels("3")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq )
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(4)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(10)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_default_value(int((2e6)/samp_rate*(2**32)))
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.101")
        def _funcion_prove_showts_edge_probe():
            while True:
                val = self.spectsensing_ss_edge_plot_0.update_variable_show_Ts(self.show_test_statistics)
                try:
                    self.set_funcion_prove_showts_edge(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.1))
        _funcion_prove_showts_edge_thread = threading.Thread(target=_funcion_prove_showts_edge_probe)
        _funcion_prove_showts_edge_thread.daemon = True
        _funcion_prove_showts_edge_thread.start()
        self._freq_offset_range = Range(-1e7, 1e7, 1e4, variable_funcion, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, "freq_offset", "slider")
        self.top_layout.addWidget(self._freq_offset_win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=oversampling,
        	bt=0.71,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=oversampling,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self._cosenito_range = Range(-250e3, 250e3, 1e3, 20e3, 200)
        self._cosenito_win = RangeWidget(self._cosenito_range, self.set_cosenito, "cosenito", "counter_slider")
        self.top_layout.addWidget(self._cosenito_win)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, "192.168.0.122", 1234, 1472, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, 2*4e3 + 0*samp_rate/40/(oversampling*8*2),True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_null_sink_1_3 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_2 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_1_0 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_1 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_short*1)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_multiply_const_vxx_0_1_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        _ENABLE_TX1_variable_check_box_check_box = Qt.QCheckBox("Enable Transmission")
        self._ENABLE_TX1_variable_check_box_choices = {True: True, False: False}
        self._ENABLE_TX1_variable_check_box_choices_inv = dict((v,k) for k,v in self._ENABLE_TX1_variable_check_box_choices.iteritems())
        self._ENABLE_TX1_variable_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(_ENABLE_TX1_variable_check_box_check_box, "setChecked", Qt.Q_ARG("bool", self._ENABLE_TX1_variable_check_box_choices_inv[i]))
        self._ENABLE_TX1_variable_check_box_callback(self.ENABLE_TX1_variable_check_box)
        _ENABLE_TX1_variable_check_box_check_box.stateChanged.connect(lambda i: self.set_ENABLE_TX1_variable_check_box(self._ENABLE_TX1_variable_check_box_choices[bool(i)]))
        self.top_layout.addWidget(_ENABLE_TX1_variable_check_box_check_box)
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0 = DataConversion.reint_short_float()
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(1024)
        self.DataConversion_eaver_resynchronizer_0 = DataConversion.eaver_resynchronizer(decimation)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.spectsensing_compute_statistics_0, 'spec_sens_pdus'), (self.spectsensing_ss_edge_plot_0, 'pdus'))    
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'), (self.spectsensing_xs_plot_1, 'pdus'))    
        self.connect((self.DataConversion_eaver_resynchronizer_0, 0), (self.spectsensing_compute_statistics_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0, 1), (self.spectsensing_compute_statistics_0, 1))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0), (self.spectsensing_ss_pds_plot_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1), (self.spectsensing_ss_pds_plot_0, 1))    
        self.connect((self.DataConversion_reint_short_float_0, 0), (self.DataConversion_eaver_resynchronizer_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0), (self.blocks_multiply_const_vxx_0_3, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1, 0), (self.blocks_multiply_const_vxx_0_1_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0), (self.blocks_multiply_const_vxx_0_1_0_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2, 0), (self.blocks_multiply_const_vxx_0_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0), (self.blocks_multiply_const_vxx_0_1_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_3, 0), (self.DataConversion_eaver_resynchronizer_0_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_udp_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.DataConversion_eaver_resynchronizer_0, 1))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.DataConversion_eaver_resynchronizer_0_0, 1))    
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 0), (self.DataConversion_reint_short_float_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 1), (self.DataConversion_reint_short_float_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 3), (self.DataConversion_reint_short_float_0_1, 0))    
        self.connect((self.blocks_deinterleave_0_0, 2), (self.DataConversion_reint_short_float_0_2, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 1), (self.blocks_short_to_float_0_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 0), (self.blocks_short_to_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 1), (self.DataConversion_reint_short_float_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 3), (self.DataConversion_reint_short_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 2), (self.DataConversion_reint_short_float_0_2_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 0), (self.DataConversion_reint_short_float_0_3, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0, 0), (self.blocks_add_xx_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0), (self.blocks_add_xx_0_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_short_to_float_0_0_0_0, 0), (self.blocks_float_to_complex_0_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_1_0, 0), (self.blocks_float_to_complex_0_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_2, 0))    
        self.connect((self.nutaq_rtdex_source_0_0_0, 0), (self.blocks_deinterleave_0_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S, 0), (self.blocks_deinterleave_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S_0, 0), (self.blocks_deinterleave_0_0_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 0), (self.blocks_null_sink_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 5), (self.blocks_null_sink_1_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 2), (self.blocks_null_sink_1_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 3), (self.blocks_null_sink_1_1_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 4), (self.blocks_null_sink_1_2, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 6), (self.blocks_null_sink_1_3, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 3), (self.spectsensing_subband_selector_0, 2))    
        self.connect((self.spectsensing_compute_statistics_0, 7), (self.spectsensing_subband_selector_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 1), (self.spectsensing_subband_selector_0, 1))    
        self.connect((self.spectsensing_subband_selector_0, 0), (self.probe, 0))    
コード例 #32
0
ファイル: wifi_tx_rx.py プロジェクト: juanduncan/cognitive
    def __init__(self, chan_est=0):
        gr.top_block.__init__(self, "Wifi Tx Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wifi Tx Rx")
        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", "wifi_tx_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.chan_est = chan_est

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.threshold = threshold = 1000
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 5e5
        self.period = period = 10
        self.pdu_length = pdu_length = 30
        self.out_buf_size = out_buf_size = 96000
        self.header_formatter = header_formatter = ieee802_11.wifi_signal_field()
        self.freq_sin = freq_sin = 1000
        self.freq = freq = 943e6
        self.encoding = encoding = 0
        self.decimation = decimation = 40

        ##################################################
        # Blocks
        ##################################################
        self._period_range = Range(1, 10000, 1, 10, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float)
        self.top_layout.addWidget(self._period_win)
        self._pdu_length_range = Range(10, 1500, 1, 30, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int)
        self.top_layout.addWidget(self._pdu_length_win)
        self._encoding_options = (0, 1, 2, )
        self._encoding_labels = ("BPSK 1/2"  , "BPSK 3/4", "QPSK 1/2", )
        self._encoding_tool_bar = Qt.QToolBar(self)
        self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding"+": "))
        self._encoding_combo_box = Qt.QComboBox()
        self._encoding_tool_bar.addWidget(self._encoding_combo_box)
        for label in self._encoding_labels: self._encoding_combo_box.addItem(label)
        self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i)))
        self._encoding_callback(self.encoding)
        self._encoding_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_encoding(self._encoding_options[i]))
        self.top_layout.addWidget(self._encoding_tool_bar)
        self.qtgui_time_sink_x_2 = qtgui.time_sink_f(
        	32, #size
        	100, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 110)
        
        self.qtgui_time_sink_x_2.set_y_label("Frame error rata", "")
        
        self.qtgui_time_sink_x_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_2.enable_autoscale(False)
        self.qtgui_time_sink_x_2.enable_grid(True)
        self.qtgui_time_sink_x_2.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_2.disable_legend()
        
        labels = ["Packets Reveiced", "", "", "", "",
                  "", "", "", "", ""]
        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_2.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_2_win)
        (self.qtgui_time_sink_x_2).set_processor_affinity([3])
        self.qtgui_time_sink_x_0_0_0_1_0_1 = qtgui.time_sink_c(
        	2**10, #size
        	samp_rate/1000, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_update_time(1)
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_axis(-0.1, 1000)
        
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_label("Generated Samples", "")
        
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.001, 5e-3, 0, "FISTOR")
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0_0_1_0_1.disable_legend()
        
        labels = ["correlation I", "correlation Q", "correlation_big", "", "",
                  "", "", "", "", ""]
        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_0_0_1_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_0_1_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_0_1_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(
                gr.sizeof_float,
                0.99,
                qtgui.NUM_GRAPH_HORIZ,
        	1
        )
        self.qtgui_number_sink_0.set_update_time(0.0000010)
        self.qtgui_number_sink_0.set_title("Frame error Rata")
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        units = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")]
        factor = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, 0)
            self.qtgui_number_sink_0.set_max(i, 100)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])
        
        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_win)
        (self.qtgui_number_sink_0).set_processor_affinity([3])
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_int,1,0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_processor_affinity([1])
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        (self.nutaq_rtdex_sink_0).set_processor_affinity([3])
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-15)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0_2.set_index(0)
        self.nutaq_custom_register_0_2.set_default_value(int((4e6)/samp_rate/40*(2**32)))
        self.nutaq_custom_register_0_2.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0_1.set_index(2)
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0_1.set_index(3)
        self.nutaq_custom_register_0_0_1.set_default_value(7)
        self.nutaq_custom_register_0_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0_0.set_index(6)
        self.nutaq_custom_register_0_0_0.set_default_value(600)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.101")
        self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False)
        (self.ieee802_11_ofdm_sync_short_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_sync_short_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False)
        (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True)
        (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_mapper_0 = ieee802_11.ofdm_mapper(encoding, False)
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255]))
        (self.ieee802_11_ofdm_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False)
        (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False)
        (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False)
        (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16)
        (self.ieee802_11_moving_average_xx_1).set_processor_affinity([3])
        (self.ieee802_11_moving_average_xx_1).set_min_output_buffer(96000)
        self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size)
        (self.ieee802_11_moving_average_xx_0).set_processor_affinity([3])
        (self.ieee802_11_moving_average_xx_0).set_min_output_buffer(96000)
        self.ieee802_11_chunks_to_symbols_xx_0 = ieee802_11.chunks_to_symbols()
        (self.ieee802_11_chunks_to_symbols_xx_0).set_min_output_buffer(96000)
        self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200)
        self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float)
        self.top_layout.addWidget(self._freq_sin_win)
        self.foo_packet_pad2_0_0 = foo.packet_pad2(False, False, 0.0001, 100000, 100000)
        (self.foo_packet_pad2_0_0).set_processor_affinity([3])
        (self.foo_packet_pad2_0_0).set_min_output_buffer(262144)
        self.fft_vxx_0_0 = fft.fft_vcc(64, False, (tuple([1/52**.5] * 64)), True, 1)
        (self.fft_vxx_0_0).set_min_output_buffer(96000)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1)
        (self.fft_vxx_0).set_processor_affinity([3])
        (self.fft_vxx_0).set_min_output_buffer(96000)
        self.digital_packet_headergenerator_bb_0 = digital.packet_headergenerator_bb(header_formatter.formatter(), "packet_len")
        self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer(64, 64+16, 2, "packet_len")
        (self.digital_ofdm_cyclic_prefixer_0_0).set_min_output_buffer(96000)
        self.digital_ofdm_carrier_allocator_cvc_0_0_0 = digital.ofdm_carrier_allocator_cvc(64, (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27),), ((-21, -7, 7, 21), ), ((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, -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), (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, 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), (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, 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), (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, -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), (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, 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), (-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, 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), (-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, 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), (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, -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), (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, 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), (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, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1)), ((0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0, 0j, 0, 0j, 0, 0j, -1, 1j, -1, 1j, -1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, (-0-1j), 1, -1j, -1, 1j, 0, -1j, 1, (-0-1j), 1, -1j, 1, 1j, -1, -1j, 1, (-0-1j), -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 0j, 0, 0j, 0, 0j), (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)), "packet_len")
        (self.digital_ofdm_carrier_allocator_cvc_0_0_0).set_min_output_buffer(96000)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([-1, 1]), 1)
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_gr_complex*1, "packet_len", 1)
        (self.blocks_tagged_stream_mux_0).set_min_output_buffer(96000)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64)
        (self.blocks_stream_to_vector_0).set_processor_affinity([3])
        (self.blocks_stream_to_vector_0).set_min_output_buffer(96000)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len")
        (self.blocks_pdu_to_tagged_stream_0).set_processor_affinity([3])
        (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(96000)
        self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        (self.blocks_multiply_xx_0).set_processor_affinity([3])
        (self.blocks_multiply_xx_0).set_min_output_buffer(96000)
        self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length)) + "1234"), period)
        (self.blocks_message_strobe_0_0).set_processor_affinity([3])
        (self.blocks_message_strobe_0_0).set_min_output_buffer(96000)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        (self.blocks_interleave_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        (self.blocks_float_to_short_0_0_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        (self.blocks_float_to_short_0_0).set_processor_affinity([3])
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        (self.blocks_float_to_complex_0).set_processor_affinity([2])
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        (self.blocks_divide_xx_0).set_processor_affinity([3])
        (self.blocks_divide_xx_0).set_min_output_buffer(96000)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16)
        (self.blocks_delay_0_0).set_processor_affinity([3])
        (self.blocks_delay_0_0).set_min_output_buffer(96000)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length)
        (self.blocks_delay_0).set_processor_affinity([3])
        (self.blocks_delay_0).set_min_output_buffer(96000)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int*1, 1)
        (self.blocks_deinterleave_0).set_processor_affinity([1])
        (self.blocks_deinterleave_0).set_min_output_buffer(32768)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        (self.blocks_conjugate_cc_0).set_processor_affinity([3])
        (self.blocks_conjugate_cc_0).set_min_output_buffer(96000)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        (self.blocks_complex_to_mag_squared_0).set_processor_affinity([3])
        (self.blocks_complex_to_mag_squared_0).set_min_output_buffer(96000)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        (self.blocks_complex_to_mag_0).set_processor_affinity([3])
        (self.blocks_complex_to_mag_0).set_min_output_buffer(96000)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_processor_affinity([3])
        (self.blocks_complex_to_float_0).set_min_output_buffer(16384)
        self.COWN_syncher2_0 = COWN.syncher2()
        (self.COWN_syncher2_0).set_processor_affinity([1])
        self.COWN_resta_0 = COWN.resta()
        (self.COWN_resta_0).set_processor_affinity([1])

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))    
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in'))    
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.ieee802_11_ofdm_mapper_0, 'in'))    
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))    
        self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0))    
        self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0))    
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0))    
        self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1))    
        self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0))    
        self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_delay_0_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_number_sink_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_time_sink_x_2, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0))    
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0))    
        self.connect((self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0), (self.fft_vxx_0_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.foo_packet_pad2_0_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.qtgui_time_sink_x_0_0_0_1_0_1, 0))    
        self.connect((self.digital_packet_headergenerator_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0))    
        self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0))    
        self.connect((self.foo_packet_pad2_0_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.ieee802_11_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 1))    
        self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1))    
        self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0))    
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0))    
        self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.digital_packet_headergenerator_bb_0, 0))    
        self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.ieee802_11_chunks_to_symbols_xx_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_null_sink_0_0_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0))    
        self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))    
コード例 #33
0
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_withFPGAdecimation")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600

        ##################################################
        # Blocks
        ##################################################
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1;
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(nfft, samp_rate, 1024 )
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-4)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(14)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.101")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=oversampling,
        	bt=0.71,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=oversampling,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, "192.168.0.100", 1234, 1472, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, 2*4e3 + 0*samp_rate/40/(oversampling*8*2),True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float()
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(1024)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'), (self.spectsensing_xs_plot_1, 'pdus'))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0), (self.spectsensing_ss_pds_plot_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1), (self.spectsensing_ss_pds_plot_0, 1))    
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0), (self.blocks_multiply_const_vxx_0_3, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0), (self.blocks_multiply_const_vxx_0_1_0_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0), (self.blocks_multiply_const_vxx_0_1_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_3, 0), (self.DataConversion_eaver_resynchronizer_0_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_udp_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.DataConversion_eaver_resynchronizer_0_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 1), (self.blocks_short_to_float_0_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 0), (self.blocks_short_to_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 1), (self.DataConversion_reint_short_float_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 3), (self.DataConversion_reint_short_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 2), (self.DataConversion_reint_short_float_0_2_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 0), (self.DataConversion_reint_short_float_0_3, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0), (self.blocks_add_xx_0_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_short_to_float_0_0_0_0, 0), (self.blocks_float_to_complex_0_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_1_0, 0), (self.blocks_float_to_complex_0_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_2, 0))    
        self.connect((self.nutaq_rtdex_source_0_0_0, 0), (self.blocks_deinterleave_0_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S_0, 0), (self.blocks_deinterleave_0_0_1, 0))    
コード例 #34
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 = 10000
        self.Nsamples_Qtime = Nsamples_Qtime = 128

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0_0_2 = qtgui.time_sink_c(
            Nsamples_Qtime,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_2.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_2.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_2.set_y_label("Amplitude DME 2", "")

        self.qtgui_time_sink_x_0_0_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_2.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                      qtgui.TRIG_SLOPE_POS, 1,
                                                      0, 1, "")
        self.qtgui_time_sink_x_0_0_2.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_2.enable_grid(True)
        self.qtgui_time_sink_x_0_0_2.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_2.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_0_2.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_2.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_2.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_2_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_2_win)
        self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_c(
            Nsamples_Qtime,  #size
            samp_rate * 4,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_1.set_y_label("Amplitude ADSB", "")

        self.qtgui_time_sink_x_0_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                      qtgui.TRIG_SLOPE_POS, 1,
                                                      0, 0, "")
        self.qtgui_time_sink_x_0_0_1.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_1.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_0_1.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_1.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            Nsamples_Qtime,  #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 DME1", "")

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

        if not True:
            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 * 1):
            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_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_short * 1,
                                                 samp_rate * 12, True)
        self.blocks_short_to_float_0_2 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_1 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0_1 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_interleave_0_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        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_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.avio505_three_ch_multip_rtdex_0 = avio505.three_ch_multip_rtdex()
        self.analog_sig_source_x_0_1_0 = analog.sig_source_c(
            samp_rate * 4, analog.GR_SIN_WAVE, 1000, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 400, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 400, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.avio505_three_ch_multip_rtdex_0, 0))
        self.connect((self.analog_sig_source_x_0_1, 0),
                     (self.avio505_three_ch_multip_rtdex_0, 1))
        self.connect((self.analog_sig_source_x_0_1_0, 0),
                     (self.avio505_three_ch_multip_rtdex_0, 2))
        self.connect((self.avio505_three_ch_multip_rtdex_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_deinterleave_0, 4),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_deinterleave_0, 6),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_deinterleave_0, 8),
                     (self.blocks_interleave_0, 2))
        self.connect((self.blocks_deinterleave_0, 10),
                     (self.blocks_interleave_0, 3))
        self.connect((self.blocks_deinterleave_0, 5),
                     (self.blocks_interleave_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 7),
                     (self.blocks_interleave_0_0, 1))
        self.connect((self.blocks_deinterleave_0, 9),
                     (self.blocks_interleave_0_0, 2))
        self.connect((self.blocks_deinterleave_0, 11),
                     (self.blocks_interleave_0_0, 3))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_short_to_float_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 3),
                     (self.blocks_short_to_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 2),
                     (self.blocks_short_to_float_0_1, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_2, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_1, 0))
        self.connect((self.blocks_interleave_0, 0),
                     (self.blocks_short_to_float_0_2, 0))
        self.connect((self.blocks_interleave_0_0, 0),
                     (self.blocks_short_to_float_0_0_1, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_short_to_float_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.blocks_short_to_float_0_0_1, 0),
                     (self.blocks_float_to_complex_0_0_0, 1))
        self.connect((self.blocks_short_to_float_0_1, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_short_to_float_0_2, 0),
                     (self.blocks_float_to_complex_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_deinterleave_0, 0))
コード例 #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus Voice GMSK")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.data_rate = data_rate = 14.40e6 / 2

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=data_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=True,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
            size=((450, 300)),
        )
        self.GridAdd(self.wxgui_scopesink2_1.win, 1, 1, 1, 1)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=48e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
            size=((450, 300)),
        )
        self.GridAdd(self.wxgui_fftsink2_1.win, 1, 2, 1, 1)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_0", gr.sizeof_short, 1, 3)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(1024)
        self.nutaq_rtdex_source_0.set_channels("1")
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",
                                                   gr.sizeof_short, 1, 2)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(1024)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(data_rate * 2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0",
                                                     1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(data_rate * 2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(16)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(5)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(6)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_0 = nutaq.carrier(
            0, "nutaq_carrier_perseus_0", "192.168.0.103")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=8,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_f(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_1.
                recv_pkt(ok, payload),
            ), )
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_short_to_float_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_1, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0),
                     (self.blocks_deinterleave_0, 0))
コード例 #36
0
ファイル: auto_fec.py プロジェクト: Analias/gr-baz
	def __init__(self,
		sample_rate,
		ber_threshold=0,	# Above which to do search
		ber_smoothing=0,	# Alpha of BER smoother (0.01)
		ber_duration=0,		# Length before trying next combo
		ber_sample_decimation=1,
		settling_period=0,
		pre_lock_duration=0,
		#ber_sample_skip=0
		**kwargs):
		
		use_throttle = False
		base_duration = 1024
		if sample_rate > 0:
			use_throttle = True
			base_duration *= 4	# Has to be high enough for block-delay
		
		if ber_threshold == 0:
			ber_threshold = 512 * 4
		if ber_smoothing == 0:
			ber_smoothing = 0.01
		if ber_duration == 0:
			ber_duration = base_duration * 2 # 1000ms
		if settling_period == 0:
			settling_period = base_duration * 1 # 500ms
		if pre_lock_duration == 0:
			pre_lock_duration = base_duration * 2 #1000ms
		
		print "Creating Auto-FEC:"
		print "\tsample_rate:\t\t", sample_rate
		print "\tber_threshold:\t\t", ber_threshold
		print "\tber_smoothing:\t\t", ber_smoothing
		print "\tber_duration:\t\t", ber_duration
		print "\tber_sample_decimation:\t", ber_sample_decimation
		print "\tsettling_period:\t", settling_period
		print "\tpre_lock_duration:\t", pre_lock_duration
		print ""
		
		self.sample_rate = sample_rate
		self.ber_threshold = ber_threshold
		#self.ber_smoothing = ber_smoothing
		self.ber_duration = ber_duration
		self.settling_period = settling_period
		self.pre_lock_duration = pre_lock_duration
		#self.ber_sample_skip = ber_sample_skip
		
		self.data_lock = threading.Lock()

		gr.hier_block2.__init__(self, "auto_fec",
			gr.io_signature(1, 1, gr.sizeof_gr_complex),			# Post MPSK-receiver complex input
			gr.io_signature3(3, 3, gr.sizeof_char, gr.sizeof_float, gr.sizeof_float))	# Decoded packed bytes, BER metric, lock
		
		self.input_watcher = auto_fec_input_watcher(self)
		default_xform = self.input_watcher.xform_lock
		
		self.gr_conjugate_cc_0 = blocks.conjugate_cc()
		self.conj_add = None
		try:
			self.gr_conjugate_cc_0.set(True)
		except:
			self.conj_mul_straight = blocks.multiply_const_vcc((0, ))
			self.conj_mul_conj = blocks.multiply_const_vcc((1, ))
			self.conj_add = blocks.add_vcc(1)
			self.connect((self.gr_conjugate_cc_0, 0), (self.conj_mul_conj, 0))    
			self.connect((self.conj_mul_conj, 0), (self.conj_add, 1))    
			self.connect((self.conj_mul_straight, 0), (self.conj_add, 0))    
			self.connect((self, 0), (self.conj_mul_straight, 0))

		self.connect((self, 0), (self.gr_conjugate_cc_0, 0))	# Input
		
		#self.blks2_selector_0 = grc_blks2.selector(
		#	item_size=gr.sizeof_gr_complex*1,
		#	num_inputs=2,
		#	num_outputs=1,
		#	input_index=default_xform.get_conjugation_index(),
		#	output_index=0,
		#)
		#self.connect((self.gr_conjugate_cc_0, 0), (self.blks2_selector_0, 0))
		#self.connect((self, 0), (self.blks2_selector_0, 1))		# Input
		
		# CHANGED
		#self.gr_multiply_const_vxx_3 = blocks.multiply_const_vcc((0.707*(1+1j), ))
		#self.connect((self.blks2_selector_0, 0), (self.gr_multiply_const_vxx_3, 0))
		#self.connect((self.gr_conjugate_cc_0, 0), (self.gr_multiply_const_vxx_3, 0))
		
		self.gr_multiply_const_vxx_2 = blocks.multiply_const_vcc((default_xform.get_rotation(), ))	# phase_mult
		#self.connect((self.gr_multiply_const_vxx_3, 0), (self.gr_multiply_const_vxx_2, 0))
		# CHANGED
		if self.conj_add is not None:
			self.connect((self.conj_add, 0), (self.gr_multiply_const_vxx_2, 0))
		else:
			self.connect((self.gr_conjugate_cc_0, 0), (self.gr_multiply_const_vxx_2, 0))
		
		self.gr_complex_to_float_0_0 = blocks.complex_to_float(1)
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.gr_complex_to_float_0_0, 0))
		
		self.gr_interleave_1 = blocks.interleave(gr.sizeof_float*1)
		self.connect((self.gr_complex_to_float_0_0, 1), (self.gr_interleave_1, 1))
		self.connect((self.gr_complex_to_float_0_0, 0), (self.gr_interleave_1, 0))
		
		self.gr_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))	# invert
		self.connect((self.gr_interleave_1, 0), (self.gr_multiply_const_vxx_0, 0))
		
		self.baz_delay_2 = baz.delay(gr.sizeof_float*1, default_xform.get_puncture_delay())	# delay_puncture
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.baz_delay_2, 0))
		
		self.depuncture_ff_0 = baz.depuncture_ff((_puncture_matrices[self.input_watcher.puncture_matrix][1]))	# puncture_matrix
		self.connect((self.baz_delay_2, 0), (self.depuncture_ff_0, 0))
		
		self.baz_delay_1 = baz.delay(gr.sizeof_float*1, default_xform.get_viterbi_delay())	# delay_viterbi
		self.connect((self.depuncture_ff_0, 0), (self.baz_delay_1, 0))
		
		self.swap_ff_0 = baz.swap_ff(default_xform.get_viterbi_swap())	# swap_viterbi
		self.connect((self.baz_delay_1, 0), (self.swap_ff_0, 0))
		
		self.gr_decode_ccsds_27_fb_0 = fec.decode_ccsds_27_fb()
		
		if use_throttle:
			print "==> Using throttle at sample rate:", self.sample_rate
			self.gr_throttle_0 = blocks.throttle(gr.sizeof_float, self.sample_rate)
			self.connect((self.swap_ff_0, 0), (self.gr_throttle_0, 0))
			self.connect((self.gr_throttle_0, 0), (self.gr_decode_ccsds_27_fb_0, 0))
		else:
			self.connect((self.swap_ff_0, 0), (self.gr_decode_ccsds_27_fb_0, 0))
		
		self.connect((self.gr_decode_ccsds_27_fb_0, 0), (self, 0))	# Output bytes
		
		self.gr_add_const_vxx_1 = blocks.add_const_vff((-4096, ))
		self.connect((self.gr_decode_ccsds_27_fb_0, 1), (self.gr_add_const_vxx_1, 0))
		
		self.gr_multiply_const_vxx_1 = blocks.multiply_const_vff((-1, ))
		self.connect((self.gr_add_const_vxx_1, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self, 1))	# Output BER
		
		self.gr_single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(ber_smoothing, 1)
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_single_pole_iir_filter_xx_0, 0))
		
		self.gr_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float, ber_sample_decimation)
		self.connect((self.gr_single_pole_iir_filter_xx_0, 0), (self.gr_keep_one_in_n_0, 0))
		
		self.const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)	# Last param is const value
		if use_throttle:
			lock_throttle_rate = self.sample_rate // 16
			print "==> Using lock throttle rate:", lock_throttle_rate
			self.gr_throttle_1 = blocks.throttle(gr.sizeof_float, lock_throttle_rate)
			self.connect((self.const_source_x_0, 0), (self.gr_throttle_1, 0))
			self.connect((self.gr_throttle_1, 0), (self, 2))
		else:
			self.connect((self.const_source_x_0, 0), (self, 2))
		
		self.msg_q = gr.msg_queue(2*256)	# message queue that holds at most 2 messages, increase to speed up process
		self.msg_sink = blocks.message_sink(gr.sizeof_float, self.msg_q, False)	# Block to speed up process
		self.connect((self.gr_keep_one_in_n_0, 0), self.msg_sink)
		
		self.input_watcher.start()
コード例 #37
0
ファイル: perseus_mimo.py プロジェクト: dodomm/cognitive
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus MIMO")
        _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 = 14.40e6 / 2
        self.freq2 = freq2 = 1e6
        self.freq1 = freq1 = 500e3

        ##################################################
        # Blocks
        ##################################################
        _freq2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq2_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq2_sizer,
            value=self.freq2,
            callback=self.set_freq2,
            label='freq2',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq2_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq2_sizer,
            value=self.freq2,
            callback=self.set_freq2,
            minimum=-samp_rate / 2,
            maximum=samp_rate / 2,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq2_sizer)
        _freq1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq1_sizer,
            value=self.freq1,
            callback=self.set_freq1,
            label='freq1',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq1_sizer,
            value=self.freq1,
            callback=self.set_freq1,
            minimum=-samp_rate / 2,
            maximum=samp_rate / 2,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq1_sizer)
        self.wxgui_fftsink_1 = 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,
            size=(200, 200),
        )
        self.GridAdd(self.wxgui_fftsink_1.win, 1, 1, 1, 1)
        self.wxgui_fftsink_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,
            win=window.blackmanharris,
            size=(200, 200),
        )
        self.GridAdd(self.wxgui_fftsink_0.win, 1, 2, 1, 1)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_0", gr.sizeof_short, 2, 5)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("1,2")
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",
                                                   gr.sizeof_short, 2, 4)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("1,2")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_0", 2, 2)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(953e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0",
                                                     1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(953e6)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_0", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(953e6)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0",
                                                     1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(953e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 7)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 6)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(6)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_0 = nutaq.carrier(
            0, "nutaq_carrier_perseus_0", "192.168.0.102")
        self.blocks_short_to_float_0_1 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_short_to_float_0_0_0 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 2**11 - 1)
        self.blocks_interleave_0_0 = blocks.interleave(gr.sizeof_short * 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1)
        self.blocks_float_to_short_0_0_1 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0_0_0 = blocks.float_to_short(
            1, 2**11 - 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        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_deinterleave_0_0 = blocks.deinterleave(gr.sizeof_short * 1)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short * 1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, freq2, 0.95, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, freq1, 0.95, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_fftsink_1, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.wxgui_fftsink_0, 0))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_complex_to_float_0_0, 0))
        self.connect((self.blocks_interleave_0_0, 0),
                     (self.nutaq_rtdex_sink_0, 1))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_short_to_float_0_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 1),
                     (self.blocks_deinterleave_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 1),
                     (self.blocks_short_to_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 0),
                     (self.blocks_short_to_float_0_1, 0))
        self.connect((self.blocks_short_to_float_0_1, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.blocks_float_to_short_0_0_0_0, 0),
                     (self.blocks_interleave_0_0, 1))
        self.connect((self.blocks_complex_to_float_0_0, 0),
                     (self.blocks_float_to_short_0_0_1, 0))
        self.connect((self.blocks_float_to_short_0_0_1, 0),
                     (self.blocks_interleave_0_0, 0))
        self.connect((self.blocks_complex_to_float_0_0, 1),
                     (self.blocks_float_to_short_0_0_0_0, 0))
コード例 #38
0
    def __init__(self, samp_rate, gain, freq, block_size):
        gr.top_block.__init__(self, "Scope")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Scope")

        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)

        ##################################################
        # Variables
        ##################################################
        trigger_level_time = 0.4
        trigger_level_freq = -40
        self.samp_rate = samp_rate
        self.gain = gain
        self.freq = freq
        self.block_size = block_size

        ##################################################
        # Blocks
        ##################################################
        # Time level trigger slider
        trigger_level_time_range = Range(0, 1.5, 0.02, 0.4, 200)
        trigger_level_time_win = RangeWidget(trigger_level_time_range,
                                             self.set_trigger_level_time,
                                             "Trigger level (time)",
                                             "counter_slider", float)
        self.top_grid_layout.addWidget(trigger_level_time_win, 1, 0, 1, 2)

        # Freq level trigger slider
        trigger_level_freq_range = Range(-50, 0, 1, -40, 200)
        trigger_level_freq_win = RangeWidget(trigger_level_freq_range,
                                             self.set_trigger_level_freq,
                                             "Trigger level (freq)",
                                             "counter_slider", float)
        self.top_grid_layout.addWidget(trigger_level_freq_win, 1, 2, 1, 2)

        # Gain slider
        gain_range = Range(0, 55, 1, gain, 200)
        gain_win = RangeWidget(gain_range, self.set_gain, "Gain",
                               "counter_slider", float)
        self.top_grid_layout.addWidget(gain_win, 0, 0, 1, 2)

        freq_range = Range(430e6, 435e6, 0.1e6, freq, 200)
        freq_win = RangeWidget(freq_range, self.set_freq, "Center Frequency",
                               "counter_slider", float)
        self.top_grid_layout.addWidget(freq_win, 0, 2, 1, 2)

        # RTL-SDR
        self.rtlsdr_source = osmosdr.source()
        self.rtlsdr_source.set_sample_rate(samp_rate)
        self.rtlsdr_source.set_center_freq(freq, 0)
        self.rtlsdr_source.set_gain_mode(False, 0)
        self.rtlsdr_source.set_gain(gain, 0)

        # Time plot
        self.time_sink = qtgui.time_sink_f(size=block_size / 2,
                                           samp_rate=samp_rate,
                                           name="")
        self.time_sink.set_update_time(0.10)
        self.time_sink.set_y_axis(-0.2, 1.5)
        self.time_sink.set_y_label("Amplitude", "")
        self.set_trigger_level_time(trigger_level_time)
        self.time_sink.enable_autoscale(False)
        self.time_sink.enable_grid(False)
        self.time_sink.enable_axis_labels(True)
        self.time_sink.enable_control_panel(False)
        self.time_sink.disable_legend()

        self._time_sink_win = sip.wrapinstance(self.time_sink.pyqwidget(),
                                               Qt.QWidget)
        self.top_grid_layout.addWidget(self._time_sink_win, 2, 0, 1, 4)

        # Freq plot
        self.freq_sink = qtgui.freq_sink_c(fftsize=block_size / 2,
                                           wintype=firdes.WIN_BLACKMAN_hARRIS,
                                           fc=freq,
                                           bw=samp_rate,
                                           name="")
        self.freq_sink.set_update_time(0.10)
        self.freq_sink.set_y_axis(-140, 10)
        self.freq_sink.set_y_label("Relative Gain", "dB")
        self.set_trigger_level_freq(trigger_level_freq)
        self.freq_sink.enable_autoscale(False)
        self.freq_sink.enable_grid(False)
        self.freq_sink.set_fft_average(1.0)
        self.freq_sink.enable_axis_labels(True)
        self.freq_sink.enable_control_panel(False)
        self.freq_sink.disable_legend()

        self._freq_sink_win = sip.wrapinstance(self.freq_sink.pyqwidget(),
                                               Qt.QWidget)
        self.top_grid_layout.addWidget(self._freq_sink_win, 3, 0, 1, 4)

        # Histogram plot
        self.histogram_sink = qtgui.histogram_sink_f(size=block_size * 2,
                                                     bins=256,
                                                     xmin=-1,
                                                     xmax=1,
                                                     name="")

        self.histogram_sink.set_update_time(0.10)
        self.histogram_sink.enable_autoscale(True)
        self.histogram_sink.enable_accumulate(False)
        self.histogram_sink.enable_grid(False)
        self.histogram_sink.enable_axis_labels(True)
        self.histogram_sink.disable_legend()

        self._histogram_sink_win = sip.wrapinstance(
            self.histogram_sink.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._histogram_sink_win, 4, 0, 1, 4)

        self.interleave = blocks.interleave(gr.sizeof_float * 1, 1)
        self.complex_to_mag = blocks.complex_to_mag(1)
        self.complex_to_float = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect(self.rtlsdr_source, self.complex_to_mag, self.time_sink)
        self.connect((self.rtlsdr_source, 0), (self.freq_sink, 0))

        self.connect(self.rtlsdr_source, self.complex_to_float)
        self.connect((self.complex_to_float, 0), (self.interleave, 0))
        self.connect((self.complex_to_float, 1), (self.interleave, 1))
        self.connect(self.interleave, self.histogram_sink)
コード例 #39
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.ntaps = ntaps = 11 * nfilts * sps
        self.excess_bw = excess_bw = 0.4
        self.txtaps = txtaps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0, excess_bw, ntaps)
        self.tx_taps = tx_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0, excess_bw, ntaps)
        self.timing_bw = timing_bw = 2 * pi / 100
        self.samp_rate = samp_rate = 20e3 * sps
        self.rx_taps = rx_taps = filter.firdes.root_raised_cosine(
            nfilts, nfilts * sps, 1.0, excess_bw, ntaps)
        self.freq_bw = freq_bw = 2 * pi / 100
        self.fll_ntaps = fll_ntaps = 55
        self.const_points = const_points = 4

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0_1 = scopesink2.scope_sink_c(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=80e3 / sps,
            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.Add(self.wxgui_scopesink2_0_1.win)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=80e3 / sps,
            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.Add(self.wxgui_scopesink2_0_0.win)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=8,
            decimation=50,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=50,
            decimation=8,
            taps=None,
            fractional_bw=None,
        )
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(sps,
                                                             taps=(txtaps),
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.low_pass_filter_0_0 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, 500e3, 80e3, 100, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, 500e3, 80e3, 100, firdes.WIN_HAMMING, 6.76))
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, timing_bw, (rx_taps), nfilts, 16, 1.5, 1)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (((1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j))), 1)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                   500e3, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate / sps, True)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_char * 1, 40)
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(2)
        self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_float * 1, 1)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            "/home/ritesh/Dropbox/Sem5/EE340_communications_Lab/Lab 10/1.txt",
            False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            "/home/ritesh/Dropbox/Sem5/EE340_communications_Lab/Lab 10/30.txt",
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            500e3, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            500e3, analog.GR_SIN_WAVE, 100000, -1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            500e3, analog.GR_COS_WAVE, 100000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_float_to_uchar_0, 0),
                     (self.blocks_skiphead_0, 0))
        self.connect((self.blocks_interleave_0, 0),
                     (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_1, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_skiphead_0, 0),
                     (self.blocks_pack_k_bits_bb_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_pack_k_bits_bb_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.wxgui_scopesink2_0_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
コード例 #40
0
    def __init__(self):
        gr.top_block.__init__(self, "Wifi Rx Oct 28")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wifi Rx Oct 28")
        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", "wifi_rx_oct_28")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.threshold = threshold = 1000
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 0.25e6
        self.lo_offset = lo_offset = 0
        self.gain = gain = 20
        self.freq = freq = 943000000.0
        self.decimation = decimation = 40
        self.chan_est = chan_est = 1

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_options = [0.25e6, 1e6, 5e6, 10e6, 20e6]
        self._samp_rate_labels = ["500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz"]
        self._samp_rate_tool_bar = Qt.QToolBar(self)
        self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate" + ": "))
        self._samp_rate_combo_box = Qt.QComboBox()
        self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box)
        for label in self._samp_rate_labels:
            self._samp_rate_combo_box.addItem(label)
        self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))
        )
        self._samp_rate_callback(self.samp_rate)
        self._samp_rate_combo_box.currentIndexChanged.connect(lambda i: self.set_samp_rate(self._samp_rate_options[i]))
        self.top_layout.addWidget(self._samp_rate_tool_bar)
        self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c(
            2 ** 13, samp_rate, "", 1  # size  # samp_rate  # name  # number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.8, 0.8)

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

        self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode(
            qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, threshold, 0.25e-3, 0, "BAD TAG"
        )
        self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0_1.disable_legend()

        labels = ["I", "Q", "correlation_big", "", "", "", "", "", "", ""]
        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, 1, 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_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win)
        self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16)
        self.ofdm_80211_adc_tags_gen_0 = ofdm_80211.adc_tags_gen()
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0", gr.sizeof_float, 1, 0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_min_output_buffer(16384)
        (self.nutaq_rtdex_source_0).set_max_output_buffer(32768)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0", gr.sizeof_short, 1, 1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        self.nutaq_radio420_tx_0_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 2, 2)
        self.nutaq_radio420_tx_0_0_0.set_default_enable(0)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0_0.set_default_datarate(samp_rate * 2 * decimation)
        self.nutaq_radio420_tx_0_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 * decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0_0.set_default_reference(0)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2 * decimation)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(4)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(0)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 * decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_2.set_index(0)
        self.nutaq_custom_register_0_2.set_default_value(int((4e6) / samp_rate / 40 * (2 ** 32)))
        self.nutaq_custom_register_0_2.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_1.set_index(2)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_1.set_index(3)
        self.nutaq_custom_register_0_0_1.set_default_value(7)
        self.nutaq_custom_register_0_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_0.set_index(6)
        self.nutaq_custom_register_0_0_0.set_default_value(600)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_0 = nutaq.carrier(0, "nutaq_carrier_perseus_0", "192.168.0.102")
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True)
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(ieee802_11.LMS, False)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, True)
        self._gain_range = Range(0, 100, 1, 20, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider")
        self.top_layout.addWidget(self._gain_win)
        self._freq_options = [
            943000000.0,
            2412000000.0,
            2417000000.0,
            2422000000.0,
            2427000000.0,
            2432000000.0,
            2437000000.0,
            2442000000.0,
            2447000000.0,
            2452000000.0,
            2457000000.0,
            2462000000.0,
            2467000000.0,
            2472000000.0,
            2484000000.0,
            5170000000.0,
            5180000000.0,
            5190000000.0,
            5200000000.0,
            5210000000.0,
            5220000000.0,
            5230000000.0,
            5240000000.0,
            5260000000.0,
            5280000000.0,
            5300000000.0,
            5320000000.0,
            5500000000.0,
            5520000000.0,
            5540000000.0,
            5560000000.0,
            5580000000.0,
            5600000000.0,
            5620000000.0,
            5640000000.0,
            5660000000.0,
            5680000000.0,
            5700000000.0,
            5745000000.0,
            5765000000.0,
            5785000000.0,
            5805000000.0,
            5825000000.0,
            5860000000.0,
            5870000000.0,
            5880000000.0,
            5890000000.0,
            5900000000.0,
            5910000000.0,
            5920000000.0,
        ]
        self._freq_labels = [
            "  0 | 943.0 | ??",
            "  1 | 2412.0 | 11g",
            "  2 | 2417.0 | 11g",
            "  3 | 2422.0 | 11g",
            "  4 | 2427.0 | 11g",
            "  5 | 2432.0 | 11g",
            "  6 | 2437.0 | 11g",
            "  7 | 2442.0 | 11g",
            "  8 | 2447.0 | 11g",
            "  9 | 2452.0 | 11g",
            " 10 | 2457.0 | 11g",
            " 11 | 2462.0 | 11g",
            " 12 | 2467.0 | 11g",
            " 13 | 2472.0 | 11g",
            " 14 | 2484.0 | 11g",
            " 34 | 5170.0 | 11a",
            " 36 | 5180.0 | 11a",
            " 38 | 5190.0 | 11a",
            " 40 | 5200.0 | 11a",
            " 42 | 5210.0 | 11a",
            " 44 | 5220.0 | 11a",
            " 46 | 5230.0 | 11a",
            " 48 | 5240.0 | 11a",
            " 52 | 5260.0 | 11a",
            " 56 | 5280.0 | 11a",
            " 58 | 5300.0 | 11a",
            " 60 | 5320.0 | 11a",
            "100 | 5500.0 | 11a",
            "104 | 5520.0 | 11a",
            "108 | 5540.0 | 11a",
            "112 | 5560.0 | 11a",
            "116 | 5580.0 | 11a",
            "120 | 5600.0 | 11a",
            "124 | 5620.0 | 11a",
            "128 | 5640.0 | 11a",
            "132 | 5660.0 | 11a",
            "136 | 5680.0 | 11a",
            "140 | 5700.0 | 11a",
            "149 | 5745.0 | 11a",
            "153 | 5765.0 | 11a",
            "157 | 5785.0 | 11a",
            "161 | 5805.0 | 11a",
            "165 | 5825.0 | 11a",
            "172 | 5860.0 | 11p",
            "174 | 5870.0 | 11p",
            "176 | 5880.0 | 11p",
            "178 | 5890.0 | 11p",
            "180 | 5900.0 | 11p",
            "182 | 5910.0 | 11p",
            "184 | 5920.0 | 11p",
        ]
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_tool_bar.addWidget(Qt.QLabel("Channel" + ": "))
        self._freq_combo_box = Qt.QComboBox()
        self._freq_tool_bar.addWidget(self._freq_combo_box)
        for label in self._freq_labels:
            self._freq_combo_box.addItem(label)
        self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))
        )
        self._freq_callback(self.freq)
        self._freq_combo_box.currentIndexChanged.connect(lambda i: self.set_freq(self._freq_options[i]))
        self.top_layout.addWidget(self._freq_tool_bar)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1)
        self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex * 1, 64)
        self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2 ** 11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2 ** 11 - 1)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/home/juan/transmiter/waveforms/fmcw_chirp_80pc.bin", True
        )
        self.blocks_delay_2 = blocks.delay(gr.sizeof_float * 1, 1)
        (self.blocks_delay_2).set_min_output_buffer(16384)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_min_output_buffer(8192)
        (self.blocks_complex_to_float_0).set_max_output_buffer(8192)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, "out"), (self.ieee802_11_ofdm_parse_mac_0, "in"))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1))
        self.connect((self.blocks_delay_2, 0), (self.ofdm_80211_adc_tags_gen_0, 0))
        self.connect((self.blocks_file_source_0_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.carajito, 0), (self.blocks_delay_0, 0))
        self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0))
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0))
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.blocks_delay_2, 0))
        self.connect((self.ofdm_80211_adc_tags_gen_0, 0), (self.ofdm_80211_short_MF_v2_0, 0))
        self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0, 0))
        self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0))
        self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1))
        self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2))
        self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.qtgui_time_sink_x_0_0_0_1, 0))
コード例 #41
0
ファイル: wifi_tx.py プロジェクト: juanduncan/cognitive
    def __init__(self):
        gr.top_block.__init__(self, "Wifi Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wifi Tx")
        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", "wifi_tx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5e5
        self.period = period = 1000
        self.pdu_length = pdu_length = 100
        self.out_buf_size = out_buf_size = 96000
        self.mult = mult = 0.5
        self.encoding = encoding = 0
        self.decimation = decimation = 40

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	2**13, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(1)
        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_NORM, qtgui.TRIG_SLOPE_POS, 0.02, 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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self._period_range = Range(1, 10000, 1, 1000, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float)
        self.top_layout.addWidget(self._period_win)
        self._pdu_length_range = Range(0, 1500, 1, 100, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int)
        self.top_layout.addWidget(self._pdu_length_win)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_int,1,0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_processor_affinity([1])
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        (self.nutaq_rtdex_sink_0).set_processor_affinity([3])
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-15)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(0.1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102")
        self._mult_range = Range(0, 2, 0.001, 0.5, 200)
        self._mult_win = RangeWidget(self._mult_range, self.set_mult, "mult", "counter_slider", float)
        self.top_layout.addWidget(self._mult_win)
        self._encoding_options = (0, 1, 2, )
        self._encoding_labels = ("BPSK 1/2"  , "BPSK 3/4", "QPSK 1/2", )
        self._encoding_tool_bar = Qt.QToolBar(self)
        self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding"+": "))
        self._encoding_combo_box = Qt.QComboBox()
        self._encoding_tool_bar.addWidget(self._encoding_combo_box)
        for label in self._encoding_labels: self._encoding_combo_box.addItem(label)
        self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i)))
        self._encoding_callback(self.encoding)
        self._encoding_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_encoding(self._encoding_options[i]))
        self.top_layout.addWidget(self._encoding_tool_bar)
        self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int*1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        (self.blocks_interleave_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        (self.blocks_float_to_short_0_0_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        (self.blocks_float_to_short_0_0).set_processor_affinity([3])
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        (self.blocks_float_to_complex_0).set_processor_affinity([2])
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int*1, 1)
        (self.blocks_deinterleave_0).set_processor_affinity([1])
        (self.blocks_deinterleave_0).set_min_output_buffer(32768)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_processor_affinity([3])
        (self.blocks_complex_to_float_0).set_min_output_buffer(16384)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 5e3, 0.5, 0)
        (self.analog_sig_source_x_0).set_processor_affinity([3])
        self.COWN_syncher2_0 = COWN.syncher2()
        (self.COWN_syncher2_0).set_processor_affinity([1])
        self.COWN_resta_0 = COWN.resta()
        (self.COWN_resta_0).set_processor_affinity([1])

        ##################################################
        # Connections
        ##################################################
        self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0))    
        self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0_1, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))    
コード例 #42
0
    def __init__(self,
                 encoder_list_0,
                 input_size=gr.sizeof_char,
                 output_size=gr.sizeof_char):
        gr.hier_block2.__init__(self, "Capillary Threaded Encoder",
                                gr.io_signature(1, 1, input_size),
                                gr.io_signature(1, 1, output_size))

        self.encoder_list_0 = encoder_list_0

        check = math.log10(len(self.encoder_list_0)) / math.log10(2.0)
        if (abs(check - int(check)) > 0.0):
            gr.log.info(
                "fec.capillary_threaded_encoder: number of encoders must be a power of 2."
            )
            raise AttributeError

        self.deinterleaves_0 = []
        for i in range(int(math.log(len(encoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.deinterleaves_0.append(
                    blocks.deinterleave(
                        input_size,
                        fec.get_encoder_input_size(encoder_list_0[0])))

        self.generic_encoders_0 = []
        for i in range(len(encoder_list_0)):
            self.generic_encoders_0.append(
                fec.encoder(encoder_list_0[i], input_size, output_size))

        self.interleaves_0 = []
        for i in range(int(math.log(len(encoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.interleaves_0.append(
                    blocks.interleave(
                        output_size,
                        fec.get_encoder_output_size(encoder_list_0[0])))

        rootcount = 0
        branchcount = 1
        for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.deinterleaves_0[rootcount], 0),
                             (self.deinterleaves_0[branchcount], 0))
                self.connect((self.deinterleaves_0[rootcount], 1),
                             (self.deinterleaves_0[branchcount + 1], 0))
                rootcount += 1
                branchcount += 2

        codercount = 0
        for i in range(len(encoder_list_0) // 2):
            self.connect((self.deinterleaves_0[rootcount], 0),
                         (self.generic_encoders_0[codercount], 0))
            self.connect((self.deinterleaves_0[rootcount], 1),
                         (self.generic_encoders_0[codercount + 1], 0))
            rootcount += 1
            codercount += 2

        rootcount = 0
        branchcount = 1
        for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.interleaves_0[branchcount], 0),
                             (self.interleaves_0[rootcount], 0))
                self.connect((self.interleaves_0[branchcount + 1], 0),
                             (self.interleaves_0[rootcount], 1))
                rootcount += 1
                branchcount += 2

        codercount = 0
        for i in range(len(encoder_list_0) // 2):
            self.connect((self.generic_encoders_0[codercount], 0),
                         (self.interleaves_0[rootcount], 0))
            self.connect((self.generic_encoders_0[codercount + 1], 0),
                         (self.interleaves_0[rootcount], 1))
            rootcount += 1
            codercount += 2

        if ((len(self.encoder_list_0)) > 1):
            self.connect((self, 0), (self.deinterleaves_0[0], 0))
            self.connect((self.interleaves_0[0], 0), (self, 0))
        else:
            self.connect((self, 0), (self.generic_encoders_0[0], 0))
            self.connect((self.generic_encoders_0[0], 0), (self, 0))
コード例 #43
0
ファイル: top_block.py プロジェクト: juanduncan/cognitive
    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 = 10000
        self.Nsamples_Qtime = Nsamples_Qtime = 128

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0_0_2 = qtgui.time_sink_c(
        	Nsamples_Qtime, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_2.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_2.set_y_axis(-1,  1)
        
        self.qtgui_time_sink_x_0_0_2.set_y_label("Amplitude DME 2", "")
        
        self.qtgui_time_sink_x_0_0_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_2.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 1, 0, 1, "")
        self.qtgui_time_sink_x_0_0_2.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_2.enable_grid(True)
        self.qtgui_time_sink_x_0_0_2.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0_2.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_0_2.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0_2.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_2.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_2_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_2_win)
        self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_c(
        	Nsamples_Qtime, #size
        	samp_rate*4, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_1.set_y_axis(-1,  1)
        
        self.qtgui_time_sink_x_0_0_1.set_y_label("Amplitude ADSB", "")
        
        self.qtgui_time_sink_x_0_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 1, 0, 0, "")
        self.qtgui_time_sink_x_0_0_1.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0_1.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_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
        	Nsamples_Qtime, #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 DME1", "")
        
        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 1, 0, 1, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          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*1):
            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_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_short*1, samp_rate*12,True)
        self.blocks_short_to_float_0_2 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_1 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0_1 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_interleave_0_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        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_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.avio505_three_ch_multip_rtdex_0 = avio505.three_ch_multip_rtdex()
        self.analog_sig_source_x_0_1_0 = analog.sig_source_c(samp_rate*4, analog.GR_SIN_WAVE, 1000, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 400, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 400, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.avio505_three_ch_multip_rtdex_0, 0))    
        self.connect((self.analog_sig_source_x_0_1, 0), (self.avio505_three_ch_multip_rtdex_0, 1))    
        self.connect((self.analog_sig_source_x_0_1_0, 0), (self.avio505_three_ch_multip_rtdex_0, 2))    
        self.connect((self.avio505_three_ch_multip_rtdex_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_deinterleave_0, 4), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_deinterleave_0, 6), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_deinterleave_0, 8), (self.blocks_interleave_0, 2))    
        self.connect((self.blocks_deinterleave_0, 10), (self.blocks_interleave_0, 3))    
        self.connect((self.blocks_deinterleave_0, 5), (self.blocks_interleave_0_0, 0))    
        self.connect((self.blocks_deinterleave_0, 7), (self.blocks_interleave_0_0, 1))    
        self.connect((self.blocks_deinterleave_0, 9), (self.blocks_interleave_0_0, 2))    
        self.connect((self.blocks_deinterleave_0, 11), (self.blocks_interleave_0_0, 3))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_short_to_float_0, 0))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_short_to_float_0_0, 0))    
        self.connect((self.blocks_deinterleave_0, 3), (self.blocks_short_to_float_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0, 2), (self.blocks_short_to_float_0_1, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0, 0), (self.qtgui_time_sink_x_0_0_2, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.qtgui_time_sink_x_0_0_1, 0))    
        self.connect((self.blocks_interleave_0, 0), (self.blocks_short_to_float_0_2, 0))    
        self.connect((self.blocks_interleave_0_0, 0), (self.blocks_short_to_float_0_0_1, 0))    
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_short_to_float_0_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_short_to_float_0_0_0, 0), (self.blocks_float_to_complex_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_0_1, 0), (self.blocks_float_to_complex_0_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_1, 0), (self.blocks_float_to_complex_0_0, 0))    
        self.connect((self.blocks_short_to_float_0_2, 0), (self.blocks_float_to_complex_0_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_deinterleave_0, 0))    
コード例 #44
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Tag Generator")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Tag Generator")
        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_tag_generator")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5e5
        self.freq_sin = freq_sin = 1000
        self.freq = freq = 943e6
        self.decimation = decimation = 40

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_f(
            2**13,  #size
            samp_rate,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0, 1e-3, 0, "")
        self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_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(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win, 2,
                                       2, 1, 1)
        self.qtgui_freq_sink_x_1 = 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_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1.disable_legend()

        if complex == type(float()):
            self.qtgui_freq_sink_x_1.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_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_0", gr.sizeof_float, 1, 0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_min_output_buffer(819200)
        (self.nutaq_rtdex_source_0).set_max_output_buffer(819200)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",
                                                   gr.sizeof_short, 1, 1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        self.nutaq_radio420_tx_0_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_0", 2, 2)
        self.nutaq_radio420_tx_0_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0_0.set_default_datarate(samp_rate * 2 *
                                                          decimation)
        self.nutaq_radio420_tx_0_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 *
                                                        decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-20)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_0", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0_0.set_default_reference(0)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2 *
                                                        decimation)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0",
                                                     1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 *
                                                      decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_3 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 11)
        self.nutaq_custom_register_0_3.set_index(2)
        self.nutaq_custom_register_0_3.set_update_rate(1)

        self.nutaq_custom_register_0_2 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_2.set_index(0)
        self.nutaq_custom_register_0_2.set_default_value(
            int((4e6) / samp_rate / 40 * (2**32)))
        self.nutaq_custom_register_0_2.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_1.set_index(2)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_1.set_index(3)
        self.nutaq_custom_register_0_0_1.set_default_value(7)
        self.nutaq_custom_register_0_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_0.set_index(6)
        self.nutaq_custom_register_0_0_0.set_default_value(600)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_0 = nutaq.carrier(
            0, "nutaq_carrier_perseus_0", "192.168.0.102")
        self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200)
        self._freq_sin_win = RangeWidget(self._freq_sin_range,
                                         self.set_freq_sin, "freq_sin",
                                         "counter_slider", float)
        self.top_layout.addWidget(self._freq_sin_win)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.6, ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        (self.blocks_float_to_complex_1).set_processor_affinity([4])
        (self.blocks_float_to_complex_1).set_min_output_buffer(262144)
        (self.blocks_float_to_complex_1).set_max_output_buffer(262144)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/juan/cognitive/fornutaq/gr-ofdm_80211/examples/waveforms/fmcw_chirp_80pc.bin",
            True)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int * 1, 1)
        (self.blocks_deinterleave_0).set_processor_affinity([7])
        (self.blocks_deinterleave_0).set_min_output_buffer(262144)
        (self.blocks_deinterleave_0).set_max_output_buffer(262144)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_min_output_buffer(131072)
        (self.blocks_complex_to_float_0).set_max_output_buffer(131072)
        self.COWN_syncher2_0 = COWN.syncher2()
        (self.COWN_syncher2_0).set_processor_affinity([7])
        (self.COWN_syncher2_0).set_min_output_buffer(262144)
        (self.COWN_syncher2_0).set_max_output_buffer(262144)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.COWN_syncher2_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_deinterleave_0, 2),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_deinterleave_0, 3),
                     (self.blocks_null_sink_0_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.qtgui_time_sink_x_0_0_0_0, 1))
        self.connect((self.blocks_deinterleave_0, 2),
                     (self.qtgui_time_sink_x_0_0_0_0, 2))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))
コード例 #45
0
ファイル: benchmark_mimo.py プロジェクト: luwangg/gr-ofdm-1
  def __init__ (self, options):
    gr.top_block.__init__(self, "ofdm_benchmark")

    ##self._tx_freq            = options.tx_freq         # tranmitter's center frequency
    ##self._tx_subdev_spec     = options.tx_subdev_spec  # daughterboard to use
    ##self._fusb_block_size    = options.fusb_block_size # usb info for USRP
    ##self._fusb_nblocks       = options.fusb_nblocks    # usb info for USRP
    ##self._which              = options.which_usrp
    self._bandwidth          = options.bandwidth
    self.servants = []
    self._verbose            = options.verbose
    
    ##self._interface          = options.interface
    ##self._mac_addr           = options.mac_addr

    self._options = copy.copy( options )


    self._interpolation = 1
    
    f1 = numpy.array([-107,0,445,0,-1271,0,2959,0,-6107,0,11953,
                      0,-24706,0,82359,262144/2,82359,0,-24706,0,
                      11953,0,-6107,0,2959,0,-1271,0,445,0,-107],
                      numpy.float64)/262144.
    
    print "Software interpolation: %d" % (self._interpolation)

    bw = 1.0/self._interpolation
    tb = bw/5
    if self._interpolation > 1:
      self.tx_filter = gr.hier_block2("filter",
                                   gr.io_signature(1,1,gr.sizeof_gr_complex),
                                   gr.io_signature(1,1,gr.sizeof_gr_complex))
      self.tx_filter2 = gr.hier_block2("filter",
                                   gr.io_signature(1,1,gr.sizeof_gr_complex),
                                   gr.io_signature(1,1,gr.sizeof_gr_complex))
      self.tx_filter.connect( self.tx_filter, gr.interp_fir_filter_ccf(2,f1),
                           gr.interp_fir_filter_ccf(2,f1), self.tx_filter )
      self.tx_filter2.connect( self.tx_filter2, gr.interp_fir_filter_ccf(2,f1),
                           gr.interp_fir_filter_ccf(2,f1), self.tx_filter2 )
      print "New"

    else:
      self.tx_filter = None
      self.tx_filter2 = None
      
    self.decimation = 1
    
    if self.decimation > 1:
      bw = 0.5/self.decimation * 1
      tb = bw/5
      # gain, sampling rate, passband cutoff, stopband cutoff
      # passband ripple in dB, stopband attenuation in dB
      # extra taps
      filt_coeff = optfir.low_pass(1.0, 1.0, bw, bw+tb, 0.1, 60.0, 1)
      print "Software decimation filter length: %d" % (len(filt_coeff))
      self.rx_filter = gr.fir_filter_ccf(self.decimation,filt_coeff)
      self.rx_filter2 = gr.fir_filter_ccf(self.decimation,filt_coeff)
    else:
      self.rx_filter = None
      self.rx_filter2 = None
      
      
##    if not options.from_file is None:
##      # sent captured file to usrp
##      self.src = gr.file_source(gr.sizeof_gr_complex,options.from_file)
##      self._setup_usrp_sink()
##      if hasattr(self, "filter"):
##        self.connect(self.src,self.filter,self.u) #,self.filter
##      else:
##        self.connect(self.src,self.u)
##      
##      return 
    
    
    
    self._setup_tx_path(options)
    self._setup_rx_path(options)
    
    config = station_configuration()
    
    self.enable_info_tx("info_tx", "pa_user")
#    if not options.no_cheat:
#      self.txpath.enable_channel_cheating("channelcheat")
    self.txpath.enable_txpower_adjust("txpower")
    self.txpath.publish_txpower("txpower_info")
    
    if options.disable_equalization or options.ideal:
        #print "CHANGE set_k"
        self.rxpath.enable_estim_power_adjust("estim_power")
        #self.rxpath.publish_estim_power("txpower_info")
         
    #self.enable_txfreq_adjust("txfreq")
    
    

    if options.imgxfer:
      self.rxpath.setup_imgtransfer_sink()
    
    if not options.no_decoding:
      self.rxpath.publish_rx_performance_measure()
      
    


    self.dst	= (self.rxpath,0)
    self.dst2 	= (self.rxpath,1)
    
    if options.force_rx_filter:
      print "Forcing rx filter usage"
      self.connect( self.rx_filter, self.dst )
      self.connect( self.rx_filter2, self.dst2 )
      self.dst = self.rx_filter
      self.dst2 = self.rx_filter2
    
    
    if options.measure:
      self.m = throughput_measure(gr.sizeof_gr_complex)
      self.m2 = throughput_measure(gr.sizeof_gr_complex)
      self.connect( self.m, self.dst )
      self.connect( self.m2, self.dst2 )
      self.dst = self.m
      self.dst2 = self.m2


    if options.snr is not None:
      if options.berm is not False:
          noise_sigma = 380 #empirically given, gives the received SNR range of (1:28) for tx amp. range of (500:10000) which is set in rm_ber_measurement.py
          #check for fading channel 
      else:
          snr_db = options.snr
          snr = 10.0**(snr_db/10.0)
          noise_sigma = sqrt( config.rms_amplitude**2 / snr )
          
      print " Noise St. Dev. %d" % (noise_sigma)
      awgn_chan = blocks.add_cc()
      awgn_chan2 = blocks.add_cc()
      awgn_noise_src = ofdm.complex_white_noise( 0.0, noise_sigma )
      awgn_noise_src2 = ofdm.complex_white_noise( 0.0, noise_sigma )
      self.connect( awgn_chan, self.dst )
      self.connect( awgn_chan2, self.dst2 )
      self.connect( awgn_noise_src, (awgn_chan,1) )
      self.connect( awgn_noise_src2, (awgn_chan2,1) )  
      self.dst = awgn_chan
      self.dst2 = awgn_chan2



    if options.freqoff is not None:
      freq_shift = blocks.multiply_cc()
      freq_shift2 = blocks.multiply_cc()
      norm_freq = options.freqoff / config.fft_length
      freq_off_src = analog.sig_source_c(1.0, analog.GR_SIN_WAVE, norm_freq, 1.0, 0.0 )
      freq_off_src2 = analog.sig_source_c(1.0, analog.GR_SIN_WAVE, norm_freq, 1.0, 0.0 )
      self.connect( freq_off_src, ( freq_shift, 1 ) )
      self.connect( freq_off_src2, ( freq_shift2, 1 ) )
      dst = self.dst
      dst2 = self.dst2
      self.connect( freq_shift, dst )
      self.connect( freq_shift2, dst2 )
      self.dst = freq_shift
      self.dst2 = freq_shift2


    if options.multipath:
      if options.itu_channel:
        fad_chan = itpp.tdl_channel(  ) #[0, -7, -20], [0, 2, 6]
          #fad_chan.set_norm_doppler( 1e-9 )
          #fad_chan.set_LOS( [500.,0,0] )
        fad_chan2 = itpp.tdl_channel(  )
        fad_chan.set_channel_profile( itpp.ITU_Pedestrian_A, 5e-8 )
        fad_chan.set_norm_doppler( 1e-8 )
        fad_chan2.set_channel_profile( itpp.ITU_Pedestrian_A, 5e-8 )
        fad_chan2.set_norm_doppler( 1e-8 )
      else:
        fad_chan = gr.fir_filter_ccc(1,[1.0,0.0,2e-1+0.1j,1e-4-0.04j])
        fad_chan2 = gr.fir_filter_ccc(1,[1.0,0.0,2e-1+0.1j,1e-4-0.04j])
        
      self.connect( fad_chan, self.dst )
      self.connect( fad_chan2, self.dst2 )
      self.dst = fad_chan
      self.dst2 = fad_chan2

    if options.samplingoffset is not None:
      soff = options.samplingoffset
      interp = moms(1000000+soff,1000000)
      interp2 = moms(1000000+soff,1000000)
      self.connect( interp, self.dst )
      self.connect( interp2, self.dst2 )
      self.dst = interp
      self.dst2 = interp2
      
      if options.record:
       log_to_file( self, interp, "data/interp_out.compl" )
       log_to_file( self, interp2, "data/interp2_out.compl" )
    
    tmm =blocks.throttle(gr.sizeof_gr_complex,self._bandwidth)
    tmm2 =blocks.throttle(gr.sizeof_gr_complex,self._bandwidth)
    tmm_add = blocks.add_cc()
    tmm2_add = blocks.add_cc()
    self.connect( tmm, tmm_add )
    self.connect( tmm2, (tmm_add,1) )
    self.connect( tmm, tmm2_add )
    self.connect( tmm2, (tmm2_add,1) )
    self.connect( tmm_add, self.dst )
    self.connect( tmm2_add, self.dst2 )
    self.dst = tmm
    self.dst2 = tmm2
    
    inter = blocks.interleave(gr.sizeof_gr_complex)
    deinter = blocks.deinterleave(gr.sizeof_gr_complex)
    
    self.connect(inter, deinter)
    self.connect((deinter,0),self.dst)
    self.connect((deinter,1),self.dst2)
    self.dst = inter
    self.dst2 = (inter,1)
    
    
    if options.force_tx_filter:
      print "Forcing tx filter usage"
      self.connect( self.tx_filter, self.dst )
      self.connect( self.tx_filter2, self.dst2 )
      self.dst = self.tx_filter
      self.dst2 = self.tx_filter2
    if options.record:
      log_to_file( self, self.txpath, "data/txpath_out.compl" )
      log_to_file( self, self.txpath2, "data/txpath2_out.compl" )
      
    if options.nullsink:
        self.connect(gr.null_source(gr.sizeof_gr_complex), self.dst)
        self.connect(gr.null_source(gr.sizeof_gr_complex), self.dst2)
        self.dst = gr.null_sink(gr.sizeof_gr_complex)
        self.dst2 = gr.null_sink(gr.sizeof_gr_complex)
        
    
    self.connect( self.txpath,self.dst )
    self.connect( (self.txpath,1),self.dst2 )
    
    
    if options.cheat:
      self.txpath.enable_channel_cheating("channelcheat")

    
      
    print "Hit Strg^C to terminate"

    if options.event_rxbaseband:
      self.publish_rx_baseband_measure()
      
      
    if options.with_old_gui:
      self.publish_spectrum(256)
      self.rxpath.publish_ctf("ctf_display")
      self.rxpath.publish_ber_measurement(["ber"])
      self.rxpath.publish_average_snr(["totalsnr"])
      if options.sinr_est:
        self.rxpath.publish_sinrsc("sinrsc_display")
      

    
    print "Hit Strg^C to terminate"


    # Display some information about the setup
    if self._verbose:
        self._print_verbage()
コード例 #46
0
ファイル: wifi_tx.py プロジェクト: juanduncan/cognitive
    def __init__(self):
        gr.top_block.__init__(self, "Wifi Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wifi Tx")
        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", "wifi_tx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.tx_gain = tx_gain = 10
        self.samp_rate = samp_rate = 500000
        self.period = period = 1000
        self.pdu_length = pdu_length = 100
        self.packet_size = packet_size = 1024
        self.out_buf_size = out_buf_size = 96000
        self.mult_gaussian = mult_gaussian = 0.01
        self.mult = mult = 0.5
        self.lo_offset = lo_offset = 0
        self.freq_cos = freq_cos = 50000
        self.encoding = encoding = 0
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq_0 = RF_freq_0 = 943e6
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_options = (500000, 1000000, 2000000, )
        self._samp_rate_labels = ('500KHz', '1MHz', '2MHz', )
        self._samp_rate_tool_bar = Qt.QToolBar(self)
        self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate"+": "))
        self._samp_rate_combo_box = Qt.QComboBox()
        self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box)
        for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label)
        self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i)))
        self._samp_rate_callback(self.samp_rate)
        self._samp_rate_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_samp_rate(self._samp_rate_options[i]))
        self.top_layout.addWidget(self._samp_rate_tool_bar)
        self._period_range = Range(1, 10000, 1, 1000, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float)
        self.top_layout.addWidget(self._period_win)
        self._encoding_options = (0, 1, 2, )
        self._encoding_labels = ("BPSK 1/2"  , "BPSK 3/4", "QPSK 1/2", )
        self._encoding_tool_bar = Qt.QToolBar(self)
        self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding"+": "))
        self._encoding_combo_box = Qt.QComboBox()
        self._encoding_tool_bar.addWidget(self._encoding_combo_box)
        for label in self._encoding_labels: self._encoding_combo_box.addItem(label)
        self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i)))
        self._encoding_callback(self.encoding)
        self._encoding_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_encoding(self._encoding_options[i]))
        self.top_layout.addWidget(self._encoding_tool_bar)
        self.wifi_phy_hier_0 = wifi_phy_hier(
            chan_est=0,
            encoding=encoding,
        )
        self._tx_gain_range = Range(0, 100, 1, 10, 200)
        self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, "tx_gain", "counter_slider", float)
        self.top_layout.addWidget(self._tx_gain_win)
        self._pdu_length_range = Range(0, 1500, 1, 100, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", float)
        self.top_layout.addWidget(self._pdu_length_win)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(1)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-5)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(25)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(10)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(1)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(0)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_default_value(int((4e6)/samp_rate/40*(2**32)))
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",1)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(0.01)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.103")
        self._mult_gaussian_range = Range(0, 1, 0.001, 0.01, 200)
        self._mult_gaussian_win = RangeWidget(self._mult_gaussian_range, self.set_mult_gaussian, "mult_gaussian", "counter_slider", float)
        self.top_layout.addWidget(self._mult_gaussian_win)
        self._mult_range = Range(0, 2, 0.001, 0.5, 200)
        self._mult_win = RangeWidget(self._mult_range, self.set_mult, "mult", "counter_slider", float)
        self.top_layout.addWidget(self._mult_win)
        self._lo_offset_options = (0, 6e6, 11e6, )
        self._lo_offset_labels = ("'0 MHz',", "'6 MHz',", '11 MHz', )
        self._lo_offset_tool_bar = Qt.QToolBar(self)
        self._lo_offset_tool_bar.addWidget(Qt.QLabel("LO offset"+": "))
        self._lo_offset_combo_box = Qt.QComboBox()
        self._lo_offset_tool_bar.addWidget(self._lo_offset_combo_box)
        for label in self._lo_offset_labels: self._lo_offset_combo_box.addItem(label)
        self._lo_offset_callback = lambda i: Qt.QMetaObject.invokeMethod(self._lo_offset_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._lo_offset_options.index(i)))
        self._lo_offset_callback(self.lo_offset)
        self._lo_offset_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_lo_offset(self._lo_offset_options[i]))
        self.top_layout.addWidget(self._lo_offset_tool_bar)
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255]))
        self._freq_cos_range = Range(-250000, 250000, 1, 50000, 200)
        self._freq_cos_win = RangeWidget(self._freq_cos_range, self.set_freq_cos, "freq_cos", "counter_slider", float)
        self.top_layout.addWidget(self._freq_cos_win)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_message_strobe_0_0_0 = blocks.message_strobe(pmt.intern("Hello BBBBBBBBBBBB1234"), period)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/juan/Desktop/waveforms/fmcw_chirp_80pc.bin", True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_min_output_buffer(8192)
        (self.blocks_complex_to_float_0).set_max_output_buffer(8192)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))    
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in'))    
        self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_mac_0, 'phy in'))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_null_source_0, 0), (self.wifi_phy_hier_0, 0))    
        self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0, 0))    
        self.connect((self.wifi_phy_hier_0, 0), (self.blocks_null_sink_0_0, 0))    
コード例 #47
0
    def __init__(self, fc=629e6, gaindB=23, samp_rate=12.5e6):
        gr.top_block.__init__(self, "Usrp 2Chrx Save")

        ##################################################
        # Parameters
        ##################################################
        self.fc = fc
        self.gaindB = gaindB
        self.samp_rate = samp_rate

        ##################################################
        # Variables
        ##################################################
        self.chans = chans = 4096

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_pub_sink_0 = zeromq.pub_sink(gr.sizeof_float, chans, 'tcp://*:50001', 100, False, -1)
        self.uhd_usrp_source = uhd.usrp_source(
            ",".join(("addr=10.11.2.61", "master_clock_rate=250e6")),
            uhd.stream_args(
                cpu_format="fc32",
                otw_format="sc16",
                args='',
                channels=list(range(0,2)),
            ),
        )
        self.uhd_usrp_source.set_subdev_spec('A:0 B:0', 0)
        self.uhd_usrp_source.set_time_source('external', 0)
        self.uhd_usrp_source.set_clock_source('external', 0)
        self.uhd_usrp_source.set_center_freq(fc, 0)
        self.uhd_usrp_source.set_gain(gaindB, 0)
        self.uhd_usrp_source.set_antenna('TX/RX', 0)
        self.uhd_usrp_source.set_center_freq(fc, 1)
        self.uhd_usrp_source.set_gain(gaindB, 1)
        self.uhd_usrp_source.set_antenna('TX/RX', 1)
        self.uhd_usrp_source.set_samp_rate(samp_rate)
        self.uhd_usrp_source.set_time_unknown_pps(uhd.time_spec())
        self.fft_vxx_0_0 = fft.fft_vcc(chans, True, window.blackmanharris(chans), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(chans, True, window.blackmanharris(chans), True, 1)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, chans)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, chans)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_float*chans, 1)
        self.blocks_integrate_xx_0_0 = blocks.integrate_ff(1000, chans)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(1000, chans)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, 'test.cfile', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(chans)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(chans)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_integrate_xx_0_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0), (self.zeromq_pub_sink_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0_0, 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_squared_0, 0))
        self.connect((self.fft_vxx_0_0, 0), (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.uhd_usrp_source, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.uhd_usrp_source, 1), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.uhd_usrp_source, 0), (self.blocks_stream_to_vector_0_0, 0))
コード例 #48
0
    def __init__(self):
        gr.top_block.__init__(self, "AIS receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("AIS receiver")
        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", "ais_rx")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate, 15000, 20000, firdes.WIN_HAMMING, 6.76)

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1_0 = filter.rational_resampler_fff(
            interpolation=48, decimation=50, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=48, decimation=50, taps=None, fractional_bw=None)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               'rtl=0')
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(162e6, 0)
        self.osmosdr_source_0.set_freq_corr(104, 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_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 16000)
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 16000)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_short * 1,
                                                   'aisfifo', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(0.3)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.3)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.rational_resampler_xxx_1_0, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_interleave_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.rational_resampler_xxx_1_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
コード例 #49
0
ファイル: perseus_s_sensing.py プロジェクト: dodomm/cognitive
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_s_sensing")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_funcion = variable_funcion = 0
        self.show_test_statistics = show_test_statistics = False
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.freq_offset = freq_offset = variable_funcion
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600
        self.ENABLE_TX1_variable_check_box = ENABLE_TX1_variable_check_box = True

        ##################################################
        # Blocks
        ##################################################
        self.probe = blocks.probe_signal_f()

        def _variable_funcion_probe():
            while True:
                val = self.probe.level()
                try:
                    self.set_variable_funcion(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.1))

        _variable_funcion_thread = threading.Thread(
            target=_variable_funcion_probe)
        _variable_funcion_thread.daemon = True
        _variable_funcion_thread.start()
        _show_test_statistics_check_box = Qt.QCheckBox(
            "Show Test Statistics (ReL and Rs)")
        self._show_test_statistics_choices = {True: True, False: False}
        self._show_test_statistics_choices_inv = dict(
            (v, k) for k, v in self._show_test_statistics_choices.iteritems())
        self._show_test_statistics_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _show_test_statistics_check_box, "setChecked",
            Qt.Q_ARG("bool", self._show_test_statistics_choices_inv[i]))
        self._show_test_statistics_callback(self.show_test_statistics)
        _show_test_statistics_check_box.stateChanged.connect(
            lambda i: self.set_show_test_statistics(
                self._show_test_statistics_choices[bool(i)]))
        self.top_layout.addWidget(_show_test_statistics_check_box)
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_subband_selector_0 = spectsensing.subband_selector(
            40, "Selection", 0, samp_rate)
        self.spectsensing_ss_subband_plot_0_0 = spectsensing.ss_subband_plot(
            show_test_statistics, "")
        self._spectsensing_ss_subband_plot_0_0_win = self.spectsensing_ss_subband_plot_0_0
        self.top_layout.addWidget(self._spectsensing_ss_subband_plot_0_0_win)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(
            nfft, samp_rate, 1024)
        self.spectsensing_ss_edge_plot_0 = spectsensing.ss_edge_plot(
            show_test_statistics, " ")
        self._spectsensing_ss_edge_plot_0_win = self.spectsensing_ss_edge_plot_0
        self.top_layout.addWidget(self._spectsensing_ss_edge_plot_0_win)

        self.spectsensing_compute_statistics_0 = spectsensing.compute_statistics(
            nfft, samp_rate, 0.0065, 1e-9, 1e-9, 40, 54)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1020 * 64,  #size
            samp_rate / 40,  #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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_S_S = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 3)
        self.nutaq_rtdex_source_S_S.set_type(0)
        self.nutaq_rtdex_source_S_S.set_packet_size(1200)
        self.nutaq_rtdex_source_S_S.set_channels("3")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",
                                                   gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_1_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)

        self.nutaq_custom_register_0_1_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_TX = nutaq.carrier(
            0, "nutaq_carrier_perseus_TX", "192.168.0.101")
        self._freq_offset_range = Range(-1e7, 1e7, 1e4, variable_funcion, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            "freq_offset", "slider")
        self.top_layout.addWidget(self._freq_offset_win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=oversampling,
            bt=0.71,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=oversampling,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1,
                                                 "192.168.0.100", 1234, 1472,
                                                 True)
        self.blocks_throttle_0 = blocks.throttle(
            gr.sizeof_char * 1,
            2 * 4e3 + 0 * samp_rate / 40 / (oversampling * 8 * 2), True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_null_sink_1_3 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_2 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_1 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff(
            (2.0**(16 * 2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc(
            (amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff(
            (2.0**(16 * 0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff(
            (2.0**(16 * 1), ))
        self.blocks_multiply_const_vxx_0_1_0 = blocks.multiply_const_vff(
            (2.0**(16 * 1), ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff(
            (2.0**(16 * 0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (2.0**(16 * 2), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_deinterleave_0_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=8,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_1.
                recv_pkt(ok, payload),
            ), )
        _ENABLE_TX1_variable_check_box_check_box = Qt.QCheckBox(
            "Enable Transmission")
        self._ENABLE_TX1_variable_check_box_choices = {
            True: True,
            False: False
        }
        self._ENABLE_TX1_variable_check_box_choices_inv = dict(
            (v, k) for k, v in
            self._ENABLE_TX1_variable_check_box_choices.iteritems())
        self._ENABLE_TX1_variable_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _ENABLE_TX1_variable_check_box_check_box, "setChecked",
            Qt.Q_ARG("bool", self._ENABLE_TX1_variable_check_box_choices_inv[i]
                     ))
        self._ENABLE_TX1_variable_check_box_callback(
            self.ENABLE_TX1_variable_check_box)
        _ENABLE_TX1_variable_check_box_check_box.stateChanged.connect(
            lambda i: self.set_ENABLE_TX1_variable_check_box(
                self._ENABLE_TX1_variable_check_box_choices[bool(i)]))
        self.top_layout.addWidget(_ENABLE_TX1_variable_check_box_check_box)
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_2 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_1 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(
            1024)
        self.DataConversion_eaver_resynchronizer_0 = DataConversion.eaver_resynchronizer(
            decimation)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect(
            (self.spectsensing_compute_statistics_0, 'spec_sens_pdus'),
            (self.spectsensing_ss_edge_plot_0, 'pdus'))
        self.msg_connect(
            (self.spectsensing_compute_statistics_0, 'spec_sens_pdus'),
            (self.spectsensing_ss_subband_plot_0_0, 'pdus'))
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'),
                         (self.spectsensing_xs_plot_1, 'pdus'))
        self.connect((self.DataConversion_eaver_resynchronizer_0, 1),
                     (self.spectsensing_compute_statistics_0, 1))
        self.connect((self.DataConversion_eaver_resynchronizer_0, 0),
                     (self.spectsensing_compute_statistics_0, 0))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0),
                     (self.spectsensing_ss_pds_plot_0, 0))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1),
                     (self.spectsensing_ss_pds_plot_0, 1))
        self.connect((self.DataConversion_reint_short_float_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_3, 0))
        self.connect((self.DataConversion_reint_short_float_0_1, 0),
                     (self.blocks_multiply_const_vxx_0_1_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_0_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_2, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_1, 0))
        self.connect((self.DataConversion_reint_short_float_0_3, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0, 1))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 0),
                     (self.DataConversion_reint_short_float_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 1),
                     (self.DataConversion_reint_short_float_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 3),
                     (self.DataConversion_reint_short_float_0_1, 0))
        self.connect((self.blocks_deinterleave_0_0, 2),
                     (self.DataConversion_reint_short_float_0_2, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 1),
                     (self.blocks_short_to_float_0_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 0),
                     (self.blocks_short_to_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 1),
                     (self.DataConversion_reint_short_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 3),
                     (self.DataConversion_reint_short_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 2),
                     (self.DataConversion_reint_short_float_0_2_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 0),
                     (self.DataConversion_reint_short_float_0_3, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_1_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0),
                     (self.blocks_add_xx_0_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_2, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_3, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 1))
        self.connect((self.blocks_short_to_float_0_1_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_1, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_2, 0))
        self.connect((self.nutaq_rtdex_source_0_0_0, 0),
                     (self.blocks_deinterleave_0_0_0, 0))
        self.connect((self.nutaq_rtdex_source_S_S, 0),
                     (self.blocks_deinterleave_0_0, 0))
        self.connect((self.nutaq_rtdex_source_S_S_0, 0),
                     (self.blocks_deinterleave_0_0_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 5),
                     (self.blocks_null_sink_1_0, 0))
        self.connect((self.spectsensing_compute_statistics_0, 2),
                     (self.blocks_null_sink_1_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 4),
                     (self.blocks_null_sink_1_2, 0))
        self.connect((self.spectsensing_compute_statistics_0, 6),
                     (self.blocks_null_sink_1_3, 0))
        self.connect((self.spectsensing_compute_statistics_0, 7),
                     (self.spectsensing_subband_selector_0, 0))
        self.connect((self.spectsensing_compute_statistics_0, 1),
                     (self.spectsensing_subband_selector_0, 1))
        self.connect((self.spectsensing_compute_statistics_0, 3),
                     (self.spectsensing_subband_selector_0, 2))
        self.connect((self.spectsensing_subband_selector_0, 0),
                     (self.probe, 0))
コード例 #50
0
ファイル: wifi_tx_rx.py プロジェクト: dodomm/cognitive
    def __init__(self, chan_est=0):
        gr.top_block.__init__(self, "Wifi Tx Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wifi Tx Rx")
        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", "wifi_tx_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.chan_est = chan_est

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.threshold = threshold = 1000
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 5e5
        self.period = period = 10
        self.pdu_length = pdu_length = 30
        self.out_buf_size = out_buf_size = 96000
        self.header_formatter = header_formatter = ieee802_11.wifi_signal_field(
        )
        self.freq_sin = freq_sin = 1000
        self.freq = freq = 943e6
        self.encoding = encoding = 0
        self.decimation = decimation = 40

        ##################################################
        # Blocks
        ##################################################
        self._period_range = Range(1, 10000, 1, 10, 200)
        self._period_win = RangeWidget(self._period_range, self.set_period,
                                       "period", "counter_slider", float)
        self.top_layout.addWidget(self._period_win)
        self._pdu_length_range = Range(10, 1500, 1, 30, 200)
        self._pdu_length_win = RangeWidget(self._pdu_length_range,
                                           self.set_pdu_length, "pdu_length",
                                           "counter_slider", int)
        self.top_layout.addWidget(self._pdu_length_win)
        self._encoding_options = (
            0,
            1,
            2,
        )
        self._encoding_labels = (
            "BPSK 1/2",
            "BPSK 3/4",
            "QPSK 1/2",
        )
        self._encoding_tool_bar = Qt.QToolBar(self)
        self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding" + ": "))
        self._encoding_combo_box = Qt.QComboBox()
        self._encoding_tool_bar.addWidget(self._encoding_combo_box)
        for label in self._encoding_labels:
            self._encoding_combo_box.addItem(label)
        self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._encoding_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._encoding_options.index(i)))
        self._encoding_callback(self.encoding)
        self._encoding_combo_box.currentIndexChanged.connect(
            lambda i: self.set_encoding(self._encoding_options[i]))
        self.top_layout.addWidget(self._encoding_tool_bar)
        self.qtgui_time_sink_x_2 = qtgui.time_sink_f(
            32,  #size
            100,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 110)

        self.qtgui_time_sink_x_2.set_y_label("Frame error rata", "")

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

        if not True:
            self.qtgui_time_sink_x_2.disable_legend()

        labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""]
        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_2.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_2_win = sip.wrapinstance(
            self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_2_win)
        (self.qtgui_time_sink_x_2).set_processor_affinity([3])
        self.qtgui_time_sink_x_0_0_0_1_0_1 = qtgui.time_sink_c(
            2**10,  #size
            samp_rate / 1000,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_update_time(1)
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_axis(-0.1, 1000)

        self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_label("Generated Samples", "")

        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.set_trigger_mode(
            qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.001, 5e-3, 0,
            "FISTOR")
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_grid(True)
        self.qtgui_time_sink_x_0_0_0_1_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0_1_0_1.disable_legend()

        labels = [
            "correlation I", "correlation Q", "correlation_big", "", "", "",
            "", "", "", ""
        ]
        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_0_0_1_0_1.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_1_0_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_1_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_0_1_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0.99,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.0000010)
        self.qtgui_number_sink_0.set_title("Frame error Rata")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        units = ["", "", "", "", "", "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, 0)
            self.qtgui_number_sink_0.set_max(i, 100)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_win)
        (self.qtgui_number_sink_0).set_processor_affinity([3])
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_0", gr.sizeof_int, 1, 0)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(8192)
        self.nutaq_rtdex_source_0.set_channels("0")
        (self.nutaq_rtdex_source_0).set_processor_affinity([1])
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",
                                                   gr.sizeof_short, 1, 1)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("0")
        (self.nutaq_rtdex_sink_0).set_processor_affinity([3])
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 *
                                                        decimation)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-15)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0",
                                                     1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 *
                                                      decimation)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(3)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_2 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_2.set_index(0)
        self.nutaq_custom_register_0_2.set_default_value(
            int((4e6) / samp_rate / 40 * (2**32)))
        self.nutaq_custom_register_0_2.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0_1.set_index(2)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_1.set_index(3)
        self.nutaq_custom_register_0_0_1.set_default_value(7)
        self.nutaq_custom_register_0_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0_0.set_index(6)
        self.nutaq_custom_register_0_0_0.set_default_value(600)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_0", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_0 = nutaq.carrier(
            0, "nutaq_carrier_perseus_0", "192.168.0.101")
        self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(
            0.56, 2, False, False)
        (self.ieee802_11_ofdm_sync_short_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_sync_short_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(
            sync_length, False, False)
        (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(
            False, True)
        (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_mapper_0 = ieee802_11.ofdm_mapper(encoding, False)
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(
            ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]),
            ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]),
            ([0xff, 0xff, 0xff, 0xff, 0xff, 255]))
        (self.ieee802_11_ofdm_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(
            chan_est, False)
        (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(
            False, False)
        (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(
            False, False)
        (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3])
        (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000)
        self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(
            window_size + 16)
        (self.ieee802_11_moving_average_xx_1).set_processor_affinity([3])
        (self.ieee802_11_moving_average_xx_1).set_min_output_buffer(96000)
        self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(
            window_size)
        (self.ieee802_11_moving_average_xx_0).set_processor_affinity([3])
        (self.ieee802_11_moving_average_xx_0).set_min_output_buffer(96000)
        self.ieee802_11_chunks_to_symbols_xx_0 = ieee802_11.chunks_to_symbols()
        (self.ieee802_11_chunks_to_symbols_xx_0).set_min_output_buffer(96000)
        self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200)
        self._freq_sin_win = RangeWidget(self._freq_sin_range,
                                         self.set_freq_sin, "freq_sin",
                                         "counter_slider", float)
        self.top_layout.addWidget(self._freq_sin_win)
        self.foo_packet_pad2_0_0 = foo.packet_pad2(False, False, 0.0001,
                                                   100000, 100000)
        (self.foo_packet_pad2_0_0).set_processor_affinity([3])
        (self.foo_packet_pad2_0_0).set_min_output_buffer(262144)
        self.fft_vxx_0_0 = fft.fft_vcc(64, False, (tuple([1 / 52**.5] * 64)),
                                       True, 1)
        (self.fft_vxx_0_0).set_min_output_buffer(96000)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True,
                                     1)
        (self.fft_vxx_0).set_processor_affinity([3])
        (self.fft_vxx_0).set_min_output_buffer(96000)
        self.digital_packet_headergenerator_bb_0 = digital.packet_headergenerator_bb(
            header_formatter.formatter(), "packet_len")
        self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer(
            64, 64 + 16, 2, "packet_len")
        (self.digital_ofdm_cyclic_prefixer_0_0).set_min_output_buffer(96000)
        self.digital_ofdm_carrier_allocator_cvc_0_0_0 = digital.ofdm_carrier_allocator_cvc(
            64, (range(-26, -21) + range(-20, -7) + range(-6, 0) +
                 range(1, 7) + range(8, 21) + range(22, 27), ),
            ((-21, -7, 7, 21), ),
            ((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, -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), (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, 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), (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, 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),
             (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, -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), (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, 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), (-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, 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), (-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, 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),
             (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, -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), (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, 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), (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, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1,
                                                                 1)),
            ((0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 +
               1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 +
               1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
             (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 +
               1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0,
              (1.4719601443879746 +
               1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
             (0, 0j, 0, 0j, 0, 0j, -1, 1j, -1, 1j, -1, 1j, -1, -1j, 1, 1j, 1,
              -1j, -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1,
              (-0 - 1j), 1, -1j, -1, 1j, 0, -1j, 1,
              (-0 - 1j), 1, -1j, 1, 1j, -1, -1j, 1, (-0 - 1j), -1, 1j, 1, 1j,
              1, 1j, 1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 0j, 0, 0j, 0, 0j),
             (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)), "packet_len")
        (self.digital_ofdm_carrier_allocator_cvc_0_0_0
         ).set_min_output_buffer(96000)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            ([-1, 1]), 1)
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(
            gr.sizeof_gr_complex * 1, "packet_len", 1)
        (self.blocks_tagged_stream_mux_0).set_min_output_buffer(96000)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 64)
        (self.blocks_stream_to_vector_0).set_processor_affinity([3])
        (self.blocks_stream_to_vector_0).set_min_output_buffer(96000)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.float_t, "packet_len")
        (self.blocks_pdu_to_tagged_stream_0).set_processor_affinity([3])
        (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(96000)
        self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        (self.blocks_multiply_xx_0).set_processor_affinity([3])
        (self.blocks_multiply_xx_0).set_min_output_buffer(96000)
        self.blocks_message_strobe_0_0 = blocks.message_strobe(
            pmt.intern("".join("x" for i in range(pdu_length)) + "1234"),
            period)
        (self.blocks_message_strobe_0_0).set_processor_affinity([3])
        (self.blocks_message_strobe_0_0).set_min_output_buffer(96000)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        (self.blocks_interleave_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        (self.blocks_float_to_short_0_0_0).set_processor_affinity([3])
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        (self.blocks_float_to_short_0_0).set_processor_affinity([3])
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        (self.blocks_float_to_complex_0).set_processor_affinity([2])
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        (self.blocks_divide_xx_0).set_processor_affinity([3])
        (self.blocks_divide_xx_0).set_min_output_buffer(96000)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16)
        (self.blocks_delay_0_0).set_processor_affinity([3])
        (self.blocks_delay_0_0).set_min_output_buffer(96000)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1,
                                           sync_length)
        (self.blocks_delay_0).set_processor_affinity([3])
        (self.blocks_delay_0).set_min_output_buffer(96000)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int * 1, 1)
        (self.blocks_deinterleave_0).set_processor_affinity([1])
        (self.blocks_deinterleave_0).set_min_output_buffer(32768)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        (self.blocks_conjugate_cc_0).set_processor_affinity([3])
        (self.blocks_conjugate_cc_0).set_min_output_buffer(96000)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        (self.blocks_complex_to_mag_squared_0).set_processor_affinity([3])
        (self.blocks_complex_to_mag_squared_0).set_min_output_buffer(96000)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        (self.blocks_complex_to_mag_0).set_processor_affinity([3])
        (self.blocks_complex_to_mag_0).set_min_output_buffer(96000)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        (self.blocks_complex_to_float_0).set_processor_affinity([3])
        (self.blocks_complex_to_float_0).set_min_output_buffer(16384)
        self.COWN_syncher2_0 = COWN.syncher2()
        (self.COWN_syncher2_0).set_processor_affinity([1])
        self.COWN_resta_0 = COWN.resta()
        (self.COWN_resta_0).set_processor_affinity([1])

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'),
                         (self.ieee802_11_ofdm_mac_0, 'app in'))
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'),
                         (self.ieee802_11_ofdm_parse_mac_0, 'in'))
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'),
                         (self.ieee802_11_ofdm_mapper_0, 'in'))
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0))
        self.connect((self.COWN_syncher2_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_divide_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.ieee802_11_moving_average_xx_1, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0))
        self.connect((self.blocks_deinterleave_0, 2),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.ieee802_11_ofdm_sync_long_0, 1))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 0))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 2))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_delay_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.ieee802_11_moving_average_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.qtgui_time_sink_x_2, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0),
                     (self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.blocks_tagged_stream_mux_0, 0))
        self.connect((self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0),
                     (self.fft_vxx_0_0, 0))
        self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0),
                     (self.foo_packet_pad2_0_0, 0))
        self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_1_0_1, 0))
        self.connect((self.digital_packet_headergenerator_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.ieee802_11_ofdm_equalize_symbols_0, 0))
        self.connect((self.fft_vxx_0_0, 0),
                     (self.digital_ofdm_cyclic_prefixer_0_0, 0))
        self.connect((self.foo_packet_pad2_0_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.ieee802_11_chunks_to_symbols_xx_0, 0),
                     (self.blocks_tagged_stream_mux_0, 1))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 1))
        self.connect((self.ieee802_11_moving_average_xx_1, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0),
                     (self.ieee802_11_ofdm_decode_mac_0, 0))
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0),
                     (self.ieee802_11_ofdm_decode_signal_0, 0))
        self.connect((self.ieee802_11_ofdm_mapper_0, 0),
                     (self.digital_packet_headergenerator_bb_0, 0))
        self.connect((self.ieee802_11_ofdm_mapper_0, 0),
                     (self.ieee802_11_chunks_to_symbols_xx_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0),
                     (self.blocks_null_sink_0_0_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0),
                     (self.ieee802_11_ofdm_sync_long_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))
コード例 #51
0
    def __init__(self):
        gr.top_block.__init__(self)

        usage = "%prog: [options] tx-freq0 tx-freq1"
        parser = OptionParser (option_class=eng_option, usage=usage)
        parser.add_option("-a", "--args", type="string", default="",
                          help="UHD device address args [default=%default]")
        parser.add_option("", "--spec", type="string", default=None,
	                  help="Subdevice of UHD device where appropriate")
        parser.add_option("-A", "--antenna", type="string", default=None,
                          help="select Rx Antenna where appropriate")
        parser.add_option("-s", "--samp-rate", type="eng_float", default=320e3,
                          help="set sample rate [default=%default]")
        parser.add_option("-g", "--gain", type="eng_float", default=None,
                          help="set gain in dB (default is midpoint)")
        (options, args) = parser.parse_args ()

        if len(args) != 2:
            parser.print_help()
            raise SystemExit
        else:
            freq0 = str_to_num(args[0])
            freq1 = str_to_num(args[1])

        # ----------------------------------------------------------------
        # Set up USRP to transmit on both daughterboards

        d = uhd.find_devices(uhd.device_addr(options.args))
        uhd_type = d[0].get('type')

        stream_args = uhd.stream_args('fc32', channels=range(2))
        self.u = uhd.usrp_sink(device_addr=options.args, stream_args=stream_args)

        # Set up USRP system based on type
        if(uhd_type == "usrp"):
            self.u.set_subdev_spec("A:0 B:0")
            tr0 = uhd.tune_request(freq0)
            tr1 = uhd.tune_request(freq1)

        else:
            if abs(freq0 - freq1) > 5.5e6:
                sys.stderr.write("\nError: When not using two separate d'boards, frequencies must bewithin 5.5MHz of each other.\n")
                raise SystemExit

            self.u.set_subdev_spec("A:0 A:0")

            mid_freq = (freq0 + freq1)/2.0
            tr0 = uhd.tune_request(freq0, rf_freq=mid_freq,
                                   rf_freq_policy=uhd.tune_request.POLICY_MANUAL)

            tr1 = uhd.tune_request(freq1, rf_freq=mid_freq,
                                   rf_freq_policy=uhd.tune_request.POLICY_MANUAL)

        # Use the tune requests to tune each channel
        self.set_freq(tr0, 0)
        self.set_freq(tr1, 1)

        self.usrp_rate  = options.samp_rate

        self.u.set_samp_rate(self.usrp_rate)
        dev_rate = self.u.get_samp_rate()

        # ----------------------------------------------------------------
        # build two signal sources, interleave them, amplify and
        # connect them to usrp

        sig0 = example_signal_0(self.usrp_rate)
        sig1 = example_signal_1(self.usrp_rate)

        intl = blocks.interleave(gr.sizeof_gr_complex)
        self.connect(sig0, (intl, 0))
        self.connect(sig1, (intl, 1))

        # Correct for any difference in requested and actual rates
        rrate = self.usrp_rate / dev_rate
        resamp = filter.pfb.arb_resampler_ccf(rrate)

        # and wire them up
        self.connect(intl, resamp, self.u)

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            g = self.u.get_gain_range()
            options.gain = float(g.start()+g.stop())/2.0

        self.set_gain(options.gain, 0)
        self.set_gain(options.gain, 1)

        # Set the subdevice spec
        if(options.spec):
            self.u.set_subdev_spec(options.spec, 0)

        # Set the antenna
        if(options.antenna):
            self.u.set_antenna(options.antenna, 0)
            self.u.set_antenna(options.antenna, 1)
コード例 #52
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus Voice GMSK")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.data_rate = data_rate = 14.40e6/2

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=data_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=True,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=((450,300)),
        )
        self.GridAdd(self.wxgui_scopesink2_1.win, 1, 1, 1, 1)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=48e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        	size=((450,300)),
        )
        self.GridAdd(self.wxgui_fftsink2_1.win, 1, 2, 1, 1)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_short,1,3)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(1024)
        self.nutaq_rtdex_source_0.set_channels("1")
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,2)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(1024)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(data_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(data_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(16)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(5)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(6)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=2,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_short_to_float_0_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))
コード例 #53
0
    def __init__(self, EbN0, viterbi=False):
        gr.top_block.__init__(self)

        self.sps = 5
        alpha = 0.35

        const = digital.constellation_bpsk().base()
        modulator = digital.generic_mod(
          constellation=const,
          differential=False,
          samples_per_symbol=self.sps,
          pre_diff_code=True,
          excess_bw=alpha,
          verbose=False,
          log=False,
          )
        channel = channels.channel_model(
        	noise_voltage=self.EbN0_to_noise_voltage(EbN0, viterbi),
        	frequency_offset=0,
        	epsilon=1.0,
        	taps=(0, 0, (1+1j)/numpy.sqrt(2), ),
        	noise_seed=RAND_SEED,
        	block_tags=False
        )
        self.sink  = blocks.vector_sink_f()
        biterrors = BitErrors()

        dut = lilacsat1_ber_viterbi() if viterbi else lilacsat1_ber_bpsk()

        pack = blocks.pack_k_bits_bb(8)
        descrambler = digital.descrambler_bb(0x21, 0x00, 16)
        self.connect(blocks.vector_source_b([1], repeat=True),
                     blocks.head(gr.sizeof_char, int(N_BITS)),
                     digital.scrambler_bb(0x21, 0x00, 16),
                     digital.diff_encoder_bb(2),
                     pack)
        self.connect(modulator, channel,
                     blocks.multiply_const_cc(0.1), # we set some amplitude to test the agc # signal amplitude 1 seems very important
                     dut,
                     digital.diff_decoder_bb(2),
                     descrambler)
        self.connect(biterrors, self.sink)
        
        if viterbi:
            deinterleave_viterbi = blocks.deinterleave(gr.sizeof_char)
            interleave_viterbi = blocks.interleave(gr.sizeof_char)
            self.connect(pack,
                         fec.encode_ccsds_27_bb(),
                         deinterleave_viterbi)
            self.connect((deinterleave_viterbi, 0),
                         (interleave_viterbi, 1))
            self.connect((deinterleave_viterbi, 1),
                         blocks.not_bb(),
                         blocks.and_const_bb(1),
                         (interleave_viterbi, 0))
            self.connect(interleave_viterbi,
                         blocks.pack_k_bits_bb(8),
                         modulator)
            descrambler2 = digital.descrambler_bb(0x21, 0x00, 16)
            self.connect((dut, 1),
                        digital.diff_decoder_bb(2),
                        descrambler2)
            or2 = blocks.or_bb()
            self.connect(descrambler, or2)
            self.connect(descrambler2, (or2, 1))
            self.connect(or2, biterrors)
            #self.sinkviterbi1 = blocks.vector_sink_b()
            #self.sinkviterbi2 = blocks.vector_sink_b()
            #self.connect(descrambler, self.sinkviterbi1)
            #self.connect(descrambler2, self.sinkviterbi2)

        else:
            self.connect(pack, modulator)
            self.connect(descrambler, biterrors)            
コード例 #54
0
ファイル: vsrm_demod.py プロジェクト: gvanhoy/gr-physec
    def __init__(self, delay=1, spread_seq=(1, -1)):
        gr.hier_block2.__init__(
            self,
            "Variable Symbol Rate Modulation Demodulator",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.delay = delay
        self.spread_seq = spread_seq

        ##################################################
        # Blocks
        ##################################################
        self.blocks_vector_to_stream_0_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1,
            len(spread_seq) + 1)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1,
            len(spread_seq) + 1)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 1 + len(spread_seq))
        self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_vcc(
            (1 / float(len(spread_seq)), ))
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vcc(
            ([1] + [0] * len(spread_seq)))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            ((0, ) + spread_seq))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_gr_complex * 1,
                                                     1)
        self.blocks_integrate_xx_0_0 = blocks.integrate_cc(
            len(spread_seq) + 1, 1)
        self.blocks_integrate_xx_0 = blocks.integrate_cc(
            len(spread_seq) + 1, 1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, delay)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_delay_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0_0, 0))
        self.connect((self.blocks_integrate_xx_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.blocks_vector_to_stream_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0_0, 0),
                     (self.blocks_integrate_xx_0_0, 0))
        self.connect((self, 0), (self.blocks_delay_0, 0))
コード例 #55
0
    def __init__(self, encoder_list_0, input_size=gr.sizeof_char, output_size=gr.sizeof_char):
        gr.hier_block2.__init__(self, "Capillary Threaded Encoder",
                                gr.io_signature(1, 1, input_size),
                                gr.io_signature(1, 1, output_size))

        self.encoder_list_0 = encoder_list_0

        check = math.log10(len(self.encoder_list_0)) / math.log10(2.0)
        if(abs(check - int(check)) > 0.0):
            gr.log.info("fec.capillary_threaded_encoder: number of encoders must be a power of 2.")
            raise AttributeError

        self.deinterleaves_0 = [];
        for i in range(int(math.log(len(encoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.deinterleaves_0.append(blocks.deinterleave(input_size,
                                                                fec.get_encoder_input_size(encoder_list_0[0])))

       	self.generic_encoders_0 = [];
        for i in range(len(encoder_list_0)):
            self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
                                                       input_size, output_size))

        self.interleaves_0 = [];
        for i in range(int(math.log(len(encoder_list_0), 2))):
            for j in range(int(math.pow(2, i))):
                self.interleaves_0.append(blocks.interleave(output_size,
                                                            fec.get_encoder_output_size(encoder_list_0[0])))

        rootcount = 0;
        branchcount = 1;
        for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.deinterleaves_0[rootcount], 0), (self.deinterleaves_0[branchcount], 0))
                self.connect((self.deinterleaves_0[rootcount], 1), (self.deinterleaves_0[branchcount + 1], 0))
                rootcount += 1;
                branchcount += 2;

        codercount = 0;
        for i in range(len(encoder_list_0)/2):
            self.connect((self.deinterleaves_0[rootcount], 0), (self.generic_encoders_0[codercount], 0))
            self.connect((self.deinterleaves_0[rootcount], 1), (self.generic_encoders_0[codercount + 1], 0))
            rootcount += 1;
            codercount += 2;


        rootcount = 0;
        branchcount = 1;
        for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
            for j in range(int(math.pow(2, i))):
                self.connect((self.interleaves_0[branchcount], 0), (self.interleaves_0[rootcount], 0))
                self.connect((self.interleaves_0[branchcount + 1], 0), (self.interleaves_0[rootcount], 1))
                rootcount += 1;
                branchcount += 2;


        codercount = 0;
        for i in range(len(encoder_list_0)/2):
            self.connect((self.generic_encoders_0[codercount], 0), (self.interleaves_0[rootcount], 0))
            self.connect((self.generic_encoders_0[codercount + 1], 0), (self.interleaves_0[rootcount], 1))
            rootcount += 1;
            codercount += 2;

       	if((len(self.encoder_list_0)) > 1):
            self.connect((self, 0), (self.deinterleaves_0[0], 0))
            self.connect((self.interleaves_0[0], 0), (self, 0))
        else:
            self.connect((self, 0), (self.generic_encoders_0[0], 0))
            self.connect((self.generic_encoders_0[0], 0), (self, 0))
コード例 #56
0
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_withFPGAdecimation")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600

        ##################################################
        # Blocks
        ##################################################
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(
            nfft, samp_rate, 1024)
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",
                                                   gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-4)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(14)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_1_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)

        self.nutaq_custom_register_0_1_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_TX = nutaq.carrier(
            0, "nutaq_carrier_perseus_TX", "192.168.0.101")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=oversampling,
            bt=0.71,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=oversampling,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1,
                                                 "192.168.0.100", 1234, 1472,
                                                 True)
        self.blocks_throttle_0 = blocks.throttle(
            gr.sizeof_char * 1,
            2 * 4e3 + 0 * samp_rate / 40 / (oversampling * 8 * 2), True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff(
            (2.0**(16 * 2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc(
            (amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff(
            (2.0**(16 * 0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff(
            (2.0**(16 * 1), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=8,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_1.
                recv_pkt(ok, payload),
            ), )
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(
            1024)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'),
                         (self.spectsensing_xs_plot_1, 'pdus'))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0),
                     (self.spectsensing_ss_pds_plot_0, 0))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1),
                     (self.spectsensing_ss_pds_plot_0, 1))
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_3, 0))
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_0_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_1, 0))
        self.connect((self.DataConversion_reint_short_float_0_3, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 1),
                     (self.blocks_short_to_float_0_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 0),
                     (self.blocks_short_to_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 1),
                     (self.DataConversion_reint_short_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 3),
                     (self.DataConversion_reint_short_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 2),
                     (self.DataConversion_reint_short_float_0_2_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 0),
                     (self.DataConversion_reint_short_float_0_3, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0),
                     (self.blocks_add_xx_0_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_2, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_3, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 1))
        self.connect((self.blocks_short_to_float_0_1_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_1, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_2, 0))
        self.connect((self.nutaq_rtdex_source_0_0_0, 0),
                     (self.blocks_deinterleave_0_0_0, 0))
        self.connect((self.nutaq_rtdex_source_S_S_0, 0),
                     (self.blocks_deinterleave_0_0_1, 0))
コード例 #57
0
ファイル: perseus_mimo.py プロジェクト: juanduncan/cognitive
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus MIMO")
        _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 = 40e6/2
        self.freq1 = freq1 = 500e3/40

        ##################################################
        # Blocks
        ##################################################
        _freq1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq1_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq1_sizer,
        	value=self.freq1,
        	callback=self.set_freq1,
        	label='freq1',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq1_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq1_sizer,
        	value=self.freq1,
        	callback=self.set_freq1,
        	minimum=-samp_rate/2/40,
        	maximum=samp_rate/2/40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq1_sizer)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,4)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(8192)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 2, 2)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-17)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(5)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(-4)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_0",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(600)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_0",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_default_value(int((2e6)/samp_rate*(2**32)))
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0d = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_carrier_perseus_0d.set_index(4)
        self.nutaq_carrier_perseus_0d.set_default_value(1)
        self.nutaq_carrier_perseus_0d.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.101")
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((0.125, ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate/40, analog.GR_COS_WAVE, freq1, 0.95, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_const_vxx_0_2, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_complex_to_float_0, 0))