Placing a Node in an Exact Location in ns3 with the ListPositionAllocator

MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject <ListPositionAllocator>();
positionAlloc ->Add(Vector(0, 0, 0)); // node0
positionAlloc ->Add(Vector(1000, 0, 0)); // node1
positionAlloc ->Add(Vector(450, 0, 0)); // node2
mobility.SetPositionAllocator(positionAlloc);
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
mobility.Install(nodes);

References

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store