How to set EDCA/DCF parameters in NS3?

Having throughput problems in OMNET++, we have to switch to the NS3 as network simulation platform. It  doesn’t have a builtin IDE like OMNET and simulation language is either C++ or python. I prefer C++.

After a long time period of  searching, I’ve managed to set DCF and EDCA parameters (like contention window) for wireless simulations (802.11 networks).  The problem is when you get Dca pointer and try to set CwMin and CwMax values, it doesn’t apply to the all nodes in the network, it has to be setup every device in the network.  For eaxample;

Ptr<NetDevice> dev = node->GetDevice(0);

Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice>(dev);

Ptr<WifiMac> mac = wifi_dev->GetMac();

PointerValue ptr;

mac->GetAttribute(“DcaTxop”, ptr);

Ptr<DcaTxop> dca = ptr.Get<DcaTxop>();

dca->SetMinCw(minCw);

dca->SetMaxCw(maxCw);

//dca->SetAifsn(2);

 

Ptr<EdcaTxopN> edca;

mac->GetAttribute(“VO_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“VI_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“BE_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“BK_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);