9#include "ns3/config-store.h"
10#include "ns3/core-module.h"
11#include "ns3/lte-module.h"
12#include "ns3/mobility-module.h"
13#include "ns3/network-module.h"
14#include <ns3/buildings-module.h>
24main(
int argc,
char* argv[])
32 cmd.AddValue(
"nEnb",
"Number of eNodeBs per floor", nEnbPerFloor);
33 cmd.AddValue(
"nUe",
"Number of UEs", nUe);
34 cmd.AddValue(
"nFloors",
"Number of floors, 0 for Friis propagation model", nFloors);
35 cmd.AddValue(
"simTime",
"Total duration of the simulation (in seconds)", simTime);
36 cmd.Parse(argc, argv);
42 cmd.Parse(argc, argv);
46 double nodeHeight = 1.5;
47 double roomHeight = 3;
48 double roomLength = 8;
49 uint32_t nRooms = std::ceil(std::sqrt(nEnbPerFloor));
57 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisPropagationLossModel"));
62 lteHelper->SetAttribute(
"PathlossModel",
63 StringValue(
"ns3::HybridBuildingsPropagationLossModel"));
64 nEnb = nFloors * nEnbPerFloor;
69 std::vector<NodeContainer> ueNodes;
76 ueNodes.push_back(ueNode);
80 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
81 std::vector<Vector> enbPosition;
89 for (
uint32_t row = 0; row < nRooms; row++)
91 for (
uint32_t column = 0; column < nRooms && plantedEnb < nEnbPerFloor;
92 column++, plantedEnb++)
94 Vector v(roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
95 positionAlloc->Add(v);
96 enbPosition.push_back(v);
97 mobility.Install(ueNodes.at(plantedEnb));
100 mobility.SetPositionAllocator(positionAlloc);
108 posX->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).x - roomLength * 0.5));
109 posX->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).x + roomLength * 0.5));
111 posY->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).y - roomLength * 0.5));
112 posY->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).y + roomLength * 0.5));
116 positionAlloc->Add(Vector(posX->GetValue(), posY->GetValue(), nodeHeight));
117 mobility.SetPositionAllocator(positionAlloc);
126 building->SetBoundaries(
127 Box(0.0, nRooms * roomLength, 0.0, nRooms * roomLength, 0.0, nFloors * roomHeight));
130 building->SetNFloors(nFloors);
131 building->SetNRoomsX(nRooms);
132 building->SetNRoomsY(nRooms);
136 for (
uint32_t floor = 0; floor < nFloors; floor++)
139 for (
uint32_t row = 0; row < nRooms; row++)
141 for (
uint32_t column = 0; column < nRooms && plantedEnbPerFloor < nEnbPerFloor;
142 column++, plantedEnb++, plantedEnbPerFloor++)
144 Vector v(roomLength * (column + 0.5),
145 roomLength * (row + 0.5),
146 nodeHeight + roomHeight * floor);
147 positionAlloc->Add(v);
148 enbPosition.push_back(v);
150 mmEnb->SetPosition(v);
153 mobility.Install(ueNodes.at(plantedEnb));
155 for (
uint32_t ue = 0; ue < nUe; ue++)
159 Vector vUe(v.x, v.y, v.z);
160 mmUe->SetPosition(vUe);
169 std::vector<NetDeviceContainer> ueDevs;
170 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
174 ueDevs.push_back(ueDev);
175 lteHelper->Attach(ueDev, enbDevs.
Get(i));
178 lteHelper->ActivateDataRadioBearer(ueDev, bearer);
182 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.
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.