Changing DCF’s backoff mechanism in NS-3

Network Simulator 3 (NS3) is a discrete event-based simulator for many types of network technologies. Ranging from CSMA to LTE and SDN networks, you can practically ensamble together many pre-written modules from each technology until you get what you want.

It’s generally thought as a good idea to implement your protocol proposal in this simulator. Not only because it is widely used, but also because many usable models (like channel and queues) are written in usable and understandable C++ code.

In order to build a simulation in NS3, you should setup channel, network devices, MAC protocols, IP addresses and application components in your script. A good idea is just to simply go through the NS3 tutorial. I have to warn you that it is very long, but totally worths it.


Implementing CSMA/ECA

You may find the files that differ from the default NS3 code for Wifi networks in my CSMA/ECA-NS3 repository.

In the following I will try to describe the changes:

1. The deterministic backoff counter is always an even number

Even-though in our proposals the backoff counter is represented by the number of empty slots minus one, for the NS3 implementation to work we must assign an even deterministic backoff.

2. Ack are sent at the highest data rate.

3. Beacons are sent at the lowest rate.

This affects the time between successful transmission metrics.

4. The Schedule Reset mechanism.

We activate the Schedule Reset after one successful transmission. The number of consecutive successful transmissions needed to evaluate the bitmap is defined by the srConservative flag. It is off by default, meaning that the bitmap is evaluated after one successful transmission. Activating the srConservative flag will force the node to evaluate the bitmap after ((CWmax + 1) / 2) / Bd successful transmissions.

As it is expected, the srConservative flag prevents collisions originated by the schedule reduction in a perfect channel.

We also setup the schedule reduction to be a Halving or a Reset of the current schedule. A schedule halving is the one activated by default with Schedule Reset. The flag srResetMode instructs Schedule Reset to reduce the schedule as much as possible on every attempt.

5. Stickiness

The node should keep the deterministic backoff even after stickiness numbers of consecutive collisions. By default this value is set to zero. Furthermore, the dynStick flag (off by default) increases the stickiness of a node that successfully reduces the schedule via Schedule Reset.



1. Combined throughput plot.

The figure below shows the average aggregate throughput of a saturated IEEE 802.11g network, where all nodes are in close range to each other without moving, no RTS/CTS is used.

Other simulation details:

– EIFSnoDIFS = 314 µs

– ackTimeout = 340 µs

– aSlotTime = 20 µs

– SIFS = 10 µs

– DIFS = 50 µs

Fig 1. Throughput

Fig 1. Throughput

As can be seen in Fig. 1, CSMA/ECA with Hysteresis increases the deterministic backoff of the nodes, consequently reducing the overall throughput.

Schedule Reset attempts to leverage this issue. Schedule Halving srConservative is the configuration option that better prevents the throughput reduction, keeping it more or less at the same level for different number of contenders.

2. Failed transmissions

Fig 2. Failed Transmissions

Fig 2. Failed Transmissions

Fig. 2 confirms the observation made in Fig. 1. Schedule Halving srConservative does not trigger new collisions.

As a conclusion we confirm that Schedule Halving srConservative is the default choice for CSMA/ECA in a perfect channel. It can maintain the overall throughput for a great number of contenders without increasing the number of failed transmissions due to collisions.

What’s to come

We are gradually including the other proposed functionality to CSMA/ECA, like channel errors and aggregation through the Fair Share mechanism. And also plan to observe CSMA/ECA behaviour when transmissions are interfered by neighbouring networks.

Posted under: CSMA/CA, CSMA/ECA, Hysteresis, MAC, NS3, WiFi

Tagged as: ,