|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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)
157 streamIndex += childRandomWalk0->
AssignStreams (streamIndex);
158 hierarchical0->
SetChild (childRandomWalk0);
159 n.Get (0)->AggregateObject (hierarchical0);
166 streamIndex += childRandomWalk1->
AssignStreams (streamIndex);
167 hierarchical1->
SetChild (childRandomWalk1);
168 n.Get (1)->AggregateObject (hierarchical1);
174 streamIndex += childRandomWalk2->
AssignStreams (streamIndex);
175 hierarchical2->
SetChild (childRandomWalk2);
176 n.Get (2)->AggregateObject (hierarchical2);
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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetReferenceMobilityModel(Ptr< MobilityModel > mobility)
Set the reference mobility model which will be installed as the parent mobility model during GroupMob...
Parse command-line arguments.
uint32_t GetId(void) const
void SetParent(Ptr< MobilityModel > model)
Sets the parent mobility model to a new one, possibly replacing an existing one.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Install(Ptr< Node > node)
Install and configure a hierarchical mobility model to the given node, based on the configured refere...
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
AttributeValue implementation for Rectangle.
void PrintPosition(Ptr< Node > node)
void AddWaypoint(const Waypoint &waypoint)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
void SetChild(Ptr< MobilityModel > model)
Sets the child mobility model to a new one, possibly replacing an existing one.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
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.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Simulation virtual time values and global simulation resolution.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
static void Run(void)
Run the simulation.
Hold variables of type string.
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...
Manage ASCII trace files for device models.
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...
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Helper class used to assign positions and mobility models to nodes for a group mobility configuration...
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
std::ofstream g_timeSeries
Vector GetPosition(void) const
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.