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));
117 for (uint32_t i = 0; i < nEnb; i++)
125 positionAlloc = CreateObject<ListPositionAllocator> ();
126 for (uint32_t j = 0; j < nUe; j++)
131 mobility.
Install (ueNodes.at(i));
137 building = CreateObject<Building> ();
138 building->SetBoundaries (
Box (0.0, nRooms * roomLength,
139 0.0, nRooms * roomLength,
140 0.0, nFloors* roomHeight));
143 building->SetNFloors (nFloors);
144 building->SetNRoomsX (nRooms);
145 building->SetNRoomsY (nRooms);
147 uint32_t plantedEnb = 0;
148 for (uint32_t floor = 0; floor < nFloors; floor++)
150 uint32_t plantedEnbPerFloor = 0;
151 for (uint32_t row = 0; row < nRooms; row++)
153 for (uint32_t column = 0; column < nRooms && plantedEnbPerFloor < nEnbPerFloor; column++, plantedEnb++, plantedEnbPerFloor++)
155 Vector v (roomLength * (column + 0.5),
156 roomLength * (row + 0.5),
157 nodeHeight + roomHeight * floor);
158 positionAlloc->
Add (v);
159 enbPosition.push_back (v);
164 mobility.
Install (ueNodes.at(plantedEnb));
165 for (uint32_t ue = 0; ue < nUe; ue++)
179 std::vector<NetDeviceContainer> ueDevs;
181 for (uint32_t i = 0; i < nEnb; i++)
184 ueDevs.push_back (ueDev);
185 lteHelper->
Attach (ueDev, enbDevs.
Get (i));