22 #include "ns3/core-module.h"
23 #include "ns3/network-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/lte-module.h"
26 #include "ns3/config-store.h"
27 #include <ns3/buildings-helper.h>
28 #include <ns3/spectrum-module.h>
38 std::ofstream outFile;
39 outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
40 if (!outFile.is_open ())
49 for (
int j = 0; j < nDevs; j++)
55 outFile <<
"set label \"" << uedev->
GetImsi ()
56 <<
"\" at " << pos.
x <<
"," << pos.
y <<
" left font \"Helvetica,4\" textcolor rgb \"grey\" front point pt 1 ps 0.3 lc rgb \"grey\" offset 0,0"
66 std::ofstream outFile;
67 outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
68 if (!outFile.is_open ())
77 for (
int j = 0; j < nDevs; j++)
83 outFile <<
"set label \"" << enbdev->
GetCellId ()
84 <<
"\" at " << pos.
x <<
"," << pos.
y
85 <<
" left font \"Helvetica,4\" textcolor rgb \"white\" front point pt 2 ps 0.3 lc rgb \"white\" offset 0,0"
92 int main (
int argc,
char *argv[])
105 uint16_t numberOfRandomUes = 0;
106 double simTime = 2.500;
107 bool generateSpectrumTrace =
false;
108 bool generateRem =
false;
109 int32_t remRbId = -1;
110 uint8_t bandwidth = 25;
111 double distance = 1000;
112 Box macroUeBox =
Box (-distance * 0.5, distance * 1.5, -distance * 0.5, distance * 1.5, 1.5, 1.5);
116 cmd.
AddValue (
"numberOfUes",
"Number of random UEs", numberOfRandomUes);
117 cmd.
AddValue (
"simTime",
"Total duration of the simulation (in seconds)", simTime);
118 cmd.
AddValue (
"generateSpectrumTrace",
"if true, will generate a Spectrum Analyzer trace", generateSpectrumTrace);
119 cmd.
AddValue (
"generateRem",
"if true, will generate a REM and then abort the simulation", generateRem);
120 cmd.
AddValue (
"remRbId",
"Resource Block Id, for which REM will be generated,"
121 "default value is -1, what means REM will be averaged from all RBs", remRbId);
122 cmd.
AddValue (
"runId",
"runId", runId);
123 cmd.
Parse (argc, argv);
138 randomUeNodes.
Create (numberOfRandomUes);
159 enbPositionAlloc->
Add (
Vector (0.0, 0.0, 0.0));
160 enbPositionAlloc->
Add (
Vector (distance, 0.0, 0.0));
161 enbPositionAlloc->
Add (
Vector (distance * 0.5, distance * 0.866, 0.0));
169 edgeUePositionAlloc->
Add (
Vector (distance * 0.5, distance * 0.28867, 0.0));
170 edgeUePositionAlloc->
Add (
Vector (distance * 0.5, distance * 0.28867, 0.0));
171 edgeUePositionAlloc->
Add (
Vector (distance * 0.5, distance * 0.28867, 0.0));
173 mobility.
Install (edgeUeNodes);
177 centerUePositionAlloc->
Add (
Vector (0.0, 0.0, 0.0));
178 centerUePositionAlloc->
Add (
Vector (distance, 0.0, 0.0));
179 centerUePositionAlloc->
Add (
Vector (distance * 0.5, distance * 0.866, 0.0));
181 mobility.
Install (centerUeNodes);
198 mobility.
Install (randomUeNodes);
213 if (frAlgorithmType ==
"ns3::LteFrHardAlgorithm")
219 else if (frAlgorithmType ==
"ns3::LteFrStrictAlgorithm")
234 else if (frAlgorithmType ==
"ns3::LteFrSoftAlgorithm")
250 else if (frAlgorithmType ==
"ns3::LteFfrSoftAlgorithm")
269 else if (frAlgorithmType ==
"ns3::LteFfrEnhancedAlgorithm")
286 else if (frAlgorithmType ==
"ns3::LteFfrDistributedAlgorithm")
289 NS_FATAL_ERROR (
"ns3::LteFfrDistributedAlgorithm not supported in this example. Please run lena-distributed-ffr");
308 enbDevs.
Get (0)->GetAttribute (
"LteFfrAlgorithm", tmp);
319 for (uint32_t i = 0; i < edgeUeDevs.
GetN (); i++)
321 lteHelper->
Attach (edgeUeDevs.
Get (i), enbDevs.
Get (i));
324 for (uint32_t i = 0; i < centerUeDevs.
GetN (); i++)
326 lteHelper->
Attach (centerUeDevs.
Get (i), enbDevs.
Get (i));
341 spectrumAnalyzerNodes.
Create (1);
344 if (generateSpectrumTrace)
350 positionAlloc->
Add (
Vector (distance * 0.5, distance * 0.866, 0.0));
355 mobility.
Install (spectrumAnalyzerNodes);
360 spectrumAnalyzerHelper.
SetChannel (dlChannel);
365 spectrumAnalyzerHelper.
EnableAsciiAll (
"spectrum-analyzer-output");
366 spectrumAnalyzerHelper.
Install (spectrumAnalyzerNodes);
375 remHelper = CreateObject<RadioEnvironmentMapHelper> ();
double x
x coordinate of vector
NetDeviceContainer InstallEnbDevice(NodeContainer c)
create a set of eNB devices
uint16_t GetCellId() const
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c) const
static Vector GetPosition(Ptr< Node > node)
Ptr< Object > GetObject(void) const
static void Run(void)
Run the simulation until one of:
Hold a signed integer type.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_FATAL_ERROR(msg)
fatal error handling
void PrintGnuplottableEnbListToFile(std::string filename)
static Ptr< SpectrumModel > GetSpectrumModel(uint16_t earfcn, uint8_t bandwidth)
Ptr< SpectrumChannel > GetChannel()
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Call ActivateDataRadioBearer (ueDevice, bearer) for each UE device in a given set.
void SetFfrAlgorithmType(std::string type)
static void SetRun(uint64_t run)
Set the run number of simulation.
void SetSchedulerType(std::string type)
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
void AttachToClosestEnb(NetDeviceContainer ueDevices, NetDeviceContainer enbDevices)
Manual attachment of a set of UE devices to the network via the closest eNodeB (with respect to dista...
Keep track of the current position and velocity of an object.
This class contains the specification of EPS Bearers.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
hold variables of type 'enum'
void PrintGnuplottableUeListToFile(std::string filename)
Attribute for objects of type ns3::Time.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Hold an unsigned integer type.
static Iterator End(void)
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
set an attribute for the scheduler to be created
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Parse command-line arguments.
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
void SetPhyAttribute(std::string name, const AttributeValue &v)
uint32_t GetNDevices(void) const
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
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 Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings...
double y
y coordinate of vector
static void SetSeed(uint32_t seed)
set the seed it will duplicate the seed value 6 times
NetDeviceContainer InstallUeDevice(NodeContainer c)
create a set of UE devices
Helper class used to assign positions and mobility models to nodes.
static Iterator Begin(void)
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper ...
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals...
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
void Parse(int argc, char *argv[])
Parse the program arguments.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
int main(int argc, char *argv[])
Hold a floating point type.
std::string GetFfrAlgorithmType() const
void SetAttribute(std::string name, const AttributeValue &value)
The eNodeB device implementation.
Ptr< T > GetObject(void) const
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
set an attribute for the FFR algorithm to be created
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
set an attribute for the LteEnbNetDevice to be created
The LteSpectrumPhy models the physical layer of LTE.
The LteUeNetDevice class implements the UE net device.