|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
64 #include "ns3/core-module.h"
65 #include <ns3/mobility-module.h>
66 #include "ns3/network-module.h"
67 #include "ns3/buildings-module.h"
78 if (node ==
nullptr)
return;
80 if (model ==
nullptr)
return;
89 std::ofstream outFile;
90 outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
91 if (!outFile.is_open ())
100 Box box = (*it)->GetBoundaries ();
101 outFile <<
"set object " << index
102 <<
" rect from " << box.
xMin <<
"," << box.
yMin
103 <<
" to " << box.
xMax <<
"," << box.
yMax
109 main (
int argc,
char *argv[])
112 uint32_t numPrints = 800;
113 bool useHelper =
false;
116 cmd.AddValue (
"useHelper",
"Whether to use helper code", useHelper);
117 cmd.Parse (argc, argv);
119 g_timeSeries.open (
"outdoor-group-mobility-time-series.mob");
142 std::vector<Ptr<Building> > buildingVector;
145 buildingVector.push_back (building);
146 building = CreateObject<Building> ();
148 buildingVector.push_back (building);
149 building = CreateObject<Building> ();
151 buildingVector.push_back (building);
152 building = CreateObject<Building> ();
154 buildingVector.push_back (building);
163 int64_t streamIndex = 1;
164 if (useHelper ==
false)
197 n.Get (0)->AggregateObject (hierarchical0);
205 n.Get (1)->AggregateObject (hierarchical1);
211 n.Get (2)->AggregateObject (hierarchical2);
227 listPosition->
Add (Vector (10, 10, 0));
231 listPosition = CreateObject<ListPositionAllocator> ();
232 listPosition->
Add (Vector (1, 0, 0));
233 listPosition->
Add (Vector (-1, 0, 0));
234 listPosition->
Add (Vector (0, 1, 0));
249 for (
unsigned int i = 0; i < numPrints; i++)
251 for (
auto nodeIt =
n.Begin (); nodeIt !=
n.End (); ++nodeIt)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static Iterator Begin(void)
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.
void Add(Vector v)
Add a position to the list of positions.
std::ofstream g_timeSeries
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...
void SetMemberPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of the member mobility...
double xMin
The x coordinate of the left bound of the box.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
AttributeValue implementation for Rectangle.
void SetPosition(const Vector &position)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void PrintGnuplottableBuildingListToFile(std::string filename)
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Iterator End(void)
double yMin
The y coordinate of the bottom bound of the box.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void SetChild(Ptr< MobilityModel > model)
Sets the child mobility model to a new one, possibly replacing an existing one.
std::vector< Ptr< Building > >::const_iterator Iterator
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)
void SetBoundaries(Box box)
Set the boundaries of the building.
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.
void SetReferencePositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of the reference mobil...
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.
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...
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
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...
void PrintPosition(Ptr< Node > node)
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.
Vector GetPosition(void) const
double xMax
The x coordinate of the right bound of the box.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
double yMax
The y coordinate of the top bound of the box.