11#include "ns3/buildings-module.h"
12#include "ns3/core-module.h"
13#include "ns3/mobility-module.h"
14#include "ns3/network-module.h"
28 std::ofstream outFile;
29 outFile.open(filename.c_str(), std::ios_base::out | std::ios_base::trunc);
30 if (!outFile.is_open())
39 Box box = (*it)->GetBoundaries();
40 outFile <<
"set object " << index <<
" rect from " << box.
xMin <<
"," << box.
yMin <<
" to "
41 << box.
xMax <<
"," << box.
yMax << std::endl;
51main(
int argc,
char* argv[])
55 cmd.Parse(argc, argv);
58 double buildingSizeX = 100;
59 double buildingSizeY = 50;
60 double streetWidth = 25;
61 double buildingHeight = 10;
64 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
65 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
67 std::vector<Ptr<Building>> buildingVector;
68 for (
uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
70 for (
uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
75 building->SetBoundaries(
Box(buildingIdX * (buildingSizeX + streetWidth),
76 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
77 buildingIdY * (buildingSizeY + streetWidth),
78 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
81 building->SetNRoomsX(1);
82 building->SetNRoomsY(1);
83 building->SetNFloors(1);
84 buildingVector.push_back(building);
98 "ns3::RandomWalk2dOutdoorMobilityModel",
105 xPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
108 yPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
112 mobility.SetPositionAllocator(position);
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.
double yMax
The y coordinate of the top bound of the box.
double xMin
The x coordinate of the left bound of the box.
double yMin
The y coordinate of the bottom bound of the box.
double xMax
The x coordinate of the right bound of the box.
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to assign positions and mobility models to nodes.
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
keep track of a set of node pointers.
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.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
void PrintGnuplottableBuildingListToFile(std::string filename)
Print the buildings list in a format that can be used by Gnuplot to draw them.