def __init__(self, ber_block, ncorrelations, lfsr_bits = 16): gr.top_block.__init__(self) prn_len = 2**lfsr_bits prn = np.concatenate((scipy.signal.max_len_seq(lfsr_bits)[0], [1])) prn_fft_conj = np.conjugate(np.fft.fft(2*prn-1)) self.source = blocks.vector_source_b(prn, True, 1, []) self.ber_block = ber_block self.char2float = blocks.char_to_float(1, 0.5) self.add_const = blocks.add_const_ff(-1.0) self.source_vector = blocks.stream_to_vector(gr.sizeof_float, prn_len) self.fft = fft.fft_vfc(prn_len, True, window.rectangular(prn_len), 1) self.prn_fft_source = blocks.vector_source_c(prn_fft_conj, True, prn_len, []) self.multiply_ffts = blocks.multiply_vcc(prn_len) self.ifft = fft.fft_vcc(prn_len, False, np.ones(prn_len)/prn_len**2, False, 1) self.corr_mag = blocks.complex_to_mag(prn_len) self.max_corr = blocks.max_ff(prn_len, 1) self.multiply_const = blocks.multiply_const_ff(-0.5) self.add_const2 = blocks.add_const_ff(0.5) self.head = blocks.head(gr.sizeof_float, ncorrelations) self.sink = blocks.vector_sink_f() self.connect(self.source, self.ber_block, self.char2float, self.add_const, self.source_vector, self.fft, (self.multiply_ffts,0), self.ifft, self.corr_mag, self.max_corr, self.multiply_const, self.add_const2, self.head, self.sink) self.connect(self.prn_fft_source, (self.multiply_ffts,1))
def __init__(self, cf): gr.top_block.__init__(self, "FM radio FFT example") ################################################## # Blocks ################################################## self.fft_vxx_0 = fft.fft_vcc(2048, True, (window.rectangular(2048)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 2048) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*2048, "/home/pradeep/tutorial_btp/fm/out", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(2048) self.RTL820T = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.RTL820T.set_sample_rate(2.0E6) self.RTL820T.set_center_freq(cf, 0) self.RTL820T.set_freq_corr(00, 0) self.RTL820T.set_dc_offset_mode(0, 0) self.RTL820T.set_iq_balance_mode(0, 0) self.RTL820T.set_gain_mode(False, 0) self.RTL820T.set_gain(0, 0) self.RTL820T.set_if_gain(00000000000, 0) self.RTL820T.set_bb_gain(000000000000, 0) self.RTL820T.set_antenna("", 0) self.RTL820T.set_bandwidth(0, 0) ################################################## # Connections ################################################## self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.RTL820T, 0), (self.blocks_stream_to_vector_0, 0)) #self.connect((self.fft_vxx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_file_sink_0, 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.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=70, decimation=64, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "bladerf=0,buffers=128,buflen=32768" ) self.osmosdr_sink_0.set_sample_rate(10e6) self.osmosdr_sink_0.set_center_freq(800e6, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(19, 0) self.osmosdr_sink_0.set_if_gain(0, 0) self.osmosdr_sink_0.set_bb_gain(0, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 10) self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(1512, dvbt.T2k, 1) self.dvbt_reference_signals_0 = dvbt.reference_signals(gr.sizeof_gr_complex, 1512, 2048, dvbt.QAM16, dvbt.NH, dvbt.C1_2, dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0) self.dvbt_reed_solomon_enc_0 = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, 8) self.dvbt_inner_coder_0 = dvbt.inner_coder(1, 1512, dvbt.QAM16, dvbt.NH, dvbt.C1_2) self.dvbt_energy_dispersal_0 = dvbt.energy_dispersal(1) self.dvbt_dvbt_map_0 = dvbt.dvbt_map(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k, 1) self.dvbt_convolutional_interleaver_0 = dvbt.convolutional_interleaver(136, 12, 17) self.dvbt_bit_inner_interleaver_0 = dvbt.bit_inner_interleaver(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(2048, 2048+64, 0, "") self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "test.ts", True) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dvbt_energy_dispersal_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dvbt_bit_inner_interleaver_0, 0), (self.dvbt_symbol_inner_interleaver_0, 0)) self.connect((self.dvbt_convolutional_interleaver_0, 0), (self.dvbt_inner_coder_0, 0)) self.connect((self.dvbt_dvbt_map_0, 0), (self.dvbt_reference_signals_0, 0)) self.connect((self.dvbt_energy_dispersal_0, 0), (self.dvbt_reed_solomon_enc_0, 0)) self.connect((self.dvbt_inner_coder_0, 0), (self.dvbt_bit_inner_interleaver_0, 0)) self.connect((self.dvbt_reed_solomon_enc_0, 0), (self.dvbt_convolutional_interleaver_0, 0)) self.connect((self.dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0)) self.connect((self.dvbt_symbol_inner_interleaver_0, 0), (self.dvbt_dvbt_map_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0))
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))
def __init__(self, max_freq_offset=10, guard=0.125, mode=3, snr=10, tmcc_print=False): gr.hier_block2.__init__( # self, "ISDB-T RF Channel Decoding", self, "isdbt_rf_channel_decoding", gr.io_signature(1, 1, gr.sizeof_gr_complex * 1), gr.io_signaturev(2, 2, [ gr.sizeof_gr_complex * 13 * 96 * 2**(mode - 1), gr.sizeof_gr_complex * (13 * 108 * 2**(mode - 1) + 1) ]), ) ################################################## # Parameters ################################################## self.max_freq_offset = max_freq_offset self.guard = guard self.mode = mode self.snr = snr self.tmcc_print = tmcc_print ################################################## # Variables ################################################## self.total_carriers = total_carriers = 2**(10 + mode) self.data_carriers = data_carriers = 13 * 96 * 2**(mode - 1) self.active_carriers = active_carriers = 13 * 108 * 2**(mode - 1) + 1 ################################################## # Blocks ################################################## self.isdbt_tmcc_decoder_0 = isdbt.tmcc_decoder(mode, tmcc_print) self.isdbt_sync_and_channel_estimaton_0 = isdbt.sync_and_channel_estimaton( total_carriers, active_carriers, max_freq_offset) self.isdbt_ofdm_sym_acquisition_0 = isdbt.ofdm_sym_acquisition( total_carriers, int(guard * total_carriers), snr) self.fft_vxx_0 = fft.fft_vcc(total_carriers, True, (window.rectangular(total_carriers)), True, 1) ################################################## # Connections ################################################## self.connect((self.fft_vxx_0, 0), (self.isdbt_sync_and_channel_estimaton_0, 0)) self.connect((self.isdbt_ofdm_sym_acquisition_0, 0), (self.fft_vxx_0, 0)) self.connect((self.isdbt_sync_and_channel_estimaton_0, 0), (self.isdbt_tmcc_decoder_0, 0)) self.connect((self.isdbt_sync_and_channel_estimaton_0, 1), (self, 1)) self.connect((self.isdbt_tmcc_decoder_0, 0), (self, 0)) self.connect((self, 0), (self.isdbt_ofdm_sym_acquisition_0, 0))
def __init__(self, N=10, NFFT=2048, used_sc=1680, syms_filename="/tmp/qpsk_syms.bin"): gr.hier_block2.__init__( self, "Basic QPSK-OFDM Tx", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_gr_complex * NFFT), ) ################################################## # Parameters ################################################## self.N = N self.NFFT = NFFT self.used_sc = used_sc self.syms_filename = syms_filename ################################################## # Blocks ################################################## self.fft_vxx_0 = fft.fft_vcc(NFFT, False, (window.rectangular(NFFT)), False, 1) self.dpd_stream_to_zero_padded_vector_0 = dpd.stream_to_zero_padded_vector( self.used_sc, self.NFFT) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_ic( ((1 + 1j, 1 - 1j, -1 - 1j, -1 + 1j)), 1) self.analog_random_source_x_0 = blocks.vector_source_i( map(int, numpy.random.randint(0, 4, used_sc * N)), False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, syms_filename, False) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( ([1.0 / self.NFFT] * self.NFFT)) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.dpd_stream_to_zero_padded_vector_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.dpd_stream_to_zero_padded_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self, 0))
def __init__(self, config): gr.top_block.__init__(self, self.__class__.__name__) self._start_time = -1 self._end_time = 0 self._running = False self.source = RadioSource(preferred_sample_rate=config.sample_rate, gains=config.gains, frequency_offset=config.frequency_offset) self.fft = fft.fft_vfc(config.fft_resolution, True, (window.rectangular(config.fft_resolution)), 1) self.stream_to_vector = blocks.stream_to_vector( gr.sizeof_float * 1, config.fft_resolution) self.psd = blocks.multiply_vcc(config.fft_resolution) self.complex_to_real = blocks.complex_to_real(1) self.complex_to_mag = blocks.complex_to_mag(config.fft_resolution) self.bpf = filter.fir_filter_ccf( 1, firdes.band_pass( 100, config.sample_rate, self.source.frequency_offset - (config.signal_bandwidth / 2), self.source.frequency_offset + (config.signal_bandwidth / 2), 600, firdes.WIN_RECTANGULAR, 6.76)) self.processing = select_detection_method(config.detection_method)( num_bins=config.fft_resolution, center_frequency=0, signal_frequency=config.frequency_offset, signal_bandwidth=config.signal_bandwidth, threshold=config.snr_threshold, decay_time=config.decay_time, decay_strength=config.decay_strength) self.extract = AsyncSink() self.connect(self.source, self.bpf) self.connect(self.bpf, self.complex_to_real) self.connect(self.complex_to_real, self.stream_to_vector) self.connect(self.stream_to_vector, self.fft) self.connect((self.fft, 0), (self.psd, 1)) self.connect((self.fft, 0), (self.psd, 0)) self.connect(self.psd, self.complex_to_mag) self.connect(self.complex_to_mag, self.processing) self.connect(self.processing, self.extract) self.processing.set_sample_rate(config.sample_rate / config.fft_resolution)
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.samp_rate = samp_rate = 6* 8000000.0 / 7 ################################################## # Blocks ################################################## self.fft_vxx_0 = fft.fft_vcc(2048, True, (window.rectangular(2048)), True, 1) self.dvbt_viterbi_decoder_0 = dvbt.viterbi_decoder(dvbt.QPSK, dvbt.NH, dvbt.C1_2, 768, 0, -1) self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(1512, dvbt.T2k, 0) self.dvbt_reed_solomon_dec_0 = dvbt.reed_solomon_dec(2, 8, 0x11d, 255, 239, 8, 51, 8) self.dvbt_ofdm_sym_acquisition_0 = dvbt.ofdm_sym_acquisition(1, 2048, 1705, 64, 30) self.dvbt_energy_descramble_0 = dvbt.energy_descramble(8) self.dvbt_dvbt_demap_0 = dvbt.dvbt_demap(1512, dvbt.QPSK, dvbt.NH, dvbt.T2k, 1) self.dvbt_demod_reference_signals_0 = dvbt.demod_reference_signals(gr.sizeof_gr_complex, 2048, 1512, dvbt.QPSK, dvbt.NH, dvbt.C1_2, dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0) self.dvbt_convolutional_deinterleaver_0 = dvbt.convolutional_deinterleaver(136, 12, 17) self.dvbt_bit_inner_deinterleaver_0 = dvbt.bit_inner_deinterleaver(1512, dvbt.QPSK, dvbt.NH, dvbt.T2k) self.blocks_vector_to_stream_1 = blocks.vector_to_stream(gr.sizeof_char*1, 1512) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "testBB.bin", False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "test_out.ts", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.dvbt_ofdm_sym_acquisition_0, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.dvbt_viterbi_decoder_0, 0)) self.connect((self.dvbt_bit_inner_deinterleaver_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.dvbt_convolutional_deinterleaver_0, 0), (self.dvbt_reed_solomon_dec_0, 0)) self.connect((self.dvbt_demod_reference_signals_0, 0), (self.dvbt_dvbt_demap_0, 0)) self.connect((self.dvbt_dvbt_demap_0, 0), (self.dvbt_symbol_inner_interleaver_0, 0)) self.connect((self.dvbt_energy_descramble_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.dvbt_ofdm_sym_acquisition_0, 0), (self.fft_vxx_0, 0)) self.connect((self.dvbt_reed_solomon_dec_0, 0), (self.dvbt_energy_descramble_0, 0)) self.connect((self.dvbt_symbol_inner_interleaver_0, 0), (self.dvbt_bit_inner_deinterleaver_0, 0)) self.connect((self.dvbt_viterbi_decoder_0, 0), (self.dvbt_convolutional_deinterleaver_0, 0)) self.connect((self.fft_vxx_0, 0), (self.dvbt_demod_reference_signals_0, 0))
def __init__(self, args): gr.top_block.__init__(self, "Benchmark FFT", catch_exceptions=True) ################################################## # Variables ################################################## nsamples = args.samples fft_size = args.fftsize actual_samples = int(nsamples / fft_size) num_blocks = args.nblocks win = args.window if hasattr(args, 'window') and args.window else '' # Apply window equal to FFT Size fftwin = [] if win.lower() == 'blackmanharris': fftwin = window.blackman_harris(fft_size) elif win.lower().startswith('rect'): fftwin = window.rectangular(fft_size) elif win.lower() == 'hamming': fftwin = window.hamming(fft_size) ################################################## # Blocks ################################################## blks = [] for i in range(num_blocks): blks.append(fft.fft_vcc(fft_size, True, fftwin)) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex * fft_size) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * fft_size) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex * fft_size, actual_samples) ################################################## # Connections ################################################## self.connect((self.blocks_head_0, 0), (blks[0], 0)) self.connect((self.blocks_null_source_0, 0), (self.blocks_head_0, 0)) for i in range(1, num_blocks): self.connect((blks[i - 1], 0), (blks[i], 0)) self.connect((blks[num_blocks - 1], 0), (self.blocks_null_sink_0, 0))
def __init__(self): gr.hier_block2.__init__( self, "STS without CP", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_gr_complex*2048), ) ################################################## # Blocks ################################################## self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), False, 1) self.STS = blocks.vector_source_c((0+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j,-2+0j,0+0j,0+0j,0+0j), False, 2048, []) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc(([1.0/2048]*2048)) ################################################## # Connections ################################################## self.connect((self.STS, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self, 0))
def __init__(self, max_freq_offset=10, guard=0.125, mode=3, snr=10, tmcc_print=False): gr.hier_block2.__init__( # self, "ISDB-T RF Channel Decoding", self, "isdbt_rf_channel_decoding", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signaturev(2, 2, [gr.sizeof_gr_complex*13*96*2**(mode-1), gr.sizeof_gr_complex*(13*108*2**(mode-1)+1)]), ) ################################################## # Parameters ################################################## self.max_freq_offset = max_freq_offset self.guard = guard self.mode = mode self.snr = snr self.tmcc_print = tmcc_print ################################################## # Variables ################################################## self.total_carriers = total_carriers = 2**(10+mode) self.data_carriers = data_carriers = 13*96*2**(mode-1) self.active_carriers = active_carriers = 13*108*2**(mode-1)+1 ################################################## # Blocks ################################################## self.isdbt_tmcc_decoder_0 = isdbt.tmcc_decoder(mode, tmcc_print) self.isdbt_sync_and_channel_estimaton_0 = isdbt.sync_and_channel_estimaton(total_carriers, active_carriers, max_freq_offset) self.isdbt_ofdm_sym_acquisition_0 = isdbt.ofdm_sym_acquisition(total_carriers, int(guard*total_carriers), snr) self.fft_vxx_0 = fft.fft_vcc(total_carriers, True, (window.rectangular(total_carriers)), True, 1) ################################################## # Connections ################################################## self.connect((self.fft_vxx_0, 0), (self.isdbt_sync_and_channel_estimaton_0, 0)) self.connect((self.isdbt_ofdm_sym_acquisition_0, 0), (self.fft_vxx_0, 0)) self.connect((self.isdbt_sync_and_channel_estimaton_0, 0), (self.isdbt_tmcc_decoder_0, 0)) self.connect((self.isdbt_sync_and_channel_estimaton_0, 1), (self, 1)) self.connect((self.isdbt_tmcc_decoder_0, 0), (self, 0)) self.connect((self, 0), (self.isdbt_ofdm_sym_acquisition_0, 0))
def __init__(self, vlen=64): gr.hier_block2.__init__( self, "Input Layer", gr.io_signature(1, 1, gr.sizeof_gr_complex * vlen), gr.io_signature(1, 1, gr.sizeof_float * vlen), ) # Blocks fft = fft.fft_vcc(vlen, True, (window.rectangular(vlen)), True, 8) log = blocks.nlog10_ff(20, vlen, 0) mag = blocks.complex_to_mag(vlen) mult = blocks.multiply_const_vcc(([ 1. / float(vlen), ] * vlen)) # Connections self.connect(self, mult) self.connect(mult, fft) self.connect(fft, mag) self.connect(mag, log) self.connect(log, self)
def __init__(self): gr.top_block.__init__(self, "Decompress Fft") ################################################## # Variables ################################################## self.sample_rate = sample_rate = 10e6 self.fft_bins = fft_bins = 400 ################################################## # Blocks ################################################## self.rfsniffer_stream_overlap_to_stream_cc_0 = rfsniffer.stream_overlap_to_stream_cc( fft_bins, 200) self.fft_vxx_0 = fft.fft_vcc(fft_bins, False, (window.rectangular(fft_bins)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, fft_bins) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fft_bins) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/tmp/decompress_fft.iq", False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, "/tmp/decompress.iq", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_stream_to_vector_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.rfsniffer_stream_overlap_to_stream_cc_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.rfsniffer_stream_overlap_to_stream_cc_0, 0), (self.blocks_file_sink_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx") ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 2.412e9 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6, 10e6, 20e6], labels=["5 MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='gain', converter=forms.int_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_gain_sizer) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[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], labels=[' 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.Add(self._freq_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation") self.Add(self.nb) self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False) 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, False) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, 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, False) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm.pcap", True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in')) 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_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_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_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) 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_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.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def main(args): d = 'Transmit a DVB-T signal using the bladeRF and gr-dtv' parser = argparse.ArgumentParser() mode_help = '# of carriers. Options: t2k, t8k (default).' parser.add_argument('-m', '--mode', dest='mode', default='t8k', type=str, help=mode_help) ch_help = 'channel width in MHz. Options: 5, 6, 7, 8 (default).' parser.add_argument('-c', '--channel', dest='channel', default=8, metavar='CH', type=int, help=ch_help) const_help = 'constellation. qpsk, qam16, qam64 (default).' parser.add_argument('-C', '--cons', dest='cons', default='qam64', metavar='TYPE', type=str, help=const_help) rate_help = 'Viterbi rate. 1/2, 2/3, 3/4, 5/6, 7/8 (default).' parser.add_argument('-r', '--rate', dest='rate', default='7/8', type=str, help=rate_help) guard_help = 'guard interval. 1/32 (default), 1/16, 1/8, 1/4.' parser.add_argument('-g', '--guard', dest='interval', default='1/32', metavar='D', type=str, help=guard_help) freq_help = 'center frequency (Hz). Default is 429e6.' parser.add_argument('-f', '--freq', dest='freq', default=429e6, type=float, help=freq_help) vga1_help = 'bladeRF TXVGA1 gain. Default is -6.' parser.add_argument('--txvga1', dest='txvga1', default=-6, metavar='gain', type=int, help=vga1_help) vga2_help = 'bladeRF TXVGA2 gain. Default is 9.' parser.add_argument('--txvga2', dest='txvga2', default=9, metavar='gain', type=int, help=vga2_help) outfile_help = 'write to specified file.' parser.add_argument('-o', '--output', dest='outfile', default=None, metavar='OUT', type=str, help=outfile_help) parser.add_argument('infile', metavar='input-file', type=str, help='Input file') args = parser.parse_args() print args if args.mode.lower() == 't2k': mode = dtv.T2k elif args.mode.lower() == 't8k': mode = dtv.T8k else: sys.stderr.write('Invalid mode provided: ' + args.mode + '\n') sys.exit(1) if args.channel < 5 or args.channel > 8: sys.stderr.write('Invalid channel: ' + str(args.channel) + '\n') sys.exit(1) else: channel_mhz = args.channel if args.cons.lower() == 'qpsk': constellation = dtv.MOD_QPSK elif args.cons.lower() == 'qam16': constellation = dtv.MOD_16QAM elif args.cons.lower() == 'qam64': constellation = dtv.MOD_64QAM else: sys.stderr.write('Invalid constellation type: ' + args.cons + '\n') sys.exit(1) if args.rate == '1/2': code_rate = dtv.C1_2 elif args.rate == '2/3': code_rate = dtv.C2_3 elif args.rate == '3/4': code_rate = dtv.C3_4 elif args.rate == '5/6': code_rate = dtv.C5_6 elif args.rate == '7/8': code_rate = dtv.C7_8 else: sys.stderr.write('Invalid Viterbi rate: ' + args.rate + '\n') sys.exit(1) if args.interval == '1/32': guard_interval = dtv.GI_1_32 elif args.interval == '1/16': guard_interval = dtv.GI_1_16 elif args.interval == '1/8': guard_interval = dtv.GI_1_8 elif args.interval == '1/4': guard_interval = dtv.GI_1_4 else: sys.stderr.write('Invalid guard interval: ' + args.interval + '\n') sys.exit(1) if args.freq < 300e6 or args.freq > 3.8e9: sys.stderr.write('Invalid center frequency: ' + str(args.freq) + '\n') sys.exit(1) else: center_freq = int(args.freq) if args.txvga1 < -35 or args.txvga1 > -4: sys.stderr.write('Invalid bladeRF TXVGA1 gain: ' + str(args.txvga1) + '\n') sys.exit(1) else: txvga1_gain = args.txvga1 if args.txvga2 < 0 or args.txvga2 > 25: sys.stderr.write('Invalid bladeRF TXVGA2 gain: ' + str(args.txvga2) + '\n') sys.exit(1) else: txvga2_gain = args.txvga2 infile = args.infile outfile = args.outfile symbol_rate = channel_mhz * 8000000.0 / 7 if mode == dtv.T2k: factor = 1 carriers = 2048 elif mode == dtv.T8k: factor = 4 carriers = 8192 if guard_interval == dtv.GI_1_32: gi = carriers / 32 elif guard_interval == dtv.GI_1_16: gi = carriers / 16 elif guard_interval == dtv.GI_1_8: gi = carriers / 8 elif guard_interval == dtv.GI_1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dtv_dvbt_energy_dispersal = dtv.dvbt_energy_dispersal(1 * factor) dtv_dvbt_reed_solomon_enc = dtv.dvbt_reed_solomon_enc( 2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dtv_dvbt_convolutional_interleaver = dtv.dvbt_convolutional_interleaver( (136 * factor), 12, 17) dtv_dvbt_inner_coder = dtv.dvbt_inner_coder(1, (1512 * factor), constellation, dtv.NH, code_rate) dtv_dvbt_bit_inner_interleaver = dtv.dvbt_bit_inner_interleaver( (1512 * factor), constellation, dtv.NH, mode) dtv_dvbt_symbol_inner_interleaver = dtv.dvbt_symbol_inner_interleaver( (1512 * factor), mode, 1) dtv_dvbt_map = dtv.dvbt_map((1512 * factor), constellation, dtv.NH, mode, 1) dtv_dvbt_reference_signals = dtv.dvbt_reference_signals( gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dtv.NH, code_rate, code_rate, guard_interval, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer( carriers, carriers + (gi), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, )) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dtv_dvbt_energy_dispersal) tb.connect(dtv_dvbt_energy_dispersal, dtv_dvbt_reed_solomon_enc) tb.connect(dtv_dvbt_reed_solomon_enc, dtv_dvbt_convolutional_interleaver) tb.connect(dtv_dvbt_convolutional_interleaver, dtv_dvbt_inner_coder) tb.connect(dtv_dvbt_inner_coder, dtv_dvbt_bit_inner_interleaver) tb.connect(dtv_dvbt_bit_inner_interleaver, dtv_dvbt_symbol_inner_interleaver) tb.connect(dtv_dvbt_symbol_inner_interleaver, dtv_dvbt_map) tb.connect(dtv_dvbt_map, dtv_dvbt_reference_signals) tb.connect(dtv_dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbt-blade.py input_file [output_file]\n"); sys.exit(1) channel_mhz = 6 mode = dvbt.T2k code_rate = dvbt.C1_2 constellation = dvbt.QPSK symbol_rate = channel_mhz * 8000000.0 / 7 center_freq = 441000000 txvga1_gain = -4 txvga2_gain = 25 if mode == dvbt.T2k: factor = 1 carriers = 2048 elif mode == dvbt.T8k: factor = 4 carriers = 8192 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17) dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate) dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode) dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1) dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1) dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(64 * factor), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, )) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map) tb.connect(dvbt_dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbt-hackrf.py infile [output_file]\n") sys.exit(1) ## Config Options config = DVBTConfig('dvbt.conf') # DVB-T Parameters channel_mhz = config.get_channel_mhz() mode = config.get_mode() code_rate = config.get_code_rate() constellation = config.get_constellation() guard_interval = config.get_guard_interval() # Hack-RF Parameters center_freq = config.get_center_freq() rf_gain = config.get_hackrf_rf_gain() if_gain = config.get_hackrf_if_gain() bb_gain = config.get_hackrf_bb_gain() ## samp_rate = 10000000.0 if mode == dvbt.T2k: factor = 1 carriers = 2048 elif mode == dvbt.T8k: factor = 4 carriers = 8192 if guard_interval == dvbt.G1_32: gi = carriers / 32 elif guard_interval == dvbt.G1_16: gi = carriers / 16 elif guard_interval == dvbt.G1_8: gi = carriers / 8 elif guard_interval == dvbt.G1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 log = gr.logger("dvbt-hackrf") log.set_level("DEBUG") log.debug("logger initilized") tb = gr.top_block() log.debug("top block initialized") src = blocks.file_source(gr.sizeof_char, infile, True) log.debug("source block initialized") dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dvbt.convolutional_interleaver( (136 * factor), 12, 17) dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate) dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver( (1512 * factor), constellation, dvbt.NH, mode) dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver( (1512 * factor), mode, 1) dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1) dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer( carriers, carriers + (gi), 0, "") rational_resampler_xxx = filter.rational_resampler_ccc(interpolation=70, decimation=64, taps=None, fractional_bw=None) blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, )) log.debug("DVB-T blocks initialized") out = osmosdr.sink(args="numchan=1") out.set_sample_rate(samp_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(rf_gain, 0) out.set_if_gain(if_gain, 0) out.set_bb_gain(bb_gain, 0) out.set_antenna("", 0) out.set_bandwidth(0, 0) log.debug("Output block initialized") tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map) tb.connect(dvbt_dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, rational_resampler_xxx) tb.connect(rational_resampler_xxx, out) log.debug("all blocks connected") if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) log.debug("running gnuradio") tb.run()
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Jun28") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx Jun28") 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_jun28") 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.5e6 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.5e6, 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_2 = qtgui.time_sink_f( 32, #size 10, #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("Amplitude", "") 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_0_0_0_0 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #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(-2, 2) 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_TAG, qtgui.TRIG_SLOPE_POS, 0.02, 0.1, 0, "ofdm_start") 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 = [ "samples", "corr", "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_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, threshold, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0.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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_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_freq_sink_x_0 = qtgui.freq_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ofdm_80211_ftc_0 = ofdm_80211.ftc() self.nutaq_rtdex_source_0 = nutaq.rtdex_source( "nutaq_carrier_perseus_0", gr.sizeof_float, 1, 3) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("2") 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(743e6) 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(0) self.nutaq_radio420_tx_0_0.set_default_tx_freq(743e6) 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(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(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(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(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.101") 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, False) 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, False) 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_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.float_t, "packet_len") self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) ################################################## # Connections ################################################## 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_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) 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.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_0_0_0_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.ofdm_80211_ftc_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.qtgui_freq_sink_x_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, 3), (self.qtgui_time_sink_x_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp", catch_exceptions=True) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", '')), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), '', ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec(0)) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=[], fractional_bw=-1.0) 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.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, window.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) 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.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_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_add_xx_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, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_add_xx_0, 1)) 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_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbt-hackrf.py infile [output_file]\n"); sys.exit(1) ## Config Options config = DVBTConfig('dvbt.conf') # DVB-T Parameters channel_mhz = config.get_channel_mhz() mode = config.get_mode() code_rate = config.get_code_rate() constellation = config.get_constellation() guard_interval = config.get_guard_interval() # Hack-RF Parameters center_freq = config.get_center_freq() rf_gain = config.get_hackrf_rf_gain() if_gain = config.get_hackrf_if_gain() bb_gain = config.get_hackrf_bb_gain() ## samp_rate = 10000000.0 if mode == dvbt.T2k: factor = 1 carriers = 2048 elif mode == dvbt.T8k: factor = 4 carriers = 8192 if guard_interval == dvbt.G1_32: gi = carriers / 32 elif guard_interval == dvbt.G1_16: gi = carriers / 16 elif guard_interval == dvbt.G1_8: gi = carriers / 8 elif guard_interval == dvbt.G1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 log=gr.logger("dvbt-hackrf") log.set_level("DEBUG"); log.debug("logger initilized") tb = gr.top_block() log.debug("top block initialized") src = blocks.file_source(gr.sizeof_char, infile, True) log.debug("source block initialized") dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17) dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate) dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode) dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1) dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1) dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "") rational_resampler_xxx = filter.rational_resampler_ccc(interpolation=70, decimation=64, taps=None, fractional_bw=None) blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, )) log.debug("DVB-T blocks initialized") out = osmosdr.sink(args="numchan=1") out.set_sample_rate(samp_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(rf_gain, 0) out.set_if_gain(if_gain, 0) out.set_bb_gain(bb_gain, 0) out.set_antenna("", 0) out.set_bandwidth(0, 0) log.debug("Output block initialized") tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map) tb.connect(dvbt_dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, rational_resampler_xxx) tb.connect(rational_resampler_xxx, out) log.debug("all blocks connected") if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) log.debug("running gnuradio") tb.run()
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))
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))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="DVBT Scanner") ################################################## # Variables ################################################## self.threshold = threshold = -60 self.signal_level = signal_level = 0 self.samp_rate = samp_rate = 2048000 self.freq = freq = 525200000 self.fft_size = fft_size = 1024 self.detected = detected = 0 ################################################## # Blocks ################################################## _threshold_sizer = wx.BoxSizer(wx.VERTICAL) self._threshold_text_box = forms.text_box( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, label="Threshold", converter=forms.float_converter(), proportion=0, ) self._threshold_slider = forms.slider( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, minimum=-100, maximum=0, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_threshold_sizer, 2, 0, 1, 1) self.probe_signal_lvl = blocks.probe_signal_f() self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spektrum") self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output") self.GridAdd(self.notebook, 0, 0, 1, 1) _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="Frequency", converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=478000000, maximum=862000000, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_freq_sizer, 1, 0, 1, 1) self.wxgui_numbersink2_1 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="Signal present", minval=0, maxval=1, factor=1.0, decimal_places=0, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=None, label="Signal Detection", peak_hold=False, show_gauge=True, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="dB", minval=-120, maxval=0, factor=1.0, decimal_places=1, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=0.03, label="Level", peak_hold=False, show_gauge=True, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.notebook.GetPage(0).GetWin(), baseband_freq=freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=fft_size, fft_rate=15, average=True, avg_alpha=0.03, title="FFT Plot", peak_hold=False, win=window.flattop, ) self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win) def _signal_level_probe(): while True: val = self.probe_signal_lvl.level() try: self.set_signal_level(val) except AttributeError: pass time.sleep(1.0 / (5)) _signal_level_thread = threading.Thread(target=_signal_level_probe) _signal_level_thread.daemon = True _signal_level_thread.start() self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "hackrf=0" ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(14, 0) self.rtlsdr_source_0.set_if_gain(24, 0) self.rtlsdr_source_0.set_bb_gain(12, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.probe_detected = blocks.probe_signal_f() self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.rectangular(fft_size)), True, 1) def _detected_probe(): while True: val = self.probe_detected.level() try: self.set_detected(val) except AttributeError: pass time.sleep(1.0 / (5)) _detected_thread = threading.Thread(target=_detected_probe) _detected_thread.daemon = True _detected_thread.start() self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_size) self.blocks_threshold_ff_0 = blocks.threshold_ff(threshold, threshold, threshold) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(1000, 0.001, 4000) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_size) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1048580) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.probe_signal_lvl, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.probe_detected, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def main(args): nargs = len(args) if nargs == 1: port = int(args[0]) outfile = None elif nargs == 2: port = int(args[0]) outfile = args[1] else: sys.stderr.write("Usage: dvbt-blade.py port [output_file]\n"); sys.exit(1) channel_mhz = 6 mode = dvbt.T2k code_rate = dvbt.C1_2 constellation = dvbt.QPSK guard_interval = dvbt.G1_32 symbol_rate = channel_mhz * 8000000.0 / 7 center_freq = 441000000 tx_gain = 83 # max 89.5 if mode == dvbt.T2k: factor = 1 carriers = 2048 elif mode == dvbt.T8k: factor = 4 carriers = 8192 if guard_interval == dvbt.G1_32: gi = carriers / 32 elif guard_interval == dvbt.G1_16: gi = carriers / 16 elif guard_interval == dvbt.G1_8: gi = carriers / 8 elif guard_interval == dvbt.G1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() out = uhd.usrp_sink( device_addr="recv_frame_size=65536,num_recv_frames=128,send_frame_size=65536,num_send_frames=128,master_clock_rate=" + str(symbol_rate*4), stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) out.set_samp_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_gain(tx_gain, 0) #src = blocks.udp_source(gr.sizeof_char*1, "127.0.0.1", port, 18800, True) src = grc_blks2.tcp_source(gr.sizeof_char*1, "127.0.0.1", port, True) dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17) dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate) dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode) dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1) dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1) dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, )) tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map) tb.connect(dvbt_dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
def __init__(self): gr.top_block.__init__(self, "Dvbt Tx Demo") Qt.QWidget.__init__(self) self.setWindowTitle("Dvbt Tx Demo") 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", "dvbt_tx_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = (8000000.0 * 8) / 7 ################################################## # Blocks ################################################## self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 1269000000, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1.set_update_time(0.10) self.qtgui_waterfall_sink_x_1.enable_grid(False) if not True: self.qtgui_waterfall_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_1.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_1_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 1269000000, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label("Relative Gain", "dB") self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(1269000000, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(14, 0) self.osmosdr_sink_0.set_if_gain(30, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 1) self.dtv_dvbt_symbol_inner_interleaver_0 = dtv.dvbt_symbol_inner_interleaver(1512, dtv.T2k, 1) self.dtv_dvbt_reference_signals_0 = dtv.dvbt_reference_signals(gr.sizeof_gr_complex, 1512, 2048, dtv.MOD_64QAM, dtv.NH, dtv.C2_3, dtv.C2_3, dtv.GI_1_32, dtv.T2k, 1, 0) self.dtv_dvbt_reed_solomon_enc_0 = dtv.dvbt_reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, 8) self.dtv_dvbt_map_0 = dtv.dvbt_map(1512, dtv.MOD_64QAM, dtv.NH, dtv.T2k, 1) self.dtv_dvbt_inner_coder_0 = dtv.dvbt_inner_coder(1, 1512, dtv.MOD_64QAM, dtv.NH, dtv.C2_3) self.dtv_dvbt_energy_dispersal_0 = dtv.dvbt_energy_dispersal(1) self.dtv_dvbt_convolutional_interleaver_0 = dtv.dvbt_convolutional_interleaver(136, 12, 17) self.dtv_dvbt_bit_inner_interleaver_0 = dtv.dvbt_bit_inner_interleaver(1512, dtv.MOD_64QAM, dtv.NH, dtv.T2k) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(2048, 2048+64, 0, "") self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/Volumes/work/satellite_ground_emulator/DVB_S2/run/shm/adv16apsk910.ts", True) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dtv_dvbt_energy_dispersal_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_waterfall_sink_x_1, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dtv_dvbt_bit_inner_interleaver_0, 0), (self.dtv_dvbt_symbol_inner_interleaver_0, 0)) self.connect((self.dtv_dvbt_convolutional_interleaver_0, 0), (self.dtv_dvbt_inner_coder_0, 0)) self.connect((self.dtv_dvbt_energy_dispersal_0, 0), (self.dtv_dvbt_reed_solomon_enc_0, 0)) self.connect((self.dtv_dvbt_inner_coder_0, 0), (self.dtv_dvbt_bit_inner_interleaver_0, 0)) self.connect((self.dtv_dvbt_map_0, 0), (self.dtv_dvbt_reference_signals_0, 0)) self.connect((self.dtv_dvbt_reed_solomon_enc_0, 0), (self.dtv_dvbt_convolutional_interleaver_0, 0)) self.connect((self.dtv_dvbt_reference_signals_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.dtv_dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0)) self.connect((self.dtv_dvbt_symbol_inner_interleaver_0, 0), (self.dtv_dvbt_map_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Output Window") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.threshold = threshold = -55 self.samp_rate = samp_rate = 2.048e6 self.freq = freq = 658e6 self.fft_size = fft_size = 1.024e3 ################################################## # Blocks ################################################## self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spectrum") self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output") self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Stream") self.Add(self.notebook) _threshold_sizer = wx.BoxSizer(wx.VERTICAL) self._threshold_text_box = forms.text_box( parent=self.notebook.GetPage(1).GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, label="Threshold", converter=forms.float_converter(), proportion=0, ) self._threshold_slider = forms.slider( parent=self.notebook.GetPage(1).GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, minimum=-100, maximum=0, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.notebook.GetPage(1).Add(_threshold_sizer) _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.notebook.GetPage(0).GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="freq", converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.notebook.GetPage(0).GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=10e6, maximum=10e9, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.notebook.GetPage(0).Add(_freq_sizer) self.wxgui_numbersink2_1 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="signal present", minval=0, maxval=1, factor=1, decimal_places=0, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=None, label="Signal Detection", peak_hold=False, show_gauge=True, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="dB", minval=-120, maxval=0, factor=1.0, decimal_places=10, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=30e-3, label="level", peak_hold=False, show_gauge=False, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.notebook.GetPage(0).GetWin(), baseband_freq=freq, y_per_div=5, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=True, avg_alpha=30e-3, title="Spectrum", peak_hold=False, win=window.rectangular, ) self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(20, 0) self.rtlsdr_source_0.set_if_gain(10, 0) self.rtlsdr_source_0.set_bb_gain(5, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.fft_1 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, 1024) self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, 0) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/media/shashwat/DATA/Q3/Wireless Networking/gnu codes/Outputs/db_498", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1024) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_1, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.fft_1, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") 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.vec_length = vec_length = 65536 self.sinc_sample_locations = sinc_sample_locations = np.arange(-np.pi*4/2.0, np.pi*4/2.0, np.pi/vec_length) self.timenow = timenow = datetime.now().strftime("%Y-%m-%d_%H.%M.%S") self.sinc = sinc = np.sinc(sinc_sample_locations/np.pi) self.prefix = prefix = "/Users/kbandura/grc_data/" self.samp_rate = samp_rate = 2.4e6 self.recfile = recfile = prefix + timenow + ".h5" self.integration_time = integration_time = 2 self.freq = freq = 1420.5e6 self.display_integration = display_integration = 0.5 self.custom_window = custom_window = sinc*np.hamming(4*vec_length) ################################################## # Blocks ################################################## self.radio_astro_hdf5_sink_1 = radio_astro.hdf5_sink(vec_length, recfile, 'testing', freq - samp_rate/2, samp_rate/vec_length, 'testing') self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f( vec_length, freq - samp_rate/2, samp_rate/vec_length, "Frequency", "PSD", "Spectrum", 1 # Number of inputs ) self.qtgui_vector_sink_f_0.set_update_time(0.10) self.qtgui_vector_sink_f_0.set_y_axis(0, 3000) self.qtgui_vector_sink_f_0.enable_autoscale(True) self.qtgui_vector_sink_f_0.enable_grid(True) self.qtgui_vector_sink_f_0.set_x_axis_units("Hz") self.qtgui_vector_sink_f_0.set_y_axis_units("arb") self.qtgui_vector_sink_f_0.set_ref_level(0) 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_vector_sink_f_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_vector_sink_f_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( vec_length, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(False) self.qtgui_time_sink_x_0.enable_control_panel(True) 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fft_vxx_0 = fft.fft_vcc(vec_length, True, (window.rectangular(vec_length)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, vec_length) self.blocks_stream_to_vector_0_2 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_length) self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_length) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_length) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_length) self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(10, vec_length, 0) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((custom_window[-vec_length:])) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc((custom_window[2*vec_length:3*vec_length])) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((custom_window[vec_length:2*vec_length])) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((custom_window[0:vec_length])) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(vec_length) self.blocks_integrate_xx_0_0 = blocks.integrate_ff(int(display_integration*samp_rate/vec_length), vec_length) self.blocks_integrate_xx_0 = blocks.integrate_ff(int((integration_time)*samp_rate/vec_length)/int(display_integration*samp_rate/vec_length), vec_length) self.blocks_delay_0_0_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 3*vec_length) self.blocks_delay_0_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 2*vec_length) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, vec_length) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(vec_length) self.blocks_add_xx_0 = blocks.add_vcc(vec_length) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(analog.GR_GAUSSIAN, 1, 0, 8192) ################################################## # Connections ################################################## self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_delay_0_0_0, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_delay_0_0_0_0, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_integrate_xx_0_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.blocks_delay_0_0_0, 0), (self.blocks_stream_to_vector_0_2, 0)) self.connect((self.blocks_delay_0_0_0_0, 0), (self.blocks_stream_to_vector_0_1, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.radio_astro_hdf5_sink_1, 0)) self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_nlog10_ff_0_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 3)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.qtgui_vector_sink_f_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_multiply_const_vxx_0_2, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_2, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
def __init__(self, fftsize, samp_rate, gain, c_freq, windows): gr.top_block.__init__(self, "CalculateFFT") #Class variables self.samp_rate = samp_rate self.gain = gain self.fftsize = fftsize self.c_freq = c_freq self.dump1 = "/tmp/ramdisk/dump1" #View as null sinks self.dump2 = "/tmp/ramdisk/dump2" self.alpha = 0.01 #Integrate 100 FFTS 0.01 self.N = 100 #100 self.probe_var = probe_var = 0 blackman_harris = window.blackmanharris(self.fftsize) hanning = window.hanning(self.fftsize) rectangular = window.rectangular(self.fftsize) self.window = blackman_harris #Default window self.select_window = windows ###Selectable FFT Windows### if self.select_window == "blackman-harris": self.window = blackman_harris elif self.select_window == "hanning": self.window = hanning elif self.select_window == "rectangular": self.window = rectangular ########## GNURADIO BLOCKS ######### #################################### self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "master_clock_rate=120e6")), #Set the master_clock_rate, default = 200 MHz, alt 184.32 MHz and 120 MHz (Set) uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) #Configure USRP channel 0 self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) self.uhd_usrp_source_0.set_center_freq(self.c_freq, 0) self.uhd_usrp_source_0.set_gain(self.gain, 0) self.uhd_usrp_source_0.set_bandwidth(self.samp_rate, 0) self.uhd_usrp_source_0.set_clock_source('internal', 0) #Signal and reference file sinks self.signal_file_sink_1 = blocks.file_sink(gr.sizeof_float*1, self.dump1, False) self.signal_file_sink_1.set_unbuffered(False) self.signal_file_sink_2 = blocks.file_sink(gr.sizeof_float*1, self.dump2, False) self.signal_file_sink_2.set_unbuffered(False) #Selector for GPIO switch self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=1, num_outputs=2+1, #+1 for the null sink input_index=0, output_index=0, ) self.blocks_null_sink = blocks.null_sink(gr.sizeof_float*1) self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(self.alpha, self.fftsize) self.fft_vxx_0 = fft.fft_vcc(self.fftsize, True, (self.window), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, self.fftsize) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, self.fftsize) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*self.fftsize, self.N) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(self.fftsize) #Block connections self.connect((self.uhd_usrp_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.single_pole_iir_filter_xx_0, 0)) self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blks2_selector_0, 0)) #Selector connections self.connect((self.blks2_selector_0, 1), (self.signal_file_sink_1, 0)) self.connect((self.blks2_selector_0, 2), (self.signal_file_sink_2, 0)) #Null sink connection self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink, 0)) #PROBE SAMPLES self.probe_signal = blocks.probe_signal_f() self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.connect((self.blocks_complex_to_mag_0, 0), (self.probe_signal, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_0, 0)) #Probe update rate def _probe_var_probe(): while True: val = self.probe_signal.level() try: self.set_probe_var(val) except AttributeError: pass time.sleep(10 / (self.samp_rate)) #Update probe variabel every 10/samp_rate seconds _probe_var_thread = threading.Thread(target=_probe_var_probe) _probe_var_thread.daemon = True _probe_var_thread.start()
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))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx Only Power") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.lo_offset = lo_offset = 11e6 self.gain = gain = 20 self.freq = freq = 5.805e9 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6, 10e6, 20e6], labels=["5 MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "FFT") self.Add(self.nb) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='gain', converter=forms.int_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_gain_sizer) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[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], labels=[' 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.Add(self._freq_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.nb.GetPage(1).GetWin(), title="Scope Plot", sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win) self.wxgui_scopesink1 = scopesink2.scope_sink_c( self.nb.GetPage(0).GetWin(), title="Scope Plot", sample_rate=12500, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(0).Add(self.wxgui_scopesink1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="%", minval=0, maxval=100, factor=1.0, decimal_places=2, ref_level=0, sample_rate=1, number_rate=15, average=True, avg_alpha=0.02, label="Frame Error Rate", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.nb.GetPage(2).GetWin(), baseband_freq=580.5*10e6, y_per_div=10, y_divs=10, ref_level=gain, ref_scale=2.0, sample_rate=samp_rate, fft_size=64, fft_rate=15, average=True, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.nb.GetPage(2).Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, True, 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(chan_est, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(True, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(True, True) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_vector_to_stream_1 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 64) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/furonics/GNURadio/25Feb2016DataTransfer.dat", False) self.blocks_file_sink_1.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/furonics/GNURadio/11thFeb2016_AtHome.pcap", False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, '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_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) 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_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_divide_xx_0, 0), (self.wxgui_scopesink2_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.wxgui_numbersink2_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.wxgui_scopesink1, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.blocks_file_sink_1, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) 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.blocks_vector_to_stream_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.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self, bandwidth=10e6, chan_est=ieee802_11.LS, encoding=ieee802_11.BPSK_1_2, frequency=5.89e9, sensitivity=0.56): gr.hier_block2.__init__( self, "WiFi PHY Hier", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) self.message_port_register_hier_in("mac_in") self.message_port_register_hier_out("carrier") self.message_port_register_hier_out("mac_out") ################################################## # Parameters ################################################## self.bandwidth = bandwidth self.chan_est = chan_est self.encoding = encoding self.frequency = frequency self.sensitivity = sensitivity ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.max_symbols = max_symbols = 5 + 1 + ((16 + 1540 * 8 + 6) * 2) / 24 self.header_formatter = header_formatter = ieee802_11.signal_field() ################################################## # Blocks ################################################## self.sync_short = ieee802_11.sync_short(sensitivity, 2, False, False) self.sync_long = ieee802_11.sync_long(sync_length, False, False) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_cc(window_size) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_mapper_0 = ieee802_11.mapper(encoding, False) self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer(chan_est, frequency, bandwidth, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(False, False) 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(397056) self.fft_vxx_0_1 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) 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(397056) 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(397056) 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(397056) 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(397056) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self, 'mac_out')) self.msg_connect((self.ieee802_11_frame_equalizer_0, 'symbols'), (self, 'carrier')) self.msg_connect((self, 'mac_in'), (self.ieee802_11_mapper_0, 'in')) 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_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.sync_long, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.sync_short, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.sync_short, 2)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0_1, 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, 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, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0)) self.connect((self.fft_vxx_0_1, 0), (self.ieee802_11_frame_equalizer_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_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) self.connect((self.ieee802_11_mapper_0, 0), (self.digital_packet_headergenerator_bb_0, 0)) self.connect((self.ieee802_11_mapper_0, 0), (self.ieee802_11_chunks_to_symbols_xx_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.sync_short, 1)) self.connect((self, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self, 0), (self.blocks_delay_0_0, 0)) self.connect((self, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.sync_long, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.sync_short, 0), (self.blocks_delay_0, 0)) self.connect((self.sync_short, 0), (self.sync_long, 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.freq_0 = freq_0 = 525.2e6 self.threshold = threshold = -60 self.samp_rate = samp_rate = 2.048e6 self.freq = freq = freq_0 ################################################## # Blocks ################################################## _threshold_sizer = wx.BoxSizer(wx.VERTICAL) self._threshold_text_box = forms.text_box( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, label="threshold", converter=forms.float_converter(), proportion=0, ) self._threshold_slider = forms.slider( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, minimum=-100, maximum=0, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_threshold_sizer) self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f( self.GetWin(), unit="signal present", minval=0, maxval=1, factor=1.0, decimal_places=10, ref_level=0, sample_rate=2.048e6, number_rate=15, average=False, avg_alpha=None, label="Signal detection", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0_0.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="Units", minval=-120, maxval=0, factor=1.0, decimal_places=10, ref_level=0, sample_rate=2048000, number_rate=15, average=True, avg_alpha=0.03, label="Level", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=2048000, fft_size=1024, fft_rate=15, average=True, avg_alpha=0.030, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtlsdr_source_0.set_sample_rate(2.048e6) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(75, 0) self.rtlsdr_source_0.set_if_gain(75, 0) self.rtlsdr_source_0.set_bb_gain(5, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1") self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2") self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3") self.Add(self.notebook_0) _freq_0_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_0_sizer, value=self.freq_0, callback=self.set_freq_0, label='freq_0', converter=forms.float_converter(), proportion=0, ) self._freq_0_slider = forms.slider( parent=self.GetWin(), sizer=_freq_0_sizer, value=self.freq_0, callback=self.set_freq_0, minimum=478e6, maximum=862e6, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_0_sizer) self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, 1024) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 2048000,True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, -60) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_int*1, "/media/ubuntu/01D165566F075780/Q3/wireless networking/GNU/out1.txt", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1024) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self, alpha=0.15, antenna="TX/RX", beta=0.3, dump_filename="<<stdout>>", equalization_method="ppt_dd", ff="", filename="", freq=2.412e9, gain=30, nskip=20000000, samp_rate=20e6): gr.top_block.__init__(self, "SWiFi RX") ################################################## # Parameters ################################################## self.alpha = alpha self.antenna = antenna self.beta = beta self.dump_filename = dump_filename self.equalization_method = equalization_method self.ff = ff self.filename = filename self.freq = freq self.gain = gain self.nskip = nskip self.samp_rate = samp_rate ################################################## # Variables ################################################## self.header_mod = header_mod = swifi.wifi_constellation_bpsk() self.header_formatter_2 = header_formatter_2 = swifi.ofdm_phy_header_parser( "frame_len", "phy") ################################################## # Blocks ################################################## self.wirlab_CSI_to_File_0 = wirlab.CSI_to_File( gr.sizeof_gr_complex * 1, "", "CSI.log", True) self.swifi_wifi_conv_decoder_0_0 = swifi.wifi_conv_decoder(24, -1) self.swifi_wifi_conv_decoder_0 = swifi.wifi_conv_decoder("phy") self.swifi_scrambler_0 = swifi.scrambler(False, "phy") self.swifi_sample_marker_0 = swifi.sample_marker( gr.sizeof_gr_complex, "phy") self.swifi_payload_parser_0 = swifi.payload_parser( "phy", dump_filename, "text", ff, True) self.swifi_ofdm_frame_sync_0 = swifi.ofdm_frame_sync( 0.9, 64, 0.4, 0.05, 0.2, "trigger") self.swifi_ofdm_equalizer_1 = swifi.ofdm_equalizer( "", True, "channel_states", digital.constellation_bpsk().base()) self.swifi_ofdm_equalizer_1.set_equalization_method( equalization_method) self.swifi_ofdm_equalizer_1.set_alpha(alpha) self.swifi_ofdm_equalizer_1.set_beta(beta) self.swifi_ofdm_equalizer_1.enable_foc(False) self.swifi_ofdm_equalizer_0 = swifi.ofdm_equalizer( "phy", False, "channel_states") self.swifi_ofdm_equalizer_0.set_equalization_method( equalization_method) self.swifi_ofdm_equalizer_0.set_alpha(alpha) self.swifi_ofdm_equalizer_0.set_beta(beta) self.swifi_ofdm_equalizer_0.enable_foc(False) self.swifi_ofdm_chan_est_0 = swifi.ofdm_chan_est( 64, ((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)), 0.5, "channel_states", "frame_len", 3, False) self.swifi_ofdm_chan_est_0.set_estimation_method(0) self.swifi_interleaver_0_0 = swifi.interleaver(False, 11) self.swifi_interleaver_0 = swifi.interleaver(False, "phy") self.swifi_header_payload_demux_0 = swifi.header_payload_demux( 3, 64, 16, "frame_len", "trigger", True, gr.sizeof_gr_complex, "phy") self.swifi_constellation_decoder_0 = swifi.constellation_decoder("phy") self.swifi_bit_unpacker_0 = swifi.bit_unpacker("phy", 1) self.swifi_bit_inserter_0 = swifi.bit_inserter("phy") self.limesdr_source_0 = limesdr.source("", 0, "") self.limesdr_source_0.set_sample_rate(10e6) self.limesdr_source_0.set_center_freq(2.472e9, 0) self.limesdr_source_0.set_bandwidth(20e6, 0) self.limesdr_source_0.set_gain(50, 0) self.limesdr_source_0.set_antenna(1, 0) self.limesdr_source_0.calibrate(5e6, 0) self.fft_vxx_0_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.digital_packet_headerparser_b_0_0 = digital.packet_headerparser_b( header_formatter_2.base()) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb( header_mod.base()) self.blocks_vector_to_stream_1_0_0_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 48) self.blocks_vector_to_stream_1_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 48) self.blocks_unpacked_to_packed_xx_0_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_LSB_FIRST) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_LSB_FIRST) ################################################## # Connections ################################################## self.msg_connect( (self.digital_packet_headerparser_b_0_0, 'header_data'), (self.swifi_header_payload_demux_0, 'header_data')) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.swifi_payload_parser_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0, 0), (self.digital_packet_headerparser_b_0_0, 0)) self.connect((self.blocks_vector_to_stream_1_0, 0), (self.swifi_sample_marker_0, 0)) self.connect((self.blocks_vector_to_stream_1_0_0_0, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.blocks_vector_to_stream_1_0_0_0, 0), (self.wirlab_CSI_to_File_0, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.swifi_interleaver_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.swifi_ofdm_chan_est_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.swifi_ofdm_equalizer_0, 0)) self.connect((self.limesdr_source_0, 0), (self.swifi_ofdm_frame_sync_0, 0)) self.connect((self.swifi_bit_inserter_0, 0), (self.swifi_wifi_conv_decoder_0, 0)) self.connect((self.swifi_bit_unpacker_0, 0), (self.swifi_interleaver_0, 0)) self.connect((self.swifi_constellation_decoder_0, 0), (self.swifi_bit_unpacker_0, 0)) self.connect((self.swifi_header_payload_demux_0, 0), (self.fft_vxx_0, 0)) self.connect((self.swifi_header_payload_demux_0, 1), (self.fft_vxx_0_0, 0)) self.connect((self.swifi_interleaver_0, 0), (self.swifi_bit_inserter_0, 0)) self.connect((self.swifi_interleaver_0_0, 0), (self.swifi_wifi_conv_decoder_0_0, 0)) self.connect((self.swifi_ofdm_chan_est_0, 0), (self.swifi_ofdm_equalizer_1, 0)) self.connect((self.swifi_ofdm_equalizer_0, 0), (self.blocks_vector_to_stream_1_0, 0)) self.connect((self.swifi_ofdm_equalizer_1, 0), (self.blocks_vector_to_stream_1_0_0_0, 0)) self.connect((self.swifi_ofdm_frame_sync_0, 0), (self.swifi_header_payload_demux_0, 0)) self.connect((self.swifi_sample_marker_0, 0), (self.swifi_constellation_decoder_0, 0)) self.connect((self.swifi_scrambler_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.swifi_wifi_conv_decoder_0, 0), (self.swifi_scrambler_0, 0)) self.connect((self.swifi_wifi_conv_decoder_0_0, 0), (self.blocks_unpacked_to_packed_xx_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx From Reco 150920") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx From Reco 150920") 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_from_reco_150920") 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.5e6 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.5e6, 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_const_sink_x_1 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(False) self.qtgui_const_sink_x_1.enable_grid(False) if not True: self.qtgui_const_sink_x_1.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_1_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) 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, False) 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_vector_to_stream_2 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) (self.blocks_throttle_0).set_min_output_buffer(2048) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_null_sink_0_1_0_0_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_file_source_0_1_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/juan/COWN/waveforms/80211_ofdm_padded_waveform_direct_fromTX_20150930.bin", True) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_file_source_0_1_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.blocks_vector_to_stream_2, 0), (self.qtgui_const_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.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.blocks_vector_to_stream_2, 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.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0_0_0, 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.carajito, 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.freq_0 = freq_0 = 525.2e6 self.threshold = threshold = -60 self.samp_rate = samp_rate = 2.048e6 self.freq = freq = freq_0 ################################################## # Blocks ################################################## _threshold_sizer = wx.BoxSizer(wx.VERTICAL) self._threshold_text_box = forms.text_box( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, label="threshold", converter=forms.float_converter(), proportion=0, ) self._threshold_slider = forms.slider( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, minimum=-100, maximum=0, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_threshold_sizer) self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f( self.GetWin(), unit="signal present", minval=0, maxval=1, factor=1.0, decimal_places=10, ref_level=0, sample_rate=2.048e6, number_rate=15, average=False, avg_alpha=None, label="Signal detection", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0_0.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="Units", minval=-120, maxval=0, factor=1.0, decimal_places=10, ref_level=0, sample_rate=2048000, number_rate=15, average=True, avg_alpha=0.03, label="Level", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=2048000, fft_size=1024, fft_rate=15, average=True, avg_alpha=0.030, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "") self.rtlsdr_source_0.set_sample_rate(2.048e6) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(15, 0) self.rtlsdr_source_0.set_if_gain(15, 0) self.rtlsdr_source_0.set_bb_gain(5, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1") self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2") self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3") self.Add(self.notebook_0) _freq_0_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_0_sizer, value=self.freq_0, callback=self.set_freq_0, label='freq_0', converter=forms.float_converter(), proportion=0, ) self._freq_0_slider = forms.slider( parent=self.GetWin(), sizer=_freq_0_sizer, value=self.freq_0, callback=self.set_freq_0, minimum=478e6, maximum=862e6, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_0_sizer) self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_float * 1, 1024) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, 2048000, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, -60) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 1024) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_int * 1, "/media/ubuntu/01D165566F075780/Q3/wireless networking/GNU/out1.txt", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( 1024) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 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.variable = variable = 0.00001 self.samp_rate_0 = samp_rate_0 = 32000 self.rf_gain = rf_gain = 64 self.if_gain = if_gain = 15 self.bb_gain = bb_gain = 15 ################################################## # Blocks ################################################## self._variable_range = Range(0.00001, 0.01, 0.00001, 0.00001, 200) self._variable_win = RangeWidget(self._variable_range, self.set_variable, 'variable', "counter_slider", float) self.top_layout.addWidget(self._variable_win) self._rf_gain_range = Range(0, 200, 1, 64, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'rf_gain', "counter_slider", float) self.top_layout.addWidget(self._rf_gain_win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=63, decimation=64, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( (4096 + 512) * 2, #size 8127000, #samp_rate "Senal en el tiempo", #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_axis_labels(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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( (4096 + 512) * 2, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 8127000, #bw "ESPECTRO OFDM", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(True) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 8192, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.isdbt_tsp_resize_0_2_1 = isdbt.tsp_resize() self.isdbt_tsp_resize_0_2_0 = isdbt.tsp_resize() self.isdbt_tsp_resize_0_2 = isdbt.tsp_resize() self.isdbt_time_interleaver_0 = isdbt.time_interleaver(3, 4, True) self.isdbt_sync_adjust_0_1 = isdbt.sync_adjust() self.isdbt_sync_adjust_0_0 = isdbt.sync_adjust() self.isdbt_sync_adjust_0 = isdbt.sync_adjust() self.isdbt_ofdm_frame_structure_0 = isdbt.ofdm_frame_structure( 3, True, 3, 3, 3, 0, 0, 0, 4, 4, 4, 1, 6, 6) self.isdbt_mapper_0_1 = isdbt.mapper(3, 6, 6, 0.125) self.isdbt_mapper_0_0 = isdbt.mapper(3, 6, 6, 0.125) self.isdbt_mapper_0 = isdbt.mapper(3, 6, 1, 0.125) self.isdbt_hierarchical_divisor_0 = isdbt.hierarchical_divisor( 3, 0.125, 1, 6, 0.5, 6, 6, 0.5, 6, 6, 0.5) self.isdbt_hierarchical_combination_0 = isdbt.hierarchical_combination( 3, 1, 6, 6) self.isdbt_frec_interleaver_0 = isdbt.frec_interleaver(3, True) self.isdbt_energy_dispersal_0_1 = isdbt.energy_dispersal(72 * 6) self.isdbt_energy_dispersal_0_0 = isdbt.energy_dispersal(432) self.isdbt_energy_dispersal_0 = isdbt.energy_dispersal(72) self.isdbt_byte_interleaver_0_1 = isdbt.byte_interleaver(3, 0, 6, 6) self.isdbt_byte_interleaver_0_0 = isdbt.byte_interleaver(3, 0, 6, 6) self.isdbt_byte_interleaver_0 = isdbt.byte_interleaver(3, 0, 6, 1) self._if_gain_range = Range(0, 30, 1, 15, 200) self._if_gain_win = RangeWidget(self._if_gain_range, self.set_if_gain, 'if_gain', "counter_slider", float) self.top_layout.addWidget(self._if_gain_win) self.fft_vxx_0 = fft.fft_vcc(4096 * 2, False, (window.rectangular(4096 * 2)), True, 1) self.dtv_dvbt_reed_solomon_enc_0_0_1 = dtv.dvbt_reed_solomon_enc( 2, 8, 0x11d, 255, 239, 8, 51, 1) self.dtv_dvbt_reed_solomon_enc_0_0_0 = dtv.dvbt_reed_solomon_enc( 2, 8, 0x11d, 255, 239, 8, 51, 1) self.dtv_dvbt_reed_solomon_enc_0_0 = dtv.dvbt_reed_solomon_enc( 2, 8, 0x11d, 255, 239, 8, 51, 1) self.dtv_dvbt_inner_coder_0_1 = dtv.dvbt_inner_coder( 1, 1512, dtv.MOD_64QAM, dtv.ALPHA2, dtv.C1_2) self.dtv_dvbt_inner_coder_0_0 = dtv.dvbt_inner_coder( 1, 1512, dtv.MOD_64QAM, dtv.ALPHA2, dtv.C1_2) self.dtv_dvbt_inner_coder_0 = dtv.dvbt_inner_coder( 1, 1512, dtv.MOD_64QAM, dtv.ALPHA2, dtv.C1_2) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( 4096 * 2, 4096 * 2 + 512 * 2, 0, "") self.blocks_vector_to_stream_1_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 4096 * 2) self.blocks_vector_to_stream_1 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 4096 * 2) self.blocks_vector_to_stream_0_1_2 = blocks.vector_to_stream( gr.sizeof_char * 1, 1512) self.blocks_vector_to_stream_0_1_1 = blocks.vector_to_stream( gr.sizeof_char * 1, 1512) self.blocks_vector_to_stream_0_1 = blocks.vector_to_stream( gr.sizeof_char * 1, 1512) self.blocks_vector_to_stream_0_0_2 = blocks.vector_to_stream( gr.sizeof_char * 204, 144 * 6) self.blocks_vector_to_stream_0_0_1 = blocks.vector_to_stream( gr.sizeof_char * 204, 144 * 6) self.blocks_vector_to_stream_0_0_0_1 = blocks.vector_to_stream( gr.sizeof_char * 1, 204) self.blocks_vector_to_stream_0_0_0_0 = blocks.vector_to_stream( gr.sizeof_char * 1, 204) self.blocks_vector_to_stream_0_0_0 = blocks.vector_to_stream( gr.sizeof_char * 1, 204) self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream( gr.sizeof_char * 204, 144) self.blocks_stream_to_vector_1_1 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 384 * 6) self.blocks_stream_to_vector_1_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 384 * 6) self.blocks_stream_to_vector_1 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 384) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (variable, )) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_file_source_0_0_0 = blocks.file_source( gr.sizeof_char * 204 * 2304 * 2, '/home/habbo/Documents/BTS_Validos/BTS_ISDB_T_3_CAPAS.ts', True) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self._bb_gain_range = Range(0, 30, 1, 15, 200) self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'bb_gain', "counter_slider", float) self.top_layout.addWidget(self._bb_gain_win) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_file_source_0_0_0, 0), (self.isdbt_hierarchical_divisor_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_stream_to_vector_1, 0), (self.isdbt_hierarchical_combination_0, 0)) self.connect((self.blocks_stream_to_vector_1_0, 0), (self.isdbt_hierarchical_combination_0, 1)) self.connect((self.blocks_stream_to_vector_1_1, 0), (self.isdbt_hierarchical_combination_0, 2)) self.connect((self.blocks_vector_to_stream_0_0, 0), (self.isdbt_tsp_resize_0_2, 0)) self.connect((self.blocks_vector_to_stream_0_0_0, 0), (self.dtv_dvbt_inner_coder_0, 0)) self.connect((self.blocks_vector_to_stream_0_0_0_0, 0), (self.dtv_dvbt_inner_coder_0_0, 0)) self.connect((self.blocks_vector_to_stream_0_0_0_1, 0), (self.dtv_dvbt_inner_coder_0_1, 0)) self.connect((self.blocks_vector_to_stream_0_0_1, 0), (self.isdbt_tsp_resize_0_2_0, 0)) self.connect((self.blocks_vector_to_stream_0_0_2, 0), (self.isdbt_tsp_resize_0_2_1, 0)) self.connect((self.blocks_vector_to_stream_0_1, 0), (self.isdbt_mapper_0, 0)) self.connect((self.blocks_vector_to_stream_0_1_1, 0), (self.isdbt_mapper_0_0, 0)) self.connect((self.blocks_vector_to_stream_0_1_2, 0), (self.isdbt_mapper_0_1, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_vector_to_stream_1_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dtv_dvbt_inner_coder_0, 0), (self.blocks_vector_to_stream_0_1, 0)) self.connect((self.dtv_dvbt_inner_coder_0_0, 0), (self.blocks_vector_to_stream_0_1_1, 0)) self.connect((self.dtv_dvbt_inner_coder_0_1, 0), (self.blocks_vector_to_stream_0_1_2, 0)) self.connect((self.dtv_dvbt_reed_solomon_enc_0_0, 0), (self.isdbt_sync_adjust_0, 0)) self.connect((self.dtv_dvbt_reed_solomon_enc_0_0_0, 0), (self.isdbt_sync_adjust_0_0, 0)) self.connect((self.dtv_dvbt_reed_solomon_enc_0_0_1, 0), (self.isdbt_sync_adjust_0_1, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_1_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.isdbt_byte_interleaver_0, 0), (self.blocks_vector_to_stream_0_0_0, 0)) self.connect((self.isdbt_byte_interleaver_0_0, 0), (self.blocks_vector_to_stream_0_0_0_0, 0)) self.connect((self.isdbt_byte_interleaver_0_1, 0), (self.blocks_vector_to_stream_0_0_0_1, 0)) self.connect((self.isdbt_energy_dispersal_0, 0), (self.isdbt_byte_interleaver_0, 0)) self.connect((self.isdbt_energy_dispersal_0_0, 0), (self.isdbt_byte_interleaver_0_0, 0)) self.connect((self.isdbt_energy_dispersal_0_1, 0), (self.isdbt_byte_interleaver_0_1, 0)) self.connect((self.isdbt_frec_interleaver_0, 0), (self.isdbt_ofdm_frame_structure_0, 0)) self.connect((self.isdbt_hierarchical_combination_0, 0), (self.isdbt_time_interleaver_0, 0)) self.connect((self.isdbt_hierarchical_divisor_0, 0), (self.blocks_vector_to_stream_0_0, 0)) self.connect((self.isdbt_hierarchical_divisor_0, 1), (self.blocks_vector_to_stream_0_0_1, 0)) self.connect((self.isdbt_hierarchical_divisor_0, 2), (self.blocks_vector_to_stream_0_0_2, 0)) self.connect((self.isdbt_mapper_0, 0), (self.blocks_stream_to_vector_1, 0)) self.connect((self.isdbt_mapper_0_0, 0), (self.blocks_stream_to_vector_1_0, 0)) self.connect((self.isdbt_mapper_0_1, 0), (self.blocks_stream_to_vector_1_1, 0)) self.connect((self.isdbt_ofdm_frame_structure_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.isdbt_ofdm_frame_structure_0, 0), (self.fft_vxx_0, 0)) self.connect((self.isdbt_sync_adjust_0, 0), (self.isdbt_energy_dispersal_0, 0)) self.connect((self.isdbt_sync_adjust_0_0, 0), (self.isdbt_energy_dispersal_0_0, 0)) self.connect((self.isdbt_sync_adjust_0_1, 0), (self.isdbt_energy_dispersal_0_1, 0)) self.connect((self.isdbt_time_interleaver_0, 0), (self.isdbt_frec_interleaver_0, 0)) self.connect((self.isdbt_tsp_resize_0_2, 0), (self.dtv_dvbt_reed_solomon_enc_0_0, 0)) self.connect((self.isdbt_tsp_resize_0_2_0, 0), (self.dtv_dvbt_reed_solomon_enc_0_0_0, 0)) self.connect((self.isdbt_tsp_resize_0_2_1, 0), (self.dtv_dvbt_reed_solomon_enc_0_0_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_null_sink_0, 0))
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbt-blade.py input_file [output_file]\n") sys.exit(1) channel_mhz = 6 mode = dvbt.T2k code_rate = dvbt.C1_2 constellation = dvbt.QPSK symbol_rate = channel_mhz * 8000000.0 / 7 center_freq = 441000000 txvga1_gain = -4 txvga2_gain = 25 if mode == dvbt.T2k: factor = 1 carriers = 2048 elif mode == dvbt.T8k: factor = 4 carriers = 8192 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dvbt.convolutional_interleaver( (136 * factor), 12, 17) dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate) dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver( (1512 * factor), constellation, dvbt.NH, mode) dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver( (1512 * factor), mode, 1) dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1) dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer( carriers, carriers + (64 * factor), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc( (0.0022097087 * 2.5, )) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map) tb.connect(dvbt_dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
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.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=1200e6, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=10e6, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=70, decimation=64, taps=None, fractional_bw=None, ) self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 10) self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(1512, dvbt.T2k, 1) self.dvbt_reference_signals_0 = dvbt.reference_signals(gr.sizeof_gr_complex, 1512, 2048, dvbt.QAM16, dvbt.NH, dvbt.C1_2, dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0) self.dvbt_reed_solomon_enc_0 = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, 8) self.dvbt_inner_coder_0 = dvbt.inner_coder(1, 1512, dvbt.QAM16, dvbt.NH, dvbt.C1_2) self.dvbt_energy_dispersal_0 = dvbt.energy_dispersal(1) self.dvbt_dvbt_map_0 = dvbt.dvbt_map(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k, 1) self.dvbt_convolutional_interleaver_0 = dvbt.convolutional_interleaver(136, 12, 17) self.dvbt_bit_inner_interleaver_0 = dvbt.bit_inner_interleaver(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(2048, 2048+64, 0, "") self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "test.ts", True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "testBB.bin", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dvbt_energy_dispersal_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dvbt_bit_inner_interleaver_0, 0), (self.dvbt_symbol_inner_interleaver_0, 0)) self.connect((self.dvbt_convolutional_interleaver_0, 0), (self.dvbt_inner_coder_0, 0)) self.connect((self.dvbt_dvbt_map_0, 0), (self.dvbt_reference_signals_0, 0)) self.connect((self.dvbt_energy_dispersal_0, 0), (self.dvbt_reed_solomon_enc_0, 0)) self.connect((self.dvbt_inner_coder_0, 0), (self.dvbt_bit_inner_interleaver_0, 0)) self.connect((self.dvbt_reed_solomon_enc_0, 0), (self.dvbt_convolutional_interleaver_0, 0)) self.connect((self.dvbt_reference_signals_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0)) self.connect((self.dvbt_symbol_inner_interleaver_0, 0), (self.dvbt_dvbt_map_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx") 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", "wifi_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.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 2e6 self.rf = rf = 14 self.lo_offset = lo_offset = 0 self.gain = gain = 0.75 self.freqq = freqq = 2.412e6 self.freq = freq = 2412000000.0 self.device_6 = device_6 = "hackrf=26b468dc3540b58f" self.device_5 = device_5 = "hackrf=88869dc38686a1b" self.device_4 = device_4 = "hackrf=88869dc2930b41b" self.device_3 = device_3 = "hackrf=88869dc3347501b" self.device_2 = device_2 = "hackrf=88869dc3918701b" self.device_1 = device_1 = "hackrf=88869dc3397a01b" self.chan_est = chan_est = 0 self.bb = bb = 20 self.IF = IF = 30 ################################################## # Blocks ################################################## # Create the options list self._samp_rate_options = [ 2000000.0, 5000000.0, 10000000.0, 20000000.0 ] # Create the labels list self._samp_rate_labels = ['2MHz', '5 MHz', '10 MHz', '20 MHz'] # Create the combo box self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_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])) # Create the radio buttons self.top_layout.addWidget(self._samp_rate_tool_bar) self._rf_range = Range(0, 50, 1, 14, 200) self._rf_win = RangeWidget(self._rf_range, self.set_rf, 'rf', "counter_slider", int) self.top_layout.addWidget(self._rf_win) # Create the options list self._chan_est_options = [0, 1, 3, 2] # Create the labels list self._chan_est_labels = ['LS', 'LMS', 'STA', 'Linear Comb'] # Create the combo box # Create the radio buttons self._chan_est_group_box = Qt.QGroupBox('chan_est' + ": ") self._chan_est_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._chan_est_button_group = variable_chooser_button_group() self._chan_est_group_box.setLayout(self._chan_est_box) for i, _label in enumerate(self._chan_est_labels): radio_button = Qt.QRadioButton(_label) self._chan_est_box.addWidget(radio_button) self._chan_est_button_group.addButton(radio_button, i) self._chan_est_callback = lambda i: Qt.QMetaObject.invokeMethod( self._chan_est_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._chan_est_options.index(i))) self._chan_est_callback(self.chan_est) self._chan_est_button_group.buttonClicked[int].connect( lambda i: self.set_chan_est(self._chan_est_options[i])) self.top_layout.addWidget(self._chan_est_group_box) self._bb_range = Range(0, 70, 1, 20, 200) self._bb_win = RangeWidget(self._bb_range, self.set_bb, 'bb', "counter_slider", int) self.top_layout.addWidget(self._bb_win) self._IF_range = Range(0, 50, 1, 30, 200) self._IF_win = RangeWidget(self._IF_range, self.set_IF, 'IF', "counter_slider", int) self.top_layout.addWidget(self._IF_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(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_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 48 * 10, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + device_5) 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(2.45e9, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(rf, 0) self.osmosdr_source_0.set_if_gain(IF, 0) self.osmosdr_source_0.set_bb_gain(bb, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) # Create the options list self._lo_offset_options = [0, 6000000.0, 11000000.0] # Create the labels list self._lo_offset_labels = ['0', '6000000.0', '11000000.0'] # Create the combo box 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])) # Create the radio buttons self.top_layout.addWidget(self._lo_offset_tool_bar) self.ieee802_11_sync_short_0 = ieee802_11.sync_short( 0.56, 2, False, False) self.ieee802_11_sync_long_0 = ieee802_11.sync_long( sync_length, True, False) self.ieee802_11_parse_mac_0 = ieee802_11.parse_mac(True, True) self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer( chan_est, 2.45e9, samp_rate, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(True, False) self._gain_range = Range(0, 1, 0.01, 0.75, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'gain', "counter_slider", float) self.top_layout.addWidget(self._gain_win) # Create the options list self._freqq_options = [2437000.0, 2462000.0, 2412000.0] # Create the labels list self._freqq_labels = ['ch6', 'ch11', 'ch1'] # Create the combo box self._freqq_tool_bar = Qt.QToolBar(self) self._freqq_tool_bar.addWidget(Qt.QLabel("freqq: ")) self._freqq_combo_box = Qt.QComboBox() self._freqq_tool_bar.addWidget(self._freqq_combo_box) for _label in self._freqq_labels: self._freqq_combo_box.addItem(_label) self._freqq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freqq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freqq_options.index(i))) self._freqq_callback(self.freqq) self._freqq_combo_box.currentIndexChanged.connect( lambda i: self.set_freqq(self._freqq_options[i])) # Create the radio buttons self.top_layout.addWidget(self._freqq_tool_bar) # Create the options list self._freq_options = [ 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, 5250000000.0, 5260000000.0, 5270000000.0, 5280000000.0, 5290000000.0, 5300000000.0, 5310000000.0, 5320000000.0, 5500000000.0, 5510000000.0, 5520000000.0, 5530000000.0, 5540000000.0, 5550000000.0, 5560000000.0, 5570000000.0, 5580000000.0, 5590000000.0, 5600000000.0, 5610000000.0, 5620000000.0, 5630000000.0, 5640000000.0, 5660000000.0, 5670000000.0, 5680000000.0, 5690000000.0, 5700000000.0, 5710000000.0, 5720000000.0, 5745000000.0, 5755000000.0, 5765000000.0, 5775000000.0, 5785000000.0, 5795000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0 ] # Create the labels list self._freq_labels = [ ' 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', ' 50 | 5250.0 | 11a', ' 52 | 5260.0 | 11a', ' 54 | 5270.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5290.0 | 11a', ' 60 | 5300.0 | 11a', ' 62 | 5310.0 | 11a', ' 64 | 5320.0 | 11a', '100 | 5500.0 | 11a', '102 | 5510.0 | 11a', '104 | 5520.0 | 11a', '106 | 5530.0 | 11a', '108 | 5540.0 | 11a', '110 | 5550.0 | 11a', '112 | 5560.0 | 11a', '114 | 5570.0 | 11a', '116 | 5580.0 | 11a', '118 | 5590.0 | 11a', '120 | 5600.0 | 11a', '122 | 5610.0 | 11a', '124 | 5620.0 | 11a', '126 | 5630.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '134 | 5670.0 | 11a', '136 | 5680.0 | 11a', '138 | 5690.0 | 11a', '140 | 5700.0 | 11a', '142 | 5710.0 | 11a', '144 | 5720.0 | 11a', '149 | 5745.0 | 11a (SRD)', '151 | 5755.0 | 11a (SRD)', '153 | 5765.0 | 11a (SRD)', '155 | 5775.0 | 11a (SRD)', '157 | 5785.0 | 11a (SRD)', '159 | 5795.0 | 11a (SRD)', '161 | 5805.0 | 11a (SRD)', '165 | 5825.0 | 11a (SRD)', '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' ] # Create the combo box self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("freq: ")) 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])) # Create the radio buttons self.top_layout.addWidget(self._freq_tool_bar) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, window.rectangular(64), True, 1) self.correctiq_correctiq_0 = correctiq.correctiq() self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'packet_len') self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_moving_average_xx_1 = blocks.moving_average_cc( window_size, 1, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( window_size + 16, 1, 4000, 1) self.blocks_file_sink_2 = blocks.file_sink( gr.sizeof_gr_complex * 1, '/home/erc/SDN/symbols_5_1.bin', False) self.blocks_file_sink_2.set_unbuffered(True) self.blocks_file_sink_1_1 = blocks.file_sink( gr.sizeof_gr_complex * 64, '/home/erc/SDN/before_fft_5_1.bin', False) self.blocks_file_sink_1_1.set_unbuffered(True) self.blocks_file_sink_1_0 = blocks.file_sink( gr.sizeof_char * 48, '/home/erc/SDN/output_equ_5_1.bin', False) self.blocks_file_sink_1_0.set_unbuffered(True) self.blocks_file_sink_1 = blocks.file_sink( gr.sizeof_gr_complex * 64, '/home/erc/SDN/after_fft_5_1.bin', False) self.blocks_file_sink_1.set_unbuffered(True) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, '/home/erc/SDN/wifi_5_1.pcap', False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.ieee802_11_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_frame_equalizer_0, 'symbols'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) 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.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_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_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_sync_short_0, 2)) self.connect((self.blocks_divide_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_moving_average_xx_1, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.ieee802_11_sync_short_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_moving_average_xx_1, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.blocks_file_sink_2, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_file_sink_1_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_file_sink_1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_frame_equalizer_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.blocks_file_sink_1_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) self.connect((self.ieee802_11_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.ieee802_11_sync_long_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.correctiq_correctiq_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Loopback") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Loopback") 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_loopback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.snr = snr = 36 self.samp_rate = samp_rate = 1e6 self.pdu_length = pdu_length = 500 self.out_buf_size = out_buf_size = 96000 self.noise_var = noise_var = -150 self.interval = interval = 100 self.freq_offset = freq_offset = 0 self.encoding = encoding = 0 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._snr_range = Range(-15, 50, 1, 36, 200) self._snr_win = RangeWidget(self._snr_range, self.set_snr, "snr", "counter_slider") self.top_layout.addWidget(self._snr_win) self._noise_var_range = Range(-180, -40, 5, -150, 200) self._noise_var_win = RangeWidget(self._noise_var_range, self.set_noise_var, "noise_var", "counter_slider") self.top_layout.addWidget(self._noise_var_win) self._encoding_options = [0, 1, 2, 3, 4, 5, 6, 7] self._encoding_labels = [ "BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4", ] self._encoding_group_box = Qt.QGroupBox("encoding") self._encoding_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._encoding_button_group = variable_chooser_button_group() self._encoding_group_box.setLayout(self._encoding_box) for i, label in enumerate(self._encoding_labels): radio_button = Qt.QRadioButton(label) self._encoding_box.addWidget(radio_button) self._encoding_button_group.addButton(radio_button, i) self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod( self._encoding_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._encoding_options.index(i)) ) self._encoding_callback(self.encoding) self._encoding_button_group.buttonClicked[int].connect(lambda i: self.set_encoding(self._encoding_options[i])) self.top_layout.addWidget(self._encoding_group_box) self._chan_est_options = [0, 1] self._chan_est_labels = ["LMS", "Linear Comb"] self._chan_est_group_box = Qt.QGroupBox("chan_est") self._chan_est_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._chan_est_button_group = variable_chooser_button_group() self._chan_est_group_box.setLayout(self._chan_est_box) for i, label in enumerate(self._chan_est_labels): radio_button = Qt.QRadioButton(label) self._chan_est_box.addWidget(radio_button) self._chan_est_button_group.addButton(radio_button, i) self._chan_est_callback = lambda i: Qt.QMetaObject.invokeMethod( self._chan_est_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._chan_est_options.index(i)) ) self._chan_est_callback(self.chan_est) self._chan_est_button_group.buttonClicked[int].connect(lambda i: self.set_chan_est(self._chan_est_options[i])) self.top_layout.addWidget(self._chan_est_group_box) self.wifi_phy_hier_0 = wifi_phy_hier(encoding=encoding, chan_est=chan_est) self.sync_long = ieee802_11.ofdm_sync_long(sync_length, False, False) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 2 ** 14, samp_rate, "", 1 # size # samp_rate # name # number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label("My own sycn short", "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 0, 0, "ofdm_start") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(False) 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 = [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_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 = qtgui.time_sink_f( 2 ** 15, samp_rate, "", 3 # size # samp_rate # name # number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-0.01, 0.4) 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.15, 2e-3, 2, "FISTOR") self.qtgui_time_sink_x_0.enable_autoscale(False) 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 = ["samples", "corr", "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(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("nuber sync") 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, -1) self.qtgui_number_sink_0.set_max(i, 1) 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._pdu_length_range = Range(0, 1500, 1, 500, 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.marica = ofdm_80211.short_match_filter(160, 16) self._interval_range = Range(10, 10000, 1, 100, 200) self._interval_win = RangeWidget(self._interval_range, self.set_interval, "interval", "counter_slider") self.top_layout.addWidget(self._interval_win) self.ieee802_11_ofdm_parse_mac_0_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, 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, 0xFF]), ) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, 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, False) self._freq_offset_range = Range(-0.10, 0.1, 0.0001, 0, 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.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.fft_vxx_0_1 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(0.05, 2, False, False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate / 2, True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_1_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff((4e9 * 10 ** ((36 - snr) / 10.0),)) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((9e9,)) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((10 ** ((snr + noise_var) / 20.0) + 1,)) self.blocks_message_strobe_1_0 = blocks.message_strobe( pmt.intern( "HOLAabcd123456aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234" ), 1000, ) self.blocks_delay_0_1 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_complex_to_mag_squared_0_1_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0_1 = blocks.complex_to_mag_squared(1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_1_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_0, "in")) self.msg_connect((self.ieee802_11_ofdm_mac_0, "phy out"), (self.wifi_phy_hier_0, "mac_in")) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0_0, "fer"), (self.blocks_pdu_to_tagged_stream_0_0, "pdus")) self.msg_connect((self.wifi_phy_hier_0, "mac_out"), (self.ieee802_11_ofdm_parse_mac_0, "in")) self.connect((self.blocks_complex_to_mag_squared_0_1, 0), (self.blocks_multiply_const_vxx_0_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_1_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_delay_0_1, 0), (self.sync_long, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.marica, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_null_source_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0_1, 0)) self.connect((self.carajito, 0), (self.blocks_null_sink_0_1_0_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.carajito, 0), (self.sync_long, 0)) self.connect((self.fft_vxx_0_1, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_throttle_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.marica, 1), (self.blocks_complex_to_mag_squared_0_1, 0)) self.connect((self.marica, 0), (self.blocks_complex_to_mag_squared_0_1_0, 0)) self.connect((self.marica, 2), (self.blocks_null_sink_0_1_0, 0)) self.connect((self.marica, 1), (self.carajito, 1)) self.connect((self.marica, 3), (self.carajito, 2)) self.connect((self.marica, 0), (self.carajito, 0)) self.connect((self.marica, 3), (self.qtgui_time_sink_x_0, 2)) self.connect((self.sync_long, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx") 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", "wifi_rx") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 10e6 self.lo_offset = lo_offset = 0 self.gain = gain = 0.75 self.freq = freq = int(sys.argv[1]) * 10e5 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_options = [5e6, 10e6, 20e6] self._samp_rate_labels = ["5 MHz", "10 MHz", "20 MHz"] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_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._freq_options = [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, 5250000000.0, 5260000000.0, 5270000000.0, 5280000000.0, 5290000000.0, 5300000000.0, 5310000000.0, 5320000000.0, 5500000000.0, 5510000000.0, 5520000000.0, 5530000000.0, 5540000000.0, 5550000000.0, 5560000000.0, 5570000000.0, 5580000000.0, 5590000000.0, 5600000000.0, 5610000000.0, 5620000000.0, 5630000000.0, 5640000000.0, 5660000000.0, 5670000000.0, 5680000000.0, 5690000000.0, 5700000000.0, 5710000000.0, 5720000000.0, 5745000000.0, 5755000000.0, 5765000000.0, 5775000000.0, 5785000000.0, 5795000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0] self._freq_labels = [' 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', ' 50 | 5250.0 | 11a', ' 52 | 5260.0 | 11a', ' 54 | 5270.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5290.0 | 11a', ' 60 | 5300.0 | 11a', ' 62 | 5310.0 | 11a', ' 64 | 5320.0 | 11a', '100 | 5500.0 | 11a', '102 | 5510.0 | 11a', '104 | 5520.0 | 11a', '106 | 5530.0 | 11a', '108 | 5540.0 | 11a', '110 | 5550.0 | 11a', '112 | 5560.0 | 11a', '114 | 5570.0 | 11a', '116 | 5580.0 | 11a', '118 | 5590.0 | 11a', '120 | 5600.0 | 11a', '122 | 5610.0 | 11a', '124 | 5620.0 | 11a', '126 | 5630.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '134 | 5670.0 | 11a', '136 | 5680.0 | 11a', '138 | 5690.0 | 11a', '140 | 5700.0 | 11a', '142 | 5710.0 | 11a', '144 | 5720.0 | 11a', '149 | 5745.0 | 11a (SRD)', '151 | 5755.0 | 11a (SRD)', '153 | 5765.0 | 11a (SRD)', '155 | 5775.0 | 11a (SRD)', '157 | 5785.0 | 11a (SRD)', '159 | 5795.0 | 11a (SRD)', '161 | 5805.0 | 11a (SRD)', '165 | 5825.0 | 11a (SRD)', '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("freq"+": ")) 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._chan_est_options = [ieee802_11.LS, ieee802_11.LMS, ieee802_11.STA, ieee802_11.COMB] self._chan_est_labels = ["LS", "LMS", "STA", "Linear Comb"] self._chan_est_group_box = Qt.QGroupBox("chan_est") self._chan_est_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._chan_est_button_group = variable_chooser_button_group() self._chan_est_group_box.setLayout(self._chan_est_box) for i, label in enumerate(self._chan_est_labels): radio_button = Qt.QRadioButton(label) self._chan_est_box.addWidget(radio_button) self._chan_est_button_group.addButton(radio_button, i) self._chan_est_callback = lambda i: Qt.QMetaObject.invokeMethod(self._chan_est_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._chan_est_options.index(i))) self._chan_est_callback(self.chan_est) self._chan_est_button_group.buttonClicked[int].connect( lambda i: self.set_chan_est(self._chan_est_options[i])) self.top_layout.addWidget(self._chan_est_group_box) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(10, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 48*10, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self._lo_offset_options = (0, 6e6, 11e6, ) self._lo_offset_labels = (str(self._lo_offset_options[0]), str(self._lo_offset_options[1]), str(self._lo_offset_options[2]), ) 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_sync_short_0 = ieee802_11.sync_short(0.56, 2, False, False) self.ieee802_11_sync_long_0 = ieee802_11.sync_long(sync_length, True, False) self.ieee802_11_parse_mac_0 = ieee802_11.parse_mac(True, True) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer(chan_est, freq, samp_rate, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(True, False) self._gain_range = Range(0, 1, 0.01, 0.75, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", float) self.top_layout.addWidget(self._gain_win) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'packet_len') self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.ieee802_11_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_frame_equalizer_0, 'symbols'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) 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_delay_0, 0), (self.ieee802_11_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_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_sync_short_0, 2)) self.connect((self.blocks_divide_xx_0, 0), (self.qtgui_time_sink_x_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_1, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_frame_equalizer_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) 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_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_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.ieee802_11_sync_long_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def main(args): d = 'Transmit a DVB-T signal using the bladeRF and gr-dtv' parser = argparse.ArgumentParser() mode_help = '# of carriers. Options: t2k, t8k (default).' parser.add_argument('-m', '--mode', dest='mode', default='t8k', type=str, help=mode_help) ch_help = 'channel width in MHz. Options: 5, 6, 7, 8 (default).' parser.add_argument('-c', '--channel', dest='channel', default=8, metavar='CH', type=int, help=ch_help) const_help = 'constellation. qpsk, qam16, qam64 (default).' parser.add_argument('-C', '--cons', dest='cons', default='qam64', metavar='TYPE', type=str, help=const_help) rate_help = 'Viterbi rate. 1/2, 2/3, 3/4, 5/6, 7/8 (default).' parser.add_argument('-r', '--rate', dest='rate', default='7/8', type=str, help=rate_help) guard_help = 'guard interval. 1/32 (default), 1/16, 1/8, 1/4.' parser.add_argument('-g', '--guard', dest='interval', default='1/32', metavar='D', type=str, help=guard_help) freq_help = 'center frequency (Hz). Default is 429e6.' parser.add_argument('-f', '--freq', dest='freq', default=429e6, type=float, help=freq_help) vga1_help = 'bladeRF TXVGA1 gain. Default is -6.' parser.add_argument('--txvga1', dest='txvga1', default=-6, metavar='gain', type=int, help=vga1_help) vga2_help = 'bladeRF TXVGA2 gain. Default is 9.' parser.add_argument('--txvga2', dest='txvga2', default=9, metavar='gain', type=int, help=vga2_help) outfile_help = 'write to specified file.' parser.add_argument('-o', '--output', dest='outfile', default=None, metavar='OUT', type=str, help=outfile_help) parser.add_argument('infile', metavar='input-file', type=str, help='Input file') args = parser.parse_args() print args if args.mode.lower() == 't2k': mode = dtv.T2k elif args.mode.lower() == 't8k': mode = dtv.T8k else: sys.stderr.write('Invalid mode provided: ' + args.mode + '\n') sys.exit(1) if args.channel < 5 or args.channel > 8: sys.stderr.write('Invalid channel: ' + str(args.channel) + '\n') sys.exit(1) else: channel_mhz = args.channel if args.cons.lower() == 'qpsk': constellation = dtv.MOD_QPSK elif args.cons.lower() == 'qam16': constellation = dtv.MOD_16QAM elif args.cons.lower() == 'qam64': constellation = dtv.MOD_64QAM else: sys.stderr.write('Invalid constellation type: ' + args.cons + '\n') sys.exit(1) if args.rate == '1/2': code_rate = dtv.C1_2 elif args.rate == '2/3': code_rate = dtv.C2_3 elif args.rate == '3/4': code_rate = dtv.C3_4 elif args.rate == '5/6': code_rate = dtv.C5_6 elif args.rate == '7/8': code_rate = dtv.C7_8 else: sys.stderr.write('Invalid Viterbi rate: ' + args.rate + '\n') sys.exit(1) if args.interval == '1/32': guard_interval = dtv.GI_1_32 elif args.interval == '1/16': guard_interval = dtv.GI_1_16 elif args.interval == '1/8': guard_interval = dtv.GI_1_8 elif args.interval == '1/4': guard_interval = dtv.GI_1_4 else: sys.stderr.write('Invalid guard interval: ' + args.interval + '\n') sys.exit(1) if args.freq < 300e6 or args.freq > 3.8e9: sys.stderr.write('Invalid center frequency: ' + str(args.freq) + '\n') sys.exit(1) else: center_freq = int(args.freq) if args.txvga1 < -35 or args.txvga1 > -4: sys.stderr.write('Invalid bladeRF TXVGA1 gain: ' + str(args.txvga1) + '\n') sys.exit(1) else: txvga1_gain = args.txvga1 if args.txvga2 < 0 or args.txvga2 > 25: sys.stderr.write('Invalid bladeRF TXVGA2 gain: ' + str(args.txvga2) + '\n') sys.exit(1) else: txvga2_gain = args.txvga2 infile = args.infile outfile = args.outfile symbol_rate = channel_mhz * 8000000.0 / 7 if mode == dtv.T2k: factor = 1 carriers = 2048 elif mode == dtv.T8k: factor = 4 carriers = 8192 if guard_interval == dtv.GI_1_32: gi = carriers / 32 elif guard_interval == dtv.GI_1_16: gi = carriers / 16 elif guard_interval == dtv.GI_1_8: gi = carriers / 8 elif guard_interval == dtv.GI_1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dtv_dvbt_energy_dispersal = dtv.dvbt_energy_dispersal(1 * factor) dtv_dvbt_reed_solomon_enc = dtv.dvbt_reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dtv_dvbt_convolutional_interleaver = dtv.dvbt_convolutional_interleaver((136 * factor), 12, 17) dtv_dvbt_inner_coder = dtv.dvbt_inner_coder(1, (1512 * factor), constellation, dtv.NH, code_rate) dtv_dvbt_bit_inner_interleaver = dtv.dvbt_bit_inner_interleaver((1512 * factor), constellation, dtv.NH, mode) dtv_dvbt_symbol_inner_interleaver = dtv.dvbt_symbol_inner_interleaver((1512 * factor), mode, 1) dtv_dvbt_map = dtv.dvbt_map((1512 * factor), constellation, dtv.NH, mode, 1) dtv_dvbt_reference_signals = dtv.dvbt_reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dtv.NH, code_rate, code_rate, guard_interval, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, )) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dtv_dvbt_energy_dispersal) tb.connect(dtv_dvbt_energy_dispersal, dtv_dvbt_reed_solomon_enc) tb.connect(dtv_dvbt_reed_solomon_enc, dtv_dvbt_convolutional_interleaver) tb.connect(dtv_dvbt_convolutional_interleaver, dtv_dvbt_inner_coder) tb.connect(dtv_dvbt_inner_coder, dtv_dvbt_bit_inner_interleaver) tb.connect(dtv_dvbt_bit_inner_interleaver, dtv_dvbt_symbol_inner_interleaver) tb.connect(dtv_dvbt_symbol_inner_interleaver, dtv_dvbt_map) tb.connect(dtv_dvbt_map, dtv_dvbt_reference_signals) tb.connect(dtv_dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
def __init__(self): gr.top_block.__init__(self, "FFT Demo", catch_exceptions=True) Qt.QWidget.__init__(self) self.setWindowTitle("FFT Demo") 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", "fft_demo") 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 = 32000 self.freq = freq = 1000 self.fft_size = fft_size = 1024 ################################################## # Blocks ################################################## self._freq_range = Range(int(-samp_rate / 2), int(samp_rate / 2), 1, 1000, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'freq', "counter_slider", float, QtCore.Qt.Horizontal) self.top_grid_layout.addWidget(self._freq_win) self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f( fft_size, 0, 1.0, "x-Axis", "y-Axis", "", 2, # Number of inputs None # parent ) self.qtgui_vector_sink_f_0.set_update_time(0.10) self.qtgui_vector_sink_f_0.set_y_axis(-10, 10) self.qtgui_vector_sink_f_0.enable_autoscale(False) self.qtgui_vector_sink_f_0.enable_grid(False) self.qtgui_vector_sink_f_0.set_x_axis_units("") self.qtgui_vector_sink_f_0.set_y_axis_units("") self.qtgui_vector_sink_f_0.set_ref_level(0) 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, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(2): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_win) self.legacy_cudaops_fft_0 = legacy_cudaops.cufft(fft_size, True, True, 1, legacy_cudaops.memory_model_t.TRADITIONAL) self.fft_vxx_0 = fft.fft_vcc(fft_size, True, window.rectangular(fft_size), False, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size) self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(1, fft_size, 0) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(1, fft_size, 0) self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(fft_size) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(fft_size) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_nlog10_ff_0_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.qtgui_vector_sink_f_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.qtgui_vector_sink_f_0, 1)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.legacy_cudaops_fft_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_0_0, 0)) self.connect((self.legacy_cudaops_fft_0, 0), (self.blocks_complex_to_mag_0, 0))
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))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Am Soundcard") ################################################## # Variables ################################################## self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=128, decimation=135, 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, 3750) self.nrsc5_l1_am_encoder_ma1_0 = nrsc5.l1_am_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(1, 17900) self.low_pass_filter_1 = filter.fir_filter_fff( 1, firdes.low_pass( 0.5, audio_rate, 4500, 1000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(256, False, window.rectangular(256), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source('sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source('sample_mono.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 256) self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 14) for i in range(14)] + [1] * (256-14) + [math.cos(math.pi / 2 * i / 14) for i in range(14)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*256, 2) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*24000) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.7) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 270, 512, 121) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, int(audio_rate * 5.5)) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_0 = blocks.add_const_ff(0.5) self.audio_sink_0 = audio.sink(44100, '', True) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 1)) self.connect((self.blocks_delay_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_add_xx_0, 1)) 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.rational_resampler_xxx_1, 0)) self.connect((self.blocks_null_source_0, 0), (self.nrsc5_l1_am_encoder_ma1_0, 1)) 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, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_am_encoder_ma1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_am_encoder_ma1_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_am_encoder_ma1_0, 2)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_add_xx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="DVBT Scanner") ################################################## # Variables ################################################## self.threshold = threshold = -60 self.signal_level = signal_level = 0 self.samp_rate = samp_rate = 2048000 self.freq = freq = 525200000 self.fft_size = fft_size = 1024 self.detected = detected = 0 ################################################## # Blocks ################################################## _threshold_sizer = wx.BoxSizer(wx.VERTICAL) self._threshold_text_box = forms.text_box( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, label="Threshold", converter=forms.float_converter(), proportion=0, ) self._threshold_slider = forms.slider( parent=self.GetWin(), sizer=_threshold_sizer, value=self.threshold, callback=self.set_threshold, minimum=-100, maximum=0, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_threshold_sizer, 2, 0, 1, 1) self.probe_signal_lvl = blocks.probe_signal_f() self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spektrum") self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output") self.GridAdd(self.notebook, 0, 0, 1, 1) _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="Frequency", converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=478000000, maximum=862000000, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_freq_sizer, 1, 0, 1, 1) self.wxgui_numbersink2_1 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="Signal present", minval=0, maxval=1, factor=1.0, decimal_places=0, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=None, label="Signal Detection", peak_hold=False, show_gauge=True, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.notebook.GetPage(1).GetWin(), unit="dB", minval=-120, maxval=0, factor=1.0, decimal_places=1, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=0.03, label="Level", peak_hold=False, show_gauge=True, ) self.notebook.GetPage(1).Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.notebook.GetPage(0).GetWin(), baseband_freq=freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=fft_size, fft_rate=15, average=True, avg_alpha=0.03, title="FFT Plot", peak_hold=False, win=window.flattop, ) self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win) def _signal_level_probe(): while True: val = self.probe_signal_lvl.level() try: self.set_signal_level(val) except AttributeError: pass time.sleep(1.0 / (5)) _signal_level_thread = threading.Thread(target=_signal_level_probe) _signal_level_thread.daemon = True _signal_level_thread.start() self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "hackrf=0") self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(14, 0) self.rtlsdr_source_0.set_if_gain(24, 0) self.rtlsdr_source_0.set_bb_gain(12, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.probe_detected = blocks.probe_signal_f() self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.rectangular(fft_size)), True, 1) def _detected_probe(): while True: val = self.probe_detected.level() try: self.set_detected(val) except AttributeError: pass time.sleep(1.0 / (5)) _detected_thread = threading.Thread(target=_detected_probe) _detected_thread.daemon = True _detected_thread.start() self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_float * 1, fft_size) self.blocks_threshold_ff_0 = blocks.threshold_ff( threshold, threshold, threshold) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fft_size) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 1000, 0.001, 4000) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fft_size) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 1048580) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.probe_signal_lvl, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.probe_detected, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Rftap Nogrc Nox") ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.freq = freq = 2.437e9 self.chan_est = chan_est = ieee802_11.LMS ################################################## # Blocks ################################################## self.rftap_rftap_encap_0 = rftap.rftap_encap(0, -1, "") self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "") self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(10, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.ieee802_11_sync_short_0 = ieee802_11.sync_short( 0.56, 2, False, False) self.ieee802_11_sync_long_0 = ieee802_11.sync_long( sync_length, False, False) self.ieee802_11_parse_mac_0 = ieee802_11.parse_mac(freq, True, False) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff( window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc( window_size) self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer( chan_est, freq, samp_rate, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(False, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "52001", 10000, False) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.ieee802_11_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.rftap_rftap_encap_0, 'in')) self.msg_connect((self.rftap_rftap_encap_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) 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_delay_0, 0), (self.ieee802_11_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_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_sync_short_0, 2)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_frame_equalizer_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) 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_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_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.ieee802_11_sync_long_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def main(args): nargs = len(args) if nargs == 1: port = int(args[0]) outfile = None elif nargs == 2: port = int(args[0]) outfile = args[1] else: sys.stderr.write("Usage: dvbt-hackrf.py port [output_file]\n"); sys.exit(1) channel_mhz = 6 mode = dtv.T2k code_rate = dtv.C1_2 constellation = dtv.MOD_QPSK guard_interval = dtv.GI_1_32 symbol_rate = channel_mhz * 8000000.0 / 7 center_freq = 441000000 rf_gain = 14 if_gain = 40 if mode == dtv.T2k: factor = 1 carriers = 2048 elif mode == dtv.T8k: factor = 4 carriers = 8192 if guard_interval == dtv.GI_1_32: gi = carriers / 32 elif guard_interval == dtv.GI_1_16: gi = carriers / 16 elif guard_interval == dtv.GI_1_8: gi = carriers / 8 elif guard_interval == dtv.GI_1_4: gi = carriers / 4 if channel_mhz == 8: bandwidth = 8750000 elif channel_mhz == 7: bandwidth = 7000000 elif channel_mhz == 6: bandwidth = 6000000 elif channel_mhz == 5: bandwidth = 5000000 else: bandwidth = 8750000 tb = gr.top_block() src = grc_blks2.tcp_source(gr.sizeof_char*1, "127.0.0.1", port, True) dvbt_energy_dispersal = dtv.dvbt_energy_dispersal(1 * factor) dvbt_reed_solomon_enc = dtv.dvbt_reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) dvbt_convolutional_interleaver = dtv.dvbt_convolutional_interleaver((136 * factor), 12, 17) dvbt_inner_coder = dtv.dvbt_inner_coder(1, (1512 * factor), constellation, dtv.NH, code_rate) dvbt_bit_inner_interleaver = dtv.dvbt_bit_inner_interleaver((1512 * factor), constellation, dtv.NH, mode) dvbt_symbol_inner_interleaver = dtv.dvbt_symbol_inner_interleaver((1512 * factor), mode, 1) dvbt_map = dtv.dvbt_map((1512 * factor), constellation, dtv.NH, mode, 1) dvbt_reference_signals = dtv.dvbt_reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dtv.NH, code_rate, code_rate, dtv.GI_1_32, mode, 0, 0) fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10) digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "") blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, )) out = osmosdr.sink() out.set_sample_rate(symbol_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(rf_gain, 0) out.set_if_gain(if_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dvbt_energy_dispersal) tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc) tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver) tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder) tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver) tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver) tb.connect(dvbt_symbol_inner_interleaver, dvbt_map) tb.connect(dvbt_map, dvbt_reference_signals) tb.connect(dvbt_reference_signals, fft_vxx) tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer) tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx) tb.connect(blocks_multiply_const_vxx, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(blocks_multiply_const_vxx, dst) tb.run()
def __init__(self): gr.top_block.__init__(self, "Dvbt Tx") ################################################## # Variables ################################################## self._bandwidth_config = ConfigParser.ConfigParser() self._bandwidth_config.read('./dvbt.conf') try: bandwidth = self._bandwidth_config.getint('dvbt', 'bandwidth') except: bandwidth = 8000000 self.bandwidth = bandwidth self.samp_rate = samp_rate = (bandwidth / 7) * 8 self._rf_gain_config = ConfigParser.ConfigParser() self._rf_gain_config.read('./dvbt.conf') try: rf_gain = self._rf_gain_config.getint('hackrf', 'rf_gain') except: rf_gain = 0 self.rf_gain = rf_gain self._mode_config = ConfigParser.ConfigParser() self._mode_config.read('./dvbt.conf') try: mode = self._mode_config.get('dvbt', 'mode') except: mode = 0 self.mode = mode self._if_gain_config = ConfigParser.ConfigParser() self._if_gain_config.read('./dvbt.conf') try: if_gain = self._if_gain_config.getint('hackrf', 'if_gain') except: if_gain = 0 self.if_gain = if_gain self._guard_interval_config = ConfigParser.ConfigParser() self._guard_interval_config.read('./dvbt.conf') try: guard_interval = self._guard_interval_config.get( 'dvbt', 'guard_interval') except: guard_interval = 0 self.guard_interval = guard_interval self._frequency_config = ConfigParser.ConfigParser() self._frequency_config.read('./dvbt.conf') try: frequency = self._frequency_config.getint('hackrf', 'frequency') except: frequency = 858000000 self.frequency = frequency self._constellation_config = ConfigParser.ConfigParser() self._constellation_config.read('./dvbt.conf') try: constellation = self._constellation_config.get( 'dvbt', 'constellation') except: constellation = 0 self.constellation = constellation self._coderate_config = ConfigParser.ConfigParser() self._coderate_config.read('./dvbt.conf') try: coderate = self._coderate_config.get('dvbt', 'coderate') except: coderate = 0 self.coderate = coderate infile = str(sys.argv[1]) #Constellation QPSK 16QAM 64QAM if constellation == "QPSK": const = dtv.MOD_QPSK elif constellation == "16QAM": const = dtv.MOD_16QAM elif constellation == "64QAM": const = dtv.MOD_64QAM else: sys.stderr.write( "CONSTELLATION IN CONFIG WRONG! Values: QPSK, 16QAM or 64QAM \n" ) sys.exit(1) # Coderate 1/2 2/3 3/4 5/6 7/8 if coderate == "1/2": codr = dtv.C1_2 elif coderate == "2/3": codr = dtv.C2_3 elif coderate == "3/4": codr = dtv.C3_4 elif coderate == "5/6": codr = dtv.C5_6 elif coderate == "7/8": codr = dtv.C7_8 else: sys.stderr.write( "CODERATE IN CONFIG WRONG! Values: 1/2, 2/3, 3/4, 5/6 or 7/8 \n" ) sys.exit(1) if mode == "2k": factor = 1 carriers = 2048 modus = dtv.T2k elif mode == "8k": factor = 4 carriers = 8192 modus = dtv.T8k else: sys.stderr.write("MODE IN CONFIG WRONG! Values: 2k or 8k \n") sys.exit(1) #guard_interval dtv.GI_1_32 1/4 1/8 1/16 1/32 if guard_interval == "1/4": guardi = dtv.GI_1_4 gi = carriers / 4 elif guard_interval == "1/8": guardi = dtv.GI_1_8 gi = carriers / 8 elif guard_interval == "1/16": guardi = dtv.GI_1_16 gi = carriers / 16 elif guard_interval == "1/32": guardi = dtv.GI_1_32 gi = carriers / 32 else: sys.stderr.write( "GUARD_INTERVAL IN CONFIG WRONG! Values: 1/4, 1/8, 1/16 or 1/32 \n" ) sys.exit(1) ################################################## # Blocks ################################################## self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '') self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(frequency, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(rf_gain, 0) self.osmosdr_sink_0.set_if_gain(if_gain, 0) self.osmosdr_sink_0.set_bb_gain(0, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.fft_vxx_0 = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 1) self.dtv_dvbt_symbol_inner_interleaver_0 = dtv.dvbt_symbol_inner_interleaver( (1512 * factor), modus, 1) self.dtv_dvbt_reference_signals_0 = dtv.dvbt_reference_signals( gr.sizeof_gr_complex, (1512 * factor), carriers, const, dtv.NH, codr, codr, guardi, modus, 1, 0) self.dtv_dvbt_reed_solomon_enc_0 = dtv.dvbt_reed_solomon_enc( 2, 8, 0x11d, 255, 239, 8, 51, (8 * factor)) self.dtv_dvbt_map_0 = dtv.dvbt_map((1512 * factor), const, dtv.NH, modus, 1) self.dtv_dvbt_inner_coder_0 = dtv.dvbt_inner_coder( 1, (1512 * factor), const, dtv.NH, codr) self.dtv_dvbt_energy_dispersal_0 = dtv.dvbt_energy_dispersal(1 * factor) self.dtv_dvbt_convolutional_interleaver_0 = dtv.dvbt_convolutional_interleaver( (136 * factor), 12, 17) self.dtv_dvbt_bit_inner_interleaver_0 = dtv.dvbt_bit_inner_interleaver( (1512 * factor), const, dtv.NH, modus) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( carriers, carriers + (gi), 0, '') self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (0.0022097087, )) if infile == "-": self.blocks_file_descriptor_source_0 = blocks.file_descriptor_source( gr.sizeof_char * 1, 0, True) else: self.blocks_file_source_0 = blocks.file_source( gr.sizeof_char * 1, infile, True) ################################################## # Connections ################################################## if infile == "-": self.connect((self.blocks_file_descriptor_source_0, 0), (self.dtv_dvbt_energy_dispersal_0, 0)) else: self.connect((self.blocks_file_source_0, 0), (self.dtv_dvbt_energy_dispersal_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.dtv_dvbt_bit_inner_interleaver_0, 0), (self.dtv_dvbt_symbol_inner_interleaver_0, 0)) self.connect((self.dtv_dvbt_convolutional_interleaver_0, 0), (self.dtv_dvbt_inner_coder_0, 0)) self.connect((self.dtv_dvbt_energy_dispersal_0, 0), (self.dtv_dvbt_reed_solomon_enc_0, 0)) self.connect((self.dtv_dvbt_inner_coder_0, 0), (self.dtv_dvbt_bit_inner_interleaver_0, 0)) self.connect((self.dtv_dvbt_map_0, 0), (self.dtv_dvbt_reference_signals_0, 0)) self.connect((self.dtv_dvbt_reed_solomon_enc_0, 0), (self.dtv_dvbt_convolutional_interleaver_0, 0)) self.connect((self.dtv_dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0)) self.connect((self.dtv_dvbt_symbol_inner_interleaver_0, 0), (self.dtv_dvbt_map_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Jun28") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx Jun28") 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_jun28") 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.5e6 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.5e6, 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_2 = qtgui.time_sink_f( 32, #size 10, #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("Amplitude", "") 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_0_0_0_0 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #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(-2, 2) 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_TAG, qtgui.TRIG_SLOPE_POS, 0.02, 0.1, 0, "ofdm_start") 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 = ["samples", "corr", "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_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) 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_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, threshold, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0.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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_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_freq_sink_x_0 = qtgui.freq_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ofdm_80211_ftc_0 = ofdm_80211.ftc() self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_float,1,3) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("2") 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(743e6) 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(0) self.nutaq_radio420_tx_0_0.set_default_tx_freq(743e6) 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(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(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(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(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.101") 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, False) 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, False) 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_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) ################################################## # Connections ################################################## 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_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) 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.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_0_0_0_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.ofdm_80211_ftc_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.qtgui_freq_sink_x_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, 3), (self.qtgui_time_sink_x_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi 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_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = ["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_1_0_0_0 = qtgui.time_sink_f( 1024*16*4, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0_0_0.set_y_axis(-0.1, 1.4) self.qtgui_time_sink_x_1_0_0_0.set_y_label("Amplitude ----", "") self.qtgui_time_sink_x_1_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.63, 0, 0, "") self.qtgui_time_sink_x_1_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_1_0_0_0.enable_grid(False) self.qtgui_time_sink_x_1_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_0_0_0.disable_legend() labels = ["RATIO", "", "", "", "", "", "", "", "", ""] 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 = [2.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_1_0_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_0_0_win) self.qtgui_time_sink_x_1_0_0 = qtgui.time_sink_f( 1024*16*4, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0_0.set_y_axis(-0.001, 0.2) self.qtgui_time_sink_x_1_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 0, 0, "") self.qtgui_time_sink_x_1_0_0.enable_autoscale(True) self.qtgui_time_sink_x_1_0_0.enable_grid(False) self.qtgui_time_sink_x_1_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_0_0.disable_legend() labels = ["Power av.", "", "", "", "", "", "", "", "", ""] 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_1_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_0_win) self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f( 1024*16*4, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0.set_y_axis(-0.001, 0.2) self.qtgui_time_sink_x_1_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 0, 0, "") self.qtgui_time_sink_x_1_0.enable_autoscale(True) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_0.disable_legend() labels = ["Correlation av.", "", "", "", "", "", "", "", "", ""] 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_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win) 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(8192) self.nutaq_rtdex_source_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(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(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(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(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(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_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.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.85 * 0.75, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) 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(True, True) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) 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.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) 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_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*48) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm.pcap", True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1, 1) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.qtgui_time_sink_x_1_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, 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_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_divide_xx_0, 0), (self.qtgui_time_sink_x_1_0_0_0, 0)) 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_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_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_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) 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_moving_average_xx_1, 0), (self.qtgui_time_sink_x_1_0_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.blocks_null_sink_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.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_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.blocks_deinterleave_0, 0))
_probe_level_thread.daemon = True _probe_level_thread.start() def _probe_detection_probe(): while True: val = self.probe_signal_detection.level() try: self.set_probe_detection(val) except AttributeError, e: pass time.sleep(1.0 / (10)) _probe_detection_thread = threading.Thread(target=_probe_detection_probe) _probe_detection_thread.daemon = True _probe_detection_thread.start() self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.rectangular(fft_size)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float * 1, fft_size) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate) self.blocks_threshold_ff_0 = blocks.threshold_ff(threshold, threshold, threshold) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex * 1, fft_size) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(fft_size, 1.0 / fft_size, 4000) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_size) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, fft_size * fft_size) ################################################## # Connections ################################################## self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Am Hackrf", catch_exceptions=True) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 1710e3 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=4096, decimation=243, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=200, decimation=21, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=[], fractional_bw=-1.0) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(freq + 100000, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(0, 0) self.osmosdr_sink_0.set_if_gain(1, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(1.5e6, 0) 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, 3750) self.nrsc5_l1_am_encoder_ma1_0 = nrsc5.l1_am_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(1, 17900) self.low_pass_filter_1 = filter.fir_filter_fff( 1, firdes.low_pass( 0.5, audio_rate, 4500, 1000, window.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(256, False, window.rectangular(256), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source('sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source('sample_mono.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 256) self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 14) for i in range(14)] + [1] * (256-14) + [math.cos(math.pi / 2 * i / 14) for i in range(14)], True, 1, []) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2 * math.pi * 100000 / samp_rate) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*256, 2) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*24000) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 270, 512, 121) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, int(audio_rate * 5.5)) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_0 = blocks.add_const_ff(0.5) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_delay_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_null_source_0, 0), (self.nrsc5_l1_am_encoder_ma1_0, 1)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.osmosdr_sink_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, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_am_encoder_ma1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_am_encoder_ma1_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_am_encoder_ma1_0, 2)) self.connect((self.rational_resampler_xxx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_add_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Hackrf") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=None, fractional_bw=None) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "") self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(0, 0) self.osmosdr_sink_0.set_if_gain(40, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.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.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) 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.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_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_add_xx_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, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_xx_0, 1)) 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_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))