Skip to content

Commit

Permalink
Adjust wifi threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
petya2164 committed Sep 4, 2019
1 parent 6d4b5c7 commit a0d14d1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 47 deletions.
5 changes: 5 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ detailed list of every change, see the Git log.
Latest
------
* tbd
* Minor: Upgrade to the ns-3.30 release
* Major: Use the --destdir option to specify the target installation folder
for the examples (e.g. ``~/ns-3-dev/examples/kodo``).
Consequently, the --ns3_path option was removed.
* Major: Upgrade to kodo-rlnc 15

2.0.0
-----
Expand Down
44 changes: 20 additions & 24 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ Our aim is to make the examples compatible with the latest ns-3 revision.
If you experience any issues with the latest revision, then you can switch
to the latest stable release (this step is **optional**)::

git checkout ns-3.29
git checkout ns-3.30

Our build system automatically tests the examples with the latest supported
revision of ns-3. This revision is specified in our buildbot.py_ script.

.. _buildbot.py: https://github.com/steinwurf/kodo-ns3-examples/blob/master/buildbot.py#L74
.. _buildbot.py: https://github.com/steinwurf/kodo-ns3-examples/blob/master/buildbot.py#L73

Configure the ns-3 project (it is important to also enable the examples)::

Expand Down Expand Up @@ -128,17 +128,13 @@ The ``waf configure`` command ensures that all dependencies are downloaded
(by default, waf will create a folder called ``bundle_dependencies`` to
store these libraries).

You must have **a valid Steinwurf license** to download the ``fifi`` and
``kodo`` dependencies, otherwise you will get a git error when you execute
the configure command!

Now we build the kodo-rlnc static library and we install the examples and all
the required files to the ``~/ns-3-dev/examples/kodo`` folder::

python waf build install --ns3_path="~/ns-3-dev"
python waf build install --destdir="~/ns-3-dev/examples/kodo"

The ``--ns3_path`` option is used to specify your ns-3 folder (you can change
this if your ns-3 is located elsewhere).
The ``--destdir`` option is used to specify the target folder (you can change
the ``kodo`` subfolder name to something else if you like).

Building the Kodo examples in ns-3
----------------------------------
Expand Down Expand Up @@ -182,19 +178,22 @@ and how many transmissions were required.

Adding your own simulation
--------------------------

At this point, you might want to add your own simulation that uses kodo.
It is recommended to create a new program by copying one of the kodo examples.
The examples are installed in ``~/ns-3-dev/examples/kodo``, so we will go to
that folder and make a copy ``kodo-wifi-broadcast.cc`` to create a new
simulation called ``my-simulation.cc`` (you can choose any name here)::

cd ~/ns-3-dev/examples/kodo
cp kodo-wifi-broadcast.cc my-simulation.cc
It is recommended to create a separate folder (e.g.
``~/ns-3-dev/examples/my-simulation``) for your custom simulation and copy all
the necessary files from ``~/ns-3-dev/examples/kodo`` (most importantly the
``include`` and ``lib`` folders).

To build an executable from the ``my-simulation.cc`` source file, we have to
define a new program in ``~/ns-3-dev/examples/kodo/wscript``.
Open this file in your text editor, and add the following lines at the end
(be careful with the indentation since this is a Python script)::
If you copy the wscript file, then please delete or comment out the parts where
we call ``bld.create_ns3_program``. We cannot have multiple programs with
the same name (e.g. ``kodo-recoders``).

When you create a new program, you can start by copying one of the kodo examples.
If you have a source file called ``my-simulation.cc``, then you can
define a new program in ``~/ns-3-dev/examples/my-simulation/wscript``.
like this::

obj = bld.create_ns3_program('my-simulation',
['core', 'applications', 'point-to-point',
Expand All @@ -220,13 +219,10 @@ these in the wscript like this::
**Warning:** If you install the kodo ns-3 examples again with this command::

cd ~/kodo-ns3-examples
python waf build install --ns3_path="~/ns-3-dev"
python waf build install --destdir="~/ns-3-dev/examples/kodo"

then the example source files and the wscript will be overwritten in
the ``~/ns-3-dev/examples/kodo`` folder, so it is recommended to create a
backup if you modified any of these files.

You can also create a separate folder for your custom simulation to avoid this
problem. For example, you can create the ``~/ns-3-dev/examples/my-simulation``
folder and copy the ``include`` and ``lib`` folders from
``~/ns-3-dev/examples/kodo``.

8 changes: 4 additions & 4 deletions examples/kodo-wifi-broadcast-object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ int main (int argc, char *argv[])
{
//! [4]
std::string phyMode ("DsssRate1Mbps");
// The default loss values yield 50% random packet loss
// The default loss values aim for about 50% random packet loss
// A different loss rate can be achieved by moving the lower and upper limits
// relative to the detection threshold (T=117.0206).
double minLoss = 117.0206 - 10.0; // dBm
double maxLoss = 117.0206 + 10.0; // dBm
// relative to the detection threshold (T=98).
double minLoss = 98.0 - 40.0; // dBm
double maxLoss = 98.0 + 40.0; // dBm
uint32_t packetSize = 1000; // bytes
double interval = 0.2; // seconds
uint32_t generationSize = 20;
Expand Down
29 changes: 10 additions & 19 deletions examples/kodo-wifi-broadcast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,16 @@
// UniformRandomVariable that can be configured with the minLoss/maxLoss
// parameters. Note that changing the position of the nodes has no effect.
//
// When setting a loss value, you need to consider the relevant values of the
// physical layer implementation. These are listed in the "Detailed Description"
// section here: https://www.nsnam.org/doxygen/classns3_1_1_wifi_phy.html
//
// EnergyDetectionThreshold: -101 dBm
// TxPowerStart/TxPowerEnd: 16.0206 dBm
//
// The TxPower starts at 16.0206 dBm and the transmission can be successfully
// received if the signal strength stays above the -101 dBm the threshold.
// If we apply 117.0206 dBm signal loss, then we reach that threshold. If
// a lower signal loss value is set, then all transmissions will be received.
// But with a higher value, all packets will be dropped. We use a random
// variable that covers a range around this threshold to simulate a randomized
// loss pattern.
// When setting a loss value, you need to consider the cutoff point is around
// the 98 dBm. If the loss gets higher than this threshold, then the packet
// will be dropped. We use a random variable that covers a range around this
// threshold to simulate a randomized loss pattern. Note that this value
// can change in future versions of ns-3.
//
// You can lower the effective packet loss rate by decreasing the minLoss
// parameter of the simulation:
//
// python waf --run kodo-wifi-broadcast --command-template="%s --minLoss=90"
// python waf --run kodo-wifi-broadcast --command-template="%s --minLoss=30"
//! [2]

#include <iostream>
Expand All @@ -114,11 +105,11 @@ int main (int argc, char *argv[])
{
//! [4]
std::string phyMode ("DsssRate1Mbps");
// The default loss values yield 50% random packet loss
// The default loss values aim for about 50% random packet loss
// A different loss rate can be achieved by moving the lower and upper limits
// relative to the detection threshold (T=117.0206).
double minLoss = 117.0206 - 10.0; // dBm
double maxLoss = 117.0206 + 10.0; // dBm
// relative to the detection threshold (T=98).
double minLoss = 98.0 - 40.0; // dBm
double maxLoss = 98.0 + 40.0; // dBm
uint32_t packetSize = 1000; // bytes
double interval = 1.0; // seconds
uint32_t generationSize = 5;
Expand Down

0 comments on commit a0d14d1

Please sign in to comment.