# An Accurate Platform for Investigating TCP Performance in Wi-Fi Networks
## 3 Emulator-Based Approach for Investigating TCP Performance in a Wi-Fi Network
### Emulator Environment  
We wish to combine the merits of a simulator for establishing Wi-Fi networks and the actual implementation of TCP CCAs. We hence select the emulator approach. Our emulator environment leverages the Mininet-WiFi simulator [32], which is a fork of the emulator Mininet, initially invented for research on software-defined networking. Mininet-WiFi extends Mininet by adding virtualized Wi-Fi stations and access points. Compared to other tools such as dummynet or other somewhat real networks, it simplifies network configuration and reduces network construction time. Mininet-WiFi is not only cost effective but also has been proven to reproduce networks with higher overall fidelity than simulations [26]. Because it is natively built on Linux, the emulator environment can use standard Linux utilities. Another essential utility for emulating and controlling the parameters of a wireless channel is Traffic Control (Tc), which can configure the Linux kernel's packet scheduler to control the packet rate, delay, latency, and loss. Tc applies these attributes to the virtual interfaces of the STAs and APs, allowing Mininet-WiFi to faithfully represent the actual packet behavior observed in the real world. We use Mininet-WiFi's APIs to quickly build Wi-Fi networks with different designated IEEE 802.11 versions and numbers of devices in our emulator environment. Since Mininet-WiFi does not provide essential functions such as changing CCAs or measuring networking performance, we have created automatically executed scripts that add these functions. The environment is programmed to cooperate well with a Linux host's CCA. It configures or changes CCAs from the kernel based on the sysctl utility wrapped in a Python script. The entire process from topology creation to communication performance measurement can be automated. Once a few parameters have been set (the time to measure, the chosen CCA, etc. ), RTT, throughput, and fairness can be measured automatically. Detailed descriptions of the performance metrics used in this work are as follows. * _Round-trip time (RTT)_: The RTT represents the time that a sent packet needs to wait for a response from the destination. In this work, RTT values are collected from a pair of Internet Control Message Protocol (ICMP) packets generated by ping. * _Throughput_: The TCP throughput is the rate of transferred traffic per time unit. In our environment, we consider the throughput values reported by iperf [33]. * _Fairness index_: We use Jain's fairness index \(\mathcal{J}\), which is defined as follows: \[\mathcal{J}(x_{1},x_{2},\dots,x_{n})=\frac{(\sum_{i=1}^{n}x_{i})^{2}}{n\sum_{i =1}^{n}x_{i}^{2}},\] (1) where \(x_{i}\) denotes the throughput for the \(i\)th connection. The value ranges from \(\frac{1}{n}\) (worst case) to 1 (best case). In addition, the scripts that we have created can be flexibly configured, for example, to replace iperf with iperf3 or to add a new active queue management mechanism in a specified device. We summarize the execution process of CCA evaluation within our platform in Figure 1. A user can select the evaluated CCAs from the host system. After that, the user can create a Wi-Fi network with the designated networking parameters. Depending on the network and evaluation scenario, the expected results will vary. The single flow evaluation will output throughput and RTT for each CCA. In addition to those outputs, the fairness index is also produced with the multiple flows evaluations. All the steps are wrapped in scripts for automation. We can stop at a specific step for confirmation or debugging. For example, Figure 2a shows a screenshot with the selection of CCA named reno and the creation of a Wi-Fi network. We can check the propagation model, wireless nodes' configuration, and links between different network components. In Figure 2b, the screenshot shows the method to confirm the link connection in the Wi-Fi network with Mininet-WiFi. The scripts keep running until the end of each experiment when the connections are all correct.