20#include "ns3/config-store.h"
21#include "ns3/core-module.h"
22#include "ns3/lte-module.h"
23#include "ns3/mobility-module.h"
24#include "ns3/network-module.h"
25#include <ns3/buildings-module.h>
35main(
int argc,
char* argv[])
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", nFloors);
46 cmd.AddValue(
"simTime",
"Total duration of the simulation (in seconds)", simTime);
47 cmd.Parse(argc, argv);
53 cmd.Parse(argc, argv);
57 double nodeHeight = 1.5;
58 double roomHeight = 3;
59 double roomLength = 8;
60 uint32_t nRooms = std::ceil(std::sqrt(nEnbPerFloor));
68 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisPropagationLossModel"));
73 lteHelper->SetAttribute(
"PathlossModel",
74 StringValue(
"ns3::HybridBuildingsPropagationLossModel"));
75 nEnb = nFloors * nEnbPerFloor;
80 std::vector<NodeContainer> ueNodes;
87 ueNodes.push_back(ueNode);
91 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
92 std::vector<Vector> enbPosition;
100 for (
uint32_t row = 0; row < nRooms; row++)
102 for (
uint32_t column = 0; column < nRooms && plantedEnb < nEnbPerFloor;
103 column++, plantedEnb++)
105 Vector v(roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
106 positionAlloc->Add(v);
107 enbPosition.push_back(v);
108 mobility.Install(ueNodes.at(plantedEnb));
111 mobility.SetPositionAllocator(positionAlloc);
119 posX->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).x - roomLength * 0.5));
120 posX->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).x + roomLength * 0.5));
122 posY->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).y - roomLength * 0.5));
123 posY->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).y + roomLength * 0.5));
124 positionAlloc = CreateObject<ListPositionAllocator>();
127 positionAlloc->Add(Vector(posX->GetValue(), posY->GetValue(), nodeHeight));
128 mobility.SetPositionAllocator(positionAlloc);
136 building = CreateObject<Building>();
137 building->SetBoundaries(
138 Box(0.0, nRooms * roomLength, 0.0, nRooms * roomLength, 0.0, nFloors * roomHeight));
141 building->SetNFloors(nFloors);
142 building->SetNRoomsX(nRooms);
143 building->SetNRoomsY(nRooms);
147 for (
uint32_t floor = 0; floor < nFloors; floor++)
150 for (
uint32_t row = 0; row < nRooms; row++)
152 for (
uint32_t column = 0; column < nRooms && plantedEnbPerFloor < nEnbPerFloor;
153 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);
161 mmEnb->SetPosition(v);
164 mobility.Install(ueNodes.at(plantedEnb));
166 for (
uint32_t ue = 0; ue < nUe; ue++)
170 Vector vUe(v.x, v.y, v.z);
171 mmUe->SetPosition(vUe);
180 std::vector<NetDeviceContainer> ueDevs;
181 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
185 ueDevs.push_back(ueDev);
186 lteHelper->Attach(ueDev, enbDevs.
Get(i));
189 lteHelper->ActivateDataRadioBearer(ueDev, bearer);
193 lteHelper->EnableTraces();
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Parse command-line arguments.
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
This class contains the specification of EPS Bearers.
@ GBR_CONV_VOICE
GBR Conversational Voice.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
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.
Hold variables of type string.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.