48#include "ns3/core-module.h"
49#include "ns3/network-module.h"
50#include <ns3/mobility-module.h>
78 NS_LOG_LOGIC(
"Node: " << node->GetId() <<
" Position: " << model->GetPosition());
80 << model->GetPosition() << std::endl;
84main(
int argc,
char* argv[])
88 bool useHelper =
false;
91 cmd.AddValue(
"useHelper",
"Whether to use helper code", useHelper);
92 cmd.Parse(argc, argv);
141 int64_t streamIndex = 1;
145 streamIndex += waypointMm->AssignStreams(streamIndex);
149 hierarchical0->SetParent(waypointMm);
157 childRandomWalk0->SetAttribute(
"Speed",
158 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
159 streamIndex += childRandomWalk0->AssignStreams(streamIndex);
160 hierarchical0->SetChild(childRandomWalk0);
164 hierarchical1->SetParent(waypointMm);
167 childRandomWalk1->SetAttribute(
"Speed",
168 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
169 streamIndex += childRandomWalk1->AssignStreams(streamIndex);
170 hierarchical1->SetChild(childRandomWalk1);
173 hierarchical2->SetParent(waypointMm);
176 childRandomWalk2->SetAttribute(
"Speed",
177 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
178 streamIndex += childRandomWalk2->AssignStreams(streamIndex);
179 hierarchical2->SetChild(childRandomWalk2);
204 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
225 for (
unsigned int i = 0; i < numPrints; i++)
227 for (
auto nodeIt = n.
Begin(); nodeIt != n.
End(); ++nodeIt)
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Parse command-line arguments.
Helper class used to assign positions and mobility models to nodes for a group mobility configuration...
void SetMemberMobilityModel(std::string type, Ts &&... args)
Configure the mobility model which will be installed as the member (child) mobility model during Grou...
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models on t...
void Install(Ptr< Node > node)
Install and configure a hierarchical mobility model to the given node, based on the configured refere...
void SetReferenceMobilityModel(Ptr< MobilityModel > mobility)
Set the reference mobility model which will be installed as the parent mobility model during GroupMob...
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ofstream g_timeSeries
The time series file.
void PrintPosition(Ptr< Node > node)
Print the node position to the time series file.