59 #include "ns3/core-module.h"
60 #include "ns3/network-module.h"
61 #include <ns3/mobility-module.h>
95 main(
int argc,
char* argv[])
98 uint32_t numPrints = 800;
99 bool useHelper =
false;
102 cmd.AddValue(
"useHelper",
"Whether to use helper code", useHelper);
103 cmd.Parse(argc, argv);
152 int64_t streamIndex = 1;
160 hierarchical0->SetParent(waypointMm);
167 childRandomWalk0->SetAttribute(
"Bounds", RectangleValue(
Rectangle(-5, 5, -5, 5)));
168 childRandomWalk0->SetAttribute(
"Speed",
169 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
170 streamIndex += childRandomWalk0->AssignStreams(streamIndex);
171 hierarchical0->SetChild(childRandomWalk0);
175 hierarchical1->SetParent(waypointMm);
177 childRandomWalk1->SetAttribute(
"Bounds", RectangleValue(
Rectangle(-5, 5, -5, 5)));
178 childRandomWalk1->SetAttribute(
"Speed",
179 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
180 streamIndex += childRandomWalk1->AssignStreams(streamIndex);
181 hierarchical1->SetChild(childRandomWalk1);
184 hierarchical2->SetParent(waypointMm);
186 childRandomWalk2->SetAttribute(
"Bounds", RectangleValue(
Rectangle(-5, 5, -5, 5)));
187 childRandomWalk2->SetAttribute(
"Speed",
188 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
189 streamIndex += childRandomWalk2->AssignStreams(streamIndex);
190 hierarchical2->SetChild(childRandomWalk2);
215 StringValue(
"ns3::ConstantRandomVariable[Constant=0.1]"));
236 for (
unsigned int i = 0; i < numPrints; i++)
238 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.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Vector GetPosition() const
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.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
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.
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
The time series file.
void PrintPosition(Ptr< Node > node)
Print the node position to the time series file.