How to change MaxDalay at WifiMacQueue

700 views
Skip to first unread message

David Taylor

unread,
Mar 31, 2011, 12:41:11 PM3/31/11
to ns-3-users
I want to change it's value, but I can't find how to access
WifiMacQueue... So far I have tried:
- using Config::Set() to access it via attribute system - but I guess
I am not using the correct context.
- accessing it via a pointer - I just can't find how to get a pointer
to it.

Anybody can help?

David Taylor

unread,
Mar 31, 2011, 12:41:12 PM3/31/11
to ns-3-users

Ruben Merz

unread,
Apr 1, 2011, 8:50:19 AM4/1/11
to ns-3-...@googlegroups.com, David Taylor
This is what I use (but for MaxPacketNumber):

_Right after_ wifiMac.SetType, I do

Config::SetDefault("ns3::WifiMacQueue::MaxPacketNumber", UintegerValue
(20));

R

--
Ruben Merz Deutsche Telekom Laboratories
http://www.net.t-labs.tu-berlin.de/people/ruben_merz.shtml

David Taylor

unread,
Apr 1, 2011, 5:10:10 PM4/1/11
to ns-3-users
Doesn't that change MaxPacketNumber for ALL WifiMacQueue's? What if u
want to change MaxPacketNumber (or MaxDelay) for a specific
WifiMacQueue... What is the context for a specific WifiMacQueue?

Ruben Merz

unread,
Apr 2, 2011, 7:20:56 AM4/2/11
to ns-3-...@googlegroups.com, David Taylor, Nicola Baldo

On 4/1/11 11:10 PM, David Taylor wrote:
> Doesn't that change MaxPacketNumber for ALL WifiMacQueue's? What if u

Yes, you're right.

For a single queue, I have never tried with Config::Set(), but I did it
with the pointers with ns-3.9 (and with a catch). Now, for ns-3.10, you
probably want to do something like:

From your simulation, get the NetDevice, cast it to WifiNetDevice.
Then, with the WifiNetDevice pointer, do a GetMac() to get the
RegularWifiMac (maybe a cast is necessary), and finally, get the DcaTxop
object and a pointer to the queue and appropriate functions (but a patch
is needed and again, the patch is specific to MaxPacketNumber).

Unless, I'm mistaken, there is no other way. No I wonder whether you
cannot access WifiMacQueue through the Config system because the DcaTxop
object is protected in RegularWifiMac. I'm cc'ing Nicola to double check.

Here is the patch:

diff --git a/src/devices/wifi/dca-txop.cc b/src/devices/wifi/dca-txop.cc
--- a/src/devices/wifi/dca-txop.cc
+++ b/src/devices/wifi/dca-txop.cc
@@ -229,12 +229,6 @@
StartAccessIfNeeded ();
}

-uint32_t
-DcaTxop::GetWifiMacQueueSize(void)
-{
- return m_queue->GetSize();
-}
-
bool
DcaTxop::WifiMacQueueIsFull (void)
{
diff --git a/src/devices/wifi/dca-txop.h b/src/devices/wifi/dca-txop.h
--- a/src/devices/wifi/dca-txop.h
+++ b/src/devices/wifi/dca-txop.h
@@ -106,10 +106,7 @@
* can be sent safely.
*/
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
- /*
- * \brief return the current size of the internal queue
- */
- uint32_t GetWifiMacQueueSize(void);
+
/**
* Verify whether the MacQueue is full.
* \return 1 if full, 0 otherwise.
diff --git a/src/devices/wifi/regular-wifi-mac.h
b/src/devices/wifi/regular-wifi-mac.h
--- a/src/devices/wifi/regular-wifi-mac.h
+++ b/src/devices/wifi/regular-wifi-mac.h
@@ -205,9 +205,6 @@
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
virtual Time GetCompressedBlockAckTimeout (void) const;

- /** Accessor for the DCF object */
- Ptr<DcaTxop> GetDcaTxop (void) const;
-
protected:
virtual void DoStart ();
virtual void DoDispose ();
@@ -328,6 +325,8 @@
*/
void SetupEdcaQueue (enum AcIndex ac);

+ /** Accessor for the DCF object */
+ Ptr<DcaTxop> GetDcaTxop (void) const;
/** Accessor for the AC_VO channel access function */
Ptr<EdcaTxopN> GetVOQueue (void) const;
/** Accessor for the AC_VI channel access function */

Ruben Merz

unread,
Apr 2, 2011, 7:36:14 AM4/2/11
to ns-3-...@googlegroups.com, David Taylor, Nicola Baldo
Regarding my comment on Config::Set(), have you tried the following

/NodeList/0/DeviceList/0/RegularWifiMac/DcaTxop/WifiMacQueue ?

R

David Taylor

unread,
Apr 2, 2011, 8:10:20 AM4/2/11
to ns-3-users
Doesn't work.

Ruben Merz

unread,
Apr 2, 2011, 8:21:34 AM4/2/11
to ns-3-...@googlegroups.com, David Taylor
Can you try

/NodeList/0/DeviceList/0/Mac/RegularWifiMac/DcaTxop/WifiMacQueue

and/or

/NodeList/0/DeviceList/0/WifiNetDevice/Mac/RegularWifiMac/DcaTxop/WifiMacQueue
?

(I'm looking at how the DcaTxop attributes are accessed in
http://www.nsnam.org/doxygen-release/classns3_1_1_dca_txop.html)

Ah, and this resource might also be helpful:
http://www.nsnam.org/wiki/index.php/HOWTO_determine_the_path_of_an_attribute_or_trace_source

Btw, if you get it to work, please post your solution back! So that we
can document it somewhere

R

David Taylor

unread,
Apr 3, 2011, 5:44:50 AM4/3/11
to ns-3-users
Still doesn't work... From the link u gave it seems like it shouldn't
work anyway, since WifiMacQueue is never aggregated... (I might be
wrong - that's my current understanding).

On Apr 2, 3:21 pm, Ruben Merz <ru...@net.t-labs.tu-berlin.de> wrote:
> Can you try
>
> /NodeList/0/DeviceList/0/Mac/RegularWifiMac/DcaTxop/WifiMacQueue
>
> and/or
>
> /NodeList/0/DeviceList/0/WifiNetDevice/Mac/RegularWifiMac/DcaTxop/WifiMacQu eue
> ?
>
> (I'm looking at how the DcaTxop attributes are accessed inhttp://www.nsnam.org/doxygen-release/classns3_1_1_dca_txop.html)
>
> Ah, and this resource might also be helpful:http://www.nsnam.org/wiki/index.php/HOWTO_determine_the_path_of_an_at...

Ruben Merz

unread,
Apr 3, 2011, 8:41:57 AM4/3/11
to ns-3-...@googlegroups.com, David Taylor

On 4/3/11 11:44 AM, David Taylor wrote:
> Still doesn't work... From the link u gave it seems like it shouldn't
> work anyway, since WifiMacQueue is never aggregated... (I might be
> wrong - that's my current understanding).

Grmmbll. I think I anyway found why it is not working: ns3::DcaTxop has
no WifiMacQueue attribute.

However, ns3::WifiNetDevice has a Mac attribute and ns3::RegularWifiMac
has a DcaTxop attribute (you can check it by running your program with
--PrintAttributes=ns3::WifiNetDevice).

Now, as I said above, if you look at dca-txop.cc, you'll see there is no
WifiMacQueue attribute. However, if I am not mistaken, WifiMacQueue is
aggregated:

DcaTxop::DcaTxop ()
: m_manager (0),
m_currentPacket (0)
{
NS_LOG_FUNCTION (this);
m_transmissionListener = new DcaTxop::TransmissionListener (this);
m_dcf = new DcaTxop::Dcf (this);
m_queue = CreateObject<WifiMacQueue> ();
m_rng = new RealRandomStream ();
m_txMiddle = new MacTxMiddle ();
}

And see also
http://www.nsnam.org/docs/manual/html/object-model.html#aggregation-example
for reference purpose.

Hence, can you try (sorry, again) the two earlier path with
$ns3::WifiMacQueue ?

If that does not work, we will file a bug to resolve it. It should not
be that complicated (or undocumented) to access WifiMacQueue attributes
for Wifi.

Thanks

Ruben Merz

unread,
Apr 3, 2011, 10:21:36 AM4/3/11
to ns-3-...@googlegroups.com, David Taylor

On 4/3/11 2:41 PM, Ruben Merz wrote:
>
>
> On 4/3/11 11:44 AM, David Taylor wrote:
>> Still doesn't work... From the link u gave it seems like it shouldn't
>> work anyway, since WifiMacQueue is never aggregated... (I might be
>> wrong - that's my current understanding).
>
> Grmmbll. I think I anyway found why it is not working: ns3::DcaTxop has
> no WifiMacQueue attribute.
>
> However, ns3::WifiNetDevice has a Mac attribute and ns3::RegularWifiMac
> has a DcaTxop attribute (you can check it by running your program with
> --PrintAttributes=ns3::WifiNetDevice).
>
> Now, as I said above, if you look at dca-txop.cc, you'll see there is no
> WifiMacQueue attribute. However, if I am not mistaken, WifiMacQueue is
> aggregated:

I'm tired, WifiMacQueue is not aggregated (no call to
AggregateObject()). So yes, won't work.

See http://www.nsnam.org/bugzilla/show_bug.cgi?id=1090

Do you care to write a patch?

R

Nicola Baldo

unread,
Apr 3, 2011, 1:21:43 PM4/3/11
to ns-3-users
I just posted a proposed patch on bugzilla:

http://www.nsnam.org/bugzilla/show_bug.cgi?id=1090

let's continue the discussion there.

Regards,

Nicola

Ruben Merz

unread,
Apr 7, 2011, 4:51:44 AM4/7/11
to ns-3-...@googlegroups.com, Nicola Baldo, david.tay...@gmail.com
David, did you try the patch? Is it solving the problem?

R

David Taylor

unread,
Apr 14, 2011, 9:04:37 AM4/14/11
to ns-3-users
Sorry for the late reply (been on vacation). The patch works just
fine. I can access MaxDelay via the attribute system now. Thanks!

Ruben Merz

unread,
Apr 14, 2011, 10:32:41 AM4/14/11
to ns-3-...@googlegroups.com, David Taylor
Ah! Excellent, nice to hear. Now that it works, would mind documenting
how you do it? Ideally, a short HOWTO here:
http://www.nsnam.org/wiki/index.php/HOWTOs

Or,at least, please post some example code (I can use it for a HOWTO
afterwards).

Thanks,
Best,
Ruben

David Taylor

unread,
Apr 14, 2011, 11:52:34 AM4/14/11
to ns-3-users
Config::Set("/$ns3::NodeListPriv/NodeList/0/$ns3::Node/DeviceList/
0/$ns3::WifiNetDevice/Mac/$ns3::AdhocWifiMac/DcaTxop/$ns3::DcaTxop/
Queue/$ns3::WifiMacQueue/MaxDelay", TimeValue(Seconds(...)));
Reply all
Reply to author
Forward
0 new messages