def __init__(self, frame_size=100, puncpat='11'): gr.top_block.__init__(self, "Fecapi Ldpc Decoders") Qt.QWidget.__init__(self) self.setWindowTitle("Fecapi Ldpc Decoders") 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", "fecapi_ldpc_decoders") self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Parameters ################################################## self.frame_size = frame_size self.puncpat = puncpat ################################################## # Variables ################################################## self.H = H = fec.ldpc_H_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 2) self.G = G = fec.ldpc_G_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0058_gen_matrix.alist") self.samp_rate = samp_rate = 50000 self.ldpc_enc_H = ldpc_enc_H = fec.ldpc_par_mtrx_encoder_make_H(H) self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist"); self.ldpc_dec_H = ldpc_dec_H = fec.ldpc_bit_flip_decoder.make(H.get_base_sptr(), 100) self.ldpc_dec_G = ldpc_dec_G = fec.ldpc_bit_flip_decoder.make(G.get_base_sptr(), 100) self.ldpc_dec = ldpc_dec = fec.ldpc_decoder.make(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 0.5, 50); ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 4 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.01) self.qtgui_time_sink_x_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_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 = ['Input', 'LDPC (alist)', 'LDPC (H)', 'LDPC (G)', 'CCSDS', '', '', '', '', ''] 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, 0.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(4): 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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fec_extended_encoder_1_0_0 = fec.extended_encoder(encoder_obj_list=ldpc_enc, threading= None, puncpat=puncpat) self.fec_extended_encoder_1_0 = fec.extended_encoder(encoder_obj_list=ldpc_enc_H, threading= None, puncpat=puncpat) self.fec_extended_encoder_1 = fec.extended_encoder(encoder_obj_list=ldpc_enc_G, threading= None, puncpat=puncpat) self.fec_extended_decoder_0_1_0 = fec.extended_decoder(decoder_obj_list=ldpc_dec, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.fec_extended_decoder_0_1 = fec.extended_decoder(decoder_obj_list=ldpc_dec_H, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.fec_extended_decoder_0 = fec.extended_decoder(decoder_obj_list=ldpc_dec_G, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.digital_map_bb_0_0_0_0 = digital.map_bb(([-1, 1])) self.digital_map_bb_0_0_0 = digital.map_bb(([-1, 1])) self.digital_map_bb_0_0 = digital.map_bb(([-1, 1])) self.blocks_vector_source_x_0_1_0 = blocks.vector_source_b((frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127], True, 1, []) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True) self.blocks_char_to_float_0_2_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_2 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_0_0_0 = blocks.char_to_float(1, 1) 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_char_to_float_0 = blocks.char_to_float(1, 1) ################################################## # Connections ################################################## self.connect((self.blocks_char_to_float_0, 0), (self.fec_extended_decoder_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0, 3)) self.connect((self.blocks_char_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0, 2)) self.connect((self.blocks_char_to_float_0_0_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_char_to_float_0_2, 0), (self.fec_extended_decoder_0_1, 0)) self.connect((self.blocks_char_to_float_0_2_0, 0), (self.fec_extended_decoder_0_1_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1_0_0, 0)) self.connect((self.blocks_vector_source_x_0_1_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_map_bb_0_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_map_bb_0_0_0, 0), (self.blocks_char_to_float_0_2, 0)) self.connect((self.digital_map_bb_0_0_0_0, 0), (self.blocks_char_to_float_0_2_0, 0)) self.connect((self.fec_extended_decoder_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.fec_extended_decoder_0_1, 0), (self.blocks_char_to_float_0_0_0, 0)) self.connect((self.fec_extended_decoder_0_1_0, 0), (self.blocks_char_to_float_0_0_0_0, 0)) self.connect((self.fec_extended_encoder_1, 0), (self.digital_map_bb_0_0, 0)) self.connect((self.fec_extended_encoder_1_0, 0), (self.digital_map_bb_0_0_0, 0)) self.connect((self.fec_extended_encoder_1_0_0, 0), (self.digital_map_bb_0_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ber Curve Gen") Qt.QWidget.__init__(self) self.setWindowTitle("Ber Curve Gen") 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", "ber_curve_gen") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.rate = rate = 2 self.polys = polys = [79, 109] self.k = k = 7 self.framebits = framebits = 4096 self.esno_0 = esno_0 = numpy.arange(0, 8, .5) self.samp_rate_0 = samp_rate_0 = 35000000 self.enc_tpc = enc_tpc = map((lambda b: map( (lambda a: fec.tpc_encoder_make( ([3]), ([43]), 26, 6, 9, 3)), range(0, 1))), range(0, len(esno_0))) self.enc_rep = enc_rep = map((lambda b: map( (lambda a: fec.repetition_encoder_make(framebits, 3)), range(0, 1)) ), range(0, len(esno_0))) self.enc_ldpc = enc_ldpc = map((lambda b: map( (lambda a: fec.ldpc_encoder_make( '/usr/share/gnuradio/fec/ldpc/271.127.3.112')), range(0, 1))), range(0, len(esno_0))) self.enc_dummy = enc_dummy = map((lambda b: map( (lambda a: fec.dummy_encoder_make(framebits)), range(0, 1))), range(0, len(esno_0))) self.enc_cc = enc_cc = map((lambda b: map( (lambda a: fec.cc_encoder_make(framebits, k, rate, ( polys), 0, fec.CC_STREAMING, False)), range(0, 1))), range(0, len(esno_0))) self.dec_tpc = dec_tpc = map((lambda b: map( (lambda a: fec.tpc_decoder_make( ([3]), ([43]), 26, 6, 9, 3, 6, 1)), range(0, 1))), range(0, len(esno_0))) self.dec_rep = dec_rep = map((lambda b: map( (lambda a: fec.repetition_decoder.make(framebits, 3, 0.5)), range(0, 1))), range(0, len(esno_0))) self.dec_ldpc = dec_ldpc = map((lambda b: map( (lambda a: fec.ldpc_decoder.make( '/usr/share/gnuradio/fec/ldpc/271.127.3.112', 0.5, 50)), range(0, 1))), range(0, len(esno_0))) self.dec_dummy = dec_dummy = map((lambda b: map( (lambda a: fec.dummy_decoder.make(framebits)), range(0, 1))), range(0, len(esno_0))) self.dec_cc = dec_cc = map((lambda b: map( (lambda a: fec.cc_decoder.make(framebits, k, rate, ( polys), 0, -1, fec.CC_STREAMING, False)), range(0, 1))), range(0, len(esno_0))) ################################################## # Blocks ################################################## self.qtgui_bercurve_sink_0 = qtgui.ber_sink_b( esno_0, #range of esnos 5, #number of curves 1000, #ensure at least -10, #cutoff [], #indiv. curve names ) self.qtgui_bercurve_sink_0.set_update_time(0.10) self.qtgui_bercurve_sink_0.set_y_axis(-10, 0) self.qtgui_bercurve_sink_0.set_x_axis(esno_0[0], esno_0[-1]) labels = [ 'None', 'Rep. (Rate=3)', 'CC (K=7, Rate=2)', 'LDPC', 'TPC', '', '', '', '', '' ] widths = [2, 2, 2, 2, 2, 1, 1, 1, 1, 1] colors = [ "blue", "red", "magenta", "dark red", "Dark Blue", "red", "red", "red", "red", "red" ] styles = [1, 2, 5, 5, 4, 0, 0, 0, 0, 0] markers = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1, 1, 1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(5): if len(labels[i]) == 0: self.qtgui_bercurve_sink_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_bercurve_sink_0.set_line_label(i, labels[i]) self.qtgui_bercurve_sink_0.set_line_width(i, widths[i]) self.qtgui_bercurve_sink_0.set_line_color(i, colors[i]) self.qtgui_bercurve_sink_0.set_line_style(i, styles[i]) self.qtgui_bercurve_sink_0.set_line_marker(i, markers[i]) self.qtgui_bercurve_sink_0.set_line_alpha(i, alphas[i]) self._qtgui_bercurve_sink_0_win = sip.wrapinstance( self.qtgui_bercurve_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_bercurve_sink_0_win) self.fec_bercurve_generator_0_1_0 = fec.bercurve_generator( enc_tpc, #size dec_tpc, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0_1 = fec.bercurve_generator( enc_ldpc, #size dec_ldpc, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0_0_0 = fec.bercurve_generator( enc_dummy, #size dec_dummy, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0_0 = fec.bercurve_generator( enc_rep, #size dec_rep, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0 = fec.bercurve_generator( enc_cc, #size dec_cc, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) ################################################## # Connections ################################################## self.connect((self.fec_bercurve_generator_0, 0), (self.qtgui_bercurve_sink_0, 64)) self.connect((self.fec_bercurve_generator_0, 1), (self.qtgui_bercurve_sink_0, 65)) self.connect((self.fec_bercurve_generator_0, 2), (self.qtgui_bercurve_sink_0, 66)) self.connect((self.fec_bercurve_generator_0, 3), (self.qtgui_bercurve_sink_0, 67)) self.connect((self.fec_bercurve_generator_0, 4), (self.qtgui_bercurve_sink_0, 68)) self.connect((self.fec_bercurve_generator_0, 5), (self.qtgui_bercurve_sink_0, 69)) self.connect((self.fec_bercurve_generator_0, 6), (self.qtgui_bercurve_sink_0, 70)) self.connect((self.fec_bercurve_generator_0, 7), (self.qtgui_bercurve_sink_0, 71)) self.connect((self.fec_bercurve_generator_0, 8), (self.qtgui_bercurve_sink_0, 72)) self.connect((self.fec_bercurve_generator_0, 9), (self.qtgui_bercurve_sink_0, 73)) self.connect((self.fec_bercurve_generator_0, 10), (self.qtgui_bercurve_sink_0, 74)) self.connect((self.fec_bercurve_generator_0, 11), (self.qtgui_bercurve_sink_0, 75)) self.connect((self.fec_bercurve_generator_0, 12), (self.qtgui_bercurve_sink_0, 76)) self.connect((self.fec_bercurve_generator_0, 13), (self.qtgui_bercurve_sink_0, 77)) self.connect((self.fec_bercurve_generator_0, 14), (self.qtgui_bercurve_sink_0, 78)) self.connect((self.fec_bercurve_generator_0, 15), (self.qtgui_bercurve_sink_0, 79)) self.connect((self.fec_bercurve_generator_0, 16), (self.qtgui_bercurve_sink_0, 80)) self.connect((self.fec_bercurve_generator_0, 17), (self.qtgui_bercurve_sink_0, 81)) self.connect((self.fec_bercurve_generator_0, 18), (self.qtgui_bercurve_sink_0, 82)) self.connect((self.fec_bercurve_generator_0, 19), (self.qtgui_bercurve_sink_0, 83)) self.connect((self.fec_bercurve_generator_0, 20), (self.qtgui_bercurve_sink_0, 84)) self.connect((self.fec_bercurve_generator_0, 21), (self.qtgui_bercurve_sink_0, 85)) self.connect((self.fec_bercurve_generator_0, 22), (self.qtgui_bercurve_sink_0, 86)) self.connect((self.fec_bercurve_generator_0, 23), (self.qtgui_bercurve_sink_0, 87)) self.connect((self.fec_bercurve_generator_0, 24), (self.qtgui_bercurve_sink_0, 88)) self.connect((self.fec_bercurve_generator_0, 25), (self.qtgui_bercurve_sink_0, 89)) self.connect((self.fec_bercurve_generator_0, 26), (self.qtgui_bercurve_sink_0, 90)) self.connect((self.fec_bercurve_generator_0, 27), (self.qtgui_bercurve_sink_0, 91)) self.connect((self.fec_bercurve_generator_0, 28), (self.qtgui_bercurve_sink_0, 92)) self.connect((self.fec_bercurve_generator_0, 29), (self.qtgui_bercurve_sink_0, 93)) self.connect((self.fec_bercurve_generator_0, 30), (self.qtgui_bercurve_sink_0, 94)) self.connect((self.fec_bercurve_generator_0, 31), (self.qtgui_bercurve_sink_0, 95)) self.connect((self.fec_bercurve_generator_0_0, 0), (self.qtgui_bercurve_sink_0, 32)) self.connect((self.fec_bercurve_generator_0_0, 1), (self.qtgui_bercurve_sink_0, 33)) self.connect((self.fec_bercurve_generator_0_0, 2), (self.qtgui_bercurve_sink_0, 34)) self.connect((self.fec_bercurve_generator_0_0, 3), (self.qtgui_bercurve_sink_0, 35)) self.connect((self.fec_bercurve_generator_0_0, 4), (self.qtgui_bercurve_sink_0, 36)) self.connect((self.fec_bercurve_generator_0_0, 5), (self.qtgui_bercurve_sink_0, 37)) self.connect((self.fec_bercurve_generator_0_0, 6), (self.qtgui_bercurve_sink_0, 38)) self.connect((self.fec_bercurve_generator_0_0, 7), (self.qtgui_bercurve_sink_0, 39)) self.connect((self.fec_bercurve_generator_0_0, 8), (self.qtgui_bercurve_sink_0, 40)) self.connect((self.fec_bercurve_generator_0_0, 9), (self.qtgui_bercurve_sink_0, 41)) self.connect((self.fec_bercurve_generator_0_0, 10), (self.qtgui_bercurve_sink_0, 42)) self.connect((self.fec_bercurve_generator_0_0, 11), (self.qtgui_bercurve_sink_0, 43)) self.connect((self.fec_bercurve_generator_0_0, 12), (self.qtgui_bercurve_sink_0, 44)) self.connect((self.fec_bercurve_generator_0_0, 13), (self.qtgui_bercurve_sink_0, 45)) self.connect((self.fec_bercurve_generator_0_0, 14), (self.qtgui_bercurve_sink_0, 46)) self.connect((self.fec_bercurve_generator_0_0, 15), (self.qtgui_bercurve_sink_0, 47)) self.connect((self.fec_bercurve_generator_0_0, 16), (self.qtgui_bercurve_sink_0, 48)) self.connect((self.fec_bercurve_generator_0_0, 17), (self.qtgui_bercurve_sink_0, 49)) self.connect((self.fec_bercurve_generator_0_0, 18), (self.qtgui_bercurve_sink_0, 50)) self.connect((self.fec_bercurve_generator_0_0, 19), (self.qtgui_bercurve_sink_0, 51)) self.connect((self.fec_bercurve_generator_0_0, 20), (self.qtgui_bercurve_sink_0, 52)) self.connect((self.fec_bercurve_generator_0_0, 21), (self.qtgui_bercurve_sink_0, 53)) self.connect((self.fec_bercurve_generator_0_0, 22), (self.qtgui_bercurve_sink_0, 54)) self.connect((self.fec_bercurve_generator_0_0, 23), (self.qtgui_bercurve_sink_0, 55)) self.connect((self.fec_bercurve_generator_0_0, 24), (self.qtgui_bercurve_sink_0, 56)) self.connect((self.fec_bercurve_generator_0_0, 25), (self.qtgui_bercurve_sink_0, 57)) self.connect((self.fec_bercurve_generator_0_0, 26), (self.qtgui_bercurve_sink_0, 58)) self.connect((self.fec_bercurve_generator_0_0, 27), (self.qtgui_bercurve_sink_0, 59)) self.connect((self.fec_bercurve_generator_0_0, 28), (self.qtgui_bercurve_sink_0, 60)) self.connect((self.fec_bercurve_generator_0_0, 29), (self.qtgui_bercurve_sink_0, 61)) self.connect((self.fec_bercurve_generator_0_0, 30), (self.qtgui_bercurve_sink_0, 62)) self.connect((self.fec_bercurve_generator_0_0, 31), (self.qtgui_bercurve_sink_0, 63)) self.connect((self.fec_bercurve_generator_0_0_0, 0), (self.qtgui_bercurve_sink_0, 0)) self.connect((self.fec_bercurve_generator_0_0_0, 1), (self.qtgui_bercurve_sink_0, 1)) self.connect((self.fec_bercurve_generator_0_0_0, 2), (self.qtgui_bercurve_sink_0, 2)) self.connect((self.fec_bercurve_generator_0_0_0, 3), (self.qtgui_bercurve_sink_0, 3)) self.connect((self.fec_bercurve_generator_0_0_0, 4), (self.qtgui_bercurve_sink_0, 4)) self.connect((self.fec_bercurve_generator_0_0_0, 5), (self.qtgui_bercurve_sink_0, 5)) self.connect((self.fec_bercurve_generator_0_0_0, 6), (self.qtgui_bercurve_sink_0, 6)) self.connect((self.fec_bercurve_generator_0_0_0, 7), (self.qtgui_bercurve_sink_0, 7)) self.connect((self.fec_bercurve_generator_0_0_0, 8), (self.qtgui_bercurve_sink_0, 8)) self.connect((self.fec_bercurve_generator_0_0_0, 9), (self.qtgui_bercurve_sink_0, 9)) self.connect((self.fec_bercurve_generator_0_0_0, 10), (self.qtgui_bercurve_sink_0, 10)) self.connect((self.fec_bercurve_generator_0_0_0, 11), (self.qtgui_bercurve_sink_0, 11)) self.connect((self.fec_bercurve_generator_0_0_0, 12), (self.qtgui_bercurve_sink_0, 12)) self.connect((self.fec_bercurve_generator_0_0_0, 13), (self.qtgui_bercurve_sink_0, 13)) self.connect((self.fec_bercurve_generator_0_0_0, 14), (self.qtgui_bercurve_sink_0, 14)) self.connect((self.fec_bercurve_generator_0_0_0, 15), (self.qtgui_bercurve_sink_0, 15)) self.connect((self.fec_bercurve_generator_0_0_0, 16), (self.qtgui_bercurve_sink_0, 16)) self.connect((self.fec_bercurve_generator_0_0_0, 17), (self.qtgui_bercurve_sink_0, 17)) self.connect((self.fec_bercurve_generator_0_0_0, 18), (self.qtgui_bercurve_sink_0, 18)) self.connect((self.fec_bercurve_generator_0_0_0, 19), (self.qtgui_bercurve_sink_0, 19)) self.connect((self.fec_bercurve_generator_0_0_0, 20), (self.qtgui_bercurve_sink_0, 20)) self.connect((self.fec_bercurve_generator_0_0_0, 21), (self.qtgui_bercurve_sink_0, 21)) self.connect((self.fec_bercurve_generator_0_0_0, 22), (self.qtgui_bercurve_sink_0, 22)) self.connect((self.fec_bercurve_generator_0_0_0, 23), (self.qtgui_bercurve_sink_0, 23)) self.connect((self.fec_bercurve_generator_0_0_0, 24), (self.qtgui_bercurve_sink_0, 24)) self.connect((self.fec_bercurve_generator_0_0_0, 25), (self.qtgui_bercurve_sink_0, 25)) self.connect((self.fec_bercurve_generator_0_0_0, 26), (self.qtgui_bercurve_sink_0, 26)) self.connect((self.fec_bercurve_generator_0_0_0, 27), (self.qtgui_bercurve_sink_0, 27)) self.connect((self.fec_bercurve_generator_0_0_0, 28), (self.qtgui_bercurve_sink_0, 28)) self.connect((self.fec_bercurve_generator_0_0_0, 29), (self.qtgui_bercurve_sink_0, 29)) self.connect((self.fec_bercurve_generator_0_0_0, 30), (self.qtgui_bercurve_sink_0, 30)) self.connect((self.fec_bercurve_generator_0_0_0, 31), (self.qtgui_bercurve_sink_0, 31)) self.connect((self.fec_bercurve_generator_0_1, 0), (self.qtgui_bercurve_sink_0, 96)) self.connect((self.fec_bercurve_generator_0_1, 1), (self.qtgui_bercurve_sink_0, 97)) self.connect((self.fec_bercurve_generator_0_1, 2), (self.qtgui_bercurve_sink_0, 98)) self.connect((self.fec_bercurve_generator_0_1, 3), (self.qtgui_bercurve_sink_0, 99)) self.connect((self.fec_bercurve_generator_0_1, 4), (self.qtgui_bercurve_sink_0, 100)) self.connect((self.fec_bercurve_generator_0_1, 5), (self.qtgui_bercurve_sink_0, 101)) self.connect((self.fec_bercurve_generator_0_1, 6), (self.qtgui_bercurve_sink_0, 102)) self.connect((self.fec_bercurve_generator_0_1, 7), (self.qtgui_bercurve_sink_0, 103)) self.connect((self.fec_bercurve_generator_0_1, 8), (self.qtgui_bercurve_sink_0, 104)) self.connect((self.fec_bercurve_generator_0_1, 9), (self.qtgui_bercurve_sink_0, 105)) self.connect((self.fec_bercurve_generator_0_1, 10), (self.qtgui_bercurve_sink_0, 106)) self.connect((self.fec_bercurve_generator_0_1, 11), (self.qtgui_bercurve_sink_0, 107)) self.connect((self.fec_bercurve_generator_0_1, 12), (self.qtgui_bercurve_sink_0, 108)) self.connect((self.fec_bercurve_generator_0_1, 13), (self.qtgui_bercurve_sink_0, 109)) self.connect((self.fec_bercurve_generator_0_1, 14), (self.qtgui_bercurve_sink_0, 110)) self.connect((self.fec_bercurve_generator_0_1, 15), (self.qtgui_bercurve_sink_0, 111)) self.connect((self.fec_bercurve_generator_0_1, 16), (self.qtgui_bercurve_sink_0, 112)) self.connect((self.fec_bercurve_generator_0_1, 17), (self.qtgui_bercurve_sink_0, 113)) self.connect((self.fec_bercurve_generator_0_1, 18), (self.qtgui_bercurve_sink_0, 114)) self.connect((self.fec_bercurve_generator_0_1, 19), (self.qtgui_bercurve_sink_0, 115)) self.connect((self.fec_bercurve_generator_0_1, 20), (self.qtgui_bercurve_sink_0, 116)) self.connect((self.fec_bercurve_generator_0_1, 21), (self.qtgui_bercurve_sink_0, 117)) self.connect((self.fec_bercurve_generator_0_1, 22), (self.qtgui_bercurve_sink_0, 118)) self.connect((self.fec_bercurve_generator_0_1, 23), (self.qtgui_bercurve_sink_0, 119)) self.connect((self.fec_bercurve_generator_0_1, 24), (self.qtgui_bercurve_sink_0, 120)) self.connect((self.fec_bercurve_generator_0_1, 25), (self.qtgui_bercurve_sink_0, 121)) self.connect((self.fec_bercurve_generator_0_1, 26), (self.qtgui_bercurve_sink_0, 122)) self.connect((self.fec_bercurve_generator_0_1, 27), (self.qtgui_bercurve_sink_0, 123)) self.connect((self.fec_bercurve_generator_0_1, 28), (self.qtgui_bercurve_sink_0, 124)) self.connect((self.fec_bercurve_generator_0_1, 29), (self.qtgui_bercurve_sink_0, 125)) self.connect((self.fec_bercurve_generator_0_1, 30), (self.qtgui_bercurve_sink_0, 126)) self.connect((self.fec_bercurve_generator_0_1, 31), (self.qtgui_bercurve_sink_0, 127)) self.connect((self.fec_bercurve_generator_0_1_0, 0), (self.qtgui_bercurve_sink_0, 128)) self.connect((self.fec_bercurve_generator_0_1_0, 1), (self.qtgui_bercurve_sink_0, 129)) self.connect((self.fec_bercurve_generator_0_1_0, 2), (self.qtgui_bercurve_sink_0, 130)) self.connect((self.fec_bercurve_generator_0_1_0, 3), (self.qtgui_bercurve_sink_0, 131)) self.connect((self.fec_bercurve_generator_0_1_0, 4), (self.qtgui_bercurve_sink_0, 132)) self.connect((self.fec_bercurve_generator_0_1_0, 5), (self.qtgui_bercurve_sink_0, 133)) self.connect((self.fec_bercurve_generator_0_1_0, 6), (self.qtgui_bercurve_sink_0, 134)) self.connect((self.fec_bercurve_generator_0_1_0, 7), (self.qtgui_bercurve_sink_0, 135)) self.connect((self.fec_bercurve_generator_0_1_0, 8), (self.qtgui_bercurve_sink_0, 136)) self.connect((self.fec_bercurve_generator_0_1_0, 9), (self.qtgui_bercurve_sink_0, 137)) self.connect((self.fec_bercurve_generator_0_1_0, 10), (self.qtgui_bercurve_sink_0, 138)) self.connect((self.fec_bercurve_generator_0_1_0, 11), (self.qtgui_bercurve_sink_0, 139)) self.connect((self.fec_bercurve_generator_0_1_0, 12), (self.qtgui_bercurve_sink_0, 140)) self.connect((self.fec_bercurve_generator_0_1_0, 13), (self.qtgui_bercurve_sink_0, 141)) self.connect((self.fec_bercurve_generator_0_1_0, 14), (self.qtgui_bercurve_sink_0, 142)) self.connect((self.fec_bercurve_generator_0_1_0, 15), (self.qtgui_bercurve_sink_0, 143)) self.connect((self.fec_bercurve_generator_0_1_0, 16), (self.qtgui_bercurve_sink_0, 144)) self.connect((self.fec_bercurve_generator_0_1_0, 17), (self.qtgui_bercurve_sink_0, 145)) self.connect((self.fec_bercurve_generator_0_1_0, 18), (self.qtgui_bercurve_sink_0, 146)) self.connect((self.fec_bercurve_generator_0_1_0, 19), (self.qtgui_bercurve_sink_0, 147)) self.connect((self.fec_bercurve_generator_0_1_0, 20), (self.qtgui_bercurve_sink_0, 148)) self.connect((self.fec_bercurve_generator_0_1_0, 21), (self.qtgui_bercurve_sink_0, 149)) self.connect((self.fec_bercurve_generator_0_1_0, 22), (self.qtgui_bercurve_sink_0, 150)) self.connect((self.fec_bercurve_generator_0_1_0, 23), (self.qtgui_bercurve_sink_0, 151)) self.connect((self.fec_bercurve_generator_0_1_0, 24), (self.qtgui_bercurve_sink_0, 152)) self.connect((self.fec_bercurve_generator_0_1_0, 25), (self.qtgui_bercurve_sink_0, 153)) self.connect((self.fec_bercurve_generator_0_1_0, 26), (self.qtgui_bercurve_sink_0, 154)) self.connect((self.fec_bercurve_generator_0_1_0, 27), (self.qtgui_bercurve_sink_0, 155)) self.connect((self.fec_bercurve_generator_0_1_0, 28), (self.qtgui_bercurve_sink_0, 156)) self.connect((self.fec_bercurve_generator_0_1_0, 29), (self.qtgui_bercurve_sink_0, 157)) self.connect((self.fec_bercurve_generator_0_1_0, 30), (self.qtgui_bercurve_sink_0, 158)) self.connect((self.fec_bercurve_generator_0_1_0, 31), (self.qtgui_bercurve_sink_0, 159))
def __init__(self, encoderType, packetLength, rate): gr.hier_block2.__init__( self, "FECEncoder", gr.io_signature(1, 1, gr.sizeof_char * 1), gr.io_signature(1, 1, gr.sizeof_char * 1), ) ################################################## # Parameters ################################################## self.packetLength = packetLength self.rate = rate self.encoderType = encoderType if encoderType == "cc": if (rate == 0.5): # Rate 1/2 self.puncpat = puncpat = '11' elif (rate == 0.75): # Rate 3/4 self.puncpat = puncpat = '101' elif (rate == 0.875): # Rate 7/8 self.puncpat = puncpat = '1010101' else: raise ValueError, "Unsupported coding rate '%f' for CC" % ( rate, ) elif encoderType == "ldpc": if (rate == 0.42): # Rate 0.42 self.puncpat = puncpat = '11' else: raise ValueError, "Unsupported coding rate '%f' for LDPC" % ( rate, ) else: raise ValueError, "Unsupported channel encoder %s" % ( encoderType, ) if (encoderType == "cc"): ################################################## # Variables ################################################## self.polys = polys = [109, 79] self.k = k = 7 self.enc_cc = enc_cc = fec.cc_encoder_make(packetLength * 8, k, 2, (polys), 0, fec.CC_TAILBITING, False) ################################################## # Blocks ################################################## self.fec_extended_encoder = fec.extended_encoder( encoder_obj_list=enc_cc, threading='capillary', puncpat=puncpat) self.blocks_unpacked_to_packed_xx = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_unpack_k_bits_bb = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) ################################################## # Connections ################################################## self.connect((self.blocks_unpacked_to_packed_xx, 0), (self, 0)) self.connect((self.blocks_unpack_k_bits_bb, 0), (self.fec_extended_encoder, 0)) self.connect((self.fec_extended_encoder, 0), (self.blocks_unpacked_to_packed_xx, 0)) self.connect((self, 0), (self.blocks_unpack_k_bits_bb, 0)) else: ################################################## # Variables ################################################## self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist") ################################################## # Blocks ################################################## self.SatelliteModem_padForLDPC_0 = SatelliteModem.padForLDPC( packetLength * 8, 42) self.fec_extended_encoder = fec.extended_encoder( encoder_obj_list=ldpc_enc, threading='capillary', puncpat=puncpat) self.blocks_unpacked_to_packed_xx = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_unpack_k_bits_bb = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) ################################################## # Connections ################################################## self.connect((self.blocks_unpacked_to_packed_xx, 0), (self, 0)) self.connect((self.blocks_unpack_k_bits_bb, 0), (self.SatelliteModem_padForLDPC_0, 0)) self.connect((self.SatelliteModem_padForLDPC_0, 0), (self.fec_extended_encoder, 0)) self.connect((self.fec_extended_encoder, 0), (self.blocks_unpacked_to_packed_xx, 0)) self.connect((self, 0), (self.blocks_unpack_k_bits_bb, 0))
def __init__(self, puncpat='11'): gr.top_block.__init__(self, "Tutorial") Qt.QWidget.__init__(self) self.setWindowTitle("Tutorial") 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", "tutorial_7_LDPC") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.puncpat = puncpat ################################################## # Variables ################################################## self.sps = sps = 4 self.nfilts = nfilts = 32 self.eb = eb = 0.22 self.tx_rrc_taps = tx_rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0, eb, 11 * sps * nfilts) self.taps_per_filt = taps_per_filt = len(tx_rrc_taps) / nfilts self.vector = vector = [int(random.random() * 4) for i in range(49600)] self.time_offset = time_offset = 1.0 self.taps = taps = [1.0, 0.25 - 0.25j, 0.50 + 0.10j, -0.3 + 0.2j] self.samp_rate = samp_rate = 50000000 self.rx_rrc_taps = rx_rrc_taps = firdes.root_raised_cosine( nfilts, nfilts * sps, 1.0, eb, 11 * sps * nfilts) self.pld_enc = pld_enc = map((lambda a: fec.ldpc_encoder_make( '/usr/local/share/gnuradio/fec/ldpc/n_1100_k_0442_gap_24.alist')), range(0, 4)) self.pld_dec = pld_dec = map((lambda a: fec.ldpc_decoder.make( '/usr/local/share/gnuradio/fec/ldpc/n_1100_k_0442_gap_24.alist', 0.5, 100)), range(0, 8)) self.pld_const = pld_const = digital.constellation_rect(([ 0.707 + 0.707j, -0.707 + 0.707j, -0.707 - 0.707j, 0.707 - 0.707j ]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base() self.pld_const.gen_soft_dec_lut(8) self.noise = noise = 0.0 self.freq_offset = freq_offset = 0 self.filt_delay = filt_delay = 1 + (taps_per_filt - 1) / 2 ################################################## # Blocks ################################################## self._time_offset_range = Range(0.99, 1.01, 0.00001, 1.0, 200) self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, 'Time Offset', "counter_slider", float) self.top_grid_layout.addWidget(self._time_offset_win, 0, 3, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._noise_range = Range(0, 5, 0.01, 0.0, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise Amp', "counter_slider", float) self.top_grid_layout.addWidget(self._noise_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._freq_offset_range = Range(-0.5, 0.5, 0.0001, 0, 200) self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, 'Freq. Offset', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_offset_win, 0, 2, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( 100 * 2, #size samp_rate, #samp_rate 'Rx Data', #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, 256) self.qtgui_time_sink_x_0_1.set_y_label('Amplitude', "") 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, 'packet_length_tag_key') self.qtgui_time_sink_x_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_1.enable_grid(True) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(False) self.qtgui_time_sink_x_0_1.enable_stem_plot(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, 2, 3, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 100 * 2, #size samp_rate, #samp_rate 'Tx Data', #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, 256) 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, 'packet_length_tag_key') self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0_0_0_1_0 = qtgui.const_sink_c( 1024, #size "RX Treated Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0_1_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0_1_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_1_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_1_0.set_trigger_mode( qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0_0_1_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0_1_0.enable_grid(False) self.qtgui_const_sink_x_0_0_0_1_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0_0_0_1_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_0_0_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0_1_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0_1_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0_1_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0_1_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0_1_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0_1_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_1_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0_0_0_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_1_0_win, 2, 2, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0_0_0_1 = qtgui.const_sink_c( 1024, #size "RX Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0_1.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_1.set_trigger_mode( qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0_0_1.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0_1.enable_grid(False) self.qtgui_const_sink_x_0_0_0_1.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0_0_0_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_0_0_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_1_win = sip.wrapinstance( self.qtgui_const_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_1_win, 2, 1, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0_0_0_0 = qtgui.const_sink_c( 1024, #size "TX Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0_0_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0_0.enable_grid(False) self.qtgui_const_sink_x_0_0_0_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0_0_0_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_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_0_win, 1, 2, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( sps, taps=(tx_rrc_taps), flt_size=nfilts) self.pfb_arb_resampler_xxx_0.declare_sample_delay(filt_delay) self.insert_vec_cpp_new_vec_0 = insert_vec_cpp.new_vec((vector)) self.fec_extended_encoder_0 = fec.extended_encoder( encoder_obj_list=pld_enc, threading='capillary', puncpat=puncpat) self.fec_extended_decoder_0_0_1_0_1_0 = fec.extended_decoder( decoder_obj_list=pld_dec, threading='capillary', ann=None, puncpat=puncpat, integration_period=10000) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( sps, 6.28 / 100.0, (rx_rrc_taps), nfilts, nfilts / 2, 1.5, 2) self.digital_map_bb_0 = digital.map_bb((pld_const.pre_diff_code())) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc( 6.28 / 200.0, pld_const.arity(), False) self.digital_correlate_access_code_xx_ts_0_0_0 = digital.correlate_access_code_ff_ts( digital.packet_utils.default_access_code, 1, 'packet_len') self.digital_constellation_soft_decoder_cf_0 = digital.constellation_soft_decoder_cf( pld_const) self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc( 15, 1, 0.01, 2) self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc( (pld_const.points()), 1) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise, frequency_offset=freq_offset, epsilon=time_offset, taps=(taps), noise_seed=0, block_tags=True) self.blocks_vector_source_x_0_0_0 = blocks.vector_source_b([0], True, 1, []) self.blocks_vector_source_x_0 = blocks.vector_source_b([0], True, 1, []) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_stream_mux_0_1_0 = blocks.stream_mux( gr.sizeof_char * 1, (96, 1104)) self.blocks_stream_mux_0_0 = blocks.stream_mux(gr.sizeof_char * 1, (1100, 4)) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char * 1, (440, 2)) self.blocks_repack_bits_bb_1_0_0_1 = blocks.repack_bits_bb( 8, 1, '', False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_0_1 = blocks.repack_bits_bb( 1, pld_const.bits_per_symbol(), '', False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb( 1, 8, '', False, gr.GR_MSB_FIRST) self.blocks_keep_m_in_n_0_1_1_0 = blocks.keep_m_in_n( gr.sizeof_char, 440, 442, 0) self.blocks_keep_m_in_n_0_0_2_0 = blocks.keep_m_in_n( gr.sizeof_float, 1100, 1104, 0) self.blocks_file_source_0_0_1_0 = blocks.file_source( gr.sizeof_char * 1, '/home/andre/Desktop/Files_To_Transmit/trasmit_10_mb.txt', False) self.blocks_file_source_0_0_1_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_0_0_0_2 = blocks.file_sink( gr.sizeof_char * 1, '/home/andre/Desktop/Trasmited/depois.txt', False) self.blocks_file_sink_0_0_0_2.set_unbuffered(False) self.blocks_char_to_float_1_0_1 = blocks.char_to_float(1, 1) self.blocks_char_to_float_1_0_0 = blocks.char_to_float(1, 1) self.acode_1104 = blocks.vector_source_b([ 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0 ], True, 1, []) ################################################## # Connections ################################################## self.connect((self.acode_1104, 0), (self.blocks_stream_mux_0_1_0, 0)) self.connect((self.blocks_char_to_float_1_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_char_to_float_1_0_1, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_file_source_0_0_1_0, 0), (self.blocks_char_to_float_1_0_0, 0)) self.connect((self.blocks_file_source_0_0_1_0, 0), (self.blocks_repack_bits_bb_1_0_0_1, 0)) self.connect((self.blocks_keep_m_in_n_0_0_2_0, 0), (self.fec_extended_decoder_0_0_1_0_1_0, 0)) self.connect((self.blocks_keep_m_in_n_0_1_1_0, 0), (self.blocks_repack_bits_bb_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.blocks_char_to_float_1_0_1, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.blocks_file_sink_0_0_0_2, 0)) self.connect((self.blocks_repack_bits_bb_0_1, 0), (self.insert_vec_cpp_new_vec_0, 0)) self.connect((self.blocks_repack_bits_bb_1_0_0_1, 0), (self.blocks_stream_mux_0, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.fec_extended_encoder_0, 0)) self.connect((self.blocks_stream_mux_0_0, 0), (self.blocks_stream_mux_0_1_0, 1)) self.connect((self.blocks_stream_mux_0_1_0, 0), (self.blocks_repack_bits_bb_0_1, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_const_sink_x_0_0_0_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_stream_mux_0_0, 1)) self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0_0_0_1, 0)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.digital_constellation_soft_decoder_cf_0, 0), (self.digital_correlate_access_code_xx_ts_0_0_0, 0)) self.connect((self.digital_correlate_access_code_xx_ts_0_0_0, 0), (self.blocks_keep_m_in_n_0_0_2_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.digital_constellation_soft_decoder_cf_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.qtgui_const_sink_x_0_0_0_1_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) self.connect((self.fec_extended_decoder_0_0_1_0_1_0, 0), (self.blocks_keep_m_in_n_0_1_1_0, 0)) self.connect((self.fec_extended_encoder_0, 0), (self.blocks_stream_mux_0_0, 0)) self.connect((self.insert_vec_cpp_new_vec_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_throttle_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Mpsk Stage3") Qt.QWidget.__init__(self) self.setWindowTitle("Mpsk Stage3") 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", "mpsk_stage3") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sps = sps = 2 self.nfilts = nfilts = 32 self.timing_loop_bw = timing_loop_bw = 6.28 / 100.0 self.time_offset = time_offset = 1.00 self.taps = taps = [ 1.0 + 0.0j, ] self.samp_rate = samp_rate = 32000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts) self.qpsk = qpsk = digital.constellation_rect(([0, 1]), ([0, 1]), 4, 2, 2, 1, 1).base() self.noise_volt = noise_volt = 0.0001 self.freq_offset = freq_offset = 0 self.excess_bw = excess_bw = 0.35 self.encoder_variable = encoder_variable = fec.ldpc_encoder_make( '/usr/share/gnuradio/fec/ldpc/n_0512_k_0130_gap_21.alist') self.decoder_variable = decoder_variable = fec.ldpc_decoder.make( '/usr/share/gnuradio/fec/ldpc/n_0512_k_0130_gap_21.alist', 0.5, 50) self.dbpsk = dbpsk = digital.constellation_bpsk().base() self.arity = arity = 4 ################################################## # Blocks ################################################## self._timing_loop_bw_range = Range(0.0, 0.2, 0.01, 6.28 / 100.0, 200) self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range, self.set_timing_loop_bw, 'Time: BW', "slider", float) self.top_grid_layout.addWidget(self._timing_loop_bw_win, 0, 3, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.00, 200) self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, 'Timing Offset', "counter_slider", float) self.top_grid_layout.addWidget(self._time_offset_win, 0, 2, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._noise_volt_range = Range(0, 1, 0.01, 0.0001, 200) self._noise_volt_win = RangeWidget(self._noise_volt_range, self.set_noise_volt, 'Noise Voltage', "counter_slider", float) self.top_grid_layout.addWidget(self._noise_volt_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._freq_offset_range = Range(-0.1, 0.1, 0.001, 0, 200) self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, 'Frequency Offset', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_offset_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.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, 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(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) self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c( 2048, #size '', #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0.enable_grid(False) self.qtgui_const_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0_0.disable_legend() labels = ['Timing Recov.', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [0.5, 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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.blackmanharris(1024)), True, 1) self.fec_extended_encoder_0_0_0 = fec.extended_encoder( encoder_obj_list=encoder_variable, threading=None, puncpat="11") self.fec_extended_decoder_0_1_0 = fec.extended_decoder( decoder_obj_list=decoder_variable, threading='ordinary', ann=None, puncpat="11", integration_period=10000) self.epy_block_0 = epy_block_0.barker_sync() self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( sps * 1.000, timing_loop_bw, (rrc_taps), nfilts, nfilts / 2, 1.5, 1) self.digital_map_bb_0_0_0_0 = digital.map_bb(([-1, 1])) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb( dbpsk, timing_loop_bw, -100, 100) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=dbpsk, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=excess_bw, verbose=False, log=False, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_volt, frequency_offset=freq_offset, epsilon=time_offset, taps=(taps), noise_seed=0, block_tags=False) self.blocks_unpacked_to_packed_xx_1_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_unpacked_to_packed_xx_0_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 1024) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) self.blocks_max_xx_0 = blocks.max_ff(1024, 1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_char * 1, '/home/gdreyfus/sagan.jpg', False) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_1 = blocks.file_sink( gr.sizeof_char * 1, '/home/gdreyfus/sentsagan.jpg', False) self.blocks_file_sink_1.set_unbuffered(True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, 'zappppp', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( 1024) self.blocks_char_to_float_0_2_0 = blocks.char_to_float(1, 1) self.Add_Barking_Code = Add_Barking_Code.blk() ################################################## # Connections ################################################## self.connect((self.Add_Barking_Code, 0), (self.blocks_unpacked_to_packed_xx_1_0, 0)) self.connect((self.blocks_char_to_float_0_2_0, 0), (self.fec_extended_decoder_0_1_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_max_xx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_max_xx_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.fec_extended_encoder_0_0_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0, 0), (self.blocks_file_sink_1, 0)) self.connect((self.blocks_unpacked_to_packed_xx_1_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.epy_block_0, 0)) self.connect((self.digital_map_bb_0_0_0_0, 0), (self.blocks_char_to_float_0_2_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_constellation_receiver_cb_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0_0, 0)) self.connect((self.epy_block_0, 0), (self.digital_map_bb_0_0_0_0, 0)) self.connect((self.fec_extended_decoder_0_1_0, 0), (self.blocks_unpacked_to_packed_xx_0_0, 0)) self.connect((self.fec_extended_encoder_0_0_0, 0), (self.Add_Barking_Code, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
def __init__(self): gr.top_block.__init__(self, "DPSK Loopback") Qt.QWidget.__init__(self) self.setWindowTitle("DPSK Loopback") 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", "dpsk_loopback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 10000 self.freq = freq = 500 self.enc = enc = fec.ldpc_encoder_make( 'C:\\Program Files\\GNURadio-3.7\\share\\gnuradio\\fec\\ldpc\\simple_g_matrix.alist' ) self.dec = dec = fec.ldpc_decoder.make( 'C:\\Program Files\\GNURadio-3.7\\share\\gnuradio\\fec\\ldpc\\simple_g_matrix.alist', 0.5, 50) self.const = const = digital.constellation_bpsk().base() ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate 'TX_BITS', #name 1 #number of inputs ) self.qtgui_time_sink_x_1_1.set_update_time(0.10) self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_1.enable_autoscale(False) self.qtgui_time_sink_x_1_1.enable_grid(False) self.qtgui_time_sink_x_1_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_1.enable_control_panel(False) self.qtgui_time_sink_x_1_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1_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_1_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_1_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate 'QT GUI Plot', #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, 1.1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 3) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title('constellation') 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(3): 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_grid_layout.addWidget(self._qtgui_number_sink_0_win) self._freq_range = Range(0, 5000, 1, 500, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win) self.fec_extended_encoder_0 = fec.extended_encoder( encoder_obj_list=enc, threading=None, puncpat='11') self.fec_extended_decoder_0 = fec.extended_decoder( decoder_obj_list=dec, threading=None, ann=None, puncpat='11', integration_period=10000) self.digital_map_bb_0 = digital.map_bb(([-1, 1])) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb( const, 62.8e-3, -1000, 1000) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=const, differential=True, samples_per_symbol=4, pre_diff_code=True, excess_bw=0.35, verbose=False, log=False, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.1, frequency_offset=0, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.blocks_vector_source_x_0 = blocks.vector_source_b( (0, 0, 0x55, 0x55), True, 1, []) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_char * 1, 4) self.blocks_char_to_float_1_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_1 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) ################################################## # Connections ################################################## self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_1_1, 0)) self.connect((self.blocks_char_to_float_1, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_char_to_float_1_0, 0), (self.fec_extended_decoder_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_constellation_receiver_cb_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 1), (self.qtgui_number_sink_0, 0)) self.connect((self.digital_constellation_receiver_cb_0, 3), (self.qtgui_number_sink_0, 2)) self.connect((self.digital_constellation_receiver_cb_0, 2), (self.qtgui_number_sink_0, 1)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_char_to_float_1_0, 0)) self.connect((self.fec_extended_decoder_0, 0), (self.blocks_char_to_float_1, 0)) self.connect((self.fec_extended_encoder_0, 0), (self.blocks_pack_k_bits_bb_0, 0))
def __init__(self, puncpat='11'): gr.top_block.__init__(self, "Tx No Gui") Qt.QWidget.__init__(self) self.setWindowTitle("Tx No Gui") 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", "tx_no_gui") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.puncpat = puncpat ################################################## # Variables ################################################## self.sps = sps = 4 self.samp_rate_array_MCR = samp_rate_array_MCR = [7500000,5000000,3750000,3000000,2500000,2000000,1500000,1000000,937500,882352,833333,714285,533333,500000,421052,400000,380952,200000] self.nfilts = nfilts = 32 self.eb = eb = 0.22 self.vector = vector = [int(random.random()*4) for i in range(49600)] self.variable_qtgui_range_0_0 = variable_qtgui_range_0_0 = 43 self.tx_rrc_taps = tx_rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0, eb, 11*sps*nfilts) self.samp_rate = samp_rate = samp_rate_array_MCR[15] self.pld_enc = pld_enc = map( (lambda a: fec.ldpc_encoder_make('/usr/local/share/gnuradio/fec/ldpc/n_1100_k_0442_gap_24.alist')), range(0,4) ); self.pld_const = pld_const = digital.constellation_rect(([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base() self.pld_const.gen_soft_dec_lut(8) self.frequencia_usrp = frequencia_usrp = 484e6 self.MCR = MCR = "master_clock_rate=60e6" ################################################## # Blocks ################################################## self._variable_qtgui_range_0_0_range = Range(0, 90, 1, 43, 200) self._variable_qtgui_range_0_0_win = RangeWidget(self._variable_qtgui_range_0_0_range, self.set_variable_qtgui_range_0_0, 'Gain_TX', "counter_slider", float) self.top_grid_layout.addWidget(self._variable_qtgui_range_0_0_win, 0, 2, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_sink_0_0 = uhd.usrp_sink( ",".join(("serial=F5EAE1", MCR)), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_sink_0_0.set_center_freq(frequencia_usrp, 0) self.uhd_usrp_sink_0_0.set_gain(variable_qtgui_range_0_0, 0) self.uhd_usrp_sink_0_0.set_antenna('TX/RX', 0) self.scrambler_cpp_additive_scrambler_0 = scrambler_cpp.additive_scrambler(0x8A, 0x7F, 7, 440-32) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "TX USRP", #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) self.qtgui_time_sink_x_1.enable_stem_plot(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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 3, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 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_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_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 3, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0_0_0_0 = qtgui.const_sink_c( 1024, #size "TX Const", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0_0_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0_0.enable_grid(False) self.qtgui_const_sink_x_0_0_0_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0_0_0_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_0_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_0_win, 1, 2, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( sps, taps=(tx_rrc_taps), flt_size=nfilts) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.insert_vec_cpp_new_vec_0 = insert_vec_cpp.new_vec((vector)) self.fec_extended_encoder_0 = fec.extended_encoder(encoder_obj_list=pld_enc, threading='capillary', puncpat=puncpat) self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc((pld_const.points()), 1) self.blocks_vector_source_x_0_0_0 = blocks.vector_source_b([0], True, 1, []) self.blocks_vector_source_x_0_0 = blocks.vector_source_b([0], True, 1, []) self.blocks_stream_mux_0_1_0_0 = blocks.stream_mux(gr.sizeof_char*1, (96, 1104)) self.blocks_stream_mux_0_0_0 = blocks.stream_mux(gr.sizeof_char*1, (1100, 4)) self.blocks_stream_mux_0_0 = blocks.stream_mux(gr.sizeof_char*1, (440, 2)) self.blocks_repack_bits_bb_1_0_0_1 = blocks.repack_bits_bb(8, 1, '', False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_1_0_0_0 = blocks.repack_bits_bb(1, pld_const.bits_per_symbol(), '', False, gr.GR_MSB_FIRST) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.7, )) self.blocks_file_source_0_0_1_0_0_0 = blocks.file_source(gr.sizeof_char*1, '/home/andre/Desktop/Files_To_Transmit/video_lion.mpeg', False) self.blocks_file_source_0_0_1_0_0_0.set_begin_tag(pmt.PMT_NIL) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 500000) self.acode_1104_0 = blocks.vector_source_b([0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0], True, 1, []) ################################################## # Connections ################################################## self.connect((self.acode_1104_0, 0), (self.blocks_stream_mux_0_1_0_0, 0)) self.connect((self.blocks_delay_0, 0), (self.qtgui_const_sink_x_0_0_0_0, 0)) self.connect((self.blocks_delay_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_delay_0, 0), (self.uhd_usrp_sink_0_0, 0)) self.connect((self.blocks_file_source_0_0_1_0_0_0, 0), (self.blocks_repack_bits_bb_1_0_0_1, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_repack_bits_bb_1_0_0_0, 0), (self.insert_vec_cpp_new_vec_0, 0)) self.connect((self.blocks_repack_bits_bb_1_0_0_1, 0), (self.scrambler_cpp_additive_scrambler_0, 0)) self.connect((self.blocks_stream_mux_0_0, 0), (self.fec_extended_encoder_0, 0)) self.connect((self.blocks_stream_mux_0_0_0, 0), (self.blocks_stream_mux_0_1_0_0, 1)) self.connect((self.blocks_stream_mux_0_1_0_0, 0), (self.blocks_repack_bits_bb_1_0_0_0, 0)) self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_stream_mux_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_stream_mux_0_0_0, 1)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.fec_extended_encoder_0, 0), (self.blocks_stream_mux_0_0_0, 0)) self.connect((self.insert_vec_cpp_new_vec_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.scrambler_cpp_additive_scrambler_0, 0), (self.blocks_stream_mux_0_0, 0))
def __init__(self, doc, ip="127.0.0.1"): gr.top_block.__init__(self, "RL Demod training") self.doc = doc self.plot_lst = [] self.widget_lst = [] ################################################## # Parameters ################################################## self.ip = ip ################################################## # Variables ################################################## self.pilot_symbols = pilot_symbols = (( 1, 1, 1, -1, ), ) self.pilot_carriers = pilot_carriers = (( -21, -7, 7, 21, ), ) self.packet_length_tag_key = packet_length_tag_key = "packet_length" self.occupied_carriers = occupied_carriers = ( list(range(-22, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 23)), ) self.length_tag_key_0 = length_tag_key_0 = "frame_len" self.length_tag_key = length_tag_key = "packet_len" self.header_mod = header_mod = digital.constellation_bpsk() self.fft_len = fft_len = 64 self.errors = errors = 0 self.bits_per_symbol = bits_per_symbol = 4 self.ber = ber = 0 self.variable_qtgui_label_0_0_val = variable_qtgui_label_0_0 = ber self.variable_qtgui_label_0_val = variable_qtgui_label_0 = errors self.variable_0 = variable_0 = len(occupied_carriers[0]) self.training_mod = training_mod = 1 self.timestamp = timestamp = '1' self.t_state = t_state = 1 self.sync_word2 = sync_word2 = [ 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0 ] self.sync_word1 = sync_word1 = [ 0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0. ] self.snr_stop = snr_stop = 29 self.snr_step = snr_step = 0.5 self.snr_start = snr_start = 0 self.samp_rate = samp_rate = 0.3e6 self.rx_lr = rx_lr = -2 self.rolloff = rolloff = 0 self.puncpat = puncpat = '11' self.payload_mod = payload_mod = digital.qam_constellation( constellation_points=2**bits_per_symbol) self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_static( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, 1) self.packet_len = packet_len = 400 self.mag = mag = 10 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist") self.ldpc_dec = ldpc_dec = fec.ldpc_decoder.make( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 0.5, 50) self.header_formatter = header_formatter = digital.packet_header_ofdm( occupied_carriers, n_syms=1, len_tag_key=packet_length_tag_key, frame_len_tag_key=length_tag_key_0, bits_per_header_sym=header_mod.bits_per_symbol(), bits_per_payload_sym=8, scramble_header=False) self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe( fft_len, header_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols) self.hdr_format = hdr_format = digital.header_format_ofdm( occupied_carriers, 1, length_tag_key, ) self.gain_rx = gain_rx = 5 self.freq = freq = 900e6 self.bits_per_symbol_0 = bits_per_symbol_0 = len(occupied_carriers[0]) ################################################## # Blocks ################################################## self.training_mod_textbox = bokehgui.textbox( self.widget_lst, str(1), 'Alternate training every' + ": ") self.training_mod_textbox.add_callback( lambda attr, old, new: self.set_training_mod(int(new))) self._t_state_options = [ 1, 0, ] self._t_state_labels = [ 'On', 'Off', ] self.t_state_radiobutton = bokehgui.radiobutton(self.widget_lst, None, self._t_state_labels, inline=True) self.t_state_radiobutton.add_callback( lambda new: self.set_t_state(int(self._t_state_options[new]))) self.rx_lr_slider = bokehgui.slider(self.widget_lst, 'RX Learning rate (log)' + ":", -5, 0, 0.1, 1, -2) self.rx_lr_slider.add_callback( lambda attr, old, new: self.set_rx_lr(new)) self.mag_slider = bokehgui.slider(self.widget_lst, 'Eb/N0' + ":", 0, 40, 0.1, 1, 10) self.mag_slider.add_callback(lambda attr, old, new: self.set_mag(new)) self.learning_ber_bf_0 = learning.ber_bf(False, 100, -7.0, 1) self.gain_rx_slider = bokehgui.slider(self.widget_lst, 'Amplitude Rx' + ":", 0, 90, 0.5, 1, 5) self.gain_rx_slider.add_callback( lambda attr, old, new: self.set_gain_rx(new)) self.blocks_probe_signal_x_0 = blocks.probe_signal_f() self.zeromq_sub_msg_source_0_0 = zeromq.sub_msg_source( "tcp://" + ip + ":50001", 1000) self.zeromq_pub_msg_sink_0_0_0 = zeromq.pub_msg_sink( 'tcp://*:50002', 1000) self.variable_qtgui_label_0_0 = bokehgui.label( self.widget_lst, str(variable_qtgui_label_0_0), 'BER' + ": ") self.variable_qtgui_label_0 = bokehgui.label( self.widget_lst, str(variable_qtgui_label_0), 'Error count' + ": ") self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.uhd_usrp_source_0.set_rx_agc(False, 0) self.uhd_usrp_source_0.set_gain(gain_rx, 0) self.timestamp_textbox = bokehgui.textbox(self.widget_lst, str('1'), 'Load timestamp' + ": ") self.timestamp_textbox.add_callback( lambda attr, old, new: self.set_timestamp(str(new))) self.learning_dl_demod_0 = learning.dl_demod( 'packet_num', False, bits_per_symbol, packet_len, 20, training_mod, 10**rx_lr, t_state, '/home/cyrille/Gnu-Radio/modules/gr-learning/examples/saved_models' ) self.learning_align_0 = learning.align('packet_num', packet_len, 1, 48) self.fft_vxx_1 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_0 = fft.fft_vcc(fft_len, True, (), True, 1) def _errors_probe(): while True: val = self.learning_ber_bf_0.total_errors() try: self.set_errors(val) except AttributeError: pass time.sleep(1.0 / (0.5)) _errors_thread = threading.Thread(target=_errors_probe) _errors_thread.daemon = True _errors_thread.start() self.digital_packet_headerparser_b_0 = digital.packet_headerparser_b( header_formatter.base()) self.digital_ofdm_sync_sc_cfb_0 = digital.ofdm_sync_sc_cfb( fft_len, fft_len // 4, False, 0.9) self.digital_ofdm_serializer_vcc_payload = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key_0, packet_length_tag_key, 1, '', True) self.digital_ofdm_serializer_vcc_header = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key_0, '', 0, '', True) self.digital_ofdm_frame_equalizer_vcvc_1 = digital.ofdm_frame_equalizer_vcvc( payload_equalizer.base(), fft_len // 4, length_tag_key_0, True, 0) self.digital_ofdm_frame_equalizer_vcvc_0 = digital.ofdm_frame_equalizer_vcvc( header_equalizer.base(), fft_len // 4, length_tag_key_0, True, 1) self.digital_ofdm_chanest_vcvc_0 = digital.ofdm_chanest_vcvc( sync_word1, sync_word2, 1, 0, 3, False) self.digital_header_payload_demux_0 = digital.header_payload_demux( 3, fft_len, fft_len // 4, length_tag_key_0, "", True, gr.sizeof_gr_complex, "rx_time", int(samp_rate), (), 0) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb( header_mod.base()) self.bokehgui_time_sink_x_0 = bokehgui.time_sink_f_proc( 1024, samp_rate, "Decoded minus label", 1) self.bokehgui_time_sink_x_0_plot = bokehgui.time_sink_f( self.doc, self.plot_lst, self.bokehgui_time_sink_x_0, is_message=False) labels = ['', '', '', '', '', '', '', '', '', ''] legend_list = [] for i in range(1): if len(labels[i]) == 0: legend_list.append("Data {0}".format(i)) else: legend_list.append(labels[i]) self.bokehgui_time_sink_x_0_plot.initialize(log_x=False, log_y=False, update_time=500, legend_list=legend_list) self.bokehgui_time_sink_x_0_plot.set_y_axis([-10, 10]) self.bokehgui_time_sink_x_0_plot.set_y_label('Difference' + '(' + "" + ')') self.bokehgui_time_sink_x_0_plot.set_x_label('Symbol' + '(' + "" + ')') self.bokehgui_time_sink_x_0_plot.enable_tags(-1, True) self.bokehgui_time_sink_x_0_plot.set_trigger_mode( bokehgui.TRIG_MODE_FREE, bokehgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.bokehgui_time_sink_x_0_plot.enable_grid(False) self.bokehgui_time_sink_x_0_plot.enable_axis_labels(True) self.bokehgui_time_sink_x_0_plot.disable_legend(not True) self.bokehgui_time_sink_x_0_plot.set_layout(*((2, 0, 1, 3))) colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "blue", "blue", "blue" ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] styles = [ "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid" ] markers = [None, None, None, None, None, None, None, None, None, None] 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): self.bokehgui_time_sink_x_0_plot.format_line( i, colors[i], widths[i], styles[i], markers[i], alphas[i]) self.bokehgui_time_const_x_0 = bokehgui.time_sink_c_proc( 1024, samp_rate, "Received noisy constellation", 1) self.bokehgui_time_const_x_0_plot = bokehgui.const_sink_c( self.doc, self.plot_lst, self.bokehgui_time_const_x_0, is_message=False) labels = ['', '', '', '', '', '', '', '', '', ''] legend_list = [] for i in range(1): if len(labels[i]) == 0: if (i % 2 == 0): legend_list.append("Re{{Data {0}}}".format(i / 2)) else: legend_list.append("Im{{Data {0}}}".format(i / 2)) else: legend_list.append(labels[i]) self.bokehgui_time_const_x_0_plot.initialize(update_time=500, legend_list=legend_list) self.bokehgui_time_const_x_0_plot.set_y_axis([-2, 2]) self.bokehgui_time_const_x_0_plot.set_y_label('Q Channel' + '(' + "" + ')') self.bokehgui_time_const_x_0_plot.set_x_label('I Channel' + '(' + "" + ')') self.bokehgui_time_const_x_0_plot.enable_tags(-1, False) self.bokehgui_time_const_x_0_plot.set_trigger_mode( bokehgui.TRIG_MODE_FREE, bokehgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.bokehgui_time_const_x_0_plot.enable_grid(True) self.bokehgui_time_const_x_0_plot.enable_axis_labels(True) self.bokehgui_time_const_x_0_plot.disable_legend(not True) self.bokehgui_time_const_x_0_plot.set_layout(*((0, 1, 2, 2))) colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "blue", "blue", "blue" ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = ['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o'] 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): self.bokehgui_time_const_x_0_plot.format_line( i, colors[i], widths[i], 'None', markers[i], alphas[i]) self.bokehgui_frequency_sink_x_0 = bokehgui.freq_sink_c_proc( 1024, firdes.WIN_BLACKMAN_hARRIS, freq, samp_rate, "Rx signal", 1) self.bokehgui_frequency_sink_x_0_plot = bokehgui.freq_sink_c( self.doc, self.plot_lst, self.bokehgui_frequency_sink_x_0, is_message=False) labels = ['', '', '', '', '', '', '', '', '', ''] legend_list = [] for i in range(1): if len(labels[i]) == 0: legend_list.append("Data {0}".format(i)) else: legend_list.append(labels[i]) self.bokehgui_frequency_sink_x_0_plot.initialize( update_time=100, legend_list=legend_list) self.bokehgui_frequency_sink_x_0_plot.set_y_axis([-140, 10]) self.bokehgui_frequency_sink_x_0_plot.set_y_label('Relative Gain' + '(' + 'dB' + ')') self.bokehgui_frequency_sink_x_0_plot.set_x_label('Frequency' + '(' + "Hz" + ')') self.bokehgui_frequency_sink_x_0_plot.set_trigger_mode( bokehgui.TRIG_MODE_FREE, 0.0, 0, "") self.bokehgui_frequency_sink_x_0_plot.enable_grid(False) self.bokehgui_frequency_sink_x_0_plot.enable_axis_labels(True) self.bokehgui_frequency_sink_x_0_plot.disable_legend(not True) self.bokehgui_frequency_sink_x_0_plot.set_layout(*((3, 0, 1, 3))) self.bokehgui_frequency_sink_x_0_plot.enable_max_hold() colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] styles = [ "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid", "solid" ] markers = [None, None, None, None, None, None, None, None, None, None] 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): self.bokehgui_frequency_sink_x_0_plot.format_line( i, colors[i], widths[i], styles[i], markers[i], alphas[i]) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_repack_bits_bb_0_0_1_1 = blocks.repack_bits_bb( bits_per_symbol, 1, '', False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_0_1 = blocks.repack_bits_bb( bits_per_symbol, 1, '', False, gr.GR_LSB_FIRST) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * bits_per_symbol) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, fft_len + 0 * (fft_len // 4) + 10) 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_0 = blocks.add_vcc(1) def _ber_probe(): while True: val = self.blocks_probe_signal_x_0.level() try: self.set_ber(val) except AttributeError: pass time.sleep(1.0 / (0.5)) _ber_thread = threading.Thread(target=_ber_probe) _ber_thread.daemon = True _ber_thread.start() self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, np.sqrt(10**(np.log10(1 / bits_per_symbol) - (mag / 10.0))) * 1, -1) self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc( -2.0 / fft_len) if self.widget_lst: input_t = bokehgui.bokeh_layout.widgetbox(self.widget_lst) widgetbox = bokehgui.bokeh_layout.WidgetLayout(input_t) widgetbox.set_layout(*((0, 0, 2, 1))) list_obj = [widgetbox] + self.plot_lst else: list_obj = self.plot_lst layout_t = bokehgui.bokeh_layout.create_layout(list_obj, "stretch_both") self.doc.add_root(layout_t) ################################################## # Connections ################################################## self.msg_connect((self.digital_packet_headerparser_b_0, 'header_data'), (self.digital_header_payload_demux_0, 'header_data')) self.msg_connect((self.learning_dl_demod_0, 'losses'), (self.zeromq_pub_msg_sink_0_0_0, 'in')) self.msg_connect((self.zeromq_sub_msg_source_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.bokehgui_time_const_x_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.learning_align_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_char_to_float_0_0_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.digital_header_payload_demux_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.learning_align_0, 1)) self.connect((self.blocks_repack_bits_bb_0_0_1, 0), (self.learning_ber_bf_0, 1)) self.connect((self.blocks_repack_bits_bb_0_0_1_1, 0), (self.learning_ber_bf_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.bokehgui_time_sink_x_0, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_packet_headerparser_b_0, 0)) self.connect((self.digital_header_payload_demux_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_header_payload_demux_0, 1), (self.fft_vxx_1, 0)) self.connect((self.digital_ofdm_chanest_vcvc_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_0, 0), (self.digital_ofdm_serializer_vcc_header, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_1, 0), (self.digital_ofdm_serializer_vcc_payload, 0)) self.connect((self.digital_ofdm_serializer_vcc_header, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_payload, 0), (self.blocks_add_xx_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0, 0), (self.analog_frequency_modulator_fc_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0, 1), (self.digital_header_payload_demux_0, 1)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_chanest_vcvc_0, 0)) self.connect((self.fft_vxx_1, 0), (self.digital_ofdm_frame_equalizer_vcvc_1, 0)) self.connect((self.learning_align_0, 1), (self.learning_dl_demod_0, 1)) self.connect((self.learning_align_0, 0), (self.learning_dl_demod_0, 0)) self.connect((self.learning_ber_bf_0, 0), (self.blocks_probe_signal_x_0, 0)) self.connect((self.learning_dl_demod_0, 1), (self.blocks_char_to_float_0_0, 0)) self.connect((self.learning_dl_demod_0, 2), (self.blocks_char_to_float_0_0_0, 0)) self.connect((self.learning_dl_demod_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.learning_dl_demod_0, 2), (self.blocks_repack_bits_bb_0_0_1, 0)) self.connect((self.learning_dl_demod_0, 1), (self.blocks_repack_bits_bb_0_0_1_1, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.bokehgui_frequency_sink_x_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_sync_sc_cfb_0, 0))
def __init__(self, frame_size=60, puncpat='11'): gr.top_block.__init__(self, "Fecapi Ldpc Encoders") Qt.QWidget.__init__(self) self.setWindowTitle("Fecapi Ldpc Encoders") 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", "fecapi_ldpc_encoders") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.frame_size = frame_size self.puncpat = puncpat ################################################## # Variables ################################################## self.H = H = fec.ldpc_H_matrix( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 2) self.G = G = fec.ldpc_G_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0058_gen_matrix.alist") self.samp_rate = samp_rate = 50000 self.ldpc_enc_H = ldpc_enc_H = fec.ldpc_par_mtrx_encoder_make_H(H) self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist") self.H_0 = H_0 = fec.ldpc_H_matrix( '/home/mbkitine/Dropbox/Lulea/GRC/DeepSpace/gr-ccsds/examples/LDPC/sim_matlab/AR4JA/python/AR4JA_r45_k1024n.a', 3) ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_1.set_update_time(0.05) self.qtgui_time_sink_x_0_0_1.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, 'packet_len') self.qtgui_time_sink_x_0_0_1.enable_autoscale(False) self.qtgui_time_sink_x_0_0_1.enable_grid(False) self.qtgui_time_sink_x_0_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_1.disable_legend() labels = ['LDPC (G)', 'CC', '', '', '', '', '', '', '', ''] 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, 0.6, 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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.05) self.qtgui_time_sink_x_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_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 = ['LDPC (alist)', 'LDPC (H)', '', '', '', '', '', '', '', ''] 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, 0.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_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.fec_extended_encoder_1 = fec.extended_encoder( encoder_obj_list=ldpc_enc_H, threading=None, puncpat=puncpat) self.fec_extended_encoder_0_0_0 = fec.extended_encoder( encoder_obj_list=ldpc_enc, threading=None, puncpat=puncpat) self.fec_extended_encoder_0 = fec.extended_encoder( encoder_obj_list=ldpc_enc_G, threading=None, puncpat=puncpat) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_char_to_float_1_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_1 = 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_throttle_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_char_to_float_1, 0), (self.qtgui_time_sink_x_0_0_1, 0)) self.connect((self.blocks_char_to_float_1_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0_0_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1, 0)) self.connect((self.fec_extended_encoder_0, 0), (self.blocks_char_to_float_1, 0)) self.connect((self.fec_extended_encoder_0_0_0, 0), (self.blocks_char_to_float_1_0_0, 0)) self.connect((self.fec_extended_encoder_1, 0), (self.blocks_char_to_float_0, 0))
def __init__(self, doc, ip="127.0.0.1"): gr.top_block.__init__(self, "RL Mod training") self.doc = doc self.plot_lst = [] self.widget_lst = [] ################################################## # Parameters ################################################## self.ip = ip ################################################## # Variables ################################################## self.pilot_symbols = pilot_symbols = ((1, 1, 1, -1,),) self.pilot_carriers = pilot_carriers = ((-21, -7, 7, 21,),) self.packet_length_tag_key = packet_length_tag_key = "packet_length" self.occupied_carriers = occupied_carriers = (list(range(-22, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 23)),) self.length_tag_key_0 = length_tag_key_0 = "frame_len" self.length_tag_key = length_tag_key = "packet_len" self.header_mod = header_mod = digital.constellation_bpsk() self.fft_len = fft_len = 64 self.bits_per_symbol = bits_per_symbol = 4 self.variable_0 = variable_0 = len(occupied_carriers[0]) self.tx_lr = tx_lr = -3 self.tx_explo = tx_explo = 0.15 self.training_mod = training_mod = 1 self.timestamp = timestamp = '1' self.t_state = t_state = 1 self.sync_word2 = sync_word2 = [0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0] self.sync_word1 = sync_word1 = [0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0.] self.samp_rate = samp_rate = 0.3e6 self.rolloff = rolloff = 0 self.puncpat = puncpat = '11' self.payload_mod = payload_mod = digital.qam_constellation(constellation_points=2**bits_per_symbol) self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_static(fft_len, occupied_carriers, pilot_carriers, pilot_symbols, 1) self.packet_len = packet_len = 400 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist") self.header_formatter = header_formatter = digital.packet_header_ofdm(occupied_carriers, n_syms=1, len_tag_key=packet_length_tag_key, frame_len_tag_key=length_tag_key_0, bits_per_header_sym=header_mod.bits_per_symbol(), bits_per_payload_sym=8, scramble_header=False) self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(fft_len, header_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols) self.hdr_format = hdr_format = digital.header_format_ofdm(occupied_carriers, 1, length_tag_key,) self.gain = gain = 10 self.freq = freq = 900e6 self.bits_per_symbol_0 = bits_per_symbol_0 = len(occupied_carriers[0]) ################################################## # Blocks ################################################## self.tx_lr_slider = bokehgui.slider(self.widget_lst, 'TX Learning rate (log)' +":", -5, 0, 0.1, 1, -3) self.tx_lr_slider.add_callback(lambda attr, old, new: self.set_tx_lr(new)) self.tx_explo_slider = bokehgui.slider(self.widget_lst, 'TX Exploration noise' +":", 0.001, 0.5, 0.001, 1, 0.15) self.tx_explo_slider.add_callback(lambda attr, old, new: self.set_tx_explo(new)) self.training_mod_textbox = bokehgui.textbox(self.widget_lst, str(1), 'Alternate training every' +": ") self.training_mod_textbox.add_callback( lambda attr, old, new: self.set_training_mod(int(new))) self._t_state_options = [ 1, 0, ] self._t_state_labels = [ 'On', 'Off', ] self.t_state_radiobutton = bokehgui.radiobutton(self.widget_lst, None, self._t_state_labels, inline = True) self.t_state_radiobutton.add_callback( lambda new: self.set_t_state(int(self._t_state_options[new]))) self.gain_slider = bokehgui.slider(self.widget_lst, 'Amplitude' +":", 0, 90, 0.5, 1, 10) self.gain_slider.add_callback(lambda attr, old, new: self.set_gain(new)) self.zeromq_sub_msg_source_0_1 = zeromq.sub_msg_source("tcp://"+ip+":50002", 100) self.zeromq_pub_msg_sink_0_0 = zeromq.pub_msg_sink('tcp://*:50001', 100) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0,1)), ), length_tag_key, ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) 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(gain, 0) self.timestamp_textbox = bokehgui.textbox(self.widget_lst, str('1'), 'Load timestamp' +": ") self.timestamp_textbox.add_callback( lambda attr, old, new: self.set_timestamp(str(new))) self.learning_tag_numerotation_0 = learning.tag_numerotation('packet_num', packet_len, 4096, "bb") self.learning_rl_mod_0 = learning.rl_mod('packet_num', bits_per_symbol, packet_len, 1, training_mod, 10**tx_lr , tx_explo, t_state , '/home/cyrille/Gnu-Radio/modules/gr-learning/examples/saved_models') self.fft_vxx_0_0 = fft.fft_vcc(fft_len, False, (), True, 1) self.fec_extended_encoder_1_0_0 = fec.extended_encoder(encoder_obj_list=ldpc_enc, threading= None, puncpat=puncpat) self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(hdr_format, length_tag_key) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( fft_len, fft_len + fft_len//4, rolloff, length_tag_key) self.digital_ofdm_carrier_allocator_cvc_0 = digital.ofdm_carrier_allocator_cvc( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, (sync_word1, sync_word2), length_tag_key, True) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(header_mod.points(), 1) self.bokehgui_time_const_x_0 = bokehgui.time_sink_c_proc(1024, samp_rate, "Transmitted noiseless constellation", 1) self.bokehgui_time_const_x_0_plot = bokehgui.const_sink_c(self.doc, self.plot_lst, self.bokehgui_time_const_x_0, is_message = False) labels = ['', '', '', '', '', '', '', '', '', ''] legend_list = [] for i in range( 1 ): if len(labels[i]) == 0: if(i % 2 == 0): legend_list.append("Re{{Data {0}}}".format(i/2)) else: legend_list.append("Im{{Data {0}}}".format(i/2)) else: legend_list.append(labels[i]) self.bokehgui_time_const_x_0_plot.initialize(update_time = 500, legend_list = legend_list) self.bokehgui_time_const_x_0_plot.set_y_axis([-2, 2]) self.bokehgui_time_const_x_0_plot.set_y_label('Q Channel' + '(' +""+')') self.bokehgui_time_const_x_0_plot.set_x_label('I Channel' + '(' +""+')') self.bokehgui_time_const_x_0_plot.enable_tags(-1, False) self.bokehgui_time_const_x_0_plot.set_trigger_mode(bokehgui.TRIG_MODE_FREE, bokehgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.bokehgui_time_const_x_0_plot.enable_grid(False) self.bokehgui_time_const_x_0_plot.enable_axis_labels(True) self.bokehgui_time_const_x_0_plot.disable_legend(not True) self.bokehgui_time_const_x_0_plot.set_layout(*((0,1,2,2))) colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "blue", "blue", "blue"] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = ['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o'] 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 ): self.bokehgui_time_const_x_0_plot.format_line(i, colors[i], widths[i], 'None', markers[i], alphas[i]) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate/6,True) self.blocks_tagged_stream_to_pdu_0_0_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, 'packet_len') self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_gr_complex*1, length_tag_key, 0) self.blocks_stream_to_tagged_stream_0_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, packet_len, length_tag_key) self.blocks_repack_bits_bb_0_0_0 = blocks.repack_bits_bb(8, 1, length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(1, bits_per_symbol, '', False, gr.GR_LSB_FIRST) self.blocks_multiply_const_xx_0 = blocks.multiply_const_cc(0.01, 1) self.analog_random_source_x_0_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 2, 1000))), True) if self.widget_lst: input_t = bokehgui.bokeh_layout.widgetbox(self.widget_lst) widgetbox = bokehgui.bokeh_layout.WidgetLayout(input_t) widgetbox.set_layout(*((0, 0, 2, 1))) list_obj = [widgetbox] + self.plot_lst else: list_obj = self.plot_lst layout_t = bokehgui.bokeh_layout.create_layout(list_obj, "fixed") self.doc.add_root(layout_t) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self.zeromq_pub_msg_sink_0_0, 'in')) self.msg_connect((self.zeromq_sub_msg_source_0_1, 'out'), (self.learning_rl_mod_0, 'losses')) self.connect((self.analog_random_source_x_0_0, 0), (self.fec_extended_encoder_1_0_0, 0)) self.connect((self.blocks_multiply_const_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.blocks_stream_to_tagged_stream_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.digital_protocol_formatter_bb_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.learning_tag_numerotation_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_tagged_stream_to_pdu_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), (self.fft_vxx_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_xx_0, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_repack_bits_bb_0_0_0, 0)) self.connect((self.fec_extended_encoder_1_0_0, 0), (self.blocks_repack_bits_bb_0_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.learning_rl_mod_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.learning_rl_mod_0, 1), (self.bokehgui_time_const_x_0, 0)) self.connect((self.learning_tag_numerotation_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.learning_tag_numerotation_0, 0), (self.learning_rl_mod_0, 0))
def __init__(self, pre_bits=[0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100e3 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make('/home/abraxas3d/goodies/share/gnuradio/fec/ldpc/271.127.3.112'); ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf(2, firdes.root_raised_cosine( 1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(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, 0,0,1,0) 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_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1,1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.top_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1,0) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0,1,3,2])) self.fec_async_encoder_0 = fec.async_encoder(ldpc_enc, False, True, True, 1500) self.es_source_0 = es.source(1*[gr.sizeof_gr_complex], 1, 2) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random()*1e-4, epsilon=1.0+random.random()*1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False ) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer(([0,14,15]), ([1,0,0,1,0,1,0,1,0,0,0,0,0,0,0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_padder_0 = burst.padder(144) self.burst_framer_0 = burst.framer(144) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256/2, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/tmp/psk_ldpc_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_padder_0, 'pdus')) self.msg_connect((self.burst_padder_0, 'pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.fec_async_encoder_0, 'in')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.fec_async_encoder_0, 'out'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))
def __init__(self, pre_bits=[ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0 ]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100e3 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make( '/home/abraxas3d/goodies/share/gnuradio/fec/ldpc/271.127.3.112') ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf( 2, firdes.root_raised_cosine(1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(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, 0, 0, 1, 0) 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_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0 self.top_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1, 0) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0, 1, 3, 2])) self.fec_async_encoder_0 = fec.async_encoder(ldpc_enc, False, True, True, 1500) self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random() * 1e-4, epsilon=1.0 + random.random() * 1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer( ([0, 14, 15]), ([1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_padder_0 = burst.padder(144) self.burst_framer_0 = burst.framer(144) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256 / 2, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, '/tmp/psk_ldpc_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_padder_0, 'pdus')) self.msg_connect((self.burst_padder_0, 'pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.fec_async_encoder_0, 'in')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.fec_async_encoder_0, 'out'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))