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-propagation-loss-model.h>
27 #include <ns3/buildings-helper.h>
28 #include <ns3/radio-environment-map-helper.h>
38 main (
int argc,
char *argv[])
41 cmd.
Parse (argc, argv);
44 inputConfig.ConfigureDefaults ();
46 cmd.
Parse (argc, argv);
50 double nodeHeight = 1.5;
51 double roomHeight = 3;
52 double roomLength = 500;
55 uint32_t nEnb = nRooms*nRooms + 4;
66 vector < NodeContainer > ueNodes;
68 oneSectorNodes.
Create (nEnb-3);
69 threeSectorNodes.
Create (3);
71 enbNodes.
Add (oneSectorNodes);
72 enbNodes.
Add (threeSectorNodes);
74 for (uint32_t i = 0; i < nEnb; i++)
78 ueNodes.push_back (ueNode);
82 vector<Vector> enbPosition;
85 building = Create<Building> ();
86 building->SetBoundaries (
Box (0.0, nRooms * roomLength,
87 0.0, nRooms * roomLength,
89 building->SetBuildingType (Building::Residential);
90 building->SetExtWallsType (Building::ConcreteWithWindows);
91 building->SetNFloors (1);
92 building->SetNRoomsX (nRooms);
93 building->SetNRoomsY (nRooms);
96 uint32_t plantedEnb = 0;
97 for (uint32_t row = 0; row < nRooms; row++)
99 for (uint32_t column = 0; column < nRooms; column++, plantedEnb++)
101 Vector v (roomLength * (column + 0.5),
102 roomLength * (row + 0.5),
104 positionAlloc->
Add (v);
105 enbPosition.push_back (v);
112 Vector v (500, 3000, nodeHeight);
113 positionAlloc->
Add (v);
114 enbPosition.push_back (v);
115 mobility.
Install (ueNodes.at(plantedEnb));
119 for (uint32_t index = 0; index < 3; index++, plantedEnb++)
121 Vector v (500, 2000, nodeHeight);
122 positionAlloc->
Add (v);
123 enbPosition.push_back (v);
124 mobility.
Install (ueNodes.at(plantedEnb));
132 for (uint32_t i = 0; i < nEnb; i++)
140 positionAlloc = CreateObject<ListPositionAllocator> ();
141 for (uint32_t j = 0; j < nUe; j++)
145 positionAlloc->
Add (
Vector (enbPosition.at(i).x + 10, enbPosition.at(i).y, nodeHeight));
147 else if ( i == nEnb - 2 )
149 positionAlloc->
Add (
Vector (enbPosition.at(i).x - std::sqrt (10), enbPosition.at(i).y + std::sqrt (10), nodeHeight));
151 else if ( i == nEnb - 1 )
153 positionAlloc->
Add (
Vector (enbPosition.at(i).x - std::sqrt (10), enbPosition.at(i).y - std::sqrt (10), nodeHeight));
161 mobility.
Install (ueNodes.at(i));
166 vector < NetDeviceContainer > ueDevs;
195 for (uint32_t i = 0; i < nEnb; i++)
198 ueDevs.push_back (ueDev);
199 lteHelper->
Attach (ueDev, enbDevs.
Get (i));
206 BuildingsHelper::MakeMobilityModelConsistent ();
smart pointer class similar to boost::intrusive_ptr
NetDeviceContainer InstallEnbDevice(NodeContainer c)
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
void Attach(NetDeviceContainer ueDevices, Ptr< NetDevice > enbDevice)
Buildings mobility model.
holds a vector of ns3::NetDevice pointers
parse command-line argumentsInstances of this class can be used to parse command-line arguments: user...
void SetEnbAntennaModelType(std::string type)
static void Destroy(void)
void SetDefault(std::string name, const AttributeValue &value)
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)
Helper class used to assign positions and mobility models to nodes.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
void Add(NodeContainer other)
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.
void Parse(int argc, char *argv[]) const
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Hold an floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const