def __init__(self, options, callback=None): gr.top_block.__init__(self) if options.freq is not None: u = uhd_receiver(options.rx_args, options.bandwidth, options.rx_freq, options.rx_gain, options.spec, options.antenna, options.verbose, options.external) if options.bandwidth > 5e6: u.u.set_min_output_buffer(163840) elif options.infile is not None: u = blocks.file_source(gr.sizeof_gr_complex, options.infile) else: import sys sys.stderr.write("--freq or --infile must be specified\n") raise SystemExit self.callback = callback rx = ofdm_receive_path(options,self.callback) self.connect(u, rx) if options.profile: from gnuradio.ctrlport import monitor self.ctrlport_monitor = monitor() self.ctrlport_monitor_performance = monitor("gr-perf-monitorx")
def __init__(self): gr.top_block.__init__(self, "Control Port") Qt.QWidget.__init__(self) self.setWindowTitle("Control Port") 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", "control_port") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_ctrlport_monitor_performance_0 = not True or monitor( "gr-perf-monitorx") self.blocks_ctrlport_monitor_0 = not True or monitor() self.audio_sink_0 = audio.sink(samp_rate, '', True) self.analog_noise_source_x_0 = analog.noise_source_f( analog.GR_GAUSSIAN, 0.1, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32e3 ################################################## # Blocks ################################################## self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.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.Add(self.wxgui_scopesink2_0.win) self.digital_map_bb_0 = digital.map_bb(([1, -1])) self.blocks_vector_source_x_0 = blocks.vector_source_i((1, 1, 1, 0), True, 1, []) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int*1, samp_rate,True) self.blocks_int_to_float_0 = blocks.int_to_float(1, 1) self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.blocks_ctrlport_monitor_performance_0 = not True or monitor("gr-perf-monitorx") self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_add_xx_0 = blocks.add_vff(1) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.blocks_int_to_float_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_int_to_float_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_char_to_float_0, 0))
class top_block(gr.top_def): init __block__(self): gr.top_block.__init__(self, "Top Block") ################################################## # Variables ################################################## self.samp_rate_0 = samp_rate_0 = 32000 self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## 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(0, 0) self.uhd_usrp_source_0.set_gain(0, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(0, 0) self.uhd_usrp_sink_0.set_gain(0, 0) self.blocks_ctrlport_monitor_performance_0 = not True or monitor("gr-perf-monitorx") ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.uhd_usrp_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "LTE_test") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 30.72e6 self.pbch_descr_key = pbch_descr_key = "descr_part" self.interp_val = interp_val = int(samp_rate/1e4) self.frame_key = frame_key = "slot" self.fftlen = fftlen = 2048 self.N_rb_dl = N_rb_dl = 50 ################################################## # Blocks ################################################## self.sync_lte_sss_sync_hier_0 = lte_sss_sync_hier( fftlen=fftlen, N_rb_dl=N_rb_dl, group_key="N_id_2", offset_key="offset_marker", ) self.sync_lte_rough_symbol_sync_cc_0 = lte.rough_symbol_sync_cc(fftlen, "sync_lte_rough_symbol_sync_cc_0") self.sync_lte_pss_sync_37_0 = lte_pss_sync_37( fftlen=fftlen, ) self.sync_lte_cp_freq_sync_0 = lte_cp_freq_sync( fftlen=2048, ) self.pre_rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp_val, decimation=1000, taps=None, fractional_bw=None, ) self.pre_blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/johannes/recorded_data/Messung_LTE_2012-05-23_12:47:32.dat", True) self.pcfich_decode_pcfich_37_0 = decode_pcfich_37( N_rb_dl=N_rb_dl, key=frame_key, ) self.pbch_decode_pbch_37_0 = decode_pbch_37( N_rb_dl=N_rb_dl, ) self.ofdm_lte_ofdm_hier_0 = lte_ofdm_hier( N_rb_dl=50, fftlen=2048, ofdm_key=frame_key, ) self.ofdm_estimator_lte_estimator_hier_0 = lte_estimator_hier( initial_id=387, estimator_key="slot", N_rb_dl=50, ) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate) self.blocks_ctrlport_monitor_performance_0 = not True or monitor("gr-perf-monitorx") self.bch_decode_bch_hier_gr37_0 = decode_bch_hier_gr37() self.MIB = lte.mib_unpack_vbm("MIB") ################################################## # Connections ################################################## self.connect((self.bch_decode_bch_hier_gr37_0, 0), (self.MIB, 0)) self.connect((self.bch_decode_bch_hier_gr37_0, 1), (self.MIB, 1)) self.connect((self.pbch_decode_pbch_37_0, 0), (self.bch_decode_bch_hier_gr37_0, 0)) self.connect((self.ofdm_estimator_lte_estimator_hier_0, 1), (self.pcfich_decode_pcfich_37_0, 2)) self.connect((self.ofdm_estimator_lte_estimator_hier_0, 0), (self.pcfich_decode_pcfich_37_0, 1)) self.connect((self.ofdm_estimator_lte_estimator_hier_0, 0), (self.pbch_decode_pbch_37_0, 1)) self.connect((self.ofdm_lte_ofdm_hier_0, 0), (self.pcfich_decode_pcfich_37_0, 0)) self.connect((self.ofdm_lte_ofdm_hier_0, 0), (self.pbch_decode_pbch_37_0, 0)) self.connect((self.ofdm_estimator_lte_estimator_hier_0, 1), (self.pbch_decode_pbch_37_0, 2)) self.connect((self.sync_lte_pss_sync_37_0, 0), (self.sync_lte_cp_freq_sync_0, 0)) self.connect((self.sync_lte_rough_symbol_sync_cc_0, 0), (self.sync_lte_pss_sync_37_0, 0)) self.connect((self.ofdm_lte_ofdm_hier_0, 0), (self.ofdm_estimator_lte_estimator_hier_0, 0)) self.connect((self.sync_lte_cp_freq_sync_0, 0), (self.sync_lte_sss_sync_hier_0, 0)) self.connect((self.sync_lte_sss_sync_hier_0, 0), (self.ofdm_lte_ofdm_hier_0, 0)) self.connect((self.pre_blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.pre_rational_resampler_xxx_0, 0)) self.connect((self.pre_rational_resampler_xxx_0, 0), (self.sync_lte_rough_symbol_sync_cc_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.MIB, "N_ant", self.pcfich_decode_pcfich_37_0, "N_ant") self.msg_connect(self.sync_lte_sss_sync_hier_0, "cell_id", self.ofdm_estimator_lte_estimator_hier_0, "cell_id") self.msg_connect(self.sync_lte_sss_sync_hier_0, "cell_id", self.pbch_decode_pbch_37_0, "cell_id") self.msg_connect(self.sync_lte_sss_sync_hier_0, "cell_id", self.pcfich_decode_pcfich_37_0, "cell_id")
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sample_rate = sample_rate = 48000 self.noise = noise = 0 self.input_chooser = input_chooser = 1 self.delay2_0 = delay2_0 = 17 self.delay2 = delay2 = 5 ################################################## # Blocks ################################################## self._noise_range = Range(0, 1, 0.01, 0, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise', "counter_slider", float) self.top_layout.addWidget(self._noise_win) self._input_chooser_options = (0, 1, ) self._input_chooser_labels = ('Test Symbol stream [3,3,-3,-3]', 'Stochastic Stream', ) self._input_chooser_tool_bar = Qt.QToolBar(self) self._input_chooser_tool_bar.addWidget(Qt.QLabel('Input Selection'+": ")) self._input_chooser_combo_box = Qt.QComboBox() self._input_chooser_tool_bar.addWidget(self._input_chooser_combo_box) for label in self._input_chooser_labels: self._input_chooser_combo_box.addItem(label) self._input_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(self._input_chooser_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._input_chooser_options.index(i))) self._input_chooser_callback(self.input_chooser) self._input_chooser_combo_box.currentIndexChanged.connect( lambda i: self.set_input_chooser(self._input_chooser_options[i])) self.top_grid_layout.addWidget(self._input_chooser_tool_bar, 0,0,1,1) self._delay2_0_range = Range(0, 100, 1, 17, 200) self._delay2_0_win = RangeWidget(self._delay2_0_range, self.set_delay2_0, 'Input delay', "counter_slider", float) self.top_layout.addWidget(self._delay2_0_win) self._delay2_range = Range(0, 100, 1, 5, 200) self._delay2_win = RangeWidget(self._delay2_range, self.set_delay2, 'delay2', "counter_slider", float) self.top_layout.addWidget(self._delay2_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 512, #size 48000, #samp_rate "", #name 1 #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('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(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 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_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( 1024, #size 4800, #samp_rate "", #name 3 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-5, 5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_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 = ['Chain Fixed', 'Chain Actual', 'Chain Fixed Test', '', '', '', '', '', '', ''] 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, 2, -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.p25_freq_mod_fc_0 = p25.freq_mod_fc( sample_rate=48000, max_amplitude=4.38895, max_deviation=2827, sensitivity_adjust=1, verbose=False, log=False ) self.p25_freq_demod_cf_0 = p25.freq_demod_cf( sample_rate=48000, max_amplitude=4.38895, max_deviation=2827, gain_adjust=1.0, verbose=False, log=False ) self.p25_c4fm_modulator_bf_0 = p25.c4fm_modulator_bf( filter_gain=1, dibit_map=([1.0/3.0, 1.0, -(1.0/3.0), -1.0]), sample_rate=48000, symbol_rate=4800, span=11, verbose=False, log=False ) self.p25_c4fm_demodulator_fixed_fb_0 = p25.c4fm_demodulator_fixed_fb( filter_gain=3.0, dibits=([3, 2, 0, 1]), sample_rate=48000, symbol_rate=4800, delay=int(delay2), span=11, verbose=False, log=False ) self.p25_c4fm_demodulator_fb_0 = p25.c4fm_demodulator_fb( filter_gain=3.0, dibits=([3, 2, 0, 1]), sample_rate=48000, symbol_rate=4800, span=11, verbose=False, log=False ) self.blocks_vector_source_x_0 = blocks.vector_source_i((1,1,3,3), True, 1, []) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int*1, 240000,True) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 1024) self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vii((1 if input_chooser == 1 else 0, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vii((1 if input_chooser == 0 else 0, )) self.blocks_int_to_float_0 = blocks.int_to_float(1, 1) self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, int(delay2_0)) self.blocks_ctrlport_monitor_performance_0 = not False or monitor("gr-perf-monitorx") self.blocks_char_to_float_0_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) self.blocks_add_xx_2 = blocks.add_vcc(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vii(1) self.analog_random_uniform_source_x_0 = analog.random_uniform_source_i(0, 4, 0) self.analog_noise_source_x_1 = analog.noise_source_c(analog.GR_GAUSSIAN, 1, 0) self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, float(noise), 0) self.analog_const_source_x_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 1) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_add_xx_2, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.analog_noise_source_x_1, 0), (self.blocks_add_xx_2, 1)) self.connect((self.analog_random_uniform_source_x_0, 0), (self.blocks_multiply_const_vxx_2, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.p25_freq_demod_cf_0, 0)) self.connect((self.blocks_add_xx_2, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_char_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0, 2)) self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.p25_c4fm_modulator_bf_0, 0)) self.connect((self.blocks_int_to_float_0, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_int_to_float_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_skiphead_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_int_to_float_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.p25_c4fm_demodulator_fb_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.p25_c4fm_demodulator_fixed_fb_0, 0), (self.blocks_char_to_float_0_0_0, 0)) self.connect((self.p25_c4fm_modulator_bf_0, 0), (self.p25_freq_mod_fc_0, 0)) self.connect((self.p25_freq_demod_cf_0, 0), (self.p25_c4fm_demodulator_fb_0, 0)) self.connect((self.p25_freq_demod_cf_0, 0), (self.p25_c4fm_demodulator_fixed_fb_0, 0)) self.connect((self.p25_freq_mod_fc_0, 0), (self.blocks_add_xx_1, 0))
def __init__(self, decim=50, decim_df=.2, decim_f=.4, device_address="type=b200", device_arguments="master_clock_rate=30.72e6", df_ref=0, df_test=10e3, f_sample=960e3*4, f_sig=6e9, g_ref=0, g_sig=0, g_test=49, n_samples=1<<24, name="test", pass_tags=False, port_base=6880, f_dsp=0): gr.top_block.__init__(self, "Ampm Cli") ################################################## # Parameters ################################################## self.decim = decim self.decim_df = decim_df self.decim_f = decim_f self.device_address = device_address self.device_arguments = device_arguments self.df_ref = df_ref self.df_test = df_test self.f_sample = f_sample self.f_sig = f_sig self.g_ref = g_ref self.g_sig = g_sig self.g_test = g_test self.n_samples = n_samples self.name = name self.pass_tags = pass_tags self.port_base = port_base self.f_dsp = f_dsp ################################################## # Variables ################################################## self.info = info = {"name":name, "f_sig":f_sig, "df_ref":df_ref, "f_sample":f_sample, "decim":decim} self.filename = filename = "{:s}_f0{:.5g}_df{:.5g}_fs{:.5g}_d{:.5g}".format(name, f_sig/1e6, df_ref, f_sample/1e6, decim) ################################################## # Blocks ################################################## self.zeromq_sub_source_0_2_0 = zeromq.sub_source(gr.sizeof_float, decim**0, "tcp://localhost:{}".format(port_base + 9), 100, pass_tags) self.zeromq_sub_source_0_2 = zeromq.sub_source(gr.sizeof_gr_complex, decim**0, "tcp://localhost:{}".format(port_base + 0), 100, pass_tags) self.zeromq_sub_source_0_1 = zeromq.sub_source(gr.sizeof_gr_complex, decim**1, "tcp://localhost:6881", 100, pass_tags) self.zeromq_sub_source_0_0 = zeromq.sub_source(gr.sizeof_gr_complex, decim**3, "tcp://localhost:6883", 100, pass_tags) self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_gr_complex, decim**2, "tcp://localhost:6882", 100, pass_tags) self.zeromq_pub_sink_0_1_2 = zeromq.pub_sink(gr.sizeof_float, decim**0, "tcp://*:{}".format(port_base + 9), 100, pass_tags) self.zeromq_pub_sink_0_1_1 = zeromq.pub_sink(gr.sizeof_gr_complex, decim**1, "tcp://*:{}".format(port_base + 1), 100, pass_tags) self.zeromq_pub_sink_0_1_0_0 = zeromq.pub_sink(gr.sizeof_gr_complex, decim**3, "tcp://*:{}".format(port_base + 3), 100, pass_tags) self.zeromq_pub_sink_0_1_0 = zeromq.pub_sink(gr.sizeof_gr_complex, decim**2, "tcp://*:{}".format(port_base + 2), 100, pass_tags) self.zeromq_pub_sink_0_1 = zeromq.pub_sink(gr.sizeof_gr_complex, decim**0, "tcp://*:{}".format(port_base + 0), 100, pass_tags) self.uhd_usrp_source_0_0 = uhd.usrp_source( ",".join((device_address, device_arguments)), uhd.stream_args( cpu_format="fc32", channels=range(2), ), ) self.uhd_usrp_source_0_0.set_subdev_spec("A:A A:B", 0) self.uhd_usrp_source_0_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_source_0_0.set_samp_rate(f_sample) self.uhd_usrp_source_0_0.set_center_freq(uhd.tune_request(target_freq=f_sig , dsp_freq=f_dsp, rf_freq_policy=uhd.tune_request.POLICY_AUTO, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0_0.set_gain(g_sig, 0) self.uhd_usrp_source_0_0.set_bandwidth(30.72e6, 0) self.uhd_usrp_source_0_0.set_center_freq(uhd.tune_request(target_freq=f_sig + df_ref, dsp_freq=f_dsp, rf_freq_policy=uhd.tune_request.POLICY_AUTO, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL), 1) self.uhd_usrp_source_0_0.set_gain(g_ref, 1) self.uhd_usrp_source_0_0.set_bandwidth(30.72e6, 1) self.blocks_stream_to_vector_0_1_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, decim**3) self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, decim**2) self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(gr.sizeof_float*1, decim**0) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, decim**0) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, decim**1) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*decim**3, n_samples/decim**3) self.blocks_head_0_1 = blocks.head(gr.sizeof_gr_complex*decim**1, n_samples/decim**1) self.blocks_head_0_0 = blocks.head(gr.sizeof_gr_complex*decim**3, n_samples/decim**3) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex*decim**2, n_samples/decim**2) self.blocks_file_meta_sink_0_3_0 = blocks.file_meta_sink(gr.sizeof_float*decim**0, "{}_w.bin".format(filename), f_sample, decim**3, blocks.GR_FILE_FLOAT, False, 1<<20, "", True) self.blocks_file_meta_sink_0_3_0.set_unbuffered(False) self.blocks_file_meta_sink_0_3 = blocks.file_meta_sink(gr.sizeof_gr_complex*decim**0, "{}_0.bin".format(filename), f_sample, decim**3, blocks.GR_FILE_FLOAT, True, 1<<20, "", True) self.blocks_file_meta_sink_0_3.set_unbuffered(False) self.blocks_file_meta_sink_0_1 = blocks.file_meta_sink(gr.sizeof_gr_complex*decim**1, "{}_1.bin".format(filename), f_sample, decim**2, blocks.GR_FILE_FLOAT, True, 1<<20, "", True) self.blocks_file_meta_sink_0_1.set_unbuffered(False) self.blocks_file_meta_sink_0_0 = blocks.file_meta_sink(gr.sizeof_gr_complex*decim**3, "{}_3.bin".format(filename), f_sample, decim**0, blocks.GR_FILE_FLOAT, True, 1<<20, "", True) self.blocks_file_meta_sink_0_0.set_unbuffered(False) self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_gr_complex*decim**2, "{}_2.bin".format(filename), f_sample, decim**1, blocks.GR_FILE_FLOAT, True, 1<<20, "", True) self.blocks_file_meta_sink_0.set_unbuffered(False) self.blocks_ctrlport_probe2_c_0_1 = blocks.ctrlport_probe2_c("d0", "diff0", 1024, gr.DISPTIME) self.blocks_ctrlport_probe2_c_0_0 = blocks.ctrlport_probe2_c("b", "input b", 1024, gr.DISPTIME) self.blocks_ctrlport_probe2_c_0 = blocks.ctrlport_probe2_c("a", "input a", 1024, gr.DISPTIME) self.blocks_ctrlport_monitor_0 = not True or monitor() self.Ampm_0 = Ampm( decim=decim, decim_df=decim_df, decim_f=decim_f, ) ################################################## # Connections ################################################## self.connect((self.Ampm_0, 0), (self.blocks_ctrlport_probe2_c_0_1, 0)) self.connect((self.Ampm_0, 2), (self.blocks_stream_to_vector_0, 0)) self.connect((self.Ampm_0, 3), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.Ampm_0, 4), (self.blocks_stream_to_vector_0_0_0, 0)) self.connect((self.Ampm_0, 1), (self.blocks_stream_to_vector_0_1, 0)) self.connect((self.Ampm_0, 0), (self.blocks_stream_to_vector_0_1_0, 0)) self.connect((self.blocks_head_0, 0), (self.blocks_file_meta_sink_0, 0)) self.connect((self.blocks_head_0_0, 0), (self.blocks_file_meta_sink_0_0, 0)) self.connect((self.blocks_head_0_1, 0), (self.blocks_file_meta_sink_0_1, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_head_0_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.zeromq_pub_sink_0_1_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.zeromq_pub_sink_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0_0, 0), (self.zeromq_pub_sink_0_1_2, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.zeromq_pub_sink_0_1_0, 0)) self.connect((self.blocks_stream_to_vector_0_1_0, 0), (self.zeromq_pub_sink_0_1_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.Ampm_0, 0)) self.connect((self.uhd_usrp_source_0_0, 1), (self.Ampm_0, 1)) self.connect((self.uhd_usrp_source_0_0, 0), (self.blocks_ctrlport_probe2_c_0, 0)) self.connect((self.uhd_usrp_source_0_0, 1), (self.blocks_ctrlport_probe2_c_0_0, 0)) self.connect((self.zeromq_sub_source_0, 0), (self.blocks_head_0, 0)) self.connect((self.zeromq_sub_source_0_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.zeromq_sub_source_0_1, 0), (self.blocks_head_0_1, 0)) self.connect((self.zeromq_sub_source_0_2, 0), (self.blocks_file_meta_sink_0_3, 0)) self.connect((self.zeromq_sub_source_0_2_0, 0), (self.blocks_file_meta_sink_0_3_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") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "CPU Workflow", #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(-1, 1) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_0.enable_autoscale(False) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_0.enable_control_panel(False) self.qtgui_time_sink_x_1_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_1_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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_grid_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "OpenACC Workflow", #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(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.openacc_accMagPhaseToComplex_1_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 1) self.openacc_accMagPhaseToComplex_1 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accMagPhaseToComplex_0_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accMagPhaseToComplex_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accComplexToMag_0_0 = openacc.accComplexToMag( 1, 0, 1, 0, 0) self.openacc_accComplexToMag_0 = openacc.accComplexToMag(1, 0, 1, 0, 0) self.openacc_accComplexToMagPhase_0_0 = openacc.accComplexToMagPhase( 1, 0, 1, 0, 0) self.openacc_accComplexToMagPhase_0 = openacc.accComplexToMagPhase( 1, 0, 1, 1, 0) self.openacc_accComplexToArg_0_0 = openacc.accComplexToArg( 1, 0, 1, 0, 0) self.openacc_accComplexToArg_0 = openacc.accComplexToArg(1, 0, 1, 0, 0) self.blocks_magphase_to_complex_1_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_1 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.blocks_ctrlport_monitor_performance_0 = not True or monitor( "gr-perf-monitorx") self.blocks_complex_to_magphase_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_complex_to_arg_0_0 = blocks.complex_to_arg(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.openacc_accComplexToMagPhase_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_complex_to_magphase_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_magphase_to_complex_1, 1)) self.connect((self.blocks_complex_to_arg_0_0, 0), (self.blocks_magphase_to_complex_1_0, 1)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_magphase_to_complex_1, 0)) self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_magphase_to_complex_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0, 0), (self.blocks_magphase_to_complex_0, 0)) self.connect((self.blocks_complex_to_magphase_0, 1), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_complex_to_magphase_0_0, 0), (self.blocks_magphase_to_complex_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0, 1), (self.blocks_magphase_to_complex_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0, 0), (self.blocks_complex_to_arg_0_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0, 0), (self.blocks_complex_to_mag_0_0, 0)) self.connect((self.blocks_magphase_to_complex_1, 0), (self.blocks_complex_to_magphase_0_0, 0)) self.connect((self.blocks_magphase_to_complex_1_0, 0), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.openacc_accComplexToArg_0, 0), (self.openacc_accMagPhaseToComplex_1, 1)) self.connect((self.openacc_accComplexToArg_0_0, 0), (self.openacc_accMagPhaseToComplex_1_0, 1)) self.connect((self.openacc_accComplexToMagPhase_0, 0), (self.openacc_accMagPhaseToComplex_0, 0)) self.connect((self.openacc_accComplexToMagPhase_0, 1), (self.openacc_accMagPhaseToComplex_0, 1)) self.connect((self.openacc_accComplexToMagPhase_0_0, 0), (self.openacc_accMagPhaseToComplex_0_0, 0)) self.connect((self.openacc_accComplexToMagPhase_0_0, 1), (self.openacc_accMagPhaseToComplex_0_0, 1)) self.connect((self.openacc_accComplexToMag_0, 0), (self.openacc_accMagPhaseToComplex_1, 0)) self.connect((self.openacc_accComplexToMag_0_0, 0), (self.openacc_accMagPhaseToComplex_1_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0, 0), (self.openacc_accComplexToArg_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0, 0), (self.openacc_accComplexToMag_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0_0, 0), (self.openacc_accComplexToArg_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0_0, 0), (self.openacc_accComplexToMag_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_1, 0), (self.openacc_accComplexToMagPhase_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_1_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self): gr.top_block.__init__( self, "OFDM in the presence of fast fading, channel and hardware impairments" ) Qt.QWidget.__init__(self) self.setWindowTitle( "OFDM in the presence of fast fading, channel and hardware impairments" ) 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", "ofdm_simulation") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.vec_length = vec_length = 1 self.update_period = update_period = 0.10 self.timing = timing = 1.0001 self.samp_rate = samp_rate = 7.68e6 self.q_offset = q_offset = 0 self.phase_noise = phase_noise = 0 self.packet_len = packet_len = 50 self.num_of_points = num_of_points = 1024 self.noise = noise = 1.2 self.len_tag_key = len_tag_key = "packet_len" self.iq_ph = iq_ph = 0 self.iq_mag = iq_mag = 0 self.i_offset = i_offset = 0 self.freq = freq = 0.01 self.fft_len = fft_len = 128 self.dist3 = dist3 = 0 self.dist2 = dist2 = 0 self.cfo_std = cfo_std = 0.01 ################################################## # Blocks ################################################## self._timing_range = Range(0.999, 1.001, 0.0001, 1.0001, 200) self._timing_win = RangeWidget(self._timing_range, self.set_timing, 'Timing Offset', "slider", float) self.top_grid_layout.addWidget(self._timing_win, 0, 2, 1, 1) self._q_offset_range = Range(-1, 1, 0.01, 0, 200) self._q_offset_win = RangeWidget(self._q_offset_range, self.set_q_offset, 'Quadrature Offset', "slider", float) self.top_grid_layout.addWidget(self._q_offset_win, 1, 3, 1, 1) self._phase_noise_range = Range(0, 40, 0.5, 0, 200) self._phase_noise_win = RangeWidget(self._phase_noise_range, self.set_phase_noise, 'Phase Noise', "slider", float) self.top_grid_layout.addWidget(self._phase_noise_win, 0, 3, 1, 1) self._noise_range = Range(0, 2, 0.01, 1.2, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise Voltage', "slider", float) self.top_grid_layout.addWidget(self._noise_win, 0, 0, 1, 1) self._iq_ph_range = Range(-3.14, 3.14, 0.01, 0, 200) self._iq_ph_win = RangeWidget(self._iq_ph_range, self.set_iq_ph, 'IQ Phase Imbalance', "slider", float) self.top_grid_layout.addWidget(self._iq_ph_win, 1, 1, 1, 1) self._iq_mag_range = Range(0, 1, 0.01, 0, 200) self._iq_mag_win = RangeWidget(self._iq_mag_range, self.set_iq_mag, 'IQ Mag. Imbalance', "slider", float) self.top_grid_layout.addWidget(self._iq_mag_win, 1, 0, 1, 1) self._i_offset_range = Range(-1, 1, 0.01, 0, 200) self._i_offset_win = RangeWidget(self._i_offset_range, self.set_i_offset, 'Inphase Offset', "slider", float) self.top_grid_layout.addWidget(self._i_offset_win, 1, 2, 1, 1) self._freq_range = Range(-1, 1, 0.01, 0.01, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'Frequency Offset', "slider", float) self.top_grid_layout.addWidget(self._freq_win, 0, 1, 1, 1) self._dist3_range = Range(0, 0.1, 0.0001, 0, 200) self._dist3_win = RangeWidget(self._dist3_range, self.set_dist3, 'Third Order Dist', "slider", float) self.top_grid_layout.addWidget(self._dist3_win, 2, 1, 1, 1) self._dist2_range = Range(0, 0.1, 0.0001, 0, 200) self._dist2_win = RangeWidget(self._dist2_range, self.set_dist2, '2nd Order Dist.', "slider", float) self.top_grid_layout.addWidget(self._dist2_win, 2, 0, 1, 1) self._cfo_std_range = Range(0, 0.1, 0.01, 0.01, 200) self._cfo_std_win = RangeWidget(self._cfo_std_range, self.set_cfo_std, 'CFO standart deviation ', "slider", float) self.top_grid_layout.addWidget(self._cfo_std_win, 2, 2, 1, 1) self.qtgui_waterfall_sink_x_1_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "GT GUI Waterfall Sink- TX Output", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_1_0.enable_grid(False) self.qtgui_waterfall_sink_x_1_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_1_0.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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_1_0_win, 4, 2, 1, 1) self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "GT GUI Waterfall Sink-TX Output", #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) self.qtgui_waterfall_sink_x_1.enable_axis_labels(True) 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_grid_layout.addWidget(self._qtgui_waterfall_sink_x_1_win, 3, 3, 1, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'QT GUI Waterfall Sink - RX RF front-end output', #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['Rx', '', '', '', '', '', '', '', '', ''] colors = [3, 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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 5, 2, 1, 1) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( num_of_points, #size samp_rate, #samp_rate 'Random source output', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(update_period) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.set_y_label("", "") self.qtgui_time_sink_x_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_1.enable_grid(False) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_1_win, 3, 0, 1, 1) self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "QT GUI Time Sink - RX RF front-end output", #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(-1, 1) self.qtgui_time_sink_x_0_0_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win, 6, 0, 1, 1) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "QT GUI Time Sink - RX RF front-end output", #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(-1, 1) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0_0_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win, 5, 0, 1, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "QT GUI Time Sink - Channel output", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 4, 0, 1, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( num_of_points, #size samp_rate, #samp_rate "QT GUI Time Sink - TX output", #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(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 3, 1, 1, 1) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_VERT, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") 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, 0) 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(True) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 6, 1, 1, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "QT GUI Frequency Sink - TX Output", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.10) self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(False) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_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_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 4, 1, 1, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "QT GUI Frequency Sink - TX Output", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 3, 2, 1, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'QT GUI Frequenx=cy Sink - RX RF front-end output', #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(-80, 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_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 = ['Rx', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 5, 1, 1, 1) self.fec_ber_bf_0 = fec.ber_bf(False, 100, -7.0) self.digital_ofdm_tx_0 = digital.ofdm_tx( fft_len=fft_len, cp_len=fft_len / 4, packet_length_tag_key=len_tag_key, bps_header=1, bps_payload=2, rolloff=0, debug_log=False, scramble_bits=False) self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=fft_len, cp_len=fft_len / 4, frame_length_tag_key='frame_' + "rx_len", packet_length_tag_key="rx_len", bps_header=1, bps_payload=2, debug_log=False, scramble_bits=False) self.channels_impairments_0 = channels.impairments( phase_noise, iq_mag, iq_ph, q_offset, i_offset, 0, dist2, dist3) self.channels_dynamic_channel_model_0 = channels.dynamic_channel_model( samp_rate, 0.01, 1e3, cfo_std, 1e3, 8, 2.0, False, 4.0, (-0.0025, -0.00125, 0.0, 0.00125, 0.0025, 0.00375, 0.005, 0.00625, 0.0075, 0.00875, 0.01, 0.01125, 0.0125, 0.015, 0.01625, 0.0175, 0.01875, 0.02, 0.02125, 0.0225, 0.02375, 0.025, 0.0275, 0.02875, 0.03, 0.03125, 0.0325, 0.03375, 0.035, 0.03625, 0.0375, 0.03875, 0.04, 0.04125, 0.0425, 0.04375, 0.045, 0.04625, 0.0475, 0.05125, 0.0525, 0.055, 0.05625, 0.0575, 0.06, 0.06375, 0.065, 0.06625, 0.0675, 0.06875, 0.0725, 0.08, 0.08125, 0.085, 0.08625, 0.0875, 0.08875, 0.09125, 0.0925, 0.09375, 0.095, 0.09875, 0.1, 0.1075, 0.10875, 0.11, 0.11125, 0.13125, 0.1325), (0.16529889, 0.46954084, 0.58274825, 0.24561255, 0.50459457, 0.69767633, 1.0, 0.77724474, 0.48675226, 0.46954084, 0.21267289, 0.19090106, 0.31600413, 0.45293801, 0.8057353, 0.64920938, 0.50459457, 0.1978987, 0.35204369, 0.54226525, 0.31600413, 0.15945397, 0.2204686, 0.35204369, 0.37832563, 0.37832563, 0.36494815, 0.2204686, 0.17763933, 0.45293801, 0.52309091, 0.52309091, 0.46954084, 0.35204369, 0.40656966, 0.25461568, 0.23692776, 0.32758753, 0.1978987, 0.21267289, 0.2204686, 0.19090106, 0.24561255, 0.17135806, 0.21267289, 0.16529889, 0.2204686, 0.30483032, 0.33959553, 0.18415085, 0.18415085, 0.22855006, 0.2940516, 0.19090106, 0.17135806, 0.18415085, 0.1978987, 0.17763933, 0.15945397, 0.26394884, 0.24561255, 0.21267289, 0.19090106, 0.17763933, 0.2204686, 0.21267289, 0.17135806, 0.17135806, 0.16529889), 8, 1.0, 0) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise, frequency_offset=freq, epsilon=timing, taps=(1.0, ), noise_seed=0, block_tags=False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1, '', 'packet_num') self.blocks_tag_debug_0.set_display(True) self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, vec_length, packet_len, len_tag_key) self.blocks_ctrlport_monitor_performance_0 = not True or monitor( "gr-perf-monitorx") self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.analog_random_source_x_0 = blocks.vector_source_b( map(int, numpy.random.randint(0, 256, 1000)), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.fec_ber_bf_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0_0_0_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_ofdm_tx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_dynamic_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.channels_impairments_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_waterfall_sink_x_1_0, 0)) self.connect((self.channels_dynamic_channel_model_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_impairments_0, 0), (self.digital_ofdm_rx_0, 0)) self.connect((self.channels_impairments_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.channels_impairments_0, 0), (self.qtgui_time_sink_x_0_0_0, 0)) self.connect((self.channels_impairments_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_tag_debug_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.fec_ber_bf_0, 1)) self.connect((self.digital_ofdm_tx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_ofdm_tx_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.digital_ofdm_tx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_ofdm_tx_0, 0), (self.qtgui_waterfall_sink_x_1, 0)) self.connect((self.fec_ber_bf_0, 0), (self.qtgui_number_sink_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 ################################################## None self.variable_cc_def_fecapi_tpc_encoder_def_0 = variable_cc_def_fecapi_tpc_encoder_def_0 = map( (lambda a: fec.tpc_make_encoder(([3]), ([43]), 26, 6, 9, 3)), range(0, 1)) self.variable_cc_def_fecapi_tpc_decoder_def_0 = variable_cc_def_fecapi_tpc_decoder_def_0 = map( (lambda a: fec.tpc_make_decoder(([3]), ([43]), 26, 6, 9, 3, 2, 1)), range(0, 1)) self.samp_rate = samp_rate = 10e6 self.num_samps_per_block = num_samps_per_block = 144 self.num_blocks = num_blocks = 2 ################################################## # Blocks ################################################## self.variable_decoder_interface_0 = variable_decoder_interface_0 = extended_decoder_interface( decoder_obj_list=variable_cc_def_fecapi_tpc_decoder_def_0, threading='capillary', ann=None, puncpat='11', integration_period=10000) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( num_samps_per_block * num_blocks, #size samp_rate, #samp_rate "FEC IO DIFF", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_1.enable_autoscale(False) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_1_win) self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_f( num_samps_per_block * num_blocks, #size samp_rate, #samp_rate "DECODER_INPUT", #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(-1, 1) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(False) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( num_samps_per_block * num_blocks, #size samp_rate, #samp_rate "FEC INPUT", #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(-1, 1) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0.enable_autoscale(False) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_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.encoder_interface_0 = extended_encoder_interface( encoder_obj_list=variable_cc_def_fecapi_tpc_encoder_def_0, threading='capillary', puncpat='11', ) self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float() self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_sub_xx_1 = blocks.sub_ff(1) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((5, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, )) self.blocks_ctrlport_monitor_0 = not True or monitor() self.analog_random_source_x_0 = blocks.vector_source_b( map( int, numpy.random.randint(0, 2, num_samps_per_block * num_blocks * 100)), True) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 1) ################################################## # Connections ################################################## self.connect((self.variable_decoder_interface_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_uchar_to_float_0_0, 0), (self.qtgui_time_sink_x_0_0_0, 0)) self.connect((self.blocks_sub_xx_1, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_sub_xx_1, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.variable_decoder_interface_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.qtgui_time_sink_x_0_0_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_uchar_to_float_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.encoder_interface_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_uchar_to_float_0_0, 0), (self.blocks_sub_xx_1, 1)) self.connect((self.encoder_interface_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_sub_xx_0, 0))
def __init__(self, options_tx, options_rx, callback): gr.top_block.__init__(self) self.init_pctime = 0 self.init_hwtime = 0 self.tx_outfile = options_tx.tx_outfile self._tx_amplitude = options_tx.tx_amplitude ####################################################################### # USRP Config # ####################################################################### tx_slave=False rx_slave=False if options_tx.tx_args != options_rx.rx_args: print "===Transceiver: enable MIMO mode, RX as slave, TX as master===" rx_slave=True if options_rx.mode == "PNC": rx_slave=False # lzyou: it seems that you MUST put rx before tx # otherwise something strange will happen (eg, not synced even the program tells you synced) d_rx_enable = True if options_rx.rx_freq is not None: source = uhd_receiver(options_rx.rx_args, options_rx.bandwidth, options_rx.rx_freq, options_rx.rx_gain, options_rx.spec, options_rx.antenna, options_rx.verbose, options_rx.external, rx_slave) #source.u.set_min_output_buffer(163840) elif options_rx.rx_infile is not None: source = blocks.file_source(gr.sizeof_gr_complex, options_rx.rx_infile) else: source = None d_rx_enable = False self.d_rx_enable = d_rx_enable self.source = source d_tx_enable = True if options_tx.tx_freq is not None: sink = uhd_transmitter(options_tx.tx_args, options_tx.bandwidth, options_tx.tx_freq, options_tx.tx_gain, options_tx.spec, options_tx.antenna, options_tx.verbose, options_tx.external, tx_slave) elif options_tx.tx_outfile is not None: sink = blocks.file_sink(gr.sizeof_gr_complex, options_tx.tx_outfile) else: sink = None d_tx_enable = False self.d_tx_enable = d_tx_enable self.sink = sink ####################################################################### # FIXME: support diff (tx/rx) framebytes self.framebytes = None ####################################################################### # Tx Path # ####################################################################### if d_tx_enable: self.tx = transmit_path.ofdm_transmit_path(options_tx) self.amp = blocks.multiply_const_cc(self._tx_amplitude) #self.amp.set_min_output_buffer(163840) self.connect(self.tx, self.amp, self.sink) self.framebytes = self.tx.framebytes ####################################################################### ####################################################################### # Rx Path # ####################################################################### # log usrp raw samples #if options_rx.mode == 'PNC': # self.connect(source, blocks.file_sink(gr.sizeof_gr_complex, '/tmp/PNCRXdiag.dat')) if options_rx.logfile: if options_rx.mode == 'PNC': self.connect(source, blocks.file_sink(gr.sizeof_gr_complex, '/tmp/PNCRXdiag.dat')) else: assert(options_rx.node != None) if options_rx.node == 'A': self.connect(source, blocks.file_sink(gr.sizeof_gr_complex, '/tmp/NodeARXdiag.dat')) elif options_rx.node == 'B': self.connect(source, blocks.file_sink(gr.sizeof_gr_complex, '/tmp/NodeBRXdiag.dat')) # setup receive_path if d_rx_enable: if options_rx.rx_outfile is not None: self.rx = blocks.file_sink(gr.sizeof_gr_complex, options_rx.rx_outfile) self.connect(self.source, self.rx) return self.rx = receive_path.ofdm_receive_path(options_rx, callback) #if self.framebytes is not None: # assert(self.framebytes == self.rx.framebytes) self.framebytes = self.rx.framebytes self.connect(self.source, self.rx) else: self.rx = None ####################################################################### if options_rx.profile: from gnuradio.ctrlport import monitor self.ctrlport_monitor = monitor() self.ctrlport_monitor_performance = monitor("gr-perf-monitorx")