how to trigger SendAssociationRequest by the position of a node ?

70 views
Skip to first unread message

丁磊

unread,
Mar 12, 2015, 5:55:37 AM3/12/15
to ns-3-...@googlegroups.com
I am working on a research about position based hand-off on wifi system, but I am trouble in how to trigger SendAssociationRequest by the position of a node.

For example, my node is configure with ns3::ConstantVelocityMobilityModel and the channel is configure with LogDistancePropagationLossModel. So I can calculate the position where mobile station should send  AssociationRequest to the next AP.

I use an extern Ptr<Node> to transmit the node into sta-wifi-mac.cc.

however, I do not know how to test the position periodic, the normal SendAssociationRequest is triggered in receive function and I want to trigger it out of it.

sorry for my poor english, my problem is:

1. how to test postition periodicly

2. how to trigger SendAssociationRequest out of receive function

thanks a lot 

Konstantinos

unread,
Mar 12, 2015, 6:11:08 AM3/12/15
to ns-3-...@googlegroups.com
Hi,

1) You can use the Simulator::Schedule() or a Timer to periodically call a method. In that method you can check the position of a node and compare it with your HO threshold position. There are several examples of such usage mainly to send periodic traffic, but the principle is the same.

2) The SendAssociationRequest is a private method of the STA MAC. So first of all you need a pointer to that MAC instance which can be easily obtained from the node pointer and second you need to think a little the process required to send the request, i.e. you can use the Simulator::Schedule calling the AssocRequestTimeout

丁磊

unread,
Mar 12, 2015, 8:08:20 PM3/12/15
to ns-3-...@googlegroups.com
hi, Konstantinos~

thanks a lot for your help
I am not good at coding,  I found the examples you said but I have a little bit more question:
I should realize the Simulator::Schedule() in my script or add a new function into class StaWifiMac ?
I don't know the difference.

在 2015年3月12日星期四 UTC+8下午6:11:08,Konstantinos写道:

Konstantinos

unread,
Mar 13, 2015, 4:29:06 AM3/13/15
to ns-3-...@googlegroups.com
Hi 

You could implement the "mobility monitor" function within the MAC class, that would solve the problems of calling private methods.
If you do it in your script, you still would need to modify the MAC class as I mentioned in the first reply.

丁磊

unread,
May 1, 2015, 11:34:56 PM5/1/15
to ns-3-...@googlegroups.com
Hi Konstantinos ~

thanks for your advice..

I have tried your suggests for several weeks, but i still have trouble in implement your advices.

I prefer to write the "mobility monitor" function within the StaWifiMac class, and I tried to transmit the Ptr<Node> of the mobile station into stawifimac like this:

for example, NodeContainer stas is the container of the mobile stations,

in sta-wifi=mac.h, i add such two sentences:

namespace ns3  {

extern NodeContainer stas;

........

private:
  Ptr<Node> node;

and in sta-wifi-mac.cc,i  add such sentence in the the construction function of StaWifiMac:  node = stas.Get(0);

StaWifiMac::StaWifiMac ()
  : m_state (BEACON_MISSED),
    m_probeRequestEvent (),
    m_assocRequestEvent (),
    m_beaconWatchdogEnd (Seconds (0.0))
{
  NS_LOG_FUNCTION (this);
  node = stas.Get(0);
  // Let the lower layers know that we are acting as a non-AP STA in
  // an infrastructure BSS.
  SetTypeOfStation (STA);
}

then it come out with such error:

[2276/2435] cxxprogram: build/src/wifi/examples/wifi-phy-test.cc.1.o -> build/src/wifi/examples/ns3.22-wifi-phy-test-debug
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
./libns3.22-wifi-debug.so: undefined reference to `ns3::stas'
collect2: error: ld returned 1 exit status
Waf: Leaving directory `/home/dinglei/ns-allinone-3.22/ns-3.22/build'

these error only come out when i add "node = stas.Get(0);".
I check it on google for a week but I still  have no idea about it, could you please give me some advise?

thanks


在 2015年3月13日星期五 UTC+8下午4:29:06,Konstantinos写道:
Reply all
Reply to author
Forward
0 new messages