NS-3 Third Example-RandomWalk2dMobilityModel

95 views
Skip to first unread message

Erdem Tuna

unread,
Jul 5, 2018, 3:51:34 AM7/5/18
to ns-3-users
Hello everyone,

I am working on the examples provided by NS-3. In the "third.cc", some nodes are installed with RandomWalk2dMobilityModel with the following codes: 
MobilityHelper mobility;

mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
 
"MinX", DoubleValue (0.0),
 
"MinY", DoubleValue (0.0),
 
"DeltaX", DoubleValue (5.0),
 
"DeltaY", DoubleValue (10.0),
 
"GridWidth", UintegerValue (3),
 
"LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
 
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiStaNodes);



The problem is when I track the position of one of the such nodes, they always end up at the same destination point every time I run time simulation. Isn't this a conflict with a random model?




pdbarnes

unread,
Jul 5, 2018, 12:24:37 PM7/5/18
to ns-3-users
All random numbers in ns-3 are pseudo-random: the sequence appears random, but it is in fact reproducible. That’s why you get the same sequence, and hence same motion, each time you execute a script.

To get different motion each time you need to change the Run number.

$ NS_GLOBAL_VALUE="RngRun=3" ./waf --run ...

See the manual chapter for more information:
https://www.nsnam.org/docs/manual/html/random-variables.html

Peter
Reply all
Reply to author
Forward
0 new messages