21 #include "ns3/core-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/mobility-module.h"
24 #include "ns3/lte-module.h"
25 #include "ns3/config-store.h"
26 #include <ns3/buildings-module.h>
35 main (
int argc,
char *argv[])
37 uint32_t nEnbPerFloor = 1;
43 cmd.
AddValue (
"nEnb",
"Number of eNodeBs per floor", nEnbPerFloor);
44 cmd.
AddValue (
"nUe",
"Number of UEs", nUe);
45 cmd.
AddValue (
"nFloors",
"Number of floors, 0 for Friis propagation model",
47 cmd.
AddValue (
"simTime",
"Total duration of the simulation (in seconds)",
49 cmd.
Parse (argc, argv);
55 cmd.
Parse (argc, argv);
59 double nodeHeight = 1.5;
60 double roomHeight = 3;
61 double roomLength = 8;
62 uint32_t nRooms = std::ceil (std::sqrt (nEnbPerFloor));
77 StringValue (
"ns3::HybridBuildingsPropagationLossModel"));
78 nEnb = nFloors * nEnbPerFloor;
83 std::vector<NodeContainer> ueNodes;
86 for (uint32_t i = 0; i < nEnb; i++)
90 ueNodes.push_back (ueNode);
95 std::vector<Vector> enbPosition;
102 uint32_t plantedEnb = 0;
103 for (uint32_t row = 0; row < nRooms; row++)
105 for (uint32_t column = 0; column < nRooms && plantedEnb < nEnbPerFloor; column++, plantedEnb++)
107 Vector v (roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
108 positionAlloc->
Add (v);
109 enbPosition.push_back (v);
110 mobility.
Install (ueNodes.at(plantedEnb));
118 for (uint32_t i = 0; i < nEnb; i++)
126 positionAlloc = CreateObject<ListPositionAllocator> ();
127 for (uint32_t j = 0; j < nUe; j++)
132 mobility.
Install (ueNodes.at(i));
139 building = CreateObject<Building> ();
140 building->SetBoundaries (
Box (0.0, nRooms * roomLength,
141 0.0, nRooms * roomLength,
142 0.0, nFloors* roomHeight));
145 building->SetNFloors (nFloors);
146 building->SetNRoomsX (nRooms);
147 building->SetNRoomsY (nRooms);
150 uint32_t plantedEnb = 0;
151 for (uint32_t floor = 0; floor < nFloors; floor++)
153 uint32_t plantedEnbPerFloor = 0;
154 for (uint32_t row = 0; row < nRooms; row++)
156 for (uint32_t column = 0; column < nRooms && plantedEnbPerFloor < nEnbPerFloor; column++, plantedEnb++, plantedEnbPerFloor++)
158 Vector v (roomLength * (column + 0.5),
159 roomLength * (row + 0.5),
160 nodeHeight + roomHeight * floor);
161 positionAlloc->
Add (v);
162 enbPosition.push_back (v);
167 mobility.
Install (ueNodes.at(plantedEnb));
169 for (uint32_t ue = 0; ue < nUe; ue++)
172 Vector vUe (v.x, v.y, v.z);
183 std::vector<NetDeviceContainer> ueDevs;
185 for (uint32_t i = 0; i < nEnb; i++)
188 ueDevs.push_back (ueDev);
189 lteHelper->
Attach (ueDev, enbDevs.
Get (i));
Introspection did not find any typical Config paths.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Hold variables of type string.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
static void Run(void)
Run the simulation.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Keep track of the current position and velocity of an object.
This class contains the specification of EPS Bearers.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
static void MakeMobilityModelConsistent()
This method goes through the whole NodeList and, for each node in the list, calls BuildingsHelper::Ma...
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
holds a vector of ns3::NetDevice pointers
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void ConfigureDefaults(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void SetMobilityModel(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())
void SetPosition(const Vector &position)
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Helper class used to assign positions and mobility models to nodes.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Add(Vector v)
Add a position to the list of positions.
void Parse(int argc, char *argv[])
Parse the program arguments.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.