Hi All,
I am trying to run a simulation for routing with AODV in MANETs.
I am using the code given below to allocate positions randomly to the nodes:
MobilityHelper mobiles;
ObjectFactory pos;
pos.SetTypeId("ns3::RandomRectanglePositionAllocator");
pos.Set ("X", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=500.0]"));
pos.Set ("Y", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=500.0]"));
Ptr<PositionAllocator> posAlloc = pos.Create()->GetObject<PositionAllocator>();
mobiles.SetMobilityModel("ns3::RandomWaypointMobilityModel",
"Speed", StringValue ("ns3::UniformRandomVariable[Min=0|Max=60]"),
"Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"),
"PositionAllocator", PointerValue(posAlloc));
mobiles.SetPositionAllocator (posAlloc);
mobiles.Install(node);
However, every time I run the simulation, after I open the animation file with NetAnim, I see that the nodes are at the same starting position every time. Why is this happening?
More importantly, can anyone tell me what I am doing wrong, or how can I get actually randomly positioned nodes every time I run the simulation?
And by running the simulation I mean executing this:
$ ./waf --run scratch/<filename>
I thought there is something wring with my code, and I tried running the manet-routing-compare.cc too, but it is also giving the same result- nodes in the same position everytime.
I am sure I am probably doing some silly mistake here. Kindly help me out.
Thanks