mobility model?

187 views
Skip to first unread message

pp

unread,
Aug 21, 2018, 10:51:44 AM8/21/18
to ns-3-users
Hi,

I have to use a mobility model where I can set up my initial positions and they move in random.I tried using random-way-point which is failing at some point.Can some one suggest me a better model? or help me with what went wrong with code attached.
mesh.cc

Erdem Tuna

unread,
Aug 21, 2018, 11:33:19 AM8/21/18
to ns-3-users
Hello,

It seems you installed the nodes with "ConstantPositionMobilityModel"
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility
.Install (nodes);

You can use the pre-implemented mobility models described in NS-3 Mobility Reference. If you want to use custom mobility models, you can use pre-generated trace mobilities with NS-2 Mobility Helper . You can generate those traces by using BonnMotion or SUMO.



21 Ağustos 2018 Salı 17:51:44 UTC+3 tarihinde pp yazdı:
Message has been deleted

pp

unread,
Aug 21, 2018, 11:52:29 AM8/21/18
to ns-3-users
I attached the wrong file.Please find the attached.Position.txt has the initial positions.
mesh.cc

Erdem Tuna

unread,
Aug 21, 2018, 12:15:49 PM8/21/18
to ns-3-users
Hello,

Can you provide the output of the script? What is wrong with the script? Where does it fail?

21 Ağustos 2018 Salı 18:52:29 UTC+3 tarihinde pp yazdı:

pp

unread,
Aug 21, 2018, 12:48:39 PM8/21/18
to ns-3-users
Its working fine until some point and failing

assert failed. cond="m_position", msg="No position allocator added before using this model", file=../src/mobility/model/random-waypoint-mobility-model.cc, line=63
terminate called without an active exception

Erdem Tuna

unread,
Aug 21, 2018, 1:24:45 PM8/21/18
to ns-3-users
Can you attach "position.txt"?

pp

unread,
Aug 21, 2018, 3:40:29 PM8/21/18
to ns-3-users
You may not get same error because I edited some code.Here I am attaching position.txt.From what I understand in manet-routing.cc for random way point model position allocator tapositionalloc is used but here I am used my own locations in the starting.

On Tuesday, August 21, 2018 at 12:24:45 PM UTC-5, Erdem Tuna wrote:
Can you attach "position.txt"?
position.txt

pp

unread,
Aug 21, 2018, 4:09:57 PM8/21/18
to ns-3-users
I want to change the following code to provide my own set of coordinates


  uint32_t m_nodeSpeed=0;
  MobilityHelper mobility;
   ObjectFactory pos;
   pos.SetTypeId ("ns3::RandomRectanglePositionAllocator");
   pos.Set ("X", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=100.0]"));
   pos.Set ("Y", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=100.0]"));

   std::ostringstream speedConstantRandomVariableStream;
   speedConstantRandomVariableStream << "ns3::ConstantRandomVariable[Constant="
                                     << m_nodeSpeed
                                     << "]";

   Ptr <PositionAllocator> taPositionAlloc = pos.Create ()->GetObject <PositionAllocator> ();
   mobility.SetMobilityModel ("ns3::RandomWaypointMobilityModel", "Speed", StringValue (speedConstantRandomVariableStream.str ()),
                              "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=2.0]"), "PositionAllocator", PointerValue (taPositionAlloc));
   mobility.SetPositionAllocator (taPositionAlloc);
   mobility.Install (nodes);
  if (m_pcap)
    wifiPhy.EnablePcapAll (std::string ("mp-"));
}

Erdem Tuna

unread,
Aug 23, 2018, 12:45:16 PM8/23/18
to ns-3-users
I ran your code, but I didn't understand what you want to achieve.

21 Ağustos 2018 Salı 23:09:57 UTC+3 tarihinde pp yazdı:

pp

unread,
Aug 23, 2018, 11:43:24 PM8/23/18
to ns-3-users
I have changed some part of the code.The thing is I want to use RandomWaypointMobilityModel but the position allocator is taPositionAlloc which randomly assigns a location but I want to use my locations.

Erdem Tuna

unread,
Aug 25, 2018, 1:01:45 PM8/25/18
to ns-3-users
I couldn't solve the problem, unfortunately.

24 Ağustos 2018 Cuma 06:43:24 UTC+3 tarihinde pp yazdı:

Polumuru Pushpa

unread,
Aug 25, 2018, 1:07:20 PM8/25/18
to ns-3-...@googlegroups.com
Its ok.Thanks for the help.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, 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 https://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