---
# System prepended metadata

title: Assignment 2 Study Notes
tags: [Wireless Communications (ET6207) Study Notes]

---

## :pencil: [**Assignment 2 Study Notes**](#-Wireless-Communications-Study-Notes)
###### tags: `Wireless Communications (ET6207) Study Notes`
:8ball: The objective of this assignment is to learn the basic concept of the NS-3 simulator. It includes how to install and configure NS-3, simulate the LTE network based on our defined and generated network topology, and run the 5G NR by using NS-3.

:8ball: In these study notes, there are three major parts, as follows:



- :male-teacher: [**Learn the Basic Concept of NS-3**](#-Learn-the-Basic-Concept-of-NS-3)

    :inbox_tray: [**How to Install NS-3**](#-How-to-Install-NS-3)
    
    :desktop_computer: [**Basic Concepts of LTE Network and 5G NR Simulations**](#-Basic-Concepts-of-LTE-Network-and-5G-NR-Simulations)
    
     

 

## **:lower_left_crayon:  Notes**
#### :male-teacher:  **Learn the Basic Concept of NS-3**
:::info
:pencil2: **NS-3**, or **Network Simulator 3**, is an open-source discrete-event network simulation framework that is widely used for research and development in the field of computer networking. It provides a platform for simulating and analyzing the behavior of computer networks, protocols, and communication systems. Here are some basic concepts and key features of NS-3:

:8ball: **Simulation Environment:**  NS-3 provides a simulation environment where users can define and simulate various network scenarios. These scenarios can range from simple point-to-point links to complex, large-scale network topologies.

:8ball: **Modularity:** NS-3 is designed with a modular architecture, allowing users to extend and customize the simulation by adding their own modules or using existing ones. This modularity makes it flexible and adaptable for a wide range of networking research.

:8ball: **C++ Core:** NS-3 is primarily implemented in C++. This makes it efficient and provides users with low-level control over network components, making it suitable for in-depth research and protocol development.

:8ball: **Scripting:** While the core of NS-3 is written in C++, it also provides a Python binding (PyNS3) that allows users to write simulation scripts in Python. This makes it more accessible to researchers who are not as comfortable with C++.

:8ball: **Networking Models:** NS-3 supports various networking models, including packet-level models and flow-level models. Users can simulate various aspects of networking, such as routing, congestion control, and error modeling.

:8ball: **Protocol Stacks:** NS-3 includes implementations of various networking protocol stacks, including IPv4, IPv6, TCP, UDP, and more. Researchers can use these implementations or create custom protocols for their experiments.

:8ball: **Realistic Simulation:** NS-3 aims to provide realistic network simulations by modeling various network parameters, such as link delays, bandwidth, and error rates. It also supports mobility models for simulating wireless networks.

:8ball: **Visualization:** NS-3 includes tools for visualizing simulation results, making it easier for researchers to analyze and understand the behavior of their simulated networks.

:8ball: **Community and Documentation:** NS-3 has an active user and developer community, which means that users can find support, tutorials, and documentation to help them get started and troubleshoot issues.

:8ball: **Application Scenarios:** NS-3 can be used to simulate a wide range of networking scenarios, including wired and wireless networks, sensor networks, ad-hoc networks, Internet of Things (IoT) applications, and more.

:dart: Generally, NS-3 is a powerful and versatile tool for network researchers and developers who want to study and experiment with various aspects of computer networking. Its modularity, extensibility, and realism make it a valuable resource for understanding and improving network protocols and technologies.

:::

#### **:inbox_tray: How to Install NS-3**
:::success
 
:pencil2: Installing NS-3 can be a bit complex due to its requirements and dependencies, but I'll provide you with a step-by-step guide to install NS-3 on a Linux-based system. NS-3 is primarily designed for Linux, and the following steps assume we're using a Linux distribution such as Ubuntu or CentOS. 
:pencil2: If we're using Windows, we can install a Linux distribution like Ubuntu on a virtual machine or use the Windows Subsystem for Linux (WSL) to follow these steps.


:8ball: **Update Our System:** 
* Open a terminal and ensure our system is up to date by running the following commands:
   ![](https://hackmd.io/_uploads/r1tnEMeWa.png)

:8ball: **Install Prerequisites:** 
* NS-3 has several prerequisites that need to be installed. These include build tools, libraries, and Python. Run the following command to install the necessary packages:
   ![](https://hackmd.io/_uploads/SkuOLMl-a.png)
   
:8ball: **Download NS-3:** 
* Clone the NS-3 source code repository from GitHub using Git:
![](https://hackmd.io/_uploads/HJI7DGlZT.png)
This will create a directory named '**ns-3**' containing the NS-3 source code.

:8ball: **Configure NS-3:** 
* Navigate to the '**ns-3**' directory:
    ![](https://hackmd.io/_uploads/H1X1dfl-p.png)
* Configure NS-3 with our desired options. For example, to enable Python bindings and use the optimized build mode, we can run:
![](https://hackmd.io/_uploads/rJA8OMx-6.png)
Adjust the configuration options as needed for our specific use case.

:8ball: **Build NS-3:** 
* Once configured, build NS-3 using the following command:
![](https://hackmd.io/_uploads/SyyPtfgW6.png)
This command will take some time to compile the NS-3 modules and examples.

:8ball: **Test Our Installation (Optional):** 
* We can run some tests to verify that NS-3 has been installed correctly:
![](https://hackmd.io/_uploads/r1vZcMe-p.png)

:8ball: **Install Additional Python Packages (Optional):**
* Depending on our NS-3 simulations, we might need to install additional Python packages. Commonly used packages include matplotlib for data visualization and numpy for numerical computations:
![](https://hackmd.io/_uploads/HyqRqfebp.png)

:8ball: **Set Environment Variables (Optional):**
* To make NS-3 commands and scripts easily accessible, we can add the NS-3 build directory to our PATH and set some environment variables. Add the following lines to our shell profile file (e.g., '**~/.bashrc**' or '**~/.zshrc**'):
![](https://hackmd.io/_uploads/H1z6oMx-T.png)
Replace '**/path/to/ns-3**' with the actual path to our NS-3 installation.

:8ball: **Reload Our Shell:**
* After modifying our shell profile, reload it to apply the changes:
![](https://hackmd.io/_uploads/H1pu2zlb6.png)

:8ball: **Start Using NS-3:**
* We can now start using NS-3 by running simulation scripts and examples. We'll typically write our own simulation scripts or use existing ones to perform network simulations.
* That's it! We should now have NS-3 successfully installed on our Linux system, and we can begin using it for network simulations and research. Please note that NS-3 is a powerful tool with a learning curve, so we may want to refer to the [**NS-3 documentation**](https://intronetworks.cs.luc.edu/current/html/ns3.html) and [**tutorials**](https://www.nsnam.org/docs/tutorial/html/) to get started with creating and running network simulations.

:::
 
#### **:desktop_computer: Basic Concepts of LTE Network and 5G NR Simulations**
:::warning
:pencil2: **LTE** (Long-Term Evolution) and **5G NR** (5G New Radio) are two generations of cellular wireless technology. Simulating LTE and 5G NR networks is essential for testing and optimizing network performance, developing new protocols, and evaluating various deployment scenarios. Here are some basic concepts related to simulating LTE and 5G NR networks:

:8ball: **Cellular Network Architecture:**

- **<font color="green">eNodeB (eNB):</font>**
    - In LTE, eNodeB is the base station or cell tower responsible for managing radio communication with **User Equipment** (UE). In 5G NR, it's replaced by gNB (gNodeB).
- **<font color="green">User Equipment (UE):</font>** 
    - UEs are the mobile devices, such as smartphones and tablets, that connect to the cellular network.
- **<font color="green">Core Network (EPC in LTE, 5GC in 5G):</font>** 
    - The core network handles functions like authentication, mobility management, and data routing. In LTE, it's referred to as the **Evolved Packet Core** (EPC), while in 5G, it's the **5G Core** (5GC).

:8ball: **Simulation Components:**

- **<font color="green">Propagation Models:</font>** 
    - Simulations use propagation models to calculate how radio waves travel between the eNodeB/gNB and UE. Common models include **free-space**, **path loss**, and **log-normal shadowing**.
- **<font color="green">Channel Models:</font>** 
    - These models simulate the effects of fading, interference, and multipath propagation on the wireless channel. Examples include **Rayleigh fading** and **Rician fading models**.
- **<font color="green">Mobility Models:</font>**
    -  For realistic simulations, mobility models define how UEs move within the network, including **speed**, **direction**, and **patterns**.
- **<font color="green">Traffic Models:</font>**
    -  These models define the type and volume of traffic in the network, such as **voice**, **video**, or **data traffic**.

:8ball: **Protocol Stacks:**

- **<font color="green">LTE Protocol Stack:</font>**
    -  The LTE protocol stack consists of several layers, including the **physical layer**, **MAC layer**, **RLC** (Radio Link Control) **layer**, **PDCP** (Packet Data Convergence Protocol) **layer**, and the **application layer**.
- **<font color="green">5G NR Protocol Stack:</font>** 
    - The 5G NR protocol stack is similar to LTE but includes additional features for **enhanced mobile broadband**, **massive machine-type communication**, and **ultra-reliable low-latency communication**.

:8ball: **Simulation Tools:**

- **<font color="green">NS-3:</font>**
    -  As mentioned earlier, NS-3 is a popular open-source network simulator that can be used to simulate both LTE and 5G NR networks. Researchers can use NS-3 to create custom network scenarios and evaluate their performance.
- **<font color="green">MATLAB/Simulink:</font>**
    -  MATLAB and Simulink offer simulation capabilities for wireless networks, including LTE and 5G. MATLAB is often used for **algorithm development**, while Simulink allows for **visual modeling** and **simulation**.
- **<font color="green">Commercial Simulators:</font>**
    -  Several commercial simulators, like **Keysight ADS**, **Rohde** & **Schwarz WinProp**, and **Ansys HFSS**, offer advanced capabilities for simulating cellular networks, including LTE and 5G.

:8ball: **Metrics and Analysis:**

- **<font color="green">Key Performance Indicators (KPIs):</font>** 
    - Simulations measure various KPIs, such as **throughput**, **latency**, **packet loss**, and **network coverage**, to evaluate the performance of LTE and 5G networks.
- **<font color="green">QoS (Quality of Service):</font>**
    -  Simulations assess the QoS metrics to determine how well the network meets user expectations, especially for real-time services like **voice** and **video**.

:8ball: **Use Cases:**

- **<font color="green">LTE Simulations:</font>**
    -  LTE simulations are often used to **optimize network parameters**, **study handover procedures**, **assess interference management techniques**, and **evaluate the impact of mobility on network performance**.
- **<font color="green">5G NR Simulations:</font>**
    -  5G NR simulations are used to investigate the capabilities of 5G networks, such as **massive MIMO**, **beamforming**, **network slicing**, and **low-latency communication**. They are also crucial for planning and deployment of 5G networks.

 
:dart: Generally, simulating LTE and 5G NR networks is an essential step in the development and deployment of these technologies, allowing researchers and engineers to understand their performance under various conditions and scenarios. It helps in optimizing network configurations, improving QoS, and ensuring that cellular networks meet the growing demands of users and emerging applications.


:::success
:8ball: <font color="BLUE">**Basic LTE Simulation Program (without EPC)**</font>

![](https://hackmd.io/_uploads/SkIpy8lba.png)
![](https://hackmd.io/_uploads/HJgSeIx-6.png)
:::

:::danger
[:back: Please click here to go back to the home page of Wireless Communications Study Notes](https://hackmd.io/@Estif/HyBBwaa03).
:::