Ejemplo n.º 1
0
    def __init__(self):
        gr.top_block.__init__(self, "CogMAC_plus")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("CogMAC_plus")
        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", "CogMAC_plus")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 1
        self.samp_rate = samp_rate = 400000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11*sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0][0:128]
        self.destination_address = destination_address = 3
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range, self.set_range_rx_gain, 'Rx Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1,0,1,1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range, self.set_range_mu, 'BB Derotation Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2,0,1,1)
        self.inets_sending_0 = inets.sending(develop_mode=0, block_id=11, constellation=gnuradio.digital.constellation_qpsk().base(), preamble=diff_preamble_128, samp_rate=samp_rate, sps=sps, system_time_granularity_us=system_time_granularity_us, usrp_device_address=usrp_device_address, center_frequency=tx_center_frequency, interframe_interval_s=0.005, t_pretx_interval_s=0, file_name_extension_t_control="t1TXs", file_name_extension_pending="Tfr", record_on=0, name_with_timestamp=1, tx_gain=0)
        self.inets_run_0 = inets.run(5, 10)
        self.inets_receiving_0 = inets.receiving(1, 21, gnuradio.digital.constellation_qpsk().base(), rrc, mu, diff_preamble_128, rx_gain, samp_rate, sps, 30, usrp_device_address, rx_center_frequency)
        self.inets_general_timer_1 = inets.general_timer(0, 3, 0, 100, 10, 0)
        self.inets_general_timer_0 = inets.general_timer(1, 15, 0, 1000, 10, 0)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 10, 1, destination_address, 1, source_address, 1, 318, 2, 524, 2, 2, -1, 1, 0, ([2, 3]), ([1000, 1000]), 2, 0, 300, 1)
        self.inets_frame_replicate_0 = inets.frame_replicate(0, 37, 4)
        self.inets_frame_probe_0_0 = inets.frame_probe(0, 100, 0, 0, 0.01, 0, "/home/inets/source/gr-inets/results/", "", 1)
        self.inets_frame_probe_0 = inets.frame_probe(2, 100, 0, 1, 0.01, 0, "/home/inets/source/gr-inets/results/", "", 1)
        self.inets_frame_path_0_0_2 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_1_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_1 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_0_2_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_0_2 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_0_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_1_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_0 = inets.frame_path(0, 39)
        self.inets_frame_index_selector_1 = inets.frame_index_selector(0, 33, (1, ), 0)
        self.inets_frame_index_selector_0 = inets.frame_index_selector(0, 33, (10, ), 0)
        self.inets_frame_counter_0 = inets.frame_counter(0, 36, 4)
        self.inets_frame_check_0 = inets.frame_check(0, 9)
        self.inets_frame_buffer_0_0 = inets.frame_buffer(0, 16, 100, 0, 0, 0)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 10, 0, 0, 1)
        self.inets_frame_and_0 = inets.frame_and(0, 38, 0)
        self.inets_frame_analysis_0 = inets.frame_analysis(0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_dummy_source_0 = inets.dummy_source(0, 23, 300, 3, 100)
        self.inets_cogmac_ch_pool_0 = inets.cogmac_ch_pool(1, 35, 3, 390000000, 0, 10000000)
        self.inets_carrier_sensing_0 = inets.carrier_sensing(1, 11, 2, 1000, 0.005, 1000, 100)
        self.inets_backoff_0 = inets.backoff(0, 11, 3, 10, 1000, 4000, 1, 0.005, 10, 1)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.inets_backoff_0, 'frame_info_out'), (self.inets_frame_buffer_0, 'indicate_empty'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_pass_out'), (self.inets_frame_path_0_0_1_0, 'frame_in'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_fail_out'), (self.inets_frame_path_0_0_1_0_2, 'frame_in'))
        self.msg_connect((self.inets_cogmac_ch_pool_0, 'next_frequency_out'), (self.inets_frame_path_0_0_1_0_0, 'frame_in'))
        self.msg_connect((self.inets_cogmac_ch_pool_0, 'next_frequency_out'), (self.inets_sending_0, 'reconfig_in'))
        self.msg_connect((self.inets_dummy_source_0, 'output'), (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_frame_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_and_0, 'frame_out'), (self.inets_frame_counter_0, 'reset_in'))
        self.msg_connect((self.inets_frame_and_0, 'frame_out'), (self.inets_frame_path_0_0_1_1_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'), (self.inets_frame_index_selector_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'buffer_not_full'), (self.inets_frame_path_0_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'buffer_empty'), (self.inets_frame_path_0_0_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_0_0, 'buffer_empty'), (self.inets_frame_path_0_0_1_0_2_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_0_0, 'dequeue_element'), (self.inets_general_timer_0, 'suspend_timer_in'))
        self.msg_connect((self.inets_frame_buffer_0_0, 'dequeue_element'), (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'), (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'), (self.inets_general_timer_1, 'active_in'))
        self.msg_connect((self.inets_frame_counter_0, 'select_out'), (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_frame_index_selector_0, 'unselected_frame_out'), (self.inets_frame_index_selector_1, 'frame_in'))
        self.msg_connect((self.inets_frame_index_selector_0, 'frame_out'), (self.inets_frame_path_0, 'frame_in'))
        self.msg_connect((self.inets_frame_index_selector_0, 'unselected_frame_out'), (self.inets_frame_path_0, 'frame_in'))
        self.msg_connect((self.inets_frame_index_selector_0, 'frame_out'), (self.inets_frame_replicate_0, 'frame_in'))
        self.msg_connect((self.inets_frame_index_selector_1, 'frame_out'), (self.inets_frame_buffer_0_0, 'dequeue'))
        self.msg_connect((self.inets_frame_index_selector_1, 'frame_out'), (self.inets_frame_path_0_0_1_1, 'frame_in'))
        self.msg_connect((self.inets_frame_index_selector_1, 'unselected_frame_out'), (self.inets_frame_path_0_0_1_1, 'frame_in'))
        self.msg_connect((self.inets_frame_path_0, 'frame_out'), (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_frame_path_0_0, 'frame_out'), (self.inets_dummy_source_0, 'trigger'))
        self.msg_connect((self.inets_frame_path_0_0_0, 'frame_out'), (self.inets_framing_0, 'reset_index'))
        self.msg_connect((self.inets_frame_path_0_0_1_0, 'frame_out'), (self.inets_frame_buffer_0_0, 'dequeue'))
        self.msg_connect((self.inets_frame_path_0_0_1_0, 'frame_out'), (self.inets_general_timer_0, 'suspend_timer_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_0_0, 'frame_out'), (self.inets_receiving_0, 'reconfig_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_0_0_0, 'frame_out'), (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_0_2, 'frame_out'), (self.inets_frame_buffer_0_0, 'flush'))
        self.msg_connect((self.inets_frame_path_0_0_1_0_2, 'frame_out'), (self.inets_general_timer_0, 'suspend_timer_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_0_2_0, 'frame_out'), (self.inets_frame_and_0, 'frame_II_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_1, 'frame_out'), (self.inets_frame_buffer_0_0, 'enqueue'))
        self.msg_connect((self.inets_frame_path_0_0_1_1_0, 'frame_out'), (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_path_0_0_1_1_0, 'frame_out'), (self.inets_general_timer_0, 'resume_timer_in'))
        self.msg_connect((self.inets_frame_path_0_0_2, 'frame_out'), (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_frame_replicate_0, 'replicate_out'), (self.inets_frame_path_0_0_1_1, 'frame_in'))
        self.msg_connect((self.inets_framing_0, 'frame_out'), (self.inets_frame_buffer_0, 'enqueue'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'), (self.inets_cogmac_ch_pool_0, 'change_in'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'), (self.inets_frame_path_0_0_1_0_0_0, 'frame_in'))
        self.msg_connect((self.inets_general_timer_1, 'expire_signal_out'), (self.inets_general_timer_0, 'resume_timer_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'), (self.inets_carrier_sensing_0, 'power_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'), (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'), (self.inets_frame_buffer_0, 'indicate_empty'))
        self.msg_connect((self.inets_run_0, 'trigger_out'), (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'), (self.inets_frame_and_0, 'frame_I_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'), (self.inets_frame_counter_0, 'counts_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'), (self.inets_frame_path_0_0_1_0, 'frame_in'))
Ejemplo n.º 2
0
    def __init__(self):
        gr.top_block.__init__(self, "csma_rtscts_80211_II")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("csma_rtscts_80211_II")
        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", "csma_rtscts_80211_II")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.20"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.timeout_duration_ms = timeout_duration_ms = 1000
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 3
        self.samp_rate = samp_rate = 400000
        self.rx_gain = rx_gain = 0
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11 * sps)

        self.padding = padding = 64
        self.mu = mu = 0.6
        self.diff_preamble_128 = diff_preamble_128 = [
            1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0,
            1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
            1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0,
            1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0,
            1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
            1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
            1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1,
            0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0,
            0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0,
            0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1,
            0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1,
            1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0
        ][0:128]
        self.destination_address = destination_address = 5
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self.inets_virtual_cs_0 = inets.virtual_cs(1, 20, 10)
        self.inets_timeout_0_0 = inets.timeout(0, 10, 100, 1000, 0)
        self.inets_timeout_0 = inets.timeout(0, 10, 100, 1000, 0)
        self.inets_sending_0 = inets.sending(
            develop_mode=0,
            block_id=11,
            constellation=gnuradio.digital.constellation_qpsk().base(),
            preamble=diff_preamble_128,
            samp_rate=samp_rate,
            sps=sps,
            system_time_granularity_us=system_time_granularity_us,
            usrp_device_address=usrp_device_address,
            center_frequency=tx_center_frequency,
            interframe_interval_s=0.005,
            t_pretx_interval_s=0,
            file_name_extension_t_control="t1TXs",
            file_name_extension_pending="Tfr",
            record_on=0,
            name_with_timestamp=0,
            tx_gain=0)
        self.inets_run_0 = inets.run(5, 10)
        self.inets_rts_framing_0 = inets.rts_framing(
            0, 30, 1, 1, destination_address, 1, source_address, 1, 318, 2,
            524, 2, 2, 1, 3, padding, diff_preamble_128,
            gnuradio.digital.constellation_qpsk().bits_per_symbol() *
            (samp_rate / sps), 1000, 800)
        self.inets_resend_check_0 = inets.resend_check(0, 24, 6)
        self.inets_receiving_0 = inets.receiving(
            0, 21,
            gnuradio.digital.constellation_qpsk().base(), rrc, mu,
            diff_preamble_128, rx_gain, samp_rate, sps, 30,
            usrp_device_address, rx_center_frequency)
        self.inets_general_timer_0_1_0 = inets.general_timer(0, 3, 0, 8, 10, 0)
        self.inets_general_timer_0_1 = inets.general_timer(0, 3, 0, 18, 10, 0)
        self.inets_general_timer_0_0 = inets.general_timer(
            0, 1, 0, 1000000, 10, 0)
        self.inets_general_timer_0 = inets.general_timer(0, 3, 3, 200, 10, 0)
        self.inets_framing_0_0 = inets.framing(0, 17, 2, 1, 0, 1,
                                               destination_address, 1,
                                               source_address, 1, 318, 2, 524,
                                               2, 2, 1, 1, 0, ([2, 3]),
                                               ([1000, 1000]), 2, 0, 300, 1)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 0, 1,
                                             destination_address, 1,
                                             source_address, 1, 318, 2, 524, 2,
                                             2, 1, 1, 0, ([2, 3]),
                                             ([1000, 1000]), 2, 0, 300, 1)
        self.inets_frame_type_check_0_1 = inets.frame_type_check(
            1, 25, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0_0_0 = inets.frame_type_check(
            0, 25, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0_0 = inets.frame_type_check(
            0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0 = inets.frame_type_check(
            0, 25, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1)
        self.inets_frame_path_1_0_1 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0_0_1_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0_0_1 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1 = inets.frame_path(0, 39)
        self.inets_frame_check_0 = inets.frame_check(0, 9)
        self.inets_frame_buffer_1 = inets.frame_buffer(0, 16, 10, 1, 1, 1)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 1000, 1, 1, 0)
        self.inets_frame_analysis_0 = inets.frame_analysis(
            0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_dummy_source_0 = inets.dummy_source(0, 23, 837, 3, 1)
        self.inets_cts_framing_0 = inets.cts_framing(
            0, 31, 1, 1, destination_address, 1, source_address, 1, 318, 2,
            524, 2, 2, 1, 3, padding, diff_preamble_128,
            gnuradio.digital.constellation_qpsk().bits_per_symbol() *
            (samp_rate / sps), 1000, 800)
        self.inets_counter_0_1_0_0 = inets.counter(1, 2, 1, "undestined_cts")
        self.inets_counter_0_1_0 = inets.counter(1, 2, 1, "undestined_rts")
        self.inets_counter_0_1 = inets.counter(1, 2, 1, "bad_frame")
        self.inets_counter_0_0_1_1 = inets.counter(1, 1, 1, "tx_ack")
        self.inets_counter_0_0_1_0_0_0_0_0 = inets.counter(1, 1, 1, "rx_data")
        self.inets_counter_0_0_1_0_0_0_0 = inets.counter(1, 1, 1, "rx_ack")
        self.inets_counter_0_0_1_0_0_0 = inets.counter(1, 1, 1, "rx_rts")
        self.inets_counter_0_0_1_0_0 = inets.counter(1, 1, 1, "rx_cts")
        self.inets_counter_0_0_1_0 = inets.counter(1, 1, 1, "tx_cts")
        self.inets_counter_0_0_1 = inets.counter(1, 1, 1, "tx_data")
        self.inets_counter_0_0_0 = inets.counter(1, 10, 1, "acked")
        self.inets_counter_0_0 = inets.counter(1, 1, 1, "tx_rts")
        self.inets_counter_0 = inets.counter(2, 2, 1, "good_frame")
        self.inets_carrier_sensing_0 = inets.carrier_sensing(
            0, 11, 4, 100, 0.005, system_time_granularity_us, 100)
        self.inets_backoff_1 = inets.backoff(0, 11, 3, 10, 50, 100, 1, 0.005,
                                             10, 1)
        self.inets_backoff_0 = inets.backoff(0, 11, 1, 5, 10, 400, 1, 0.005,
                                             10, 1)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect(
            (self.inets_address_check_0, 'address_check_pass_out'),
            (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_address_check_0, 'address_check_fail_out'),
            (self.inets_frame_type_check_0_1, 'frame_info_in'))
        self.msg_connect((self.inets_backoff_0, 'frame_info_out'),
                         (self.inets_resend_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_backoff_1, 'frame_info_out'),
                         (self.inets_counter_0_0_0, 'message_in'))
        self.msg_connect((self.inets_backoff_1, 'frame_info_out'),
                         (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_fail_out'),
                         (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_pass_out'),
                         (self.inets_frame_buffer_1, 'enqueue'))
        self.msg_connect((self.inets_cts_framing_0, 'frame_out'),
                         (self.inets_general_timer_0_1_0, 'active_in'))
        self.msg_connect((self.inets_dummy_source_0, 'output'),
                         (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'),
                         (self.inets_frame_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'),
                         (self.inets_rts_framing_0, 'data_frame_in'))
        self.msg_connect((self.inets_frame_buffer_1, 'dequeue_element'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'),
                         (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'),
                         (self.inets_counter_0, 'message_in'))
        self.msg_connect((self.inets_frame_check_0, 'bad_frame_info_out'),
                         (self.inets_counter_0_1, 'message_in'))
        self.msg_connect((self.inets_frame_path_1, 'frame_out'),
                         (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_frame_path_1_0, 'frame_out'),
                         (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_frame_path_1_0, 'frame_out'),
                         (self.inets_general_timer_0_1, 'active_in'))
        self.msg_connect((self.inets_frame_path_1_0_0, 'frame_out'),
                         (self.inets_frame_buffer_1, 'enqueue'))
        self.msg_connect((self.inets_frame_path_1_0_0_0, 'frame_out'),
                         (self.inets_frame_buffer_1, 'dequeue'))
        self.msg_connect((self.inets_frame_path_1_0_0_0_0, 'frame_out'),
                         (self.inets_timeout_0, 'ack_frame_info_in'))
        self.msg_connect((self.inets_frame_path_1_0_0_0_1, 'frame_out'),
                         (self.inets_counter_0_0_1_0_0, 'message_in'))
        self.msg_connect((self.inets_frame_path_1_0_0_0_1, 'frame_out'),
                         (self.inets_timeout_0_0, 'cts_frame_info_in'))
        self.msg_connect((self.inets_frame_path_1_0_0_0_1_0, 'frame_out'),
                         (self.inets_rts_framing_0, 'cts_frame_in'))
        self.msg_connect((self.inets_frame_path_1_0_1, 'frame_out'),
                         (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'rts_frame_info_out'),
                         (self.inets_counter_0_0_1_0_0_0, 'message_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'ack_frame_info_out'),
                         (self.inets_counter_0_0_1_0_0_0_0, 'message_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0, 'data_frame_info_out'),
            (self.inets_counter_0_0_1_0_0_0_0_0, 'message_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'rts_frame_info_out'),
                         (self.inets_cts_framing_0, 'rts_frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'ack_frame_info_out'),
                         (self.inets_frame_path_1_0_0_0_0, 'frame_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'cts_frame_info_out'),
                         (self.inets_frame_path_1_0_0_0_1, 'frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0, 'data_frame_info_out'),
            (self.inets_framing_0_0, 'data_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'rts_frame_info_out'),
                         (self.inets_virtual_cs_0, 'nav_cmd_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'ack_frame_info_out'),
            (self.inets_backoff_1, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'data_frame_info_out'),
            (self.inets_rts_framing_0, 'data_frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'cts_frame_info_out'),
            (self.inets_frame_path_1_0_0_0_1_0, 'frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'rts_frame_info_out'),
            (self.inets_frame_path_1_0_1, 'frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_1, 'rts_frame_info_out'),
            (self.inets_counter_0_1_0, 'message_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_1, 'cts_frame_info_out'),
            (self.inets_counter_0_1_0_0, 'message_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_1, 'cts_frame_info_out'),
            (self.inets_virtual_cs_0, 'nav_cmd_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_1, 'rts_frame_info_out'),
            (self.inets_virtual_cs_0, 'nav_cmd_in'))
        self.msg_connect((self.inets_framing_0_0, 'frame_out'),
                         (self.inets_general_timer_0_1_0, 'active_in'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'),
                         (self.inets_dummy_source_0, 'trigger'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'),
                         (self.inets_frame_path_1, 'frame_in'))
        self.msg_connect((self.inets_general_timer_0_0, 'expire_signal_out'),
                         (self.inets_general_timer_0, 'disable_timer_in'))
        self.msg_connect((self.inets_general_timer_0_1, 'expire_signal_out'),
                         (self.inets_carrier_sensing_0, 'stop_in'))
        self.msg_connect((self.inets_general_timer_0_1_0, 'expire_signal_out'),
                         (self.inets_frame_path_1_0_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'),
                         (self.inets_carrier_sensing_0, 'power_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'),
                         (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_fail_out'),
                         (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_pass_out'),
                         (self.inets_frame_path_1_0, 'frame_in'))
        self.msg_connect((self.inets_rts_framing_0, 'frame_out'),
                         (self.inets_virtual_cs_0, 'frame_cmd_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'),
                         (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'),
                         (self.inets_general_timer_0_0, 'active_in'))
        self.msg_connect((self.inets_sending_0, 'rts_frame_out'),
                         (self.inets_counter_0_0, 'message_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'),
                         (self.inets_counter_0_0_1, 'message_in'))
        self.msg_connect((self.inets_sending_0, 'cts_frame_out'),
                         (self.inets_counter_0_0_1_0, 'message_in'))
        self.msg_connect((self.inets_sending_0, 'ack_frame_out'),
                         (self.inets_counter_0_0_1_1, 'message_in'))
        self.msg_connect((self.inets_sending_0, 'rx_control_out'),
                         (self.inets_frame_path_1_0_0_0, 'frame_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'),
                         (self.inets_timeout_0, 'data_frame_info_in'))
        self.msg_connect((self.inets_sending_0, 'rts_frame_out'),
                         (self.inets_timeout_0_0, 'rts_frame_info_in'))
        self.msg_connect((self.inets_timeout_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0, 'frame_info_in'))
        self.msg_connect((self.inets_timeout_0_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0_0, 'frame_info_in'))
        self.msg_connect((self.inets_virtual_cs_0, 'frame_cmd_out'),
                         (self.inets_frame_path_1_0, 'frame_in'))
Ejemplo n.º 3
0
    def __init__(self):
        gr.top_block.__init__(self, "four_way_handshake_csma")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("four_way_handshake_csma")
        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", "four_way_handshake_csma")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.tx_center_frequency = tx_center_frequency = 4.2e8
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 1
        self.samp_rate = samp_rate = 1000000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 4.2e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11 * sps)

        self.padding = padding = 64
        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [
            1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0,
            1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
            1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0,
            1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0,
            1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
            1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
            1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1,
            0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0,
            0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0,
            0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1,
            0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1,
            1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0
        ][0:128]
        self.destination_address = destination_address = 2
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range,
                                              self.set_range_rx_gain,
                                              'Rx Gain', "counter_slider",
                                              float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1, 0, 1, 1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range,
                                         self.set_range_mu,
                                         'BB Derotation Gain',
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2, 0, 1, 1)
        self.inets_timeout_0_0 = inets.timeout(0, 10, 100, 1000, 0)
        self.inets_timeout_0 = inets.timeout(0, 40, 100, 1000, 0)
        self.inets_sending_0 = inets.sending(
            develop_mode=0,
            block_id=11,
            constellation=gnuradio.digital.constellation_qpsk().base(),
            preamble=diff_preamble_128,
            samp_rate=samp_rate,
            sps=sps,
            system_time_granularity_us=system_time_granularity_us,
            usrp_device_address=usrp_device_address,
            center_frequency=tx_center_frequency,
            interframe_interval_s=0.01,
            t_pretx_interval_s=0.003)
        self.inets_rts_framing_0 = inets.rts_framing(
            0, 30, 1, 1, destination_address, 1, source_address, 1, 318, 2,
            524, 2, 2, 1, 3, padding, diff_preamble_128,
            gnuradio.digital.constellation_qpsk().bits_per_symbol() *
            (samp_rate / sps), 1000, 800)
        self.inets_resend_check_0_0 = inets.resend_check(0, 24, 6)
        self.inets_resend_check_0 = inets.resend_check(0, 24, 6)
        self.inets_receiving_0 = inets.receiving(
            1, 21,
            gnuradio.digital.constellation_qpsk().base(), rrc, mu,
            diff_preamble_128, rx_gain, samp_rate, sps, 30,
            usrp_device_address, rx_center_frequency)
        self.inets_general_timer_0 = inets.general_timer(0, 3, 0, 5000, 10, 0)
        self.inets_framing_1 = inets.framing(0, 17, 2, 1, 0, 1,
                                             destination_address, 1,
                                             source_address, 1, 318, 2, 524, 2,
                                             2, 1, 1, 0, ([2, 3]),
                                             ([1000, 1000]), 2)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 0, 1,
                                             destination_address, 1,
                                             source_address, 1, 318, 2, 524, 2,
                                             2, 1, 1, 0, ([2, 3]),
                                             ([1000, 1000]), 2)
        self.inets_frame_type_check_0_0_1 = inets.frame_type_check(
            0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0_0_0 = inets.frame_type_check(
            1, 25, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0_0 = inets.frame_type_check(
            0, 25, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 10, 1, 1)
        self.inets_frame_analysis_0 = inets.frame_analysis(
            0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_dummy_source_0 = inets.dummy_source(0, 23, 100, 1, 1)
        self.inets_cts_framing_0 = inets.cts_framing(
            0, 31, 1, 1, destination_address, 1, source_address, 1, 318, 2,
            524, 2, 2, 1, 3, padding, diff_preamble_128,
            gnuradio.digital.constellation_qpsk().bits_per_symbol() *
            (samp_rate / sps), 1000, 800)
        self.inets_counter_1_0 = inets.counter(1, 100, 1)
        self.inets_counter_0 = inets.counter(1, 100, 0)
        self.inets_backoff_0 = inets.backoff(0, 11, 1, 10, 100, 400, 0, 0.005,
                                             10, 0)
        self.inets_address_check_0_1 = inets.address_check(
            0, 17, source_address)
        self.inets_address_check_0_0_0 = inets.address_check(
            0, 17, source_address)
        self.inets_address_check_0_0 = inets.address_check(
            0, 17, source_address)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)
        self.inets_IFS_0_0 = inets.IFS(0, 19, 1000, 800, 1, 0, 1, cs_threshold,
                                       system_time_granularity_us)
        self.inets_IFS_0 = inets.IFS(0, 19, 1000, 800, 3, 0, 1, cs_threshold,
                                     system_time_granularity_us)
        self.blocks_message_strobe_0 = blocks.message_strobe(
            pmt.intern("TEST"), 1000)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'),
                         (self.inets_dummy_source_0, 'trigger'))
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'),
                         (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_IFS_0, 'frame_info_fail_out'),
                         (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_IFS_0, 'frame_info_pass_out'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_IFS_0_0, 'frame_info_pass_out'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect(
            (self.inets_address_check_0, 'address_check_pass_out'),
            (self.inets_framing_1, 'data_in'))
        self.msg_connect(
            (self.inets_address_check_0_0, 'address_check_fail_out'),
            (self.inets_backoff_0, 'virtual_cs_frame_in'))
        self.msg_connect(
            (self.inets_address_check_0_0, 'address_check_pass_out'),
            (self.inets_cts_framing_0, 'rts_frame_info_in'))
        self.msg_connect(
            (self.inets_address_check_0_0_0, 'address_check_fail_out'),
            (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_address_check_0_0_0, 'address_check_pass_out'),
            (self.inets_timeout_0, 'cts_frame_info_in'))
        self.msg_connect(
            (self.inets_address_check_0_1, 'address_check_pass_out'),
            (self.inets_timeout_0_0, 'ack_frame_info_in'))
        self.msg_connect((self.inets_backoff_0, 'frame_info_out'),
                         (self.inets_resend_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_cts_framing_0, 'frame_out'),
                         (self.inets_IFS_0_0, 'frame_in'))
        self.msg_connect((self.inets_dummy_source_0, 'output'),
                         (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'),
                         (self.inets_rts_framing_0, 'data_frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'rts_frame_info_out'),
            (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'cts_frame_info_out'),
            (self.inets_rts_framing_0, 'cts_frame_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'data_frame_info_out'),
            (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'rts_frame_info_out'),
            (self.inets_address_check_0_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'cts_frame_info_out'),
            (self.inets_address_check_0_0_0, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_0, 'ack_frame_info_out'),
            (self.inets_address_check_0_1, 'frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_1, 'ack_frame_info_out'),
            (self.inets_counter_0, 'message_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_1, 'ack_frame_info_out'),
            (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0_1, 'data_frame_info_out'),
            (self.inets_resend_check_0_0, 'frame_info_in'))
        self.msg_connect((self.inets_framing_0, 'frame_out'),
                         (self.inets_frame_buffer_0, 'enqueue'))
        self.msg_connect((self.inets_framing_1, 'frame_out'),
                         (self.inets_IFS_0_0, 'frame_in'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'),
                         (self.inets_counter_0, 'stop_counter_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'),
                         (self.inets_IFS_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'),
                         (self.inets_IFS_0_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'),
                         (self.inets_backoff_0, 'power_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'),
                         (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_pass_out'),
                         (self.inets_IFS_0, 'frame_in'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_fail_out'),
                         (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect(
            (self.inets_resend_check_0_0, 'resend_check_fail_out'),
            (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect(
            (self.inets_resend_check_0_0, 'resend_check_pass_out'),
            (self.inets_rts_framing_0, 'cts_frame_in'))
        self.msg_connect((self.inets_rts_framing_0, 'frame_out'),
                         (self.inets_IFS_0, 'frame_in'))
        self.msg_connect((self.inets_sending_0, 'rts_frame_out'),
                         (self.inets_timeout_0, 'rts_frame_info_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'),
                         (self.inets_timeout_0_0, 'data_frame_info_in'))
        self.msg_connect((self.inets_timeout_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0, 'frame_info_in'))
        self.msg_connect((self.inets_timeout_0_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0_1, 'frame_info_in'))
Ejemplo n.º 4
0
    def __init__(self):
        gr.top_block.__init__(self, "theoretical_csma_rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("theoretical_csma_rx")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "theoretical_csma_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.timeout_duration_ms = timeout_duration_ms = 1000
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 2
        self.samp_rate = samp_rate = 400000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11*sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0][0:128]
        self.destination_address = destination_address = 1
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range, self.set_range_rx_gain, 'Rx Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1,0,1,1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range, self.set_range_mu, 'BB Derotation Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2,0,1,1)
        self.inets_run_0 = inets.run(20, 10)
        self.inets_receiving_0 = inets.receiving(0, 21, gnuradio.digital.constellation_qpsk().base(), rrc, mu, diff_preamble_128, rx_gain, samp_rate, sps, 30, usrp_device_address, rx_center_frequency)
        self.inets_general_timer_0 = inets.general_timer(0, 5, 0, 500000, 10, 0)
        self.inets_frame_probe_0 = inets.frame_probe(2, 100, 0, 1, 0.0015, 0, "/home/inets/source/gr-inets/results/", "", 1)
        self.inets_frame_counter_0 = inets.frame_counter(0, 36, 8, 0)
        self.inets_frame_check_0 = inets.frame_check(0, 9)
        self.inets_frame_analysis_0 = inets.frame_analysis(0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_counter_0_0_2 = inets.counter(1, 1, 1, "", 0, "/home/inets/source/gr-inets/results/", 1)
        self.inets_counter_0_0_1 = inets.counter(1, 2, 1, "", 0, "/home/inets/source/gr-inets/results/", 1)
        self.inets_counter_0_0_0 = inets.counter(1, 3, 1, "", 0, "/home/inets/source/gr-inets/results/", 1)
        self.inets_counter_0_0 = inets.counter(3, 5, 1, "not_addressed", 1, "/home/inets/source/gr-inets/results/", 0)
        self.inets_counter_0 = inets.counter(3, 4, 1, "addressed", 1, "/home/inets/source/gr-inets/results/", 0)
        self.inets_cmd_path_0 = inets.cmd_path(0, 44, 1)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.inets_address_check_0, 'address_check_pass_out'), (self.inets_counter_0, 'message_in'))
        self.msg_connect((self.inets_address_check_0, 'address_check_fail_out'), (self.inets_counter_0_0, 'message_in'))
        self.msg_connect((self.inets_cmd_path_0, 'cmd_out'), (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_frame_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'), (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_counter_0, 'unselect_out'), (self.inets_cmd_path_0, 'cmd_in'))
        self.msg_connect((self.inets_frame_counter_0, 'unselect_out'), (self.inets_counter_0, 'reset_counter'))
        self.msg_connect((self.inets_frame_counter_0, 'unselect_out'), (self.inets_counter_0_0, 'reset_counter'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'), (self.inets_frame_counter_0, 'counts_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'), (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'), (self.inets_general_timer_0, 'active_in'))
Ejemplo n.º 5
0
    def __init__(self):
        gr.top_block.__init__(self, "streaming_rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("streaming_rx")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "streaming_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.20"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 2
        self.samp_rate = samp_rate = 1000000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11*sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0][0:128]
        self.destination_address = destination_address = 1
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range, self.set_range_rx_gain, 'Rx Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1,0,1,1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range, self.set_range_mu, 'BB Derotation Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2,0,1,1)
        self.inets_receiving_0 = inets.receiving(0, 21, gnuradio.digital.constellation_qpsk().base(), rrc, mu, diff_preamble_128, rx_gain, samp_rate, sps, 30, usrp_device_address, rx_center_frequency)
        self.inets_frame_type_check_0 = inets.frame_type_check(0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_probe_0 = inets.frame_probe(0, 100, 0, 0, 0.01)
        self.inets_frame_analysis_0 = inets.frame_analysis(0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)
        self.blocks_socket_pdu_1 = blocks.socket_pdu("UDP_CLIENT", 'localhost', '1234', 300, False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.inets_address_check_0, 'address_check_pass_out'), (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_frame_probe_0, 'info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'data_frame_info_out'), (self.blocks_socket_pdu_1, 'pdus'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'), (self.inets_frame_analysis_0, 'frame_in'))
Ejemplo n.º 6
0
    def __init__(self):
        gr.top_block.__init__(self, "two_way_handshake_test_Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("two_way_handshake_test_Rx")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "two_way_handshake_test_Rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.20"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.system_time_granularity_us = system_time_granularity_us = 1000
        self.source_address = source_address = 1
        self.samp_rate = samp_rate = 400000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11*sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0][0:128]
        self.destination_address = destination_address = 3
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range, self.set_range_rx_gain, 'Rx Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1,0,1,1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range, self.set_range_mu, 'BB Derotation Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2,0,1,1)
        self.inets_sending_0 = inets.sending(develop_mode=0, block_id=11, constellation=gnuradio.digital.constellation_qpsk().base(), preamble=diff_preamble_128, samp_rate=samp_rate, sps=sps, system_time_granularity_us=system_time_granularity_us, usrp_device_address=usrp_device_address, center_frequency=tx_center_frequency, interframe_interval_s=0.006, t_pretx_interval_s=0, file_name_extension_t_control="t2TXs", file_name_extension_pending="T2fr", record_on=1, name_with_timestamp=0, tx_gain=0)
        self.inets_receiving_0 = inets.receiving(0, 21, gnuradio.digital.constellation_qpsk().base(), rrc, mu, diff_preamble_128, rx_gain, samp_rate, sps, 30, usrp_device_address, rx_center_frequency)
        self.inets_framing_0 = inets.framing(0, 17, 2, 1, 0, 1, destination_address, 1, source_address, 1, 318, 2, 524, 2, 2, 1, 1, 0, ([2, 3]), ([1000, 1000]), 2, 0, 300, 1)
        self.inets_frame_type_check_0 = inets.frame_type_check(0, 25, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_probe_0_0_1 = inets.frame_probe(2, 100, 0, 1, 0.005, 0, "/home/inets/source/gr-inets/results/", "t2CS", 0)
        self.inets_frame_probe_0_0 = inets.frame_probe(2, 102, 0, 0, 0.01, 1, "/home/inets/source/gr-inets/results/", "t2e", 0)
        self.inets_frame_probe_0 = inets.frame_probe(2, 101, 0, 0, 0.01, 1, "/home/inets/source/gr-inets/results/", "t2RXe", 0)
        self.inets_frame_check_0 = inets.frame_check(0, 9)
        self.inets_frame_analysis_0 = inets.frame_analysis(0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_address_check_0 = inets.address_check(0, 17, 1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.inets_address_check_0, 'address_check_pass_out'), (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_frame_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'), (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'data_frame_info_out'), (self.inets_frame_probe_0, 'info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'data_frame_info_out'), (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_framing_0, 'frame_out'), (self.inets_receiving_0, 'rx_switch_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'), (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'), (self.inets_frame_probe_0_0_1, 'info_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_switch_out'), (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_sending_0, 'ack_frame_out'), (self.inets_frame_probe_0_0, 'info_in'))
        self.msg_connect((self.inets_sending_0, 'rx_control_out'), (self.inets_receiving_0, 'rx_switch_in'))
Ejemplo n.º 7
0
    def __init__(self):
        gr.top_block.__init__(self, "Test_frame_buffer")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Test_frame_buffer")
        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", "Test_frame_buffer")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 15
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.system_time_granularity_us = system_time_granularity_us = 1000
        self.samp_rate = samp_rate = 32000
        self.rx_gain = rx_gain = range_rx_gain

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11 * sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [
            1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0,
            1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
            1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0,
            1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0,
            1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
            1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
            1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1,
            0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0,
            0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0,
            0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1,
            0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1,
            1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0
        ][0:128]
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 60, 1, 15, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range,
                                              self.set_range_rx_gain,
                                              'Rx Gain', "counter_slider",
                                              float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1, 0, 1, 1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range,
                                         self.set_range_mu,
                                         'BB Derotation Gain',
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2, 0, 1, 1)
        self.inets_timeout_0 = inets.timeout(0, 10, 100, 1000)
        self.inets_sending_0 = inets.sending(
            develop_mode=1,
            block_id=11,
            constellation=gnuradio.digital.constellation_qpsk().base(),
            preamble=diff_preamble_128,
            samp_rate=samp_rate,
            sps=sps,
            system_time_granularity_us=system_time_granularity_us,
            usrp_device_address=usrp_device_address)
        self.inets_receiving_0 = inets.receiving(
            2, 11,
            gnuradio.digital.constellation_qpsk().base(), rrc, mu,
            diff_preamble_128, rx_gain, samp_rate, sps, cs_threshold,
            usrp_device_address)
        self.inets_framing_0_0 = inets.framing(0, 17, 2, 1, 1, 1, 5, 1, 1, 1,
                                               0, 2, 0, 2, 1, 1, 0, 0)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 1, 1, 5, 1, 1, 1, 0,
                                             2, 0, 2, 1, 1, 0, 0)
        self.inets_frame_type_check_0_0 = inets.frame_type_check(
            0, 0, 1, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0 = inets.frame_type_check(
            0, 0, 1, 1, 1, 1, 1, 1)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 10, 1)
        self.inets_carrier_sensing_0 = inets.carrier_sensing(
            0, 11, 2, 100, 0.005, 1000)
        self.inets_backoff_0 = inets.backoff(0, 11, 3, 1, 10, 6, 100, 400)
        self.inets_address_check_0 = inets.address_check(0, 17, 1)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_SERVER", 'localhost',
                                                     '52001', 10000, False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'),
                         (self.inets_framing_0, 'data_in'))
        self.msg_connect(
            (self.inets_address_check_0, 'address_check_pass_out'),
            (self.inets_framing_0_0, 'data_in'))
        self.msg_connect((self.inets_backoff_0, 'resend_frame_info_out'),
                         (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_pass_out'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'),
                         (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0, 'data_frame_info_out'),
            (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'ack_frame_info_out'),
                         (self.inets_timeout_0, 'ack_frame_info_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'data_frame_info_out'),
            (self.inets_backoff_0, 'frame_info_trigger_in'))
        self.msg_connect(
            (self.inets_frame_type_check_0_0, 'ack_frame_info_out'),
            (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_framing_0, 'frame_out'),
                         (self.inets_frame_buffer_0, 'enqueue'))
        self.msg_connect((self.inets_framing_0_0, 'frame_out'),
                         (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'),
                         (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'),
                         (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_sending_0, 'tx_frame_info_out'),
                         (self.inets_timeout_0, 'data_frame_info_in'))
        self.msg_connect((self.inets_timeout_0, 'frame_info_out'),
                         (self.inets_frame_type_check_0_0, 'frame_info_in'))
Ejemplo n.º 8
0
    def __init__(self,
                 constellation=gnuradio.digital.constellation_qpsk().base()):
        gr.top_block.__init__(self, "Test_slide_window")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Test_slide_window")
        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", "Test_slide_window")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.constellation = constellation

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.range_rx_gain = range_rx_gain = 0
        self.range_mu = range_mu = 0.6
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.tx_center_frequency = tx_center_frequency = 3.8e8
        self.system_time_granularity_us = system_time_granularity_us = 1000
        self.source_address = source_address = 1
        self.samp_rate = samp_rate = 1000000
        self.rx_gain = rx_gain = range_rx_gain
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11 * sps)

        self.mu = mu = range_mu
        self.diff_preamble_128 = diff_preamble_128 = [
            1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0,
            1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
            1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0,
            1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0,
            1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
            1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
            1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1,
            0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0,
            0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0,
            0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1,
            0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1,
            1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0
        ][0:128]
        self.destination_address = destination_address = 2
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self._range_rx_gain_range = Range(0, 1, 1, 0, 200)
        self._range_rx_gain_win = RangeWidget(self._range_rx_gain_range,
                                              self.set_range_rx_gain,
                                              'Rx Gain', "counter_slider",
                                              float)
        self.top_grid_layout.addWidget(self._range_rx_gain_win, 1, 0, 1, 1)
        self._range_mu_range = Range(0, 1, 0.01, 0.6, 200)
        self._range_mu_win = RangeWidget(self._range_mu_range,
                                         self.set_range_mu,
                                         'BB Derotation Gain',
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._range_mu_win, 2, 0, 1, 1)
        self.inets_timeout_0 = inets.timeout(0, 10, 1000, 1000, 1)
        self.inets_slide_window_0 = inets.slide_window(
            1, 22, 5, 1,
            constellation.bits_per_symbol() * (samp_rate / sps), 200, 1)
        self.inets_sending_0 = inets.sending(
            develop_mode=0,
            block_id=11,
            constellation=gnuradio.digital.constellation_qpsk().base(),
            preamble=diff_preamble_128,
            samp_rate=samp_rate,
            sps=sps,
            system_time_granularity_us=system_time_granularity_us,
            usrp_device_address=usrp_device_address,
            center_frequency=tx_center_frequency)
        self.inets_receiving_0 = inets.receiving(
            1, 21,
            gnuradio.digital.constellation_qpsk().base(), rrc, mu,
            diff_preamble_128, rx_gain, samp_rate, sps, 30,
            usrp_device_address, rx_center_frequency)
        self.inets_framing_1 = inets.framing(0, 17, 2, 1, 0, 1,
                                             destination_address, 1,
                                             source_address, 1, 318, 2, 524, 2,
                                             2, 1, 1, 0)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 0, 1,
                                             destination_address, 1,
                                             source_address, 1, 318, 2, 524, 2,
                                             2, 1, 1, 0)
        self.inets_frame_type_check_0 = inets.frame_type_check(
            0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_probe_0 = inets.frame_probe(1, 100, 0)
        self.inets_frame_index_check_0 = inets.frame_index_check(
            1, 28, 1, 1, 1, 1, 1)
        self.inets_frame_filter_1 = inets.frame_filter(0, 26, 0, 0, 0, 0, 8, 0,
                                                       0, 1)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 10, 1, 1)
        self.inets_frame_analysis_0 = inets.frame_analysis(
            0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_dummy_source_0 = inets.dummy_source(0, 23, 100, 2, 20)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_SERVER", 'localhost',
                                                     '52001', 10000, False)
        self.blocks_message_strobe_0 = blocks.message_strobe(
            pmt.intern("TEST"), 1000)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'),
                         (self.inets_dummy_source_0, 'trigger'))
        self.msg_connect(
            (self.inets_address_check_0, 'address_check_pass_out'),
            (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_dummy_source_0, 'output'),
                         (self.inets_frame_buffer_0, 'enqueue'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'),
                         (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'),
                         (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_frame_filter_1, 'frame_info_out'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_frame_index_check_0, 'frame_info_out'),
                         (self.inets_sending_0, 'in'))
        self.msg_connect(
            (self.inets_frame_type_check_0, 'data_frame_info_out'),
            (self.inets_framing_1, 'data_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'ack_frame_info_out'),
                         (self.inets_timeout_0, 'ack_frame_info_in'))
        self.msg_connect((self.inets_framing_0, 'frame_out'),
                         (self.inets_slide_window_0, 'frame_info_in'))
        self.msg_connect((self.inets_framing_1, 'frame_out'),
                         (self.inets_frame_index_check_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'),
                         (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_slide_window_0, 'reload_request'),
                         (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_slide_window_0, 'frame_info_out'),
                         (self.inets_frame_filter_1, 'frame_info_in'))
        self.msg_connect((self.inets_slide_window_0, 'frame_info_out'),
                         (self.inets_timeout_0, 'data_frame_info_in'))
        self.msg_connect((self.inets_timeout_0, 'frame_info_out'),
                         (self.inets_slide_window_0, 'ack_info_in'))