How to get same position distribution with position allocator?

279 views
Skip to first unread message

ZM Lin

unread,
Apr 16, 2014, 3:49:09 AM4/16/14
to ns-3-...@googlegroups.com
Hello,

I want run my simulator with different run number under same seed number experiments. The position of node is random distributed within rectangle space. However, I want use same position distribution for every node in different runs. Could you tell me how to achieve this? Thank you in advance.
 

Konstantinos

unread,
Apr 16, 2014, 4:50:37 AM4/16/14
to ns-3-...@googlegroups.com
To make it clear, you want to have randomization in all aspects of your simulation (e.g. timings) but you want to keep the position of the nodes the same?
Then, instead of using random position allocatior, you can use a constant... e.g. grid or list.
If you do not want that, you could run the first time with random, print the initial positions and then use them as input for the rest (there is no automatic procedure for this, you have to read/write the file with basic C++ methods).

Regards,
K.

ZM Lin

unread,
Apr 16, 2014, 6:01:57 AM4/16/14
to ns-3-...@googlegroups.com
Thank you for your reply. Yes, you are right. I want to have randomization in all aspects of your simulation (e.g. timings) but I want to keep the position of the nodes the same.
From what I know, there is also a AssignStreams function that is used to assign the stream, to acheive same mobility pattern.  But I dont know whether it can be applied into position allocate or not,. Or how can I use AssignStreams to keep the position distribution pattern fixed?
Thank you so much for your reply.

pdbarnes

unread,
Apr 17, 2014, 3:44:41 PM4/17/14
to ns-3-...@googlegroups.com
Exactly.

For example, with RandomWalk2dMobilityModel, you could set the seed, run, and stream of the Direction and Speed attributes to repeat the mobility pattern, with the rest of the simulation using a new run number.

Moab Rodrigues

unread,
May 13, 2015, 7:51:56 PM5/13/15
to ns-3-...@googlegroups.com
Hi, this answer is for someone that find this topic in the future and still don't know do.
See the example "example-ping-lr-wpan.cc", in this example you find the code below.

MobilityHelper mobility;
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
                                 "MinX", DoubleValue (0.0),
                                 "MinY", DoubleValue (0.0),
                                 "DeltaX", DoubleValue (20),
                                 "DeltaY", DoubleValue (20),
                                 "GridWidth", UintegerValue (3),
                                 "LayoutType", StringValue ("RowFirst"));
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility.Install (nodes);

This solve the problem.

Moab Rodrigues.

pdbarnes

unread,
May 15, 2015, 12:59:39 AM5/15/15
to ns-3-...@googlegroups.com
Actually Moab's reply doesn't solve MP's original question. Moab shows how to have nodes at fixed positions. MP's question was about keeping the mobility pattern exactly repeatable over many runs with different Run numbers, to accumulate statistics.
Petet

pdbarnes

unread,
May 15, 2015, 1:08:48 AM5/15/15
to ns-3-...@googlegroups.com
MP -> ZM. Apologies :)
Reply all
Reply to author
Forward
0 new messages