CSMA/ECA in NS-3: super short tutorial

In this tutorial I will provide a short example on how to use CSMA/ECA methods in the EdcaTxopN and DcfManager NS-3 classes.

Changing the settings will provide different configurations of CSMA/ECA.

Setting a deterministic backoff after a successful transmissions (Basic CSMA/ECA)

In order to implement Basic CSMA/ECA, you must call DcfManager methods. You generally do this by getting the current manager with a smart pointer. For instance:

Ptr<DcfManager> manager = someNodeContainer.Get(i)->GetDevice (someDeviceId)->GetObject<WifiNetDevice> ()->GetMac ()->GetObject<RegularWifiMac> ()->GetDcfManager ();

Now that you have a reference to the Dcfmanager (manager from hereon) you are able to call methods from it to setup different configurations of CSMA/ECA.

DcfManager::SetEnvironmentForECA

This method receives:

  1. bool hysteresis: nodes do not reset CW_cur <- CW_min after a successful transmission.
  2. bool scheduleReset: whether of not the Schedule Reset is going to be used.
  3. uint32_t stickiness: the default stickiness value (see previous articles to know what stickiness refers to.)
  4. bool dynStick: whether dynamic stickiness is used or not with Schedule Reset.

So, in the end, the following configurations will provide these CSMA/ECA configurations:

  • Basic CSMA/ECA: manager->SetEnvironmentForECA (false, false, 1, false);
  • CSMA/ECA with Hysteresis: manager->SetEnvironmentForECA (true, false, 1, false);
  • CSMA/ECA with Hysteresis and Schedule Reset with Dynamic Stickiness: manager->SetEnvironmentForECA (true, true, 1, true);

Adding AMPDU aggregation with Fair Share

In order to use Schedule Reset or frame aggregation, it is imperative that you use the 802.11n standard or newer. You can configure it using the WifiHelper. Additionally, you should also configure the maximum AMPDU size. All of this setup is shown in the example provided by NS-3 documentation at ns3/examples/wireless/simple-ampdu-aggregation.cc.

We should activate Fair Share both in the EdcaTxopN and DcfManager classes. To get a smart pointer to EdcaTxopN:

Ptr<EdcaTxopN> edca = someNodeContainer.Get(i)->GetDevice (someDeviceId)->GetObject<WifiNetDevice> ()->GetMac ()->GetObject<RegularWifiMac> ()->GetBEQueue ();

Notice that we are actually pointing to the Best-effort (BE) Access Category (AC). So QoS must be disabled in order to try single queue CSMA/ECA. Multiple queue CSMA/ECA has not been tested with NS-3.

Then:

if (ECA && FairShare)
{
    edca->ResetStats ();
    edca->SetFairShare ();
    manager->SetAmpduSimulation ();
}

NOTE: you may try to do AMSDU aggregation as well as AMPDU aggregation. What changes with the calling of the aforementioned methods is the level of aggregation performed. That is, following Fair Share.

What files?

Because only EdcaTxopN and DcfManager classes are involved in the configuration of CSMA/ECA, you should simple download the correspondent files from the CSMA/ECA-NS3 repository (these classes are located in the src/wifi/mode/ directory).

Posted under: CSMA/ECA, Fair Share, Hysteresis, NS3, WiFi

Leave a Reply