Get pointer to Phy from PhyHelper

80 views
Skip to first unread message

Natasha Zlobinsky

unread,
Jul 22, 2020, 3:26:09 PM7/22/20
to ns-3-users
I think this should be a fairly easy thing but I cannot find an answer to it. How can I get a pointer to the Phy associated with a PhyHelper object. Example, I created a YansWifiHelper with Default settings 
YansWifiPhyHelper nodePhyHelper = YansWifiHelper::Default();

Now I want to get to the actual Phy object, before installing it in an device, so that I can set the channel width. Is this possible?
Something like,
 nodePhyHelper.GetPhy()

Alternatively I though it might be possible through the config namepace path, but not sure how. By this I mean something like:
Config::Set("/PhyHelper/DeviceList/*/WifiNetDevice/Phy/WifiPhy/ChannelWidth")

In summary, the question is what is the easiest way to set a channel width for a WifiPhyHelper phy before installing it in a device, or, if it has to be installed first, then how to do it afterwards without having to go through the process of getting the NetDevice and DynamicCasting the pointer of the NetDevice and then getting the Phy from the NetDevice?

Thanks

Tom Henderson

unread,
Jul 22, 2020, 4:32:29 PM7/22/20
to ns-3-...@googlegroups.com, Natasha Zlobinsky
On 7/22/20 12:26 PM, Natasha Zlobinsky wrote:
I think this should be a fairly easy thing but I cannot find an answer to it. How can I get a pointer to the Phy associated with a PhyHelper object. Example, I created a YansWifiHelper with Default settings 
YansWifiPhyHelper nodePhyHelper = YansWifiHelper::Default();

Now I want to get to the actual Phy object, before installing it in an device, so that I can set the channel width. Is this possible?
Something like,
 nodePhyHelper.GetPhy()

This helper (and many in ns-3) make use of object factories to create the underlying objects.  An object factory is a special object that can be configured to create specially tailored objects, so that every time your helper needs to create a new object (WifiPhy in this case), the object factory creates an identical one.

The YansWifiPhyHelper configures the object factory to create objects of type 'ns3::YansWifiPhy'.  The Set() method allows you to configure attributes in advance of installation time, for YansWifiPhy attributes as well as WifiPhy attributes.  Since channel width is an attribute, it can be configured like this:


  nodePhyHelper.Set ("ChannelWidth", UintegerValue (40));

This must be done _before_ Install() is called.


Alternatively I though it might be possible through the config namepace path, but not sure how. By this I mean something like:
Config::Set("/PhyHelper/DeviceList/*/WifiNetDevice/Phy/WifiPhy/ChannelWidth")


This could also be done, but only _after_ install time (the objects have to exist already when Config::Set() is called.

- Tom


In summary, the question is what is the easiest way to set a channel width for a WifiPhyHelper phy before installing it in a device, or, if it has to be installed first, then how to do it afterwards without having to go through the process of getting the NetDevice and DynamicCasting the pointer of the NetDevice and then getting the Phy from the NetDevice?

Thanks
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/52598979-69f8-472a-800f-9e9e60bba280o%40googlegroups.com.


Natasha Zlobinsky

unread,
Jul 23, 2020, 4:41:20 AM7/23/20
to ns-3-users

Thanks for the reply, Tom Henderson! That makes sense. 
The same method doesn't seem to hold for getting parameters, though? I cannot seem to do
nodePhyHelper.Get("ChannelWidth");
or
UintegerValue channelWidth;
nodePhyHelper.GetAttribute("ChannelWidth", channelWidth);

 To get the channel width, is there a more direct way than through the NetDevice, getting the Phy pointer from there and then doing ->GetChannelWidth()?

Thanks in advance.

Natasha Zlobinsky

unread,
Aug 3, 2020, 3:02:19 AM8/3/20
to ns-3-users
Hi

I am still looking for an answer to this of what is the quickest way to get channel parameters (ChannelNumber and ChannelWidth) from a WifiPhyHelper? I cannot seem to get it directly using .Get(...) or .GetAttribute(...)

Please assist....

On Wednesday, July 22, 2020 at 9:26:09 PM UTC+2, Natasha Zlobinsky wrote:
Reply all
Reply to author
Forward
0 new messages