def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.simple_mac_0_0 = mac.simple_mac(1,0.1,10) self.simple_mac_0 = mac.simple_mac(0,0.1,10) self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(0,0) self.blocks_random_pdu_0 = blocks.random_pdu(5, 5) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.simple_mac_0, "to_radio", self.simple_mac_0_0, "from_radio") self.msg_connect(self.simple_mac_0_0, "to_radio", self.simple_mac_0, "from_radio") 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.mac_virtual_channel_encoder_0, "in") self.msg_connect(self.mac_virtual_channel_encoder_0, "out", self.simple_mac_0_0, "from_app") self.msg_connect(self.simple_mac_0, "to_app", self.blocks_message_debug_0, "print_pdu")
def __init__(self): gr.top_block.__init__(self, "Hdlc Frame") Qt.QWidget.__init__(self) self.setWindowTitle("Hdlc Frame") 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", "hdlc_Frame") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.message = message = 'a', 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ################################################## # Blocks ################################################## self.satellites_pdu_to_kiss_0 = satellites.pdu_to_kiss() self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, '', '', False, False, '') self._qtgui_edit_box_msg_0_win = sip.wrapinstance( self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_edit_box_msg_0_win) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_framer_pb_0 = digital.hdlc_framer_pb('packet_len') self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_random_pdu_0 = blocks.random_pdu(16, 64, chr(0xFF), 2) self.blocks_message_strobe_random_0 = blocks.message_strobe_random( pmt.intern("TEST"), blocks.STROBE_POISSON, 10000, 500) self.blocks_message_debug_1 = blocks.message_debug() self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_random_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.satellites_pdu_to_kiss_0, 'in')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.satellites_pdu_to_kiss_0, 'out'), (self.digital_hdlc_framer_pb_0, 'in')) self.connect((self.digital_hdlc_framer_pb_0, 0), (self.digital_hdlc_deframer_bp_0, 0))
def test_protocol_v2(self): # set up fg src = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = protocol_sink('/tmp/blocksat/bitcoinfibre', '/tmp/blocksat/api', PROTO_V1, False) self.tb.msg_connect((src, 'pdus'), (snk, 'async_pdu')) self.tb.run()
def __init__(self): gr.top_block.__init__(self, "Bit Padding Test") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.blocks_random_pdu_0 = blocks.random_pdu(10, 12, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0))
def test_001_t (self): # set up fg self.blocks_random_pdu_0 = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = file_sink_nonblock('/tmp/test_001_out'); self.tb.connect (src, snk) self.tb.run ()
def test_001_t(self): # set up fg self.blocks_random_pdu_0 = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = file_sink_nonblock('/tmp/test_001_out') self.tb.connect(src, snk) self.tb.run()
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.ec_ax25_decoder_b_0 = ec.ax25_decoder_b(True, 0, "") self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", "52001", 10000, False) self.blocks_random_pdu_0 = blocks.random_pdu(256, 256, chr(0xFF), 1) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 2000) self.ax25_ax25_encoder_0 = ax25.ax25_encoder("SPACE ", "EARTH ", 0, 0) ################################################## # Connections ################################################## self.msg_connect((self.ax25_ax25_encoder_0, 'pdu_out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) 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.ax25_ax25_encoder_0, 'pdu_in')) self.msg_connect((self.ec_ax25_decoder_b_0, 'pdus'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.ec_ax25_decoder_b_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ber Test") ################################################## # Variables ################################################## self.sps = sps = 4 self.nfilts = nfilts = 32 self.timing_loop_bw = timing_loop_bw = 62.8e-3 self.samp_rate = samp_rate = 32000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), 0.35, 11*sps*nfilts) self.qpsk = qpsk = digital.constellation_rect(([1+1j, -1+1j, -1-1j, 1-1j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base() self.excess_bw = excess_bw = 0.35 ################################################## # Blocks ################################################## self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, (rrc_taps), nfilts, nfilts/2, 1.5, 1) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=qpsk, differential=False, samples_per_symbol=sps, pre_diff_code=True, excess_bw=excess_bw, verbose=True, log=False, ) self.digital_constellation_decoder_cb_0_0 = digital.constellation_decoder_cb(qpsk) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, 'packet_len') self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(2, 8, "", False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(8, 2, "", False, gr.GR_LSB_FIRST) self.blocks_random_pdu_0 = blocks.random_pdu(5, 6, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_message_strobe_0 = blocks.message_strobe(pmt.PMT_T, 2000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # 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.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.digital_constellation_decoder_cb_0_0, 0), (self.blocks_repack_bits_bb_0_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_constellation_decoder_cb_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.dflood_dflood_3 = dflood.dflood( 3, 0, 20, False, False, 5, 65, 2, 120, 50, 0, 0.8, True, None ) self.dflood_dflood_1 = dflood.dflood( 1, 0, 20, False, False, 1, 5, 0, 120, 50, 2, 0.8, True, None ) self.dflood_dflood_0 = dflood.dflood( 0, 0, 10, False, False, 5, 65, 2, 120, 50, 2, 0.8, True, None ) self.blocks_random_pdu_0 = blocks.random_pdu(6, 6, chr(0xFF), 2) self.blocks_message_strobe_3 = blocks.message_strobe(pmt.intern("TEST"), 20000) self.blocks_message_strobe_2_0 = blocks.message_strobe(pmt.intern("TEST"), 10000) self.blocks_message_strobe_1 = blocks.message_strobe(pmt.intern("TEST"), 20000) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 20000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.dflood_dflood_0, 'ctrl_in')) self.msg_connect((self.blocks_message_strobe_1, 'strobe'), (self.dflood_dflood_1, 'ctrl_in')) self.msg_connect((self.blocks_message_strobe_2_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_message_strobe_3, 'strobe'), (self.dflood_dflood_3, 'ctrl_in')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.dflood_dflood_3, 'from_app')) self.msg_connect((self.dflood_dflood_0, 'to_app'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.dflood_dflood_0, 'to_radio'), (self.dflood_dflood_1, 'from_radio')) self.msg_connect((self.dflood_dflood_1, 'to_radio'), (self.dflood_dflood_0, 'from_radio')) self.msg_connect((self.dflood_dflood_1, 'to_radio'), (self.dflood_dflood_3, 'from_radio')) self.msg_connect((self.dflood_dflood_3, 'to_radio'), (self.dflood_dflood_1, 'from_radio'))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.djilink_scenario_0 = djilink.scenario() self.blocks_random_pdu_0 = blocks.random_pdu(10, 10, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) ################################################## # 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.djilink_scenario_0, 'scenario_msg'))
def test_protocol_v2 (self): # Block parameters blk_pipe = '/tmp/blocksat/bitcoinfibre' api_pipe = '/tmp/blocksat/api' protocol_version = PROTO_V2 disable_api = False disable_blk = False # set up fg src = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = protocol_sink(blk_pipe, api_pipe, protocol_version, disable_api, disable_blk) self.tb.msg_connect((src, 'pdus'), (snk, 'async_pdu')) #self.tb.run() # check data local_blk_pipe = Pipe(blk_pipe) data = local_blk_pipe.read(512) self.assertEqual(len(data), 0)
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.blocks_random_pdu_0 = blocks.random_pdu(32, 32, chr(0xFF), 1) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 10000) self.blocks_message_debug_0 = blocks.message_debug() self.ax25_pdu_prepend_append_0 = ax25.pdu_prepend_append(-6, -2, 0xAA) ################################################## # Connections ################################################## self.msg_connect((self.ax25_pdu_prepend_append_0, 'pdu_out'), (self.blocks_message_debug_0, 'print_pdu')) 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.ax25_pdu_prepend_append_0, 'pdu_in')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu'))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.simple_mac_0_0 = mac.simple_mac(1, 0.1, 10) self.simple_mac_0 = mac.simple_mac(0, 0.1, 10) self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(0, 0) self.blocks_random_pdu_0 = blocks.random_pdu(5, 5) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.simple_mac_0, "to_radio", self.simple_mac_0_0, "from_radio") self.msg_connect(self.simple_mac_0_0, "to_radio", self.simple_mac_0, "from_radio") 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.mac_virtual_channel_encoder_0, "in") self.msg_connect(self.mac_virtual_channel_encoder_0, "out", self.simple_mac_0_0, "from_app") self.msg_connect(self.simple_mac_0, "to_app", self.blocks_message_debug_0, "print_pdu")
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.tnc_hdlc_framer_0 = tnc.hdlc_framer(preamble_length=50, postamble_length=7,verbose=False, use_scrambler=False) self.tnc_hdlc_deframer_0 = tnc.hdlc_deframer() self.tnc_ax25_framer_0 = tnc.ax25_framer(mycall="KI4MTT",destcall="KI4MTS",verbose=True) self.tnc_ax25_deframer_0 = tnc.ax25_deframer(mycall="KI4MTT",verbose=True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 50) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.tnc_hdlc_deframer_0, 0)) ################################################## # Asynch Message 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.tnc_ax25_framer_0, "in") self.msg_connect(self.tnc_ax25_deframer_0, "out", self.blocks_message_debug_0, "print_pdu") self.msg_connect(self.tnc_ax25_framer_0, "out", self.tnc_hdlc_framer_0, "in") self.msg_connect(self.tnc_hdlc_framer_0, "out", self.blocks_pdu_to_tagged_stream_0, "pdus") self.msg_connect(self.tnc_hdlc_deframer_0, "out", self.tnc_ax25_deframer_0, "in")
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Blocks ################################################## self.llsr_llsr_mac_1 = llsr.llsr_mac( 0, 0.01, 5, 2, True, 0.05, 10.0, 10, False, False, 0) self.llsr_llsr_mac_0 = llsr.llsr_mac( 1, 0.01, 5, 2, True, 0.05, 10.0, 10, False, False, 0) self.blocks_random_pdu_0 = blocks.random_pdu(5, 5, chr(0xFF), 2) self.blocks_message_strobe_3 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_strobe_2 = blocks.message_strobe(pmt.intern("TEST"), 20000) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 10000) self.blocks_message_debug_1 = blocks.message_debug() self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.llsr_llsr_mac_0, 'ctrl_in')) self.msg_connect((self.blocks_message_strobe_2, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_message_strobe_3, 'strobe'), (self.llsr_llsr_mac_1, 'ctrl_in')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.llsr_llsr_mac_0, 'from_app_arq')) self.msg_connect((self.llsr_llsr_mac_0, 'to_app'), (self.blocks_message_debug_1, 'print_pdu')) self.msg_connect((self.llsr_llsr_mac_0, 'to_radio'), (self.llsr_llsr_mac_1, 'from_radio')) self.msg_connect((self.llsr_llsr_mac_1, 'to_app'), (self.blocks_message_debug_0, 'print')) self.msg_connect((self.llsr_llsr_mac_1, 'to_radio'), (self.llsr_llsr_mac_0, 'from_radio'))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 ################################################## # Blocks ################################################## self.tnc_hdlc_framer_0 = tnc.hdlc_framer(preamble_length=50, postamble_length=7, verbose=False, use_scrambler=False) self.tnc_hdlc_deframer_0 = tnc.hdlc_deframer() self.tnc_ax25_framer_0 = tnc.ax25_framer(mycall="KI4MTT", destcall="KI4MTS", verbose=True) self.tnc_ax25_deframer_0 = tnc.ax25_deframer(mycall="KI4MTT", verbose=True) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=96, decimation=250, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=250, decimation=96, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.digital_gmsk_mod_0 = digital.gmsk_mod( samples_per_symbol=2, bt=0.35, verbose=False, log=False, ) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=10, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_random_pdu_0 = blocks.random_pdu(50, 50, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, "packet_len") self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 500) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( -200, 0.1, 0, True) ################################################## # 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.tnc_ax25_framer_0, 'in')) self.msg_connect((self.tnc_ax25_deframer_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.tnc_ax25_framer_0, 'out'), (self.tnc_hdlc_framer_0, 'in')) self.msg_connect((self.tnc_hdlc_deframer_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.tnc_hdlc_deframer_0, 'out'), (self.tnc_ax25_deframer_0, 'in')) self.msg_connect((self.tnc_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_gmsk_mod_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.tnc_hdlc_deframer_0, 0)) self.connect((self.digital_gmsk_mod_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_complex_to_mag_0, 0))
def __init__(self): gr.top_block.__init__(self, "FSK Packet Transmission") Qt.QWidget.__init__(self) self.setWindowTitle("FSK Packet Transmission") 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", "fsk") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.baudrate = baudrate = 1200 self.sps = sps = int(samp_rate) / baudrate self.nfilts = nfilts = 32 self.fsk_lo_tone = fsk_lo_tone = 1200 self.zero_pad = zero_pad = 100000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, samp_rate, 1200.0, 0.7, 11 * sps) self.preamble_len = preamble_len = 32 self.preamble_char = preamble_char = 0xaa self.hdr_format = hdr_format = digital.header_format_default( digital.packet_utils.default_access_code, 0) self.fsk_hi_tone = fsk_hi_tone = 2200 * 0 + (fsk_lo_tone + baudrate) * 1 ################################################## # Blocks ################################################## self.root_raised_cosine_filter_1 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, samp_rate, baudrate, 0.7, 11 * int(samp_rate) / baudrate)) self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, samp_rate, baudrate, 0.7, 11 * int(samp_rate) / baudrate)) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-70, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0, 1, 1, 1) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-2.125, 2.125) 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(True) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not False: 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192 * 6, #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(-2.125, 2.125) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0.02, 0, 'packet_len') self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #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(-100, 20) 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(True) 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 False: 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 = [2, 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, 0, 1, 1) self.fsk_packet_tx_1_0 = fsk_packet_tx_1( baud=baudrate, fsk_hi=fsk_lo_tone, fsk_low=fsk_hi_tone, hdr_format=hdr_format, preamble_len=preamble_len, preamble_sym=preamble_char, samp_rate=samp_rate, zero_pad=zero_pad, ) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( sps, 6.28 / 200, (rrc_taps), nfilts, 1, 1.5, 1) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.25, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 0.0j, ), noise_seed=0, block_tags=False) self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_rotator_cc_1 = blocks.rotator_cc( (-1.0 * fsk_hi_tone / samp_rate) * 2 * math.pi) self.blocks_rotator_cc_0 = blocks.rotator_cc( (-1.0 * fsk_lo_tone / samp_rate) * 2 * math.pi) self.blocks_random_pdu_0 = blocks.random_pdu(2, 128 * 4, chr(0xFF), 2) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, )) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 500) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(int(samp_rate), '', True) ################################################## # 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.fsk_packet_tx_1_0, 'data in')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_complex_to_mag_1, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.blocks_rotator_cc_1, 0), (self.root_raised_cosine_filter_1, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_rotator_cc_1, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.fsk_packet_tx_1_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.root_raised_cosine_filter_1, 0), (self.blocks_complex_to_mag_1, 0))
def __init__(self): gr.top_block.__init__(self, "Uhd Packet Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Packet Tx") 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", "uhd_packet_tx") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.sps = sps = 2 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, 5 * sps * nfilts) self.rate = rate = 2 self.polys = polys = [109, 79] self.k = k = 7 self.Const_PLD = Const_PLD = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_PLD.gen_soft_dec_lut(8) self.samp_rate = samp_rate = 1000e3 self.rep = rep = 3 self.ntaps = ntaps = len(tx_rrc_taps) self.hdr_format = hdr_format = digital.header_format_counter( digital.packet_utils.default_access_code, 3, Const_PLD.bits_per_symbol()) self.gain = gain = 50 self.freq = freq = 483e6 - 300 self.enc_hdr = enc_hdr = fec.dummy_encoder_make(8000) self.enc = enc = fec.cc_encoder_make(1500 * 8, k, rate, (polys), 0, fec.CC_TERMINATED, False) self.amp = amp = 0.5 self.Const_HDR = Const_HDR = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_HDR.gen_soft_dec_lut(8) ################################################## # Blocks ################################################## self.tab0 = Qt.QTabWidget() self.tab0_widget_0 = Qt.QWidget() self.tab0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_0) self.tab0_grid_layout_0 = Qt.QGridLayout() self.tab0_layout_0.addLayout(self.tab0_grid_layout_0) self.tab0.addTab(self.tab0_widget_0, 'Time') self.tab0_widget_1 = Qt.QWidget() self.tab0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_1) self.tab0_grid_layout_1 = Qt.QGridLayout() self.tab0_layout_1.addLayout(self.tab0_grid_layout_1) self.tab0.addTab(self.tab0_widget_1, 'Freq.') self.tab0_widget_2 = Qt.QWidget() self.tab0_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_2) self.tab0_grid_layout_2 = Qt.QGridLayout() self.tab0_layout_2.addLayout(self.tab0_grid_layout_2) self.tab0.addTab(self.tab0_widget_2, 'Const.') self.top_grid_layout.addWidget(self.tab0, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_range = Range(200e3, 10e6, 200e3, 1000e3, 200) self._samp_rate_win = RangeWidget(self._samp_rate_range, self.set_samp_rate, 'Sample Rate', "counter_slider", float) self.top_grid_layout.addWidget(self._samp_rate_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._gain_range = Range(0, 83, 1, 50, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._freq_range = Range(50e6, 3e9, 500e3, 483e6 - 300, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_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._amp_range = Range(0, 0.9, 0.005, 0.5, 200) self._amp_win = RangeWidget(self._amp_range, self.set_amp, 'Amplitude', "counter_slider", float) self.top_grid_layout.addWidget(self._amp_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.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), 'packet_len', ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq( uhd.tune_request(freq, samp_rate / 2.0), 0) self.uhd_usrp_sink_0.set_gain(gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 2500, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-2, 2) 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, 'packet_len') 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 False: 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.tab0_grid_layout_0.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1, #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 False: 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.tab0_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 'packet_len') 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 False: 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.tab0_grid_layout_2.addWidget(self._qtgui_const_sink_x_0_win) self.packet_tx_0 = packet_tx( hdr_const=Const_HDR, hdr_enc=enc_hdr, hdr_format=digital.header_format_default( digital.packet_utils.default_access_code, 0), pld_const=Const_PLD, pld_enc=enc, psf_taps=tx_rrc_taps, sps=sps, ) self.blocks_random_pdu_0 = blocks.random_pdu(15, 150, chr(0xff), 1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((amp, )) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 2000) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # 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.packet_tx_0, 'in')) self.msg_connect((self.packet_tx_0, 'postcrc'), (self.blocks_message_debug_0, 'print_pdu')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.packet_tx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self, address="type=b200", param_freq=2450e6): grc_wxgui.top_block_gui.__init__(self, title="Cognitiva Node") ################################################## # Parameters ################################################## self.address = address self.param_freq = param_freq ################################################## # Variables ################################################## self.samp_rate = samp_rate = 4e6 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join((address, "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(param_freq, 0) self.uhd_usrp_source_0.set_gain(0, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join((address, "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(param_freq, 0) self.uhd_usrp_sink_0.set_gain(0, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.cognitiva_spectrum_sense_0 = cognitiva.spectrum_sense() self.cognitiva_phy_0 = cognitiva_phy( debug_mask=0, phy_ver=2, ) self.cognitiva_cognitiva_mac_0 = cognitiva.cognitiva_mac( "::1020", True, 0, 10, 0.1, 2.0, True, 0.05, 10.0, True, True, 1) self.cognitiva_bin_statistics_0 = cognitiva.bin_statistics(1024, 0.1, 0.2, samp_rate, 1) self.blocks_random_pdu_0 = blocks.random_pdu(240, 240, chr(0xFF), 2) self.blocks_message_strobe_0_0_0 = blocks.message_strobe(pmt.intern("TEST"), 2000) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_debug_0_0_0 = blocks.message_debug() self.blocks_message_debug_0_0 = blocks.message_debug() ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.cognitiva_spectrum_sense_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.cognitiva_phy_0, 0)) self.connect((self.cognitiva_phy_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.cognitiva_spectrum_sense_0, 0), (self.cognitiva_bin_statistics_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.cognitiva_cognitiva_mac_0, "payload out", self.blocks_message_debug_0_0, "print_pdu") self.msg_connect(self.blocks_message_strobe_0_0, "strobe", self.blocks_random_pdu_0, "generate") self.msg_connect(self.blocks_random_pdu_0, "pdus", self.cognitiva_cognitiva_mac_0, "payload in") self.msg_connect(self.cognitiva_cognitiva_mac_0, "mpdu out", self.cognitiva_phy_0, "from_mac") self.msg_connect(self.cognitiva_phy_0, "to_mac", self.cognitiva_cognitiva_mac_0, "mpdu in") self.msg_connect(self.blocks_message_strobe_0_0_0, "strobe", self.cognitiva_bin_statistics_0, "start") self.msg_connect(self.cognitiva_bin_statistics_0, "bins", self.blocks_message_debug_0_0_0, "print")
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") 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", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 20e3 ################################################## # 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) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.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, 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.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0 self.top_grid_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, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0, 1, 3, 2])) self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) 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_framer_0 = burst.framer(1024) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256, 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_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_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.burst_preamble_insert_0, 'pdus')) 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.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, beta_rrc=0.13, bits_per_symb=2, cfar_thresh=50, cfo_samps=512, corr_reps=2, demod_hidden_layers=[50], demod_init_weights="", demod_seed=341133, demodtype="neural", lambda_center=1, log_interval=1, max_amplitude=0.707, mod_hidden_layers=[50], mod_init_weights="", mod_seed=341132, modtype="neural", packet_len=256, rx_gain=4, samps_per_symb=2, shared_preamble="", spy_thresh=0.1, tx_gain=3): gr.top_block.__init__(self, "Echo Single-USRP Flowgraph") ################################################## # Parameters ################################################## self.beta_rrc = beta_rrc self.bits_per_symb = bits_per_symb self.cfar_thresh = cfar_thresh self.cfo_samps = cfo_samps self.corr_reps = corr_reps self.demod_hidden_layers = demod_hidden_layers self.demod_init_weights = demod_init_weights self.demod_seed = demod_seed self.demodtype = demodtype self.lambda_center = lambda_center self.log_interval = log_interval self.max_amplitude = max_amplitude self.mod_hidden_layers = mod_hidden_layers self.mod_init_weights = mod_init_weights self.mod_seed = mod_seed self.modtype = modtype self.packet_len = packet_len self.rx_gain = rx_gain self.samps_per_symb = samps_per_symb self.shared_preamble = shared_preamble self.spy_thresh = spy_thresh self.tx_gain = tx_gain ################################################## # Variables ################################################## self.spy_length = spy_length = 64 * bits_per_symb self.samp_rate = samp_rate = 500000 self.full_len = full_len = 2 * packet_len + (spy_length + 96) / bits_per_symb self.cfo_freqs = cfo_freqs = 11./256, 43./256, 97./256 self.F_center = F_center = 1000000000 ################################################## # Blocks ################################################## self.zeromq_pull_msg_source_1 = zeromq.pull_msg_source("tcp://127.0.0.1:5556", 100, True) self.zeromq_pull_msg_source_0 = zeromq.pull_msg_source("tcp://127.0.0.1:5555", 100, True) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(2), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(F_center, 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna("RX2", 0) self.uhd_usrp_source_0.set_center_freq(F_center, 1) self.uhd_usrp_source_0.set_gain(rx_gain, 1) self.uhd_usrp_source_0.set_antenna("RX2", 1) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), "packet_len", ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(F_center, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.echo_watchdog_0 = echo.watchdog(1) self.echo_echo_mod_demod_0 = echo.echo_mod_demod(packet_len * bits_per_symb, shared_preamble, bits_per_symb, modtype, demodtype, mod_seed=mod_seed, demod_seed=demod_seed, mod_hidden_layers=(mod_hidden_layers), demod_hidden_layers=(demod_hidden_layers), mod_init_weights=mod_init_weights, demod_init_weights=demod_init_weights, log_interval=log_interval, spy_length=spy_length, spy_threshold=0.1, max_amplitude=max_amplitude, lambda_center=lambda_center, _alias="neural-agent") self.neural_to_classic_handler = echo.packet_handler(cfo_samps, corr_reps, full_len, cfar_thresh, samps_per_symb, beta_rrc, (cfo_freqs)) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.0000, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 0.0j, ), noise_seed=0, block_tags=False ) self.blocks_random_pdu_0 = blocks.random_pdu(2 * packet_len * bits_per_symb, 2 * packet_len * bits_per_symb, chr(0x01), 2) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.echo_echo_mod_demod_0, 'mod_in')) self.msg_connect((self.neural_to_classic_handler, 'unwrap_out'), (self.echo_echo_mod_demod_0, 'demod_in')) self.msg_connect((self.neural_to_classic_handler, 'unwrap_out'), (self.echo_watchdog_0, 'in')) self.msg_connect((self.echo_echo_mod_demod_0, 'mod_out'), (self.neural_to_classic_handler, 'wrap_in')) self.msg_connect((self.echo_watchdog_0, 'out'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.zeromq_pull_msg_source_0, 'out'), (self.echo_echo_mod_demod_0, 'control')) self.msg_connect((self.zeromq_pull_msg_source_0, 'out'), (self.uhd_usrp_sink_0, 'command')) self.msg_connect((self.zeromq_pull_msg_source_1, 'out'), (self.echo_echo_mod_demod_0, 'control')) self.msg_connect((self.zeromq_pull_msg_source_1, 'out'), (self.uhd_usrp_source_0, 'command')) self.connect((self.channels_channel_model_0, 0), (self.neural_to_classic_handler, 0)) self.connect((self.neural_to_classic_handler, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 1), (self.channels_channel_model_0, 0))
def __init__(self): gr.top_block.__init__(self, "Downconversion Test") Qt.QWidget.__init__(self) self.setWindowTitle("Downconversion Test") 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", "DownConversion_test") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.sps = sps = 4 self.nfilts = nfilts = 32 self.timing_loop_bw = timing_loop_bw = 62.8e-3 self.samp_rate = samp_rate = 6e6 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts) self.qpsk = qpsk = digital.constellation_rect( ([1 + 1j, -1 + 1j, -1 - 1j, 1 - 1j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base() self.lpf_transition_width = lpf_transition_width = 100e3 self.lpf_cutoff_freq = lpf_cutoff_freq = 1.3e6 self.excess_bw = excess_bw = 0.35 self.center_freq = center_freq = 800e3 ################################################## # Blocks ################################################## self._samp_rate_range = Range(2e6, 100e6, 1e3, 6e6, 200) self._samp_rate_win = RangeWidget(self._samp_rate_range, self.set_samp_rate, "samp_rate", "counter_slider", float) self.top_layout.addWidget(self._samp_rate_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.low_pass_filter_0_0 = filter.fir_filter_fff( 1, firdes.low_pass(0.75, samp_rate, lpf_cutoff_freq, lpf_transition_width, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff( 1, firdes.low_pass(0.75, samp_rate, lpf_cutoff_freq, lpf_transition_width, firdes.WIN_HAMMING, 6.76)) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf( sps, timing_loop_bw, (rrc_taps), nfilts, nfilts / 2, 1.5, 1) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=qpsk, differential=False, samples_per_symbol=sps, pre_diff_code=True, excess_bw=excess_bw, verbose=True, log=False, ) self.digital_constellation_decoder_cb_0_0 = digital.constellation_decoder_cb( qpsk) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.blocks_random_pdu_0 = blocks.random_pdu(5, 6, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_xx_0_2 = blocks.multiply_vff(1) self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.PMT_T, 2000) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_float_2_0 = blocks.complex_to_float(1) self.blocks_complex_to_float_2 = blocks.complex_to_float(1) self.blocks_complex_to_float_1 = blocks.complex_to_float(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.analog_sig_source_x_0_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -center_freq, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, center_freq, 1, 0) ################################################## # 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.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.analog_sig_source_x_0_1, 0), (self.blocks_complex_to_float_2_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_complex_to_float_1, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_float_1, 1), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_complex_to_float_2, 0), (self.blocks_multiply_xx_0_1, 0)) self.connect((self.blocks_complex_to_float_2, 1), (self.blocks_multiply_xx_0_2, 0)) self.connect((self.blocks_complex_to_float_2_0, 0), (self.blocks_multiply_xx_0_1, 1)) self.connect((self.blocks_complex_to_float_2_0, 1), (self.blocks_multiply_xx_0_2, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_float_2, 0)) self.connect((self.blocks_float_to_complex_0_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_multiply_xx_0_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_multiply_xx_0_2, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.digital_constellation_decoder_cb_0_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_complex_to_float_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_constellation_decoder_cb_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_float_to_complex_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_float_to_complex_0_0, 1))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 614400 self.rf_freq = rf_freq = 145e6 self.rf_bw = rf_bw = 100e3 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", otw_format="sc12", channels=range(1), ), "packet_len", ) self.uhd_usrp_sink_0.set_clock_rate(30.72e6, uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(rf_freq, 0) self.uhd_usrp_sink_0.set_gain(0, 0) self.uhd_usrp_sink_0.set_bandwidth(rf_bw, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.5, 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_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_random_pdu_0 = blocks.random_pdu(2000, 2000, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # 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.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_char_to_float_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_char_to_float_0, 0))
def __init__(self): gr.top_block.__init__(self, "LECIM DSSS FEC Test") Qt.QWidget.__init__(self) self.setWindowTitle("LECIM DSSS FEC Test") 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", "fec_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.len_tag_var = len_tag_var = "len_tag" self.ebn0_db = ebn0_db = 3 ################################################## # Blocks ################################################## self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) self.lpwan_dsss_normalize_ff_0 = lpwan.dsss_normalize_ff(len_tag_var) self.lpwan_dsss_interleaver_bb_0 = lpwan.dsss_interleaver_bb( len_tag_var) self.lpwan_dsss_deinterleaver_ff_0 = lpwan.dsss_deinterleaver_ff( len_tag_var) self.fec_ber_bf_0 = fec.ber_bf(False, 100, -7.0) self.dsss_fec_enc_b_0 = dsss_fec_enc_b( len_tag_var="len_tag", tailbiting=True, ) self.dsss_fec_dec_fb_0 = dsss_fec_dec_fb( len_tag_var=len_tag_var, tailbiting=True, ) self.digital_map_bb_0_1 = digital.map_bb(([-1, 1])) self.blocks_random_pdu_0 = blocks.random_pdu(32, 32, chr(0xFF), 1) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.001, )) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("generate"), 10) self.blocks_char_to_float_1_2 = blocks.char_to_float(1, 1) self.blocks_add_xx_0 = blocks.add_vff(1) self.analog_noise_source_x_0 = analog.noise_source_f( analog.GR_GAUSSIAN, np.sqrt(10**(-ebn0_db / 10.0)), 4) ################################################## # 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.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.dsss_fec_enc_b_0, 'in')) self.msg_connect((self.dsss_fec_dec_fb_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_char_to_float_1_2, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.lpwan_dsss_deinterleaver_ff_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.fec_ber_bf_0, 1)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.fec_ber_bf_0, 0)) self.connect((self.digital_map_bb_0_1, 0), (self.blocks_char_to_float_1_2, 0)) self.connect((self.dsss_fec_enc_b_0, 0), (self.lpwan_dsss_interleaver_bb_0, 0)) self.connect((self.fec_ber_bf_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.lpwan_dsss_deinterleaver_ff_0, 0), (self.lpwan_dsss_normalize_ff_0, 0)) self.connect((self.lpwan_dsss_interleaver_bb_0, 0), (self.digital_map_bb_0_1, 0)) self.connect((self.lpwan_dsss_normalize_ff_0, 0), (self.dsss_fec_dec_fb_0, 0))
def __init__(self, verbose, center_freq, freq, samp_rate, threshold, channel_width, tcp_str, hw_sel, payload_len, transition_width=0, iq_file_name=""): gr.top_block.__init__(self) if True: #verbose > 0: print "\nFlowgraph Properties:" print " Center Frequency: {} MHz".format(center_freq / 1000000.0) print " Tune Frequency: {} MHz".format(freq / 1000000.0) print " IQ Sample Rate (in): {} MHz".format(samp_rate / 1000000.0) print " Channel Width: {} MHz".format(channel_width / 1000000.0) print " Transition Width: {} MHz".format(transition_width / 1000000.0) print " Threshold: {}".format(threshold) print " IQ File Name: {}".format(iq_file_name) print " ZMQ TCP ADDR: {}".format(tcp_str) print " HW Sel: {}".format(hw_sel) # start by dumping baseband into a file and viewing in grc if verbose > 0: print "Entering OOK Demodulator..." # variables self.center_freq = center_freq self.freq = freq self.threshold = threshold self.channel_width = channel_width self.samp_rate = samp_rate if transition_width == 0: self.transition_width = channel_width / 10 else: self.transition_width = transition_width self.taps = firdes.low_pass(1, self.samp_rate, self.channel_width / 2, self.transition_width) self.symbol_rate = 10e3 self.samples_per_symbol = \ int(self.samp_rate/self.symbol_rate) self.payload_len = payload_len # blocks, starting from the input channel filter self.freq_xlating_fir_filter_xxx_0 = \ filter.freq_xlating_fir_filter_ccc( 1, self.taps, freq - center_freq, samp_rate) if hw_sel == HW_SEL_FILE: self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, iq_file_name, True) # skip the throttle block, we just want to get done self.connect((self.blocks_file_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) elif hw_sel == HW_SEL_HACKRF: self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'hackrf=0') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(center_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(10, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) elif self.hw_sel == HW_SEL_USRP: self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(center_freq, 0) self.uhd_usrp_source_0.set_gain(20, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.connect((self.osmosdr_source_0, 0), (self.uhd_usrp_source_0, 0)) # add limeSDR using osmocom #elif self.hw_sel == HW_SEL_LIME: # demodulation self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1 * threshold, )) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_add_const_vxx_0, 0)) # binary slicer is next major thing, but there # may be a pfb block in between self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() # polyphase clock sync (optional) if False: nfilts = 32 self.rrc_taps = rrc_taps = \ firdes.root_raised_cosine( nfilts, samp_rate, self.symbol_rate, 0.35, nfilts) self.digital_pfb_clock_sync_xxx_0_0 = \ digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (rrc_taps), 32, 16, 1.5, self.samples_per_symbol) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) else: self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) # decimate down to the symbol rate self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_char * 1, int(self.samp_rate / self.symbol_rate)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_keep_one_in_n_0, 0)) # find preamble and apply tag self.digital_correlate_access_code_xx_ts_0 = \ digital.correlate_access_code_bb_ts( "01010101010101010101", 0, "packet_len") self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_correlate_access_code_xx_ts_0, 0)) # pack bitstream into bytes self.blocks_repack_bits_bb_0_0_0 = blocks.repack_bits_bb( 1, 8, 'packet_len', False, gr.GR_MSB_FIRST) self.connect((self.digital_correlate_access_code_xx_ts_0, 0), (self.blocks_repack_bits_bb_0_0_0, 0)) # generate PDU self.blocks_tagged_stream_to_pdu_0 = \ blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.connect((self.blocks_repack_bits_bb_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) # add ZeroMQ sink to get data out of flowgraph self.zeromq_push_msg_sink_0 = zeromq.push_msg_sink(tcp_str, 100) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.zeromq_push_msg_sink_0, 'in')) # debug only if False: self.blocks_random_pdu_0 = blocks.random_pdu(50, 128, chr(0xFF), 2) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.zeromq_push_msg_sink_0, 'in'))
def test_001_t(self): # set up fg src = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = fifo_async_sink('/tmp/pipe_out') self.tb.msg_connect((src, 'pdus'), (snk, 'async_pdu')) self.tb.run()
def __init__(self): gr.top_block.__init__(self, "Hdlc Afsk Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Hdlc Afsk Tx") 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", "hdlc_afsk_tx") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.train_symb = train_symb = ((1, 0, 0, 0, 0, 0, 0, 1), (0, 1, 1, 1, 1, 1, 1, 0)) self.baudrate = baudrate = 1200 self.audio_rate = audio_rate = 24e3 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 4096, #size audio_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.5, 1.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0.01, 0, 'packet_len') self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc audio_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-100, 0) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win) self.hdlc_frame_encoder_0 = hdlc_frame_encoder( tail_seq=3, training_seq=40, training_symb=train_symb[1], ) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", 'localhost', '52001', 10000, False) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 6e3) self.afsk_mod_0 = afsk_mod( baudrate=baudrate, fsk_dev=baudrate / 2.0, psf_taps=firdes.root_raised_cosine(1.0, 40, 1, 0.35, 11 * 40), samp_rate=audio_rate, ) ################################################## # 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.hdlc_frame_encoder_0, 'message in')) self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.hdlc_frame_encoder_0, 'message in')) self.connect((self.afsk_mod_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.afsk_mod_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.hdlc_frame_encoder_0, 0), (self.afsk_mod_0, 0))
def __init__(self, chiprate=2000000, data_seed_tx=2645625, fec_tailbiting=True, ovsf_code_index=0, ovsf_spreading_factor=0, preamble_len=32, preamble_seed_tx=54321, psdu_len=16, roll_off=1, sfd_present=False, spread_factor=2**10, sps=4): gr.top_block.__init__(self, "LECIM DSSS tx") Qt.QWidget.__init__(self) self.setWindowTitle("LECIM DSSS tx") 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") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chiprate = chiprate self.data_seed_tx = data_seed_tx self.fec_tailbiting = fec_tailbiting self.ovsf_code_index = ovsf_code_index self.ovsf_spreading_factor = ovsf_spreading_factor self.preamble_len = preamble_len self.preamble_seed_tx = preamble_seed_tx self.psdu_len = psdu_len self.roll_off = roll_off self.sfd_present = sfd_present self.spread_factor = spread_factor self.sps = sps ################################################## # Variables ################################################## self.sfd = sfd = lpwan.dsss_const.sfd32 if preamble_len == 32 else lpwan.dsss_const.sfd16 self.preamble = preamble = lpwan.dsss_const.preamble32 if preamble_len == 32 else lpwan.dsss_const.preamble16 self.taps_num = taps_num = 32 self.shr = shr = np.append(preamble, sfd) if sfd_present else preamble self.len_tag_var = len_tag_var = "packet_len" ################################################## # Blocks ################################################## self.lpwan_dsss_spreading_bb_0_0 = lpwan.dsss_spreading_bb( len_tag_var, spread_factor, preamble_seed_tx, True, ovsf_code_index, ovsf_spreading_factor) self.lpwan_dsss_spreading_bb_0 = lpwan.dsss_spreading_bb( len_tag_var, spread_factor, data_seed_tx, False, ovsf_code_index, ovsf_spreading_factor) self.lpwan_dsss_interleaver_bb_0 = lpwan.dsss_interleaver_bb( len_tag_var) self.lpwan_dsss_diff_coding_bb_0_0 = lpwan.dsss_diff_coding_bb( len_tag_var) self.lpwan_dsss_diff_coding_bb_0 = lpwan.dsss_diff_coding_bb( len_tag_var) self.dsss_oqpsk_mod_0_0 = dsss_oqpsk_mod( burst_tag="burst", num_of_taps=taps_num, packet_length=(psdu_len * 8 * 2 + len(shr)) * spread_factor, roll_off=roll_off, sps=sps, ) self.dsss_fec_enc_b_0_0 = dsss_fec_enc_b( len_tag_var=len_tag_var, tailbiting=fec_tailbiting, ) self.digital_crc32_async_bb_0 = digital.crc32_async_bb(False) self.blocks_vector_source_x_0_0 = blocks.vector_source_b( shr.tolist(), True, 1, [ gr.tag_utils.python_to_tag( (0, pmt.intern(len_tag_var), pmt.from_long(len(shr)))) ]) self.blocks_stream_mux_0 = blocks.stream_mux( gr.sizeof_char * 1, (len(shr) * spread_factor, psdu_len * 2 * 8 * spread_factor)) self.blocks_random_pdu_0 = blocks.random_pdu(psdu_len - 4, psdu_len - 4, chr(0xFF), 1) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("generate"), 50) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_gr_complex * 1, '/Users/victorguipont/Developpement-informatique/GNU-radio/sf1024', 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.digital_crc32_async_bb_0, 'in')) self.msg_connect((self.digital_crc32_async_bb_0, 'out'), (self.dsss_fec_enc_b_0_0, 'in')) self.connect((self.blocks_stream_mux_0, 0), (self.dsss_oqpsk_mod_0_0, 0)) self.connect((self.blocks_vector_source_x_0_0, 0), (self.lpwan_dsss_diff_coding_bb_0_0, 0)) self.connect((self.dsss_fec_enc_b_0_0, 0), (self.lpwan_dsss_interleaver_bb_0, 0)) self.connect((self.dsss_oqpsk_mod_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.lpwan_dsss_diff_coding_bb_0, 0), (self.lpwan_dsss_spreading_bb_0, 0)) self.connect((self.lpwan_dsss_diff_coding_bb_0_0, 0), (self.lpwan_dsss_spreading_bb_0_0, 0)) self.connect((self.lpwan_dsss_interleaver_bb_0, 0), (self.lpwan_dsss_diff_coding_bb_0, 0)) self.connect((self.lpwan_dsss_spreading_bb_0, 0), (self.blocks_stream_mux_0, 1)) self.connect((self.lpwan_dsss_spreading_bb_0_0, 0), (self.blocks_stream_mux_0, 0))
def __init__(self): gr.top_block.__init__(self, "OFDM Single") Qt.QWidget.__init__(self) self.setWindowTitle("OFDM Single") 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", "vr2_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.vr2_pc = vr2_pc = ((-14, -7, 7, 14), ) self.vr2_pattern2 = vr2_pattern2 = [1, -1, 1, -1] self.vr2_pattern1 = vr2_pattern1 = [0., 1.41421356, 0., -1.41421356] self.fft_len = fft_len = 64 self.zcpu = zcpu = psutil self._xmlrpcport_config = ConfigParser.ConfigParser() self._xmlrpcport_config.read('./default') try: xmlrpcport = self._xmlrpcport_config.getint("rx", "xmlrpcport") except: xmlrpcport = 0 self.xmlrpcport = xmlrpcport self.vr2_sw2 = vr2_sw2 = [ 0., 0., 0., 0., 0., 0., ] + vr2_pattern2 * ((fft_len - 12) / len(vr2_pattern2)) + [ 0., 0., 0., 0., 0., 0., ] self.vr2_sw1 = vr2_sw1 = [ 0., 0., 0., 0., 0., 0., ] + vr2_pattern1 * ((fft_len - 12) / len(vr2_pattern1)) + [ 0., 0., 0., 0., 0., 0., ] self.vr2_ps = vr2_ps = ((1, 1, -1, -1), ) self.vr2_oc = vr2_oc = (sorted( tuple( set([x for x in range(-26, 27)]) - set(vr2_pc[0]) - set([ 0, ]))), ) self._usrpip_config = ConfigParser.ConfigParser() self._usrpip_config.read('default') try: usrpip = self._usrpip_config.get("usrp", "ip") except: usrpip = "127.0.0.1" self.usrpip = usrpip self._txoutport_config = ConfigParser.ConfigParser() self._txoutport_config.read('default') try: txoutport = self._txoutport_config.get("usrp", "txoutport") except: txoutport = "2666" self.txoutport = txoutport self.txgain = txgain = 1 self.tx_goodput = tx_goodput = 0 self._timeout_config = ConfigParser.ConfigParser() self._timeout_config.read('default') try: timeout = self._timeout_config.getint("global", "zmqtimeout") except: timeout = 100 self.timeout = timeout self._samprate_config = ConfigParser.ConfigParser() self._samprate_config.read('default') try: samprate = self._samprate_config.getfloat("usrp_hydra", "samprate2") except: samprate = 4e6 self.samprate = samprate self.rxgain = rxgain = 0 self.rx_goodput = rx_goodput = 0 self._maxnoutput_config = ConfigParser.ConfigParser() self._maxnoutput_config.read('default') try: maxnoutput = self._maxnoutput_config.getint("global", "maxnoutput") except: maxnoutput = 100 self.maxnoutput = maxnoutput self._freq_config = ConfigParser.ConfigParser() self._freq_config.read('./default') try: freq = self._freq_config.getfloat("usrp_hydra", "txfreq2") except: freq = 4.4e9 self.freq = freq self.cpu_percent = cpu_percent = 0 self.amplitude = amplitude = 0.01 ################################################## # Blocks ################################################## self._txgain_range = Range(0, 1, 0.01, 1, 200) self._txgain_win = RangeWidget(self._txgain_range, self.set_txgain, 'txgain', "counter_slider", float) self.top_layout.addWidget(self._txgain_win) self._rxgain_range = Range(0, 1, 0.01, 0, 200) self._rxgain_win = RangeWidget(self._rxgain_range, self.set_rxgain, 'rxgain', "counter_slider", float) self.top_layout.addWidget(self._rxgain_win) self.probe1_1_0 = blocks.probe_rate(gr.sizeof_char * 1, 500.0, 0.15) self.probe1_1 = blocks.probe_rate(gr.sizeof_char * 1, 500.0, 0.15) self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer( ('127.0.0.1', xmlrpcport), allow_none=True) self.xmlrpc_server_0.register_instance(self) self.xmlrpc_server_0_thread = threading.Thread( target=self.xmlrpc_server_0.serve_forever) self.xmlrpc_server_0_thread.daemon = True self.xmlrpc_server_0_thread.start() self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samprate) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_normalized_gain(rxgain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samprate) self.uhd_usrp_sink_0.set_center_freq(freq + 4e6, 0) self.uhd_usrp_sink_0.set_normalized_gain(txgain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(samprate, 0) def _tx_goodput_probe(): while True: val = self.probe1_1_0.rate() try: self.set_tx_goodput(val) except AttributeError: pass time.sleep(1.0 / (10)) _tx_goodput_thread = threading.Thread(target=_tx_goodput_probe) _tx_goodput_thread.daemon = True _tx_goodput_thread.start() def _rx_goodput_probe(): while True: val = self.probe1_1.rate() try: self.set_rx_goodput(val) except AttributeError: pass time.sleep(1.0 / (10)) _rx_goodput_thread = threading.Thread(target=_rx_goodput_probe) _rx_goodput_thread.daemon = True _rx_goodput_thread.start() self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 100, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.digital_ofdm_tx_0 = digital.ofdm_tx(fft_len=fft_len, cp_len=16, packet_length_tag_key="vr2tx", occupied_carriers=vr2_oc, pilot_carriers=vr2_pc, pilot_symbols=vr2_ps, sync_word1=vr2_sw1, sync_word2=vr2_sw2, bps_header=1, bps_payload=1, rolloff=0, debug_log=False, scramble_bits=False) self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=fft_len, cp_len=16, frame_length_tag_key='frame_' + "vr2rx", packet_length_tag_key="vr2rx", occupied_carriers=vr2_oc, pilot_carriers=vr2_pc, pilot_symbols=vr2_ps, sync_word1=vr2_sw1, sync_word2=vr2_sw2, bps_header=1, bps_payload=1, debug_log=False, scramble_bits=False) self.digital_burst_shaper_xx_0 = digital.burst_shaper_cc( (([])), 2000, 1000, False, "vr2tx") def _cpu_percent_probe(): while True: val = self.zcpu.cpu_percent() try: self.set_cpu_percent(val) except AttributeError: pass time.sleep(1.0 / (1)) _cpu_percent_thread = threading.Thread(target=_cpu_percent_probe) _cpu_percent_thread.daemon = True _cpu_percent_thread.start() self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, "vr2rx") (self.blocks_tagged_stream_to_pdu_0).set_processor_affinity([1]) self.blocks_tag_debug_0_0 = blocks.tag_debug(gr.sizeof_char * 1, "Tx'd Packets", "") self.blocks_tag_debug_0_0.set_display(True) self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1, "Rx'd Packet", "") self.blocks_tag_debug_0.set_display(True) self.blocks_random_pdu_0_0 = blocks.random_pdu(50, 100, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, "vr2tx") self.blocks_pdu_set_0_0 = blocks.pdu_set(pmt.intern("vr2rx"), pmt.intern("generate")) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.01, )) self._amplitude_range = Range(0, 1, 0.01, 0.01, 200) self._amplitude_win = RangeWidget(self._amplitude_range, self.set_amplitude, 'amplitude', "counter_slider", float) self.top_layout.addWidget(self._amplitude_win) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_set_0_0, 'pdus'), (self.blocks_random_pdu_0_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_pdu_set_0_0, 'pdus')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.digital_burst_shaper_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tag_debug_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.digital_ofdm_tx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.probe1_1_0, 0)) self.connect((self.digital_burst_shaper_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_tag_debug_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.probe1_1, 0)) self.connect((self.digital_ofdm_tx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_rx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "LECIM DSSS Loopback Test") Qt.QWidget.__init__(self) self.setWindowTitle("LECIM DSSS Loopback Test") 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", "loopback_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Blocks ################################################## self.lpwan_dsss_oqpsk_phy_0 = lpwan_dsss_oqpsk_phy( burst_tag="burst", chiprate=2000000, data_seed_rx=2345432, data_seed_tx=2345432, fec_tailbiting=True, max_freq_hypo=2000, ovsf_code_index=0, ovsf_spreading_factor=0, preamble_len=32, preamble_seed_rx=54321, preamble_seed_tx=54321, psdu_len=32, roll_off=1, sfd_present=False, spread_factor=2**8, sps=4, ) self.digital_crc32_async_bb_0_0 = digital.crc32_async_bb(True) self.digital_crc32_async_bb_0 = digital.crc32_async_bb(False) self.channels_channel_model_0 = channels.channel_model( noise_voltage=2, frequency_offset=0.0001, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.blocks_random_pdu_0 = blocks.random_pdu(28, 28, chr(0xFF), 1) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("generate"), 140) self.blocks_message_debug_0 = blocks.message_debug() ################################################## # 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.digital_crc32_async_bb_0, 'in')) self.msg_connect((self.digital_crc32_async_bb_0, 'out'), (self.lpwan_dsss_oqpsk_phy_0, 'in_tx')) self.msg_connect((self.digital_crc32_async_bb_0_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.lpwan_dsss_oqpsk_phy_0, 'out_rx'), (self.digital_crc32_async_bb_0_0, 'in')) self.connect((self.channels_channel_model_0, 0), (self.lpwan_dsss_oqpsk_phy_0, 0)) self.connect((self.lpwan_dsss_oqpsk_phy_0, 0), (self.channels_channel_model_0, 0))
def __init__(self, addr='127.0.0.1', alpha=0.5, bb_gain=.45, port='4000', samp_rate=500e3, samps_per_symb=4, tx_correct=0, tx_freq=2395e6, tx_gain=20, tx_offset=0, tx_period=44, update_period=2000): gr.top_block.__init__(self, "Tx Scram Rand") Qt.QWidget.__init__(self) self.setWindowTitle("Tx Scram Rand") 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_scram_rand") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.addr = addr self.alpha = alpha self.bb_gain = bb_gain self.port = port self.samp_rate = samp_rate self.samps_per_symb = samps_per_symb self.tx_correct = tx_correct self.tx_freq = tx_freq self.tx_gain = tx_gain self.tx_offset = tx_offset self.tx_period = tx_period self.update_period = update_period ################################################## # Blocks ################################################## self.vtgs_mult_scrambler_0 = vtgs.mult_scrambler(17, 0x3FFFF) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq+tx_correct, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) 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_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=50, postamble_bytes=7) self.digital_map_bb_0 = digital.map_bb((1,0)) self.digital_gfsk_mod_0 = digital.gfsk_mod( samples_per_symbol=samps_per_symb, sensitivity=1.0, bt=0.35, verbose=False, log=False, ) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, (768,5232)) self.blocks_random_pdu_0 = blocks.random_pdu(256, 256, chr(0xFF), 2) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((bb_gain, )) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("TEST"), tx_period) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), update_period) self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 1, 768)), True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_message_strobe_0_0, 'set_msg')) self.msg_connect((self.kiss_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_mux_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_gfsk_mod_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.blocks_stream_mux_0, 1)) self.connect((self.blocks_stream_mux_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.vtgs_mult_scrambler_0, 0)) self.connect((self.vtgs_mult_scrambler_0, 0), (self.blocks_pack_k_bits_bb_0, 0))
def __init__(self): gr.top_block.__init__(self, "Packet Loopback Hier") Qt.QWidget.__init__(self) self.setWindowTitle("Packet Loopback Hier") 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", "packet_loopback_hier") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.Const_PLD = Const_PLD = digital.constellation_calcdist((digital.psk_4()[0]), (digital.psk_4()[1]), 4, 1).base() self.Const_PLD.gen_soft_dec_lut(8) self.sps = sps = 2 self.rep = rep = 3 self.rate = rate = 2 self.polys = polys = [109, 79] self.nfilts = nfilts = 32 self.k = k = 7 self.hdr_format = hdr_format = digital.header_format_counter(digital.packet_utils.default_access_code, 3, Const_PLD.bits_per_symbol()) self.eb = eb = 0.22 self.tx_rrc_taps = tx_rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0, eb, 5*sps*nfilts) self.time_offset = time_offset = 1.0 self.rx_rrc_taps = rx_rrc_taps = firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, eb, 11*sps*nfilts) self.noise = noise = 0.0 self.freq_offset = freq_offset = 0 self.enc_hdr = enc_hdr = fec.repetition_encoder_make(8000, rep) self.enc = enc = fec.cc_encoder_make(8000, k, rate, (polys), 0, fec.CC_TERMINATED, False) self.dec_hdr = dec_hdr = fec.repetition_decoder.make(hdr_format.header_nbits(), rep, 0.5) self.dec = dec = fec.cc_decoder.make(8000, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False) self.amp = amp = 1.0 self.Const_HDR = Const_HDR = digital.constellation_calcdist((digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_HDR.gen_soft_dec_lut(8) ################################################## # 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,2,1,1) self.tab1 = Qt.QTabWidget() self.tab1_widget_0 = Qt.QWidget() self.tab1_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab1_widget_0) self.tab1_grid_layout_0 = Qt.QGridLayout() self.tab1_layout_0.addLayout(self.tab1_grid_layout_0) self.tab1.addTab(self.tab1_widget_0, 'Time') self.tab1_widget_1 = Qt.QWidget() self.tab1_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab1_widget_1) self.tab1_grid_layout_1 = Qt.QGridLayout() self.tab1_layout_1.addLayout(self.tab1_grid_layout_1) self.tab1.addTab(self.tab1_widget_1, 'Freq.') self.tab1_widget_2 = Qt.QWidget() self.tab1_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab1_widget_2) self.tab1_grid_layout_2 = Qt.QGridLayout() self.tab1_layout_2.addLayout(self.tab1_grid_layout_2) self.tab1.addTab(self.tab1_widget_2, 'Const.') self.top_grid_layout.addWidget(self.tab1, 1,2,1,1) self.tab0 = Qt.QTabWidget() self.tab0_widget_0 = Qt.QWidget() self.tab0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_0) self.tab0_grid_layout_0 = Qt.QGridLayout() self.tab0_layout_0.addLayout(self.tab0_grid_layout_0) self.tab0.addTab(self.tab0_widget_0, 'Time') self.tab0_widget_1 = Qt.QWidget() self.tab0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_1) self.tab0_grid_layout_1 = Qt.QGridLayout() self.tab0_layout_1.addLayout(self.tab0_grid_layout_1) self.tab0.addTab(self.tab0_widget_1, 'Freq.') self.tab0_widget_2 = Qt.QWidget() self.tab0_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_2) self.tab0_grid_layout_2 = Qt.QGridLayout() self.tab0_layout_2.addLayout(self.tab0_grid_layout_2) self.tab0.addTab(self.tab0_widget_2, 'Const.') self.top_grid_layout.addWidget(self.tab0, 1,1,1,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,0,1,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,1,1,1) self._amp_range = Range(0, 2, 0.01, 1.0, 200) self._amp_win = RangeWidget(self._amp_range, self.set_amp, 'Amplitude', "counter_slider", float) self.top_layout.addWidget(self._amp_win) self.qtgui_time_sink_x_1_0_0_1 = qtgui.time_sink_c( 125, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0_0_1.set_update_time(0.10) self.qtgui_time_sink_x_1_0_0_1.set_y_axis(-2, 2) self.qtgui_time_sink_x_1_0_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 25, 0, "payload symbols") self.qtgui_time_sink_x_1_0_0_1.enable_autoscale(False) self.qtgui_time_sink_x_1_0_0_1.enable_grid(False) self.qtgui_time_sink_x_1_0_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_0_0_1.enable_control_panel(False) if not False: self.qtgui_time_sink_x_1_0_0_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_1_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0_0_1.pyqwidget(), Qt.QWidget) self.tab1_layout_0.addWidget(self._qtgui_time_sink_x_1_0_0_1_win) self.qtgui_time_sink_x_1_0_0_0 = qtgui.time_sink_c( 1250, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0_0_0.set_y_axis(-150, 150) self.qtgui_time_sink_x_1_0_0_0.set_y_label('Correlation', "") self.qtgui_time_sink_x_1_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 50, 0, "corr_est") self.qtgui_time_sink_x_1_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_1_0_0_0.enable_grid(False) self.qtgui_time_sink_x_1_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_0_0_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_1_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_1_0_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1_0_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_0_0_0_win, 1,0,1,1) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 2500, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-2, 2) 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, 'packet_len') self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not False: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.tab0_layout_0.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tab1_layout_1.addWidget(self._qtgui_freq_sink_x_0_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1, #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 False: 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.tab0_layout_1.addWidget(self._qtgui_freq_sink_x_0_win) self.qtgui_const_sink_x_0_0_0 = qtgui.const_sink_c( 800, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_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.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0.enable_grid(False) self.qtgui_const_sink_x_0_0_0.enable_axis_labels(True) if not False: self.qtgui_const_sink_x_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.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.tab1_layout_2.addWidget(self._qtgui_const_sink_x_0_0_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 'packet_len') 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 False: 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.tab0_layout_2.addWidget(self._qtgui_const_sink_x_0_win) self.packet_tx_0 = packet_tx( hdr_const=Const_HDR, hdr_enc=enc_hdr, hdr_format=hdr_format, pld_const=Const_PLD, pld_enc=enc, psf_taps=tx_rrc_taps, sps=sps, ) self.packet_rx_0 = packet_rx( eb=eb, hdr_const=Const_HDR, hdr_dec=dec_hdr, hdr_format=hdr_format, pld_const=Const_PLD, pld_dec=dec, psf_taps=rx_rrc_taps, sps=sps, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise, frequency_offset=freq_offset, epsilon=time_offset, taps=(1.0, ), noise_seed=0, block_tags=True ) self.blocks_random_pdu_0 = blocks.random_pdu(20, 200, chr(0xFF), 2) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((amp, )) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_debug_0_0_0 = blocks.message_debug() ################################################## # 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.packet_tx_0, 'in')) self.msg_connect((self.packet_rx_0, 'pkt out'), (self.blocks_message_debug_0_0_0, 'print_pdu')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.packet_rx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.packet_rx_0, 1), (self.qtgui_const_sink_x_0_0_0, 0)) self.connect((self.packet_rx_0, 1), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.packet_rx_0, 4), (self.qtgui_time_sink_x_1_0_0_0, 0)) self.connect((self.packet_rx_0, 1), (self.qtgui_time_sink_x_1_0_0_1, 0)) self.connect((self.packet_tx_0, 0), (self.channels_channel_model_0, 0))
def __init__(self): gr.top_block.__init__(self, "Epsilon Greedy Loopback") Qt.QWidget.__init__(self) self.setWindowTitle("Epsilon Greedy 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", "epsilon_greedy_loopback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 5000000 ################################################## # Blocks ################################################## self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 0 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.01) 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 = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.liquiddsp_flex_tx_0 = liquiddsp.flex_tx(0, 0, 0) self.liquiddsp_flex_rx_0 = liquiddsp.flex_rx() self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) self.cognition_epsilon_greedy_0 = cognition.epsilon_greedy() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 50, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 125) ################################################## # 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.liquiddsp_flex_tx_0, 'pdus')) self.msg_connect((self.cognition_epsilon_greedy_0, 'configuration'), (self.liquiddsp_flex_tx_0, 'configuration')) self.msg_connect((self.liquiddsp_flex_rx_0, 'packet_info'), (self.cognition_epsilon_greedy_0, 'packet_info')) self.msg_connect((self.liquiddsp_flex_rx_0, 'constellation'), (self.qtgui_const_sink_x_0, 'in')) self.msg_connect((self.liquiddsp_flex_tx_0, 'pdus'), (self.es_source_0, 'schedule_event')) self.connect((self.blocks_throttle_0, 0), (self.liquiddsp_flex_rx_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1e3 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.message_tools_msg_vector_sink_0 = message_tools.msg_vector_sink(1) self.ccsds_rs_decode_pdu_0 = ccsds.rs_decode_pdu(1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_random_pdu_0 = blocks.random_pdu(255, 255, chr(0xFF), 1) self.blocks_message_strobe_1 = blocks.message_strobe(pmt.intern("TEST"), 5000) self.blocks_message_debug_0 = blocks.message_debug() self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 250, 1, 0) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_1, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.ccsds_rs_decode_pdu_0, 'pdu_in')) self.msg_connect((self.ccsds_rs_decode_pdu_0, 'pdu_out'), (self.blocks_message_debug_0, 'print')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") ################################################## # Variables ################################################## self.rate = rate = 2 self.polys = polys = [109, 79] self.k = k = 7 self.samp_rate = samp_rate = 48000 self.enc_cc = enc_cc = fec.cc_encoder_make(8000, k, rate, (polys), 0, fec.CC_TERMINATED, False) self.dec_cc = dec_cc = fec.cc_decoder.make(8000, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False) ################################################## # Blocks ################################################## self.splash_packet_encoder_0 = splash.packet_encoder( samples_per_symbol=8, bits_per_symbol=1, preamble="", access_code="", pad_for_usrp=False, payload_length=9 ) self.splash_packet_decoder_0 = splash.packet_decoder( access_code="", threshold=-1 ) self.splash_XCEIVER_0 = splash.XCEIVER() self.digital_map_bb_0 = digital.map_bb(([-1,1])) self.dflood_dflood_0 = dflood.dflood( 2, 0, 30, False, False, 5, 65, 2, 120, 50, 2, True, None ) self.blocks_tagged_stream_to_pdu_1 = blocks.tagged_stream_to_pdu(blocks.float_t, "packet_len") self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(8, 1, "packet_len", True, gr.GR_MSB_FIRST) self.blocks_random_pdu_0_0 = blocks.random_pdu(1, 5, chr(0xFF), 1) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") self.blocks_message_strobe_2 = blocks.message_strobe(pmt.intern("TEST"), 10000) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 10000) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1) self.audio_source_0 = audio.source(48000, "", True) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_probe_avg_mag_sqrd_x_0 = analog.probe_avg_mag_sqrd_c(-70, 1) self.Async_Ecnoder = fec.async_encoder(enc_cc, True, False, False, 1500) self.Async_Decoder = fec.async_decoder(dec_cc, True, False, 1500) ################################################## # Connections ################################################## self.msg_connect((self.Async_Decoder, 'out'), (self.dflood_dflood_0, 'from_radio')) self.msg_connect((self.Async_Ecnoder, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0_0, 'generate')) self.msg_connect((self.blocks_message_strobe_2, 'strobe'), (self.dflood_dflood_0, 'ctrl_in')) self.msg_connect((self.blocks_random_pdu_0_0, 'pdus'), (self.dflood_dflood_0, 'from_app')) self.msg_connect((self.blocks_tagged_stream_to_pdu_1, 'pdus'), (self.Async_Decoder, 'in')) self.msg_connect((self.dflood_dflood_0, 'to_radio'), (self.Async_Ecnoder, 'in')) self.msg_connect((self.dflood_dflood_0, 'to_app'), (self.blocks_message_debug_0, 'print_pdu')) self.connect((self.audio_source_0, 0), (self.splash_XCEIVER_0, 0)) self.connect((self.blocks_char_to_float_0_1, 0), (self.blocks_tagged_stream_to_pdu_1, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.splash_packet_encoder_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect((self.splash_XCEIVER_0, 2), (self.analog_probe_avg_mag_sqrd_x_0, 0)) self.connect((self.splash_XCEIVER_0, 0), (self.audio_sink_0, 0)) self.connect((self.splash_XCEIVER_0, 1), (self.splash_packet_decoder_0, 0)) self.connect((self.splash_packet_decoder_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.splash_packet_encoder_0, 0), (self.splash_XCEIVER_0, 1))
def __init__(self, addr='127.0.0.1', alpha=0.5, bb_gain=1, port='4000', samp_rate=500e3, samps_per_symb=4, tx_correct=0, tx_freq=2395e6, tx_gain=20, tx_offset=0, tx_period=500, update_period=2000): gr.top_block.__init__(self, "Tx Scram Rand 2") ################################################## # Parameters ################################################## self.addr = addr self.alpha = alpha self.bb_gain = bb_gain self.port = port self.samp_rate = samp_rate self.samps_per_symb = samps_per_symb self.tx_correct = tx_correct self.tx_freq = tx_freq self.tx_gain = tx_gain self.tx_offset = tx_offset self.tx_period = tx_period self.update_period = update_period ################################################## # Blocks ################################################## self.vtgs_ao40_encoder_0 = vtgs.ao40_encoder(False, 449838109) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_time_source('gpsdo', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq+tx_correct, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.digital_map_bb_0 = digital.map_bb((1,0)) self.digital_dxpsk_mod_0 = digital.dbpsk_mod( samples_per_symbol=samps_per_symb, excess_bw=alpha, mod_code="gray", verbose=False, log=False) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, (768,5232)) self.blocks_random_pdu_0 = blocks.random_pdu(256, 256, chr(0xFF), 2) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((bb_gain, )) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("TEST"), tx_period) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), update_period) self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 1, 768)), True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.vtgs_ao40_encoder_0, 'in')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_message_strobe_0_0, 'set_msg')) self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_mux_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_dxpsk_mod_0, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_dxpsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.vtgs_ao40_encoder_0, 0), (self.blocks_stream_mux_0, 1))
def __init__(self, beta_rrc=0.13, bits_per_symb=2, cfar_thresh=8, cfo_samps=512, corr_reps=2, log_interval=1, packet_len=512, samps_per_symb=2, spy_length=64, spy_thresh=0.1): gr.top_block.__init__(self, "Echo Classic Usrp Spy") ################################################## # Parameters ################################################## self.beta_rrc = beta_rrc self.bits_per_symb = bits_per_symb self.cfar_thresh = cfar_thresh self.cfo_samps = cfo_samps self.corr_reps = corr_reps self.log_interval = log_interval self.packet_len = packet_len self.samps_per_symb = samps_per_symb self.spy_length = spy_length self.spy_thresh = spy_thresh ################################################## # Variables ################################################## self.tx_gain = tx_gain = 4 self.samp_rate = samp_rate = 500000 self.rx_gain = rx_gain = 3 self.cfo_freqs = cfo_freqs = 11. / 256, 43. / 256, 97. / 256 self.body = body = [ 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0 ] self.F_center = F_center = 1000000000 ################################################## # Blocks ################################################## self.zeromq_pull_msg_source_tx = zeromq.pull_msg_source( "tcp://127.0.0.1:5555", 100, True) self.zeromq_pull_msg_source_rx = zeromq.pull_msg_source( "tcp://127.0.0.1:5556", 100, True) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(2), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(F_center, 0) self.uhd_usrp_source_0.set_gain(20, 0) self.uhd_usrp_source_0.set_antenna("RX2", 0) self.uhd_usrp_source_0.set_center_freq(F_center, 1) self.uhd_usrp_source_0.set_gain(rx_gain, 1) self.uhd_usrp_source_0.set_antenna("RX2", 1) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), "packet_len", ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(F_center, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.echo_watchdog_0 = echo.watchdog(5) self.echo_preamble_insert_0_1 = echo.preamble_insert((body), 1, 0, 0) self.echo_preamble_insert_0_0 = echo.preamble_insert((body), 0, 1, 0) self.echo_preamble_insert_0 = echo.preamble_insert((body), 1, 0, 1) self.echo_packet_length_check_0 = echo.packet_length_check( (2 * packet_len + spy_length) / bits_per_symb) self.echo_modulator_classic_spy_0 = echo.modulator_classic_spy( bits_per_symb, (body), log_interval, spy_length) self.echo_demodulator_classic_spy_0 = echo.demodulator_classic_spy( bits_per_symbol=bits_per_symb, block_length=1024, preamble=(body), log_ber_interval=log_interval, spy_length=spy_length, spy_threshold=spy_thresh) self.neural_to_classic_handler = echo.packet_handler( cfo_samps, corr_reps, (2 * packet_len + spy_length) / bits_per_symb, cfar_thresh, samps_per_symb, beta_rrc, (cfo_freqs)) self.blocks_random_pdu_0 = blocks.random_pdu(packet_len, packet_len, chr(0x01), 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.echo_preamble_insert_0_1, 'in')) self.msg_connect((self.neural_to_classic_handler, 'unwrap_out'), (self.echo_packet_length_check_0, 'in')) self.msg_connect((self.echo_demodulator_classic_spy_0, 'corrupt'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.echo_demodulator_classic_spy_0, 'bits'), (self.echo_preamble_insert_0, 'in')) self.msg_connect((self.echo_demodulator_classic_spy_0, 'bits'), (self.echo_preamble_insert_0_0, 'in')) self.msg_connect((self.echo_modulator_classic_spy_0, 'symbols'), (self.neural_to_classic_handler, 'wrap_in')) self.msg_connect((self.echo_packet_length_check_0, 'failed'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.echo_packet_length_check_0, 'validated'), (self.echo_demodulator_classic_spy_0, 'symbols')) self.msg_connect((self.echo_packet_length_check_0, 'passthrough'), (self.echo_watchdog_0, 'in')) self.msg_connect((self.echo_preamble_insert_0, 'out'), (self.echo_modulator_classic_spy_0, 'bits')) self.msg_connect((self.echo_preamble_insert_0_0, 'out'), (self.echo_modulator_classic_spy_0, 'update')) self.msg_connect((self.echo_preamble_insert_0_1, 'out'), (self.echo_modulator_classic_spy_0, 'bits')) self.msg_connect((self.echo_watchdog_0, 'out'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.zeromq_pull_msg_source_rx, 'out'), (self.uhd_usrp_source_0, 'command')) self.msg_connect((self.zeromq_pull_msg_source_tx, 'out'), (self.uhd_usrp_sink_0, 'command')) self.connect((self.neural_to_classic_handler, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 1), (self.neural_to_classic_handler, 0))
def __init__(self): gr.top_block.__init__(self, "Veausted") Qt.QWidget.__init__(self) self.setWindowTitle("Veausted") 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", "veausted") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.variable_qtgui_range_0 = variable_qtgui_range_0 = 50 self.samp_rate = samp_rate = 32e3 self.freq = freq = 1e3 self.ampl = ampl = 1 ################################################## # Blocks ################################################## self._variable_qtgui_range_0_layout = Qt.QVBoxLayout() self._variable_qtgui_range_0_tool_bar = Qt.QToolBar(self) self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_tool_bar) self._variable_qtgui_range_0_tool_bar.addWidget(Qt.QLabel("variable_qtgui_range_0"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._variable_qtgui_range_0_counter = qwt_counter_pyslot() self._variable_qtgui_range_0_counter.setRange(0, 100, 1) self._variable_qtgui_range_0_counter.setNumButtons(2) self._variable_qtgui_range_0_counter.setValue(self.variable_qtgui_range_0) self._variable_qtgui_range_0_tool_bar.addWidget(self._variable_qtgui_range_0_counter) self._variable_qtgui_range_0_counter.valueChanged.connect(self.set_variable_qtgui_range_0) self._variable_qtgui_range_0_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._variable_qtgui_range_0_slider.setRange(0, 100, 1) self._variable_qtgui_range_0_slider.setValue(self.variable_qtgui_range_0) self._variable_qtgui_range_0_slider.setMinimumWidth(200) self._variable_qtgui_range_0_slider.valueChanged.connect(self.set_variable_qtgui_range_0) self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_slider) self.top_layout.addLayout(self._variable_qtgui_range_0_layout) self.spectsensing_time_plot_0 = spectsensing.time_plot("") self._spectsensing_time_plot_0_win = self.spectsensing_time_plot_0; self.top_layout.addWidget(self._spectsensing_time_plot_0_win) self.spectsensing_test_plot_0 = spectsensing.test_plot() self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("freq"+": ")) self._freq_line_edit = Qt.QLineEdit(str(self.freq)) self._freq_tool_bar.addWidget(self._freq_line_edit) self._freq_line_edit.returnPressed.connect( lambda: self.set_freq(eng_notation.str_to_num(self._freq_line_edit.text().toAscii()))) self.top_layout.addWidget(self._freq_tool_bar) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_random_pdu_0 = blocks.random_pdu(10, 10, chr(0xFF), 2) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 1, 0) self._ampl_tool_bar = Qt.QToolBar(self) self._ampl_tool_bar.addWidget(Qt.QLabel("ampl"+": ")) self._ampl_line_edit = Qt.QLineEdit(str(self.ampl)) self._ampl_tool_bar.addWidget(self._ampl_line_edit) self._ampl_line_edit.returnPressed.connect( lambda: self.set_ampl(eng_notation.str_to_num(self._ampl_line_edit.text().toAscii()))) self.top_layout.addWidget(self._ampl_tool_bar) ################################################## # Connections ################################################## self.connect((self.blocks_throttle_0, 0), (self.spectsensing_test_plot_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.spectsensing_test_plot_0, 0), (self.blocks_null_sink_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.spectsensing_test_plot_0, "pdus", self.spectsensing_time_plot_0, "pdus")
def test_001_t (self): # set up fg src = blocks.random_pdu(50, 2000, chr(0xFF), 2) snk = fifo_async_sink('/tmp/pipe_out'); self.tb.msg_connect((src, 'pdus'), (snk, 'async_pdu')) self.tb.run ()
def __init__(self): gr.top_block.__init__(self, "Ppm Symb Recov") Qt.QWidget.__init__(self) self.setWindowTitle("Ppm Symb Recov") 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", "ppm_symb_recov") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32e3 self.interp = interp = 2 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=interp, decimation=1, taps=(firdes.low_pass(1,samp_rate*interp,samp_rate/2,samp_rate/2,firdes.WIN_HAMMING)), fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate*interp, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) 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 = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_char*1, 'packet_len', 0) self.blocks_random_pdu_1 = blocks.random_pdu(120, 130, chr(0x01), 2) self.blocks_random_pdu_0 = blocks.random_pdu(50, 2000, chr(0x00), 2) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_message_strobe_1 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_add_xx_0 = blocks.add_vff(1) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 0.1, 0) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_1, 'generate')) self.msg_connect((self.blocks_message_strobe_1, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.blocks_random_pdu_1, 'pdus'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_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))