# MS Project #1
- **Authors**: Wiktor Tekiela, Jakub Tutka, Mateusz Zięba
- **Script**: wifi-rate-adaptation-distance.cc
## 1. Problem analysis
- **Analyze the code by reading and running it.**
- There was an error:
**msg="Attribute name=ChannelWidth is not settable for this object: tid=ns3::YansWifiPhy", +0.000000000s -1 file=/home/jakub/ns3-tutorial/ns-allinone-3.37/ns-3.37/src/core/model/object-base.cc, line=270**
- Fix: Another way to set ChannelWidth for PHY object.
- Delete:
```cpp
// Set channel width
Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth",UintegerValue(chWidth));
```
- Add (for 5GHz frequency band):
```cpp
std::string channelStr("{0, " + std::to_string(chWidth) + ", BAND_5GHZ, 0}");
wifiPhy.Set("ChannelSettings", StringValue(channelStr));
```
- **Explain the goal of the simulation**
- The simulation goal is to show how rate-adaptive WiFi algorithms (eg. Minstrel) behave.
- **Provide a high-level overview of the network topology**
- Default topology includes two Nodes: one AP at (0,0,0) and one STA at (5,0,0).
- By default, STA is configured to make 100 steps (1 step = 1 m) along the x-axis every second of the simulation.
- Each of the Nodes is equipped with one NetDevice and Application.
- The AP generates constant bitrate UDP traffic, with the STA being the traffic sink (DL transmission).

## 2. System model
- **What are the simulation settings (e.g., fixed parameter values)?**
- Number of AP nodes [1]
- Number of STA nodes [1]
- Number of applications [1x UDP Client at AP, 1x UDP Server on STA]
- Lenght of packets [1420 B]
- Data rate [400 Mbps]
- Max AMPDU Size for Best Effort [65535 B]
- Channel Width [20 MHz]
- RTS/CTS Treshold [65535 B]
- Short Guard Interval (only in IEEE 802.11n) [False]
- **What are the simulation inputs?**
- STA/AP PRC Manager [default MinstrelHt]
- Wi-Fi Standard [default 802.11n 5GHz]
- Steps / Steps time / Steps size [default 100 / 1 s / 1 m]
- Position of AP / STA [default AP at (0,0), STA at (5,0)]
- **What are the simulation outputs?**
- Average throughput depending on distance
- **What simplifications are used in the simulation?**
- The STA moves only in one dimension (AdvancePosition() function).
- There is no applied fading model.
- No inter-channel interferences.
- Unidirectional transmission
## 3. Discrete event simulation
- **Identify a discrete networking event related to the goal of the model. Recall that handling an event usually generates a new event which is inserted into the future event list (FEL). Present a sequence of five such events (where handling one creates a new event, scheduled after some period).**
- In our scenario, a unique event is AdvancedPosition(), which is generated recursively every steps time value. It makes it possible to change the position of STA, it also calculates throughput depending on the current distance, which makes it possible to show how the selected rate-adaptive algorithm works.
- **Compare the real time used to perform the simulation (with the Linux time command) with the simulated time. Create a plot showing the real time used for simulating.**

## 4. Simulation parameters
- **What was the chosen simulation time? Why?**
- The simulation time was set to 60% of the initial simulation time, since for the MCS=11 the data rate past the 60th meter (or second due to the translation of steps to distance) drops to zero.
- **How many independent simulation runs did you perform? Why?**
Q: we are thinking about totaling the number of runs to 10.
- **What warm-up time did you use? Why?**
- We used only one warmup time = 0.5s because application connects with network in that interval and it is ready to work.
- **Which values were measured? Why?**
- Throughput, to test how rate-adaptive WiFi rate control Ministrel behave.
## 5. Output results
- **Present selected results along with a proper statistical analysis.**
Statistical analysis TBD
## 6. Conclusions