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-helper.h>
15#include <ns3/buildings-propagation-loss-model.h>
16#include <ns3/radio-environment-map-helper.h>
26main(
int argc,
char* argv[])
29 cmd.Parse(argc, argv);
34 cmd.Parse(argc, argv);
38 double nodeHeight = 1.5;
39 double roomHeight = 3;
40 double roomLength = 500;
48 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisPropagationLossModel"));
54 std::vector<NodeContainer> ueNodes;
56 oneSectorNodes.
Create(nEnb - 3);
57 threeSectorNodes.
Create(3);
59 enbNodes.
Add(oneSectorNodes);
60 enbNodes.
Add(threeSectorNodes);
66 ueNodes.push_back(ueNode);
70 std::vector<Vector> enbPosition;
74 building->SetBoundaries(
75 Box(0.0, nRooms * roomLength, 0.0, nRooms * roomLength, 0.0, roomHeight));
78 building->SetNFloors(1);
79 building->SetNRoomsX(nRooms);
80 building->SetNRoomsY(nRooms);
81 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
85 for (
uint32_t row = 0; row < nRooms; row++)
87 for (
uint32_t column = 0; column < nRooms; column++, plantedEnb++)
89 Vector v(roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
90 positionAlloc->Add(v);
91 enbPosition.push_back(v);
93 mmEnb->SetPosition(v);
98 Vector v(500, 3000, nodeHeight);
99 positionAlloc->Add(v);
100 enbPosition.push_back(v);
101 mobility.Install(ueNodes.at(plantedEnb));
105 for (
uint32_t index = 0; index < 3; index++, plantedEnb++)
107 Vector v(500, 2000, nodeHeight);
108 positionAlloc->Add(v);
109 enbPosition.push_back(v);
110 mobility.Install(ueNodes.at(plantedEnb));
113 mobility.SetPositionAllocator(positionAlloc);
120 posX->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).x - roomLength * 0));
121 posX->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).x + roomLength * 0));
123 posY->SetAttribute(
"Min",
DoubleValue(enbPosition.at(i).y - roomLength * 0));
124 posY->SetAttribute(
"Max",
DoubleValue(enbPosition.at(i).y + roomLength * 0));
131 Vector(enbPosition.at(i).x + 10, enbPosition.at(i).y, nodeHeight));
133 else if (i == nEnb - 2)
135 positionAlloc->Add(Vector(enbPosition.at(i).x - std::sqrt(10),
136 enbPosition.at(i).y + std::sqrt(10),
139 else if (i == nEnb - 1)
141 positionAlloc->Add(Vector(enbPosition.at(i).x - std::sqrt(10),
142 enbPosition.at(i).y - std::sqrt(10),
147 positionAlloc->Add(Vector(posX->GetValue(), posY->GetValue(), nodeHeight));
149 mobility.SetPositionAllocator(positionAlloc);
157 std::vector<NetDeviceContainer> ueDevs;
161 enbDevs = lteHelper->InstallEnbDevice(oneSectorNodes);
167 lteHelper->SetEnbAntennaModelType(
"ns3::CosineAntennaModel");
168 lteHelper->SetEnbAntennaModelAttribute(
"Orientation",
DoubleValue(0));
169 lteHelper->SetEnbAntennaModelAttribute(
"HorizontalBeamwidth",
DoubleValue(100));
170 lteHelper->SetEnbAntennaModelAttribute(
"MaxGain",
DoubleValue(0.0));
171 enbDevs.
Add(lteHelper->InstallEnbDevice(threeSectorNodes.
Get(0)));
173 lteHelper->SetEnbAntennaModelType(
"ns3::CosineAntennaModel");
174 lteHelper->SetEnbAntennaModelAttribute(
"Orientation",
DoubleValue(360 / 3));
175 lteHelper->SetEnbAntennaModelAttribute(
"HorizontalBeamwidth",
DoubleValue(100));
176 lteHelper->SetEnbAntennaModelAttribute(
"MaxGain",
DoubleValue(0.0));
177 enbDevs.
Add(lteHelper->InstallEnbDevice(threeSectorNodes.
Get(1)));
179 lteHelper->SetEnbAntennaModelType(
"ns3::CosineAntennaModel");
180 lteHelper->SetEnbAntennaModelAttribute(
"Orientation",
DoubleValue(2 * 360 / 3));
181 lteHelper->SetEnbAntennaModelAttribute(
"HorizontalBeamwidth",
DoubleValue(100));
182 lteHelper->SetEnbAntennaModelAttribute(
"MaxGain",
DoubleValue(0.0));
183 enbDevs.
Add(lteHelper->InstallEnbDevice(threeSectorNodes.
Get(2)));
188 ueDevs.push_back(ueDev);
189 lteHelper->Attach(ueDev, enbDevs.
Get(i));
192 lteHelper->ActivateDataRadioBearer(ueDev, bearer);
199 remHelper->SetAttribute(
"ChannelPath",
StringValue(
"/ChannelList/0"));
200 remHelper->SetAttribute(
"OutputFile",
StringValue(
"rem.out"));
201 remHelper->SetAttribute(
"XMin",
DoubleValue(-2000.0));
202 remHelper->SetAttribute(
"XMax",
DoubleValue(+2000.0));
203 remHelper->SetAttribute(
"YMin",
DoubleValue(-500.0));
204 remHelper->SetAttribute(
"YMax",
DoubleValue(+3500.0));
206 remHelper->Install();
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
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
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.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
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.
void SetDefault(std::string name, const AttributeValue &value)
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.