Using different CWmin in different AdhocWifiMac stations

1,536 views
Skip to first unread message

Jaume

unread,
Jun 4, 2010, 6:37:12 AM6/4/10
to ns-3-users
Hi,
I'm still trying to find the way of using different CWmin in different
AdhocWifiMac stations. I use the example
wifi-hidden-terminal and I insert the line

Config::Set ("/NodeList/0/DeviceList/0/Mac/Dcf/MinCw", UintegerValue
(15));

since there is an attribute called MinCw in Dcf.

http://pastebin.com/dH1K59C2

It doesn't work and I guess that the path is not correct. I tryed to
set the MinCw for station 0 to several different values and I always
obtain the same output from the program.

I tryed to find the right path using ConfigStore. Unfortunately, the
path to MinCw does not appear in the config.txt file.

http://pastebin.com/Lqrt4vPX

Any advice? Thanks in advance.

Jaume

Chris Facchini

unread,
Jun 11, 2010, 12:55:24 PM6/11/10
to ns-3-users
Hi Jaume,



> I'm still trying to find the way of using different CWmin in different

> AdhocWifiMac stations.



I am, as well, struggling to set the contention window, but, alas, in
vain.

Here I report my experience, and hope it can shed some light on the
Attribute system.



> I use the example

> wifi-hidden-terminal and I insert the line

>

>   Config::Set ("/NodeList/0/DeviceList/0/Mac/Dcf/MinCw", UintegerValue

> (15));

>

> since there is an attribute called MinCw in Dcf.



Actually, the Dcf class is more of an interface (as contains all pure
virtual methods).

So, you want to see what classes, if any, inherit from the Dcf class.
Trying

egrep -nRIe 'public.*Dcf' src/

shows that there are:

./src/devices/wifi/edca-txop-n.h:72:class EdcaTxopN : public Dcf

./src/devices/wifi/dca-txop.h:66:class DcaTxop : public Dcf

(among other irrelevant matches)



Based on the type of standard you want to simulate (.11e or !.11e) you
pick one of those classes.

Now, to trace the contention window you can add a TraceSource (let's
assume you name it 'Cw') in the *dca-txop.cc file, under the GetTypeId
method and, using a path similar to the following one:

"/NodeList/0/DeviceList/0/Mac/DcaTxop/Cw"

you should be able to track your variable.



To get back on topic (about setting and not about tracing the
variable), much to my surprise, I couldn't find a way to use any of
the Setters defined in the Dcf class.

I also tried to explicitly specify the attribute (under the
DcaTxop::GetTypeId method) but nothing happened.



Turning on the 'Config' LogComponent, I got the following:

0s -1 Config:ParsePath(/NodeList/0/DeviceList/0/Mac/DcaTxop/MinCw, /
NodeList/0/DeviceList/0/Mac/DcaTxop, MinCw)

0s -1 Config:LookupMatches(/NodeList/0/DeviceList/0/Mac/DcaTxop)

0s -1 Config:DoResolve(/NodeList/0/DeviceList/0/Mac/DcaTxop/,
0x80883f0)

0s -1 GetAttribute(vector)=NodeList on path=/

0s -1 Array 0 matches 0

0s -1 Config:DoResolve(/DeviceList/0/Mac/DcaTxop/, 0x80883a8)

0s -1 GetAttribute(vector)=DeviceList on path=/NodeList/0/

0s -1 Array 0 matches 0

0s -1 Config:DoResolve(/Mac/DcaTxop/, 0x80ab868)

0s -1 GetAttribute(ptr)=Mac on path=/NodeList/0/DeviceList/0/

0s -1 Config:DoResolve(/DcaTxop/, 0x80ab988)

0s -1 GetAttribute(ptr)=DcaTxop on path=/NodeList/0/DeviceList/0/Mac/

0s -1 Config:DoResolve(/, 0x80abf18)

0s -1 resolved=/NodeList/0/DeviceList/0/Mac/DcaTxop/

0s -1 Array 1 does not match 0

0s -1 Array 2 does not match 0

0s -1 Array 3 does not match 0

0s -1 Array 4 does not match 0

0s -1 Config:DoResolve(/NodeList/0/DeviceList/0/Mac/DcaTxop/,
0x80ab2e0)

0s -1 Requested item=NodeList does not exist on path=/

0s -1 Config:DoResolve(/NodeList/0/DeviceList/0/Mac/DcaTxop/, 0)



As far as I understand, the simulator is able to climb up to the
'DcaTxop' object, and then it silently fails.



What puzzles me more is the fact that I can reach a TraceSource but
not an Attribute, even though both are defined in the same class.



Any suggestion on what could be the next move is most welcome. :)

Cheers,

Chris

Tom Henderson

unread,
Jun 13, 2010, 9:41:01 AM6/13/10
to ns-3-...@googlegroups.com
On 6/11/10 9:55 AM, Chris Facchini wrote:
> Hi Jaume,
>
>
>
>> I'm still trying to find the way of using different CWmin in different
>
>> AdhocWifiMac stations.

I was able to reproduce this (but not fix it) and I filed bug 941 on it.

The software structure for DcaTxop is not typical (inherits from Dcf and
also has a private copy of a Dcf in m_dcf); am not sure whether that
contributes to the problem.

- Tom

Jaume

unread,
Jun 14, 2010, 5:16:51 AM6/14/10
to ns-3-users
Thanks for your help guys :)

Chris Facchini

unread,
Jun 30, 2010, 4:15:20 PM6/30/10
to ns-3-users
Hey guys! Little update.

On Jun 14, 11:16 am, Jaume wrote:
> Thanks for your help guys :)
>
> > >> I'm still trying to find the way of using different CWmin in different

I've messed a little with the code and, it turned out, the CWmin can
actually be set.

Try this:
1) Add the following lines to src/devices/wifi/dca-txop.cc, in the
GetTypeId method:
.AddAttribute ("CwMin",
"Sets the minimum contention window.",
UintegerValue (),
MakeUintegerAccessor (&DcaTxop::SetMinCw),
MakeUintegerChecker<uint32_t> ())

The SetMinCw function is already defined some lines below.

2) In your simulation script, connect to the Attribute using this
instruction:
Config::Set ("/NodeList/0/DeviceList/0/Mac/DcaTxop/CwMin",
UintegerValue (1000));

3) Also, turn on DcaTxop logging:
LogComponentEnable ("DcaTxop", LOG_LEVEL_ALL);

By running your script, you should see something like this:
01 0s -1 DcaTxop:DcaTxop(0x116baa0)
02 0s -1 DcaTxop:SetMinCw(0x116baa0, 0)
03 0s -1 DcaTxop:SetLow(0x116baa0, 0x116b490)
04 0s -1 [mac=00:00:00:00:00:00] DcaTxop:SetManager(0x116baa0,
0x116b820)
05 0s -1 [mac=00:00:00:00:00:01] DcaTxop:SetMinCw(0x116baa0, 31)
06 ...
07 0s -1 [mac=00:00:00:00:00:01] DcaTxop:SetMinCw(0x116baa0, 1000)

Some notes:
In 02 MinCw is set to 0 because there no default value has been
provided in the .AddAttribute.
In 05 MinCw is set to 31, as specified in nqsta-wifi-mac.cc:681:
case WIFI_PHY_STANDARD_80211b:
ConfigureDcf (m_dca, 31, 1023, AC_BE_NQOS);
In 07 MinCw is set to the value specified in the simulation script.

> On Jun 13, 3:41 pm, Tom Henderson wrote:
> > I was able to reproduce this (but not fix it) and I filed bug 941 on it.
>
> > The software structure for DcaTxop is not typical (inherits from Dcf and
> > also has a private copy of a Dcf in m_dcf); am not sure whether that
> > contributes to the problem.

I've tested this procedure with ns-3-dev (rev f7e1f9dfa08d) and,
apparently, it works.
I think we got the path wrong in the first place.
In fact, it occurred to me I went through something similar several
months ago:
http://groups.google.com/group/ns-3-users/browse_thread/thread/a78581b39082cb25/fa5caa230c80335f

By the way, what is the rationale to follow in order to get the
correct path?

Cheers,
Chris

Jaume

unread,
Jul 1, 2010, 4:54:36 AM7/1/10
to ns-3-users

M.E.A.SMATI

unread,
Sep 24, 2012, 11:26:18 AM9/24/12
to ns-3-...@googlegroups.com
hi,

i'd like to set the cwmax and cwmin to zero for a group of node (cheaters), 7 for max and 3 for min for the others (honest one).

i tried the following code:

Ptr<DcaTxop> m_beacoDca2 = CreateObject<DcaTxop> ();
  m_beacoDca2->SetMinCw (0);
  m_beacoDca2->SetMaxCw (0);
  m_beacoDca2->SetAifsn (0);

but the it results that they both talk like normal case !
so i tried what you have said but ive got this with the same results !!!
 
DcaTxop:DcaTxop(0x89f1f00)
DcaTxop:SetMinCw(0x89f1f00, 0)
DcaTxop:SetMaxCw(0x89f1f00, 0)
DcaTxop:SetMinCw(0x89f1f00, 15)
DcaTxop:SetMaxCw(0x89f1f00, 1023)
DcaTxop:SetAifsn(0x89f1f00, 2)
DcaTxop:SetLow(0x89f1f00, 0x89f1a80)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x89f1f00, 0x89f1c80)
[mac=00:00:00:00:00:06] DcaTxop:SetMinCw(0x89f1f00, 15)
[mac=00:00:00:00:00:06] DcaTxop:SetMaxCw(0x89f1f00, 1023)
[mac=00:00:00:00:00:06] DcaTxop:SetAifsn(0x89f1f00, 2)
[mac=00:00:00:00:00:06] DcaTxop:SetWifiRemoteStationManager(0x89f1f00, 0x89f1da8)
DcaTxop:DcaTxop(0x89f3390)
DcaTxop:SetMinCw(0x89f3390, 0)
DcaTxop:SetMaxCw(0x89f3390, 0)
DcaTxop:SetMinCw(0x89f3390, 15)
DcaTxop:SetMaxCw(0x89f3390, 1023)
DcaTxop:SetAifsn(0x89f3390, 2)
DcaTxop:SetLow(0x89f3390, 0x89f3098)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x89f3390, 0x89f32c0)
[mac=00:00:00:00:00:07] DcaTxop:SetMinCw(0x89f3390, 15)
[mac=00:00:00:00:00:07] DcaTxop:SetMaxCw(0x89f3390, 1023)
[mac=00:00:00:00:00:07] DcaTxop:SetAifsn(0x89f3390, 2)
[mac=00:00:00:00:00:07] DcaTxop:SetWifiRemoteStationManager(0x89f3390, 0x89f2f10)
DcaTxop:DcaTxop(0x89f48d0)
DcaTxop:SetMinCw(0x89f48d0, 0)
DcaTxop:SetMaxCw(0x89f48d0, 0)
DcaTxop:SetMinCw(0x89f48d0, 15)
DcaTxop:SetMaxCw(0x89f48d0, 1023)
DcaTxop:SetAifsn(0x89f48d0, 2)
DcaTxop:SetLow(0x89f48d0, 0x89f45d8)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x89f48d0, 0x89f4800)
[mac=00:00:00:00:00:08] DcaTxop:SetMinCw(0x89f48d0, 15)
[mac=00:00:00:00:00:08] DcaTxop:SetMaxCw(0x89f48d0, 1023)
[mac=00:00:00:00:00:08] DcaTxop:SetAifsn(0x89f48d0, 2)
[mac=00:00:00:00:00:08] DcaTxop:SetWifiRemoteStationManager(0x89f48d0, 0x89f4450)
DcaTxop:DcaTxop(0x89f5e18)
DcaTxop:SetMinCw(0x89f5e18, 0)
DcaTxop:SetMaxCw(0x89f5e18, 0)
DcaTxop:SetMinCw(0x89f5e18, 15)
DcaTxop:SetMaxCw(0x89f5e18, 1023)
DcaTxop:SetAifsn(0x89f5e18, 2)
DcaTxop:SetLow(0x89f5e18, 0x89f5b20)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x89f5e18, 0x89f5d48)
[mac=00:00:00:00:00:09] DcaTxop:SetMinCw(0x89f5e18, 15)
[mac=00:00:00:00:00:09] DcaTxop:SetMaxCw(0x89f5e18, 1023)
[mac=00:00:00:00:00:09] DcaTxop:SetAifsn(0x89f5e18, 2)
[mac=00:00:00:00:00:09] DcaTxop:SetWifiRemoteStationManager(0x89f5e18, 0x89f5998)
DcaTxop:DcaTxop(0x89f7378)
DcaTxop:SetMinCw(0x89f7378, 0)
DcaTxop:SetMaxCw(0x89f7378, 0)
DcaTxop:SetMinCw(0x89f7378, 15)
DcaTxop:SetMaxCw(0x89f7378, 1023)
DcaTxop:SetAifsn(0x89f7378, 2)
DcaTxop:SetLow(0x89f7378, 0x89f7080)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x89f7378, 0x89f72a8)
[mac=00:00:00:00:00:0a] DcaTxop:SetMinCw(0x89f7378, 15)
[mac=00:00:00:00:00:0a] DcaTxop:SetMaxCw(0x89f7378, 1023)
[mac=00:00:00:00:00:0a] DcaTxop:SetAifsn(0x89f7378, 2)
[mac=00:00:00:00:00:0a] DcaTxop:SetWifiRemoteStationManager(0x89f7378, 0x89f6ef8)
[mac=00:00:00:00:00:01] DcaTxop:DoDispose(0x89eb130)
DcaTxop:~DcaTxop(0x89eb130)
[mac=00:00:00:00:00:02] DcaTxop:DoDispose(0x89ec950)
DcaTxop:~DcaTxop(0x89ec950)
[mac=00:00:00:00:00:03] DcaTxop:DoDispose(0x89ede40)
DcaTxop:~DcaTxop(0x89ede40)
[mac=00:00:00:00:00:04] DcaTxop:DoDispose(0x89ef390)
DcaTxop:~DcaTxop(0x89ef390)
[mac=00:00:00:00:00:05] DcaTxop:DoDispose(0x89f08d0)
DcaTxop:~DcaTxop(0x89f08d0)
[mac=00:00:00:00:00:06] DcaTxop:DoDispose(0x89f1f00)
DcaTxop:~DcaTxop(0x89f1f00)
[mac=00:00:00:00:00:07] DcaTxop:DoDispose(0x89f3390)
DcaTxop:~DcaTxop(0x89f3390)
[mac=00:00:00:00:00:08] DcaTxop:DoDispose(0x89f48d0)
DcaTxop:~DcaTxop(0x89f48d0)
[mac=00:00:00:00:00:09] DcaTxop:DoDispose(0x89f5e18)
DcaTxop:~DcaTxop(0x89f5e18)
[mac=00:00:00:00:00:0a] DcaTxop:DoDispose(0x89f7378)
DcaTxop:~DcaTxop(0x89f7378)

Thanks!

M.E.A.SMATI

unread,
Sep 25, 2012, 8:13:44 AM9/25/12
to ns-3-...@googlegroups.com
hi,

now i get

DcaTxop:DcaTxop(0x8be5f08)
DcaTxop:SetMinCw(0x8be5f08, 0)
DcaTxop:SetMinCw(0x8be5f08, 0)
DcaTxop:SetMaxCw(0x8be5f08, 0)
DcaTxop:SetAifsn(0x8be5f08, 0)
DcaTxop:SetLow(0x8be5f08, 0x8be5c38)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0x8be5f08, 0x8be5e38)
[mac=00:00:00:00:00:04] DcaTxop:SetMinCw(0x8be5f08, 15)
[mac=00:00:00:00:00:04] DcaTxop:SetMaxCw(0x8be5f08, 1023)
[mac=00:00:00:00:00:04] DcaTxop:SetAifsn(0x8be5f08, 2)
[mac=00:00:00:00:00:04] DcaTxop:SetWifiRemoteStationManager(0x8be5f08, 0x8be5ae0)
[mac=00:00:00:00:00:01] DcaTxop:DoDispose(0x8be1b88)
DcaTxop:~DcaTxop(0x8be1b88)
[mac=00:00:00:00:00:02] DcaTxop:DoDispose(0x8be30e8)
DcaTxop:~DcaTxop(0x8be30e8)
[mac=00:00:00:00:00:03] DcaTxop:DoDispose(0x8be4900)
DcaTxop:~DcaTxop(0x8be4900)
[mac=00:00:00:00:00:04] DcaTxop:DoDispose(0x8be5f08)
DcaTxop:~DcaTxop(0x8be5f08)

i don't understand, setting the values to zero is forbidden or i screwed somewhere ?

thanks.

邹若奇

unread,
Jan 3, 2013, 1:19:30 AM1/3/13
to ns-3-...@googlegroups.com
I got the same result with you. It seems no change after I set the value of CW. Can anybody help please?

在 2012年9月25日星期二UTC+9下午9时13分44秒,M.E.A.SMATI写道:

lazy cat

unread,
Jan 3, 2013, 1:22:22 AM1/3/13
to ns-3-...@googlegroups.com
by the way, the initial value of cwmin is 0,then changed into 15, at last. the value of cwmin becomes 31. why there is 15 between initial 0 and 802.11b's 31.


在 2013年1月3日星期四UTC+9下午3时19分30秒,邹若奇写道:

lazy cat

unread,
Jan 3, 2013, 1:07:46 PM1/3/13
to ns-3-...@googlegroups.com
I am sorry, it works. The method definitely works well. but different version of ns3 may have different namespace. Thank you a lot.


在 2013年1月3日星期四UTC+9下午3时22分22秒,lazy cat写道:

Zoraze Ali

unread,
Feb 27, 2013, 10:52:03 AM2/27/13
to ns-3-...@googlegroups.com
Hello Everyone,

I am using the same method to configure the Contention Window in wireless adhoc network and i am using ns 3.16 . But my values are been over ride every time with default values . Please help me in this regard... below is the log from DcaTxop..

DcaTxop:DcaTxop(0xe4c0a0)
DcaTxop:SetMinCw(0xe4c0a0, 0)
DcaTxop:SetMinCw(0xe4c0a0, 15)
DcaTxop:SetMaxCw(0xe4c0a0, 1023)
DcaTxop:SetAifsn(0xe4c0a0, 2)
DcaTxop:SetMinCw(0xe4c0a0, 5)      // these are my values
DcaTxop:SetMaxCw(0xe4c0a0, 25)   // these are my values
DcaTxop:DcaTxop(0xe4cb40)
DcaTxop:SetMinCw(0xe4cb40, 0)
DcaTxop:SetMinCw(0xe4cb40, 15)
DcaTxop:SetMaxCw(0xe4cb40, 1023)
DcaTxop:SetAifsn(0xe4cb40, 2)
DcaTxop:SetLow(0xe4cb40, 0xe4c700)
[mac=00:00:00:00:00:00] DcaTxop:SetManager(0xe4cb40, 0xe4ca20)
[mac=00:00:00:00:00:01] DcaTxop:SetMinCw(0xe4cb40, 15)
[mac=00:00:00:00:00:01] DcaTxop:SetMaxCw(0xe4cb40, 1023)
[mac=00:00:00:00:00:01] DcaTxop:SetAifsn(0xe4cb40, 2)
[mac=00:00:00:00:00:01] DcaTxop:SetWifiRemoteStationManager(0xe4cb40, 0xe4c3a0)

Regards,
zoraze

MEJRI Mohamed Nidhal

unread,
Jul 14, 2013, 8:48:34 AM7/14/13
to ns-3-...@googlegroups.com
I am using the same method to configure the Contention Window (MinCw and MaxCw)for some of my nodes in wireless adhoc network and i am using ns 3.17 . But my values are been over ride every time with default values . Please help me in this regard. I have the same log as Zoraze Ali. If someone have a working code please help me thank you.

Fadhil Firyaguna

unread,
Mar 20, 2014, 10:17:44 AM3/20/14
to ns-3-...@googlegroups.com
I have the same problem above. I am using ns-3.16. The values are been over ride every time too. Is there a solution yet?

Thank you

poornima ks

unread,
Jul 5, 2014, 6:44:45 AM7/5/14
to ns-3-...@googlegroups.com
Hi,

I have been trying to find out the number of "missed cts" and i added a custom trace to dcatxop. Could someone post the trace path for dcatxop?
Thanks,
Poornima
Reply all
Reply to author
Forward
0 new messages