# (A2) NS-3 Simulation
###### tags:`NS-3` `LTE`
## :notebook_with_decorative_cover: Personal Information
:::info
- Name: Saffana Zyan Dini
- ID : M11102815
:::
## :book: Part I :A2 NS-3 Simulator
### A. Weekly Plan
| Study | 04/10 | 07/10 | 09/10 | 11/10 | 14/10 | 15/10 |
|:-----------------------------------------:|:----------:| ----- |:------:|:-------:|:-------:|:-------:|
|Learn the basic concept of ns-3 |X| X | | | | |
|Install ns-3 | X|X||| | |
|ns-3 configuration | |X|X| | | |
|ns-3 testing | |X| X| | | |
|ns-3 Simulation | |X|X|X| X| X |
|Study Note | | | | |X | X |
|Presentation Video | | | | | | x |
### B. Network Topology
Find 'ns-allinone-3.335/ns-3.35/scr/lte/examples/lena-dual-stipe.cc.' Modified some function and parameter. Give NetAnim Function for display GUI. Move it to Scratch folder.
Run with:
```bash
sudo ./waf --run scratch/lena-dual-stripe.cc
```
this the result:

### C. Studying Note
#### :bookmark: NS-3 Installation
To install NS-3 (Network Simulator 3), you will need to follow a series of steps. NS-3 is typically used for simulating and studying network protocols and network behavior. Here's a basic guide on how to install NS-3:
1. **System Requirements:**
- A Linux-based operating system (e.g., Ubuntu, Fedora, Debian). NS-3 is not officially supported on Windows, but you can use Windows Subsystem for Linux (WSL) or a virtual machine with Linux.
- Python 2.7 or later (Python 3 is recommended).
- Some optional modules might require additional software, such as GCC and other development tools.
2. **Prerequisites:**
You'll need several dependencies for NS-3. Open a terminal and run these commands to install them on your system (commands are for Ubuntu, adapt for your specific distribution):
```bash
sudo apt update
sudo apt install g++ python3 python3-dev python3-setuptools python3-clang python3-pip cmake libc6-dev git
```
3. **Download NS-3:**
You can download the latest version of NS-3 from the official website or use Git to clone the repository. Using Git is recommended because it makes it easier to stay up to date. you can find all version of NS-3 [here](https://www.nsnam.org/releases/ns-3-30/download/). This tutorial use ns-3 3.35
```bash
git clone https://gitlab.com/nsnam/ns-3-allinone.git
```
4. **Build NS-3:**
Change to the directory where you cloned the repository and build NS-3. This may take some time.
```bash
cd ns-3-allinone
./download.py -n ns-3
./build.py
```
5. **Run Tests:**
After the build is complete, you can run a few tests to make sure everything is working properly. The tests can be run using the provided test.py script:
```bash
./test.py -c core
```
6. **Usage:**
NS-3 provides a lot of example scripts to simulate different network scenarios. You can find these examples in the 'ns-3.xx/examples' directory.
7. **Optional Tools:**
You might want to install optional tools like Wireshark and NetAnim to visualize simulation results:
- Wireshark: To view packet traces, you can install Wireshark.
- NetAnim: A GUI-based network animator for NS-3. Follow the installation instructions provided with NetAnim.
That's a basic overview of the installation process for NS-3. Keep in mind that NS-3 is a highly configurable and versatile tool, and you may need to install additional modules or configure it further based on your specific research or simulation needs. Be sure to refer to the official NS-3 documentation for more detailed information on its installation and usage.
8. **Testing Example**
**a. Hello-simulator**
This file has been inside the scratch folder. You just need to run it.
```bash
sudo ./waf --run scratch/hello-simulator.cc
```
Result:

**b. first**
you need to find this file in 'examples/tutorial/first.cc'. Next, you need move it to scratch folder and run it after.
```bash
sudo ./waf --run scratch/first.cc
```
Result:

Run GUI NetAnim
```bash
cd ~/workspace/ns-allinone-3.35/netanim-3.108
./NetAnim
```

### C. Presentation Video
[Presentation Video](https://youtu.be/icHvMZieO10)
## :book: Part II :Demo Video
Demo video: [Run a simulation for LTE Network.](https://youtu.be/Pl2OxG-taGc?si=QDxTsp50HZjii8hS)