61 #include "ns3/core-module.h"
62 #include <ns3/mobility-module.h>
63 #include "ns3/network-module.h"
74 if (node ==
nullptr)
return;
76 if (model ==
nullptr)
return;
83 main (
int argc,
char *argv[])
86 uint32_t numPrints = 800;
87 bool useHelper =
false;
90 cmd.AddValue (
"useHelper",
"Whether to use helper code", useHelper);
91 cmd.Parse (argc, argv);
140 int64_t streamIndex = 1;
141 if (useHelper ==
false)
148 hierarchical0->SetParent (waypointMm);
156 childRandomWalk0->SetAttribute (
"Speed",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.1]"));
157 streamIndex += childRandomWalk0->AssignStreams (streamIndex);
158 hierarchical0->SetChild (childRandomWalk0);
162 hierarchical1->SetParent (waypointMm);
165 childRandomWalk1->SetAttribute (
"Speed",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.1]"));
166 streamIndex += childRandomWalk1->AssignStreams (streamIndex);
167 hierarchical1->SetChild (childRandomWalk1);
170 hierarchical2->SetParent (waypointMm);
173 childRandomWalk2->SetAttribute (
"Speed",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.1]"));
174 streamIndex += childRandomWalk2->AssignStreams (streamIndex);
175 hierarchical2->SetChild (childRandomWalk2);
198 "Speed",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.1]"));
219 for (
unsigned int i = 0; i < numPrints; i++)
221 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...
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...
void SetMemberMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
Configure the mobility model which will be installed as the member (child) mobility model during Grou...
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
Keep track of the current position and velocity of an object.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Vector GetPosition(void) const
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Iterator End(void) 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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t GetId(void) const
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
AttributeValue implementation for Rectangle.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Run(void)
Run the simulation.
static Time Now(void)
Return the current simulation virtual time.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void AddWaypoint(const Waypoint &waypoint)
#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.
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
void PrintPosition(Ptr< Node > node)