Skip to content
Snippets Groups Projects
README.md 8.84 KiB
Newer Older
Rute C. Sofia's avatar
Rute C. Sofia committed
 1. DetNetWiFi-ns3 framework overview
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
This repository holds the ns-3 DetNetWiFi simulation framework for wireless/wired deterministic networks:
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
The framework holds the following components:
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* Modelling of TSN endpoints and TSN enabled switches interconnected to TSN WLAN regions. Multiple TSN end-points interconnected to 2 TSN-enabled switches; a switch interconnects to a TSN WLAN region. See TSNWiFi example. On the wired part, integrates a Time-aware Shaper based on the [code of Krummacker et al](https://www.researchgate.net/profile/Dennis-Krummacker/publication/348431501_TSN_Simulation_Time-Aware_Shaper_implemented_in_ns-3/links/5ffec2c0299bf140888ff7cd/TSN-Simulation-Time-Aware-Shaper-implemented-in-ns-3.pdf).
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* TWT-based time-aware scheduling as described in ([Documentation, Proposal for Time Aware Scheduling](https://git.fortiss.org/iiot_external/detnetwifi-ns3/-/blob/main/Documentation/IEEENOMS_TSNWiFi_Schneider_Sofia_Kovatsch.pdf). See also the  [Youtube video](https://www.youtube.com/watch?v=J2Hy3X61ts8)
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* Timing Model providing support for Clocks per node. This block provides individual node clocks, to model synchronisation aspects. On the wired region, each node can therefore synchronise its own local clock to the IEEE 1588 Grandmaster clock residing on one of the switches. Each of the wireless nodes also contains a local clock.
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* Fine Time Measurement protocol based synchronisation, as  [Documentation, Fine time Measurement protocol based synchronization](https://git.fortiss.org/iiot_external/detnetwifi-ns3/-/blob/main/Documentation/TSNWiFi_TimeSync-7.pdf). The framework holds the FTM-PTP synchronisation proposal developed in the context of the fortiss project TSNWiFi. The FTM code (synchronisation) has been adapted from the TU Berlin FTM code for localization, available here: https://github.com/tkn-tub/wifi-ftm-ns3. 
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* Examples: Examples are available under [ns-3.34/scratch/](https://git.fortiss.org/iiot_external/detnetwifi-ns3/-/tree/main/ns-3.34/scratch). [TSNWiFi.cc](https://git.fortiss.org/iiot_external/detnetwifi-ns3/-/tree/main/ns-3.34/scratch/TSNWifi) holds an example with 1 TSN wired region interconnected to 1 WTSN region. [DetNetWiFi.cc](hhttps://git.fortiss.org/iiot_external/detnetwifi-ns3/-/tree/main/ns-3.34/scratch/DetNetWifi_Scenario1) holds an example for OBSS WTSN regions.
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* [Documentation](./Documentation). Tutorials on the framework; scientific publications, etc.
Rute C. Sofia's avatar
Rute C. Sofia committed
# 2. How to Install
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
- If you want to use iPerf to model traffic, or any other use space command, then you need ns-3 DCE (Direct code execution). DCE requires Ubuntu 18.04 (does not run yet in Ubuntu 20 https://www.google.com/search?client=firefox-b-d&q=ns%2F3+DCE).
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
- Installing ns-3 DCE is OPTIONAL and not covered in our exmaples; in TSNWiFi.cc you have some commented code to understand how to run iPerf.
Rute C. Sofia's avatar
Rute C. Sofia committed
## 2.1 Install ns-3.34 (MANDATORY) and ns-3-DCE (OPTIONAL)
The instructions to install ns-3 and ns-3-DCE are derived from: https://www.nsnam.org/docs/dce/manual/html/getting-started.html. We rely on bake, a new tool in ns. See https://www.nsnam.org/wiki/Installation#Installation_with_Bake
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
**NOTE: DCE is only required if you want to use iPerf, and that requires that you use Ubuntu 18.04. Our code DOES NOT require DCE! You can use any traffic generator you want, including ns-3 traffic models. The current DCE version is 1.11 and can only be used in Ubuntu versions up to 18.04; DCE version 1.12 is expected to run in Ubuntu 20.04 in 2022. Info: https://github.com/direct-code-execution/ns-3-dce/wiki/Roadmap**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
For Ubuntu 20.04, please check the steps here: https://karimmd.github.io/post/tutorial/ns3_installation/ to ensure an adequate use of dependencies:
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* **Update the Ubuntu Repo and Existing Applications**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
_sudo apt update
sudo apt -y upgrade_
Rute C. Sofia's avatar
Rute C. Sofia committed
* **Install Core Dependencies for Build and Compilation**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
_sudo apt install build-essential libsqlite3-dev libboost-all-dev libssl-dev git python3-setuptools castxml_
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* **Install Dependencies for NS-3 Python bindings**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
_sudo apt install gir1.2-goocanvas-2.0 gir1.2-gtk-3.0 libgirepository1.0-dev python3-dev python3-gi python3-gi-cairo python3-pip python3-pygraphviz python3-pygccxml_
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* **Install Dependencies for NS-3**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
_sudo apt install g++ pkg-config sqlite3 qt5-default mercurial ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gdb valgrind uncrustify doxygen graphviz imagemagick python3-sphinx dia tcpdump libxml2 libxml2-dev cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake_
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
* **Install Additional Python Packages**
_sudo su 
cd
pip3 install kiwi
exit
cd_
Rute C. Sofia's avatar
Rute C. Sofia committed
* **Download and Install NS-3 and NetAnim**
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
git clone https://gitlab.com/nsnam/bake
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
export BAKE_HOME=`pwd`
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
export PATH=$PATH:$BAKE_HOME:$BAKE_HOME/build/bin
Rute C. Sofia's avatar
Rute C. Sofia committed

Rute C. Sofia's avatar
Rute C. Sofia committed
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME:$BAKE_HOME/build/lib

**In bake:**

./bake.py configure -e ns-3.34

./bake.py check

This will download the selected modules, all their dependencies and build ns-3 with all these independent modules. You can also perform this installation step by step, i.e. by calling download and build in different steps. 

./bake.py download

./bake.py deploy

After these steps you have ns-3 ready to run. You can check different tutorials here. https://www.nsnam.org/wiki/Installation#Validating

**IF you want to use iPerf, then install dce. OPTIONAL**

**For versions of Ubuntu up to 18.04:**

./bake.py configure -e dce-ns3-1.11

./bake.py download

./bake.py deploy

**For Ubuntu 20.04, install dce-dev (https://www.nsnam.org/wiki/GSoC2018_DCE_Upgrade#Install_Direct_Code_Execution)**

https://ns-3-dce-gsoc-2018.github.io/

Dependencies:

apt get install bison

apt get install flex



## 2.2 Copy our repository

git clone https://git.fortiss.org/iiot_external/detnetwifi-ns3.git


- Move to ns-3.34 folder
- Type        ./waf configure --cxx-standard=-std=c++17 in command window
- Then,  type ./waf build 
- It is recommended to update the g++ compiler version to 8 or above before installation


## 2.3 OPTIONAL: Install and Test iPerf with ns-3 (Requires Ubuntu 18.04 and ns-3 DCE)
- iPerf can be used to model traffic accordingly to the TSN Traffic profiles are provided in deliverable D2.1 (https://sharepoint.fortiss.org/projects/detnetwifi/Shared%20Documents/Deliverables/D2.1/DetNetWiFi_DeliverableD2.1.pdf?d=w069686d7410c480bb1acf3840d1a57e0)

- run first the example for iPerf in ns-3-dce:

cd source/ns-3-dce

./waf --run dce-iperf 

OR

./waf --run iperf-example

- we have tested iPerf 3 (v3.1), with the following add-ons:

I. https://github.com/RichardWithnell/iperf/tree/dce
Added compatibility with DCE

II. https://github.com/woody77/iperf/tree/pacing_timer
Added pacing functionality

I. is the main repository, copy only "pacing" functionality from II. 

File changes:
* cjson.c
* iperf_api.c
* iperf_api.h
* iperf.h
* iperf_util.c
* iperf_udp.c
* iperf_tcp.c
* iperf_locale.c

Note: 
* Search for "pacing" in II and add all the required code to I.
* WIP: Parallel streams, function only with 1 stream now.

./configure CFLAGS="-g -U_FORTIFY_SOURCE -fPIC" LDFLAGS="-pie -rdynamic" --with-pic --disable-shared --disable-static --without-openssl

make 

# 3. Run the ns-3 DetNetWiFi Examples
We provide an example, the DetNetWiFiScenario1 example, which is based on the modelling of the DetNetWiFi demonstrator. Currently the model considers 1 TSN wired region and 2 OBSSs.

For ns-3 logging, etc., check https://www.nsnam.org/docs/release/3.7/tutorial/tutorial_21.html

## 3.1 TSNWiFi.cc
- The TSNWiFi example, available in [scratch/TSNWiFi](https://git.fortiss.org/iiot/detnetwifi-ns3/-/tree/main/ns-3.34/scratch/TSNWifi), provides a basic TSN wired/wireless scenario interconnecting 1 wired TSN region with 1 WTSN region.

cd <yourpath>/ns3-34/

export NS_LOG=UdpEchoClientApplication=level_all

./waf --run scratch/TSNWiFi/TSNWifi.cc

## 3.2 DetNetWiFi.cc
- The DetNetWiFi_Scenario1.cc example, available in [scratch/DetNetWifi_Scenario1](https://git.fortiss.org/iiot/detnetwifi-ns3/-/tree/main/ns-3.34/scratch/DetNetWifi_Scenario1), provides an OBSS scenario with 2 APs (2 BSSs) and multiple STAs.

cd <yourpath>/ns3-34/

./waf --run DetNetWifi_Scenario1

# 4. Creating a new Example Scenario

On your local repository, Call your Scenario DetNetWiFi_Scenariox.cc

* create a folder under ns-3.34/scratch/DetNetWiFi_Scenariox/
* ensure adequate commenting and authoring in accordance with the fortiss IIOT rules (check the internal wiki)
* Check .gitignore on the folder scratch, and ensure your directory is visible!



# Credits
* Overall code check-up: Rute C. Sofia, Sugandh Huthanahally Mohan
* Time synchronisation aspects, FTM, time model: Sugandh Huthanally Mohan
* Initial Scheduling, TAS integration, TWT aspects: Chitiphat Chongaroonngamsaeng
* Frame preemption validation: Chitiphat Chongaroonngamsaeng
* Multi-AP co-OFDMA coordination: Ahmed Ansari, Manel Khelifi
* Multi-AP adaptive scheduling aspects: Chitiphat Chongaroonngamsaeng, Sugandh Huthanahally Mohan, Ahmed Ansari
Rute C. Sofia's avatar
Rute C. Sofia committed