how to get the position of a node in sta-wifi-mac

73 views
Skip to first unread message

丁磊

unread,
Apr 23, 2014, 5:02:45 AM4/23/14
to ns-3-...@googlegroups.com
I am working on a research about position based hand-off on wifi (802.11n), so I need to get the position as the trigger to start SendProbeRequest function.
But I have no idea about how to get the position of the MobilityModel of a node in the script.

thank you

ps:sorry for my poor English 

Konstantinos

unread,
Apr 23, 2014, 5:14:29 AM4/23/14
to ns-3-...@googlegroups.com
If you have a smart pointer to the node (or event the node ID) you can do something like this:

Ptr<Node> node; // assume that you have the pointer for the node from other sources
node
= NodeList::GetNode(id); // this only if you know the node_id
Ptr<MobilityModel> mob = node->GetObject<MobilityModel>();
Vector pos = mob->GetPosition();

丁磊

unread,
Apr 23, 2014, 6:54:30 AM4/23/14
to ns-3-...@googlegroups.com
thank you, I know how to get the position now
but my problem is :
when I use NodeContainer.Create(1) to create a node in the script,how to transmit the pointer of this node to a function in mac-layer
in other words,
how can a wifiMac instance know which node (or nodedevice) it is installed on

thanks a lot

在 2014年4月23日星期三UTC+8下午5时14分29秒,Konstantinos写道:

Tommaso Pecorella

unread,
Apr 23, 2014, 4:18:32 PM4/23/14
to ns-3-...@googlegroups.com
Hi,

actually I don't think it can. You should add a pointer to the NetDevice. There isn't one because it's not needed, and it would make it a bit harder to deallocate objects.

Honestly, I'd rather implement the functionality requiring the position in a higher layer (e.g., the NetDevice)

T.
Reply all
Reply to author
Forward
0 new messages