Changes between Initial Version and Version 1 of 802.11/wlan_exp/examples


Ignore:
Timestamp:
Feb 11, 2014, 2:53:38 PM (10 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/examples

    v1 v1  
     1{{{#!comment
     2[[Include(wiki:802.11/beta-note)]]
     3}}}
     4
     5[[TracNav(802.11/TOC)]]
     6
     7= 802.11 Reference Design: Experiment Examples =
     8
     9== AP-to-STA Throughput ==
     10
     11This example uses two WARP v3 nodes running the 802.11 Reference Design. One node is configured as an AP, the other as a station. The station node is associates with the AP at boot.
     12
     13This script uses the txrx_stats data in the reference design to calculate through in a unidirectional flow. The AP generates a fully backlogged flow of packets addressed to the station. The station counts how many bytes it has received from the AP. The Python script polls the station twice over a period of 10 seconds, recording the txrx_stats reports before and after. It then computes the number of new bytes received and the time span between reports. The script uses the timestamps reported by the node in the txrx_stats report to calculate the time span. This removes any dependence on the PC-nodes link in computing the denominator for the throughput calculation.
     14
     15{{{#!python
     16#Initialize the 802.11 WARP nodes
     17# Update the serial numbers below for your local nodes
     18nodes = wlan_exp_util.wlan_exp_init_nodes(['W3-a-00001', 'W3-a-00002'])
     19
     20#Find the AP node
     21n_ap = [n for n in nodes if n.node_type == NT_AP][0]
     22
     23#Find the STA node
     24n_sta = [n for n in nodes if n.node_type == NT_STA][0]
     25
     26#Start a flow from the AP's local traffic generator (LTG) to the STA
     27# Set the flow to fully backlogged with 1400 byte payloads
     28n_ap.config_ltg(n_sta, LTG_CBR(1400, 0))
     29
     30#Experiment parameters - trial time and PHY rates to test
     31TRIAL_TIME = 10
     32rates = (R6, R9, R12, R18)
     33
     34#Result arrays (filled in by the loop below)
     35rx_bytes = []
     36rx_time_spans = []
     37
     38for ii,rate in enumerate(rates):
     39  #Configure the AP's Tx rate for the selected station
     40  n_ap.set_tx_rate(n_sta, rate)
     41
     42  #Record the station's initial Tx/Rx stats
     43  rx_stats_start = n_sta.get_txrx_stats(n_ap)
     44
     45  time.sleep(TRIAL_TIME)
     46
     47  #Record the station's final Tx/Rx stats
     48  rx_stats_end = n_sta.get_txrx_stats(n_ap)
     49
     50  #Compute the number of new bytes received and the time span
     51  rx_bytes[ii] = rx_stats_end['rx_bytes'] - rx_stats_start['rx_bytes']
     52  rx_time_spans[ii] = rx_stats_end['timestamp'] - rx_stats_start['timestamp']
     53
     54#Calculate and display the throughput results
     55for ii in len(num_rx[ii]):
     56  #Timestamps are in microseconds; bits/usec == Mbits/sec
     57  xput = (rx_bytes[ii] * 8) / rx_time_spans[ii]
     58  print("Rate = %2.1f Mbps   Throughput = %2.1 Mbps", (rates[ii], xput))
     59
     60}}}
     61
     62----