def __init__(self, chan_est=1, encoding=0, freq_offset=0, interval=500, nmessages=50, snr=10): gr.top_block.__init__(self, "Wifi Loopback Nogui") ################################################## # Parameters ################################################## self.chan_est = chan_est self.encoding = encoding self.freq_offset = freq_offset self.interval = interval self.nmessages = nmessages self.snr = snr ################################################## # Variables ################################################## self.out_buf_size = out_buf_size = 96000 ################################################## # Blocks ################################################## self.wifi_phy_hier_0 = wifi_phy_hier( encoding=encoding, chan_est=chan_est, ) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.intern("Hello World!"), interval, nmessages, True, False) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 1000, 1000) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.channels_channel_model_0 = channels.channel_model( noise_voltage=.5**.5, frequency_offset=freq_offset, epsilon=1.0, taps=(1.0, ), noise_seed=0, block_tags=False ) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(((10**(snr/10.0))**.5, )) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap", False) self.blocks_file_sink_0_0.set_unbuffered(True) ################################################## # Connections ################################################## self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.foo_wireshark_connector_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self, chan_est=1, dopp=400, encoding=0, freq_offset=0, interval=500, nmessages=50, ntrials=0, resultdir="0", snr=10): gr.top_block.__init__(self, "Wifi Loopback Nogui") ################################################## # Parameters ################################################## self.chan_est = chan_est self.dopp = dopp self.encoding = encoding self.freq_offset = freq_offset self.interval = interval self.nmessages = nmessages self.ntrials = ntrials self.resultdir = resultdir self.snr = snr ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 self.out_buf_size = out_buf_size = 96000 self.ndopp = ndopp = dopp/samp_rate ################################################## # Blocks ################################################## self.wifi_phy_hier_0 = wifi_phy_hier( encoding=encoding, chan_est=chan_est, ) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.intern("Hello World!"), interval, nmessages, True, False) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 1000, 1000) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, ndopp, False, 4.0, ntrials, (0, 0.00003, 0.000064, 0.0032, 0.003232, 0.0064, 0.006432, 0.006464, 0.0096, 0.009632, 0.009664), (1, 1, 1, 0.234, 0.234, 0.003, 0.003, 0.003, 0.005, 0.005, 0.005), 8 ) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((((10**(snr/10.0))**0.5)/(2**0.5), )) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "" + resultdir + "/ofdm_" + str(ntrials) + "_" + str(nmessages) + "_" + str(snr) + "_" + str(encoding) + "_" + str(interval) + ".pcap", False) self.blocks_file_sink_0_0.set_unbuffered(True) ################################################## # Connections ################################################## self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.foo_wireshark_connector_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_selective_fading_model_0, 0)) self.connect((self.channels_selective_fading_model_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self): gr.top_block.__init__(self, "BER AWGN Test OQPSK") ################################################## # Variables ################################################## self.snr = snr = 0 self.c = c = ieee802_15_4.css_phy(slow_rate=True, phy_packetsize_bytes=127) ################################################## # Blocks ################################################## self.ieee802_15_4_oqpsk_phy_nosync_0 = ieee802_15_4_oqpsk_phy_nosync( payload_len=c.phy_packetsize_bytes, ) self.ieee802_15_4_make_pair_with_blob_0 = ieee802_15_4.make_pair_with_blob(np.random.randint(0,256,(c.phy_packetsize_bytes,))) self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.cons(pmt.PMT_NIL, pmt.string_to_symbol("trigger")), 1, 5, True, False) # self.msg_trigger = blocks.message_strobe(pmt.cons(pmt.intern("trigger"), pmt.intern("dummy")), 1000) self.comp_bits = ieee802_15_4.compare_blobs(packet_error_mode=False) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.analog_noise_source_x_0_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 10**(-snr/10), 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.blocks_add_xx_0_0, 0), (self.ieee802_15_4_oqpsk_phy_nosync_0, 0)) self.connect((self.ieee802_15_4_oqpsk_phy_nosync_0, 0), (self.blocks_add_xx_0_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.ieee802_15_4_oqpsk_phy_nosync_0, "txin") self.msg_connect(self.foo_periodic_msg_source_0, "out", self.ieee802_15_4_make_pair_with_blob_0, "in") # self.msg_connect(self.msg_trigger, "strobe", self.ieee802_15_4_make_pair_with_blob_0, "in") self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.comp_bits, "ref") self.msg_connect(self.ieee802_15_4_oqpsk_phy_nosync_0, "rxout", self.comp_bits, "test") self.msg_connect(self.ieee802_15_4_oqpsk_phy_nosync_0, "rxout", self.ieee802_15_4_make_pair_with_blob_0, "in")
def __init__(self, freq=2480000000, gain=48, method=7): gr.top_block.__init__(self, "IEEE 802.15.4 Transceiver using OQPSK PHY") ################################################## # Parameters ################################################## self.freq = freq self.gain = gain self.method = method ################################################## # Blocks ################################################## self.uhdgps_cpdu_average_power_0 = uhdgps.cpdu_average_power(-60) 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(5000000) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(gain, 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(5000000) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(gain, 0) self.lqe_powerControl_0 = lqe.powerControl( gain, '/home/wendley/SerieGanho100ms.txt', False) self.lqe_getRSSI_0 = lqe.getRSSI(False, 2, 2, 40, -108, -67, 0.500, 0.2, 0.1, 0.05) self.ieee802_15_4_rime_stack_0 = ieee802_15_4.rime_stack( ([129]), ([131]), ([132]), ([23, 42])) self.ieee802_15_4_oqpsk_phy_0 = ieee802_15_4_oqpsk_phy() self.ieee802_15_4_mac_0 = ieee802_15_4.mac(True) self.foo_periodic_msg_source_1 = foo.periodic_msg_source( pmt.intern( "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ), 400, 1000, True, False) self.es_trigger_sample_timer_0 = es.trigger_sample_timer( gr.sizeof_gr_complex, int(2000), 2, int(4000000), 512) self.es_sink_0 = es.sink(1 * [gr.sizeof_gr_complex], 8, 64, 0, 2, 0) self.es_handler_pdu_0 = es.es_make_handler_pdu( es.es_handler_print.TYPE_C32) self.digital_probe_mpsk_snr_est_c_0 = digital.probe_mpsk_snr_est_c( 2, 1000, 0.001) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", '', '52001', 10000, False) self.blocks_pdu_remove_0 = blocks.pdu_remove( pmt.intern("es::event_buffer")) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.ieee802_15_4_mac_0, 'cs in')) self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'), (self.ieee802_15_4_rime_stack_0, 'bcin')) self.msg_connect((self.digital_probe_mpsk_snr_est_c_0, 'snr'), (self.lqe_getRSSI_0, 'SNR')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.uhdgps_cpdu_average_power_0, 'cpdus')) self.msg_connect( (self.es_trigger_sample_timer_0, 'sample_timer_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_sample_timer_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.foo_periodic_msg_source_1, 'out'), (self.ieee802_15_4_rime_stack_0, 'bcin')) self.msg_connect((self.foo_periodic_msg_source_1, 'out'), (self.lqe_getRSSI_0, 'sendOrder')) self.msg_connect((self.ieee802_15_4_mac_0, 'pdu out'), (self.ieee802_15_4_oqpsk_phy_0, 'txin')) self.msg_connect((self.ieee802_15_4_mac_0, 'app out'), (self.ieee802_15_4_rime_stack_0, 'fromMAC')) self.msg_connect((self.ieee802_15_4_mac_0, 'ackOut'), (self.lqe_getRSSI_0, 'Ackin')) self.msg_connect((self.ieee802_15_4_mac_0, 'packLost'), (self.lqe_getRSSI_0, 'lostPacks')) self.msg_connect((self.ieee802_15_4_mac_0, 'resendPck'), (self.lqe_getRSSI_0, 'sendPacks')) self.msg_connect((self.ieee802_15_4_mac_0, 'ackOut'), (self.lqe_powerControl_0, 'saveGain')) self.msg_connect((self.ieee802_15_4_mac_0, 'resendPck'), (self.lqe_powerControl_0, 'saveGain')) self.msg_connect((self.ieee802_15_4_oqpsk_phy_0, 'rxout'), (self.ieee802_15_4_mac_0, 'pdu in')) self.msg_connect((self.ieee802_15_4_rime_stack_0, 'bcout'), (self.blocks_socket_pdu_0_0, 'pdus')) self.msg_connect((self.ieee802_15_4_rime_stack_0, 'toMAC'), (self.ieee802_15_4_mac_0, 'app in')) self.msg_connect((self.lqe_getRSSI_0, 'estimation'), (self.lqe_powerControl_0, 'estimation')) self.msg_connect((self.uhdgps_cpdu_average_power_0, 'cpdus'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.uhdgps_cpdu_average_power_0, 'rssi'), (self.lqe_getRSSI_0, 'RSSIin')) self.connect((self.es_trigger_sample_timer_0, 0), (self.es_sink_0, 0)) self.connect((self.ieee802_15_4_oqpsk_phy_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_probe_mpsk_snr_est_c_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.es_trigger_sample_timer_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.ieee802_15_4_oqpsk_phy_0, 0))
def __init__(self): gr.top_block.__init__(self, "BER AWGN Test CSS SD/HD vs OQPSK") ################################################## # Variables ################################################## self.snr = snr = 0 self.c = c = ieee802_15_4.css_phy(slow_rate=False, phy_packetsize_bytes=127) ################################################## # Blocks ################################################## self.ieee802_15_4_oqpsk_phy_nosync_0 = ieee802_15_4_oqpsk_phy_nosync( payload_len=c.phy_packetsize_bytes, ) self.ieee802_15_4_make_pair_with_blob_0 = ieee802_15_4.make_pair_with_blob(np.random.randint(0,256,(c.phy_packetsize_bytes,))) self.ieee802_15_4_css_phy_sd_0 = ieee802_15_4_css_phy_sd( phr=c.PHR, nbytes_payload=c.phy_packetsize_bytes, bits_per_cw=c.bits_per_symbol, codewords=c.codewords, intlv_seq=c.intlv_seq, sym_per_frame=c.nsym_frame, num_subchirps=c.n_subchirps, chirp_seq=c.chirp_seq, time_gap_1=c.time_gap_1, time_gap_2=c.time_gap_2, len_sub=38, nzeros_padding=c.padded_zeros, preamble=c.preamble, sfd=c.SFD, nsamp_frame=c.nsamp_frame, ) self.ieee802_15_4_css_phy_hd_0 = ieee802_15_4_css_phy_hd( phr=c.PHR, nbytes_payload=c.phy_packetsize_bytes, bits_per_cw=c.bits_per_symbol, codewords=c.codewords, intlv_seq=c.intlv_seq, sym_per_frame=c.nsym_frame, num_subchirps=c.n_subchirps, chirp_seq=c.chirp_seq, time_gap_1=c.time_gap_1, time_gap_2=c.time_gap_2, len_sub=38, nzeros_padding=c.padded_zeros, preamble=c.preamble, sfd=c.SFD, nsamp_frame=c.nsamp_frame, ) self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.cons(pmt.PMT_NIL, pmt.string_to_symbol("trigger")), 10, 100, True, False) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((1.1687, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1.1687, )) self.blocks_add_xx_0_1 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_noise_source_x_0_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 10**(-snr/10), 0) self.comp_bits_sd = ieee802_15_4.compare_blobs() self.comp_bits_hd = ieee802_15_4.compare_blobs() ################################################## # Connections ################################################## self.connect((self.blocks_add_xx_0, 0), (self.ieee802_15_4_css_phy_sd_0, 0)) self.connect((self.ieee802_15_4_css_phy_sd_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.ieee802_15_4_css_phy_hd_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0_1, 1)) self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0_1, 0)) self.connect((self.blocks_add_xx_0_1, 0), (self.ieee802_15_4_css_phy_hd_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.ieee802_15_4_css_phy_sd_0, "txin") self.msg_connect(self.foo_periodic_msg_source_0, "out", self.ieee802_15_4_make_pair_with_blob_0, "in") self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.ieee802_15_4_css_phy_hd_0, "txin") self.msg_connect(self.ieee802_15_4_css_phy_sd_0, "rxout", self.comp_bits_sd, "test") self.msg_connect(self.ieee802_15_4_css_phy_hd_0, "rxout", self.comp_bits_hd, "test") self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.comp_bits_hd, "ref") self.msg_connect(self.ieee802_15_4_make_pair_with_blob_0, "out", self.comp_bits_sd, "ref") self.msg_connect(self.ieee802_15_4_css_phy_sd_0, "rxout", self.ieee802_15_4_make_pair_with_blob_0, "in")
def __init__(self, chiprate=2000000, data_seed_rx=2345432, data_seed_tx=2345432, fec_tailbiting=True, max_freq_hypo=2, 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**10, sps=4): gr.top_block.__init__(self, "my personal playground") Qt.QWidget.__init__(self) self.setWindowTitle("my personal playground") 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", "playground") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chiprate = chiprate self.data_seed_rx = data_seed_rx self.data_seed_tx = data_seed_tx self.fec_tailbiting = fec_tailbiting self.max_freq_hypo = max_freq_hypo self.ovsf_code_index = ovsf_code_index self.ovsf_spreading_factor = ovsf_spreading_factor self.preamble_len = preamble_len self.preamble_seed_rx = preamble_seed_rx 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_0 = taps_num_0 = 64 self.taps_num = taps_num = 64 self.shr = shr = np.append(preamble, sfd) if sfd_present else preamble self.len_tag_var = len_tag_var = "packet_len" self.freq_vec = freq_vec = lpwan.dsss_const.gen_freq_hypo_vec( spread_factor, chiprate, max_freq_hypo) ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, sps, 1, 1, taps_num)) self.qtgui_time_sink_x_3_0 = qtgui.time_sink_f( 1024000, #size 1, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_3_0.set_update_time(0.10) self.qtgui_time_sink_x_3_0.set_y_axis(-1, 2e6) self.qtgui_time_sink_x_3_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_3_0.enable_tags(-1, True) self.qtgui_time_sink_x_3_0.set_trigger_mode(qtgui.TRIG_MODE_AUTO, qtgui.TRIG_SLOPE_POS, 200, 40000, 0, "PSDU") self.qtgui_time_sink_x_3_0.enable_autoscale(True) self.qtgui_time_sink_x_3_0.enable_grid(False) self.qtgui_time_sink_x_3_0.enable_axis_labels(True) self.qtgui_time_sink_x_3_0.enable_control_panel(True) if not True: self.qtgui_time_sink_x_3_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: self.qtgui_time_sink_x_3_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_3_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_3_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_3_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_3_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_3_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_3_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_3_0_win = sip.wrapinstance( self.qtgui_time_sink_x_3_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_3_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 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.qtgui_const_sink_x_1 = qtgui.const_sink_c( 256, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(True) self.qtgui_const_sink_x_1.enable_grid(False) self.qtgui_const_sink_x_1.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance( self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_1_win) self.lpwan_message_counter_0 = lpwan.message_counter(0, 1) 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_preamble_search_cc_0 = lpwan.dsss_preamble_search_cc( spread_factor, preamble_seed_rx, ovsf_code_index, ovsf_spreading_factor, (freq_vec), preamble_len, sfd_present, sps, 0, chiprate, "oqpsk", (firdes.root_raised_cosine(1, sps, 1, roll_off, taps_num))) 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_filter_crc_packets_0 = lpwan.dsss_filter_crc_packets() self.lpwan_dsss_diff_decoding_ff_0 = lpwan.dsss_diff_decoding_ff( len_tag_var, True, len(shr)) self.lpwan_dsss_diff_coding_bb_0_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.lpwan_dsss_despread_cc_0 = lpwan.dsss_despread_cc( spread_factor, data_seed_rx, preamble_seed_rx, ovsf_code_index, ovsf_spreading_factor, sps, psdu_len, 1, chiprate, False, True, 1, 0.05, 0.8, 0.5) self.lpwan_dsss_deinterleaver_ff_0_0 = lpwan.dsss_deinterleaver_ff( len_tag_var) self.foo_periodic_msg_source_0 = foo.periodic_msg_source( pmt.intern("Hello World!"), 20, 200, True, False) self.dsss_oqpsk_mod_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.dsss_fec_dec_fb_0 = dsss_fec_dec_fb( len_tag_var=len_tag_var, tailbiting=fec_tailbiting, ) self.digital_crc32_async_bb_1_0 = digital.crc32_async_bb(False) self.digital_crc32_async_bb_1 = digital.crc32_async_bb(True) 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_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.complex_t, 'packet_len') self.blocks_tag_gate_1 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) 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_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'packet_len') self.blocks_null_sink_1_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_noise_source_x_0_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 1, 213) ################################################## # Connections ################################################## self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.digital_crc32_async_bb_0, 'in')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.lpwan_dsss_filter_crc_packets_0, 'in_soft')) self.msg_connect((self.digital_crc32_async_bb_0, 'out'), (self.dsss_fec_enc_b_0_0, 'in')) self.msg_connect((self.digital_crc32_async_bb_1, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.digital_crc32_async_bb_1, 'out'), (self.digital_crc32_async_bb_1_0, 'in')) self.msg_connect((self.digital_crc32_async_bb_1, 'out'), (self.lpwan_message_counter_0, 'in')) self.msg_connect( (self.digital_crc32_async_bb_1_0, 'out'), (self.lpwan_dsss_filter_crc_packets_0, 'in_hard_crc_ok')) self.msg_connect((self.dsss_fec_dec_fb_0, 'out'), (self.digital_crc32_async_bb_1, 'in')) self.msg_connect((self.dsss_fec_dec_fb_0, 'out'), (self.lpwan_dsss_filter_crc_packets_0, 'in_hard')) self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.lpwan_dsss_filter_crc_packets_0, 'out_soft'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.qtgui_time_sink_x_3_0, 0)) self.connect((self.blocks_complex_to_mag_0_0, 0), (self.qtgui_time_sink_x_3_0, 1)) self.connect((self.blocks_complex_to_real_0, 0), (self.lpwan_dsss_deinterleaver_ff_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_const_sink_x_1, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.dsss_oqpsk_mod_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_tag_gate_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_vector_source_x_0_0, 0), (self.lpwan_dsss_diff_coding_bb_0_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), (self.blocks_tag_gate_1, 0)) self.connect((self.lpwan_dsss_deinterleaver_ff_0_0, 0), (self.lpwan_dsss_normalize_ff_0, 0)) self.connect((self.lpwan_dsss_despread_cc_0, 0), (self.lpwan_dsss_diff_decoding_ff_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, 0), (self.lpwan_dsss_spreading_bb_0_0, 0)) self.connect((self.lpwan_dsss_diff_decoding_ff_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.lpwan_dsss_diff_decoding_ff_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.lpwan_dsss_interleaver_bb_0, 0), (self.lpwan_dsss_diff_coding_bb_0, 0)) self.connect((self.lpwan_dsss_normalize_ff_0, 0), (self.dsss_fec_dec_fb_0, 0)) self.connect((self.lpwan_dsss_preamble_search_cc_0, 0), (self.blocks_complex_to_mag_0_0, 0)) self.connect((self.lpwan_dsss_preamble_search_cc_0, 1), (self.blocks_null_sink_1_0_0, 0)) self.connect((self.lpwan_dsss_preamble_search_cc_0, 1), (self.blocks_tag_gate_0, 0)) self.connect((self.lpwan_dsss_preamble_search_cc_0, 0), (self.lpwan_dsss_despread_cc_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)) self.connect((self.lpwan_message_counter_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.lpwan_dsss_preamble_search_cc_0, 0))