|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include "ns3/buildings-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/core-module.h"
26 #include "ns3/network-module.h"
35 std::ofstream outFile;
36 outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
37 if (!outFile.is_open ())
46 Box box = (*it)->GetBoundaries ();
47 outFile <<
"set object " << index
48 <<
" rect from " << box.
xMin <<
"," << box.
yMin
49 <<
" to " << box.
xMax <<
"," << box.
yMax
61 main (
int argc,
char *argv[])
65 cmd.Parse (argc, argv);
68 double buildingSizeX = 100;
69 double buildingSizeY = 50;
70 double streetWidth = 25;
71 double buildingHeight = 10;
72 uint32_t numBuildingsX = 10;
73 uint32_t numBuildingsY = 10;
74 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
75 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
77 std::vector<Ptr<Building> > buildingVector;
78 for (uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
80 for (uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
83 building = CreateObject<Building> ();
86 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
87 buildingIdY * (buildingSizeY + streetWidth),
88 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
89 0.0, buildingHeight));
93 buildingVector.push_back (building);
106 mobility.SetMobilityModel (
"ns3::RandomWalk2dOutdoorMobilityModel",
108 Rectangle (-streetWidth, maxAxisX, -streetWidth, maxAxisY)));
119 mobility.SetPositionAllocator (position);
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static Iterator Begin(void)
Parse command-line arguments.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double xMin
The x coordinate of the left bound of the box.
AttributeValue implementation for Rectangle.
void PrintGnuplottableBuildingListToFile(std::string filename)
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Hold objects of type Ptr<T>.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
static Iterator End(void)
double yMin
The y coordinate of the bottom bound of the box.
void SetNRoomsX(uint16_t nroomx)
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
std::vector< Ptr< Building > >::const_iterator Iterator
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
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.
void SetNRoomsY(uint16_t nroomy)
static void Run(void)
Run the simulation.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Manage ASCII trace files for device models.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
keep track of a set of node pointers.
double xMax
The x coordinate of the right bound of the box.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
Helper class used to assign positions and mobility models to nodes.
void SetNFloors(uint16_t nfloors)
double yMax
The y coordinate of the top bound of the box.