HowTo: Switch on nodes at random instance of time in a specified interval

53 views
Skip to first unread message

Shashidhar B.L

unread,
Jun 23, 2015, 8:50:59 AM6/23/15
to ns-3-...@googlegroups.com
Hi,
I have a grid topology of 10X10 nodes. I have AODV installed on these nodes. Now I want each of these nodes to switch on and send their 1st hello message at different time instances, say in an interval of 100 seconds. To be more specific, say 1st node switches on at 3rd second, and 10th node at 1st second and so on in a random fashion. Is it possible to do this?

If not random, then can I manually assign the start instance of every node once the simulator starts running?

Regards
Shashidhar B.L

Konstantinos

unread,
Jun 23, 2015, 9:04:46 AM6/23/15
to ns-3-...@googlegroups.com, shashid...@gmail.com
Hi Shashidhar,

If you check in the AODV source, HELLOs are generated 'randomly' following a UniformRandomVariable from 0-100miliseconds

// In RoutingProtocol::DoInitialize (void)

if (EnableHello)
 
{
 
m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
  startTime
= m_uniformRandomVariable->GetInteger (0, 100);
 
NS_LOG_DEBUG ("Starting at time " << startTime << "ms");
 
m_htimer.Schedule (MilliSeconds (startTime));
 
}

I guess you can modify this to a larger range (Seconds instead of MiliSeconds).

That controls only when the first HELLO message will be send, the node will be 'switched on' from t=0sec.
If you want to switch on nodes also randomly, you can work with Simulator::Schedule and control the network interface of each node (Interface Up/Down)
Search the mailing list, it has been discussed several time how to make an interface Up/Down

Regards,
K.

Shashidhar B.L

unread,
Jun 23, 2015, 9:15:55 AM6/23/15
to ns-3-...@googlegroups.com
Hi,
Many thanks for the quick and indeed very helpful response. I can find my way now.

Cheers

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/eQaZtfJ31_Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages