Newer
Older
This repository holds the ns-3 DetNetWiFi simulation framework for wireless/wired deterministic networks:
* 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).
* 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)
* 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.
* 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.
* 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.
* [Documentation](./Documentation). Tutorials on the framework; scientific publications, etc.
- 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).
- 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.
## 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
**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**
For Ubuntu 20.04, please check the steps here: https://karimmd.github.io/post/tutorial/ns3_installation/ to ensure an adequate use of dependencies:
* **Update the Ubuntu Repo and Existing Applications**
* **Install Core Dependencies for Build and Compilation**
_sudo apt install build-essential libsqlite3-dev libboost-all-dev libssl-dev git python3-setuptools castxml_
* **Install Dependencies for NS-3 Python bindings**
_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_
_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_
* **Install Additional Python Packages**
_sudo su
cd
pip3 install kiwi
exit
cd_
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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