|   | A Discrete-Event Network Simulator | API | 
	  
	
	
       
 
Go to the documentation of this file.
   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   uint16_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));   
 
  163   mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
 
  164   mobility.SetPositionAllocator (enbPositionAlloc);
 
  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));  
 
  172   mobility.SetPositionAllocator (edgeUePositionAlloc);
 
  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));      
 
  180   mobility.SetPositionAllocator (centerUePositionAlloc);
 
  197   mobility.SetPositionAllocator (randomUePositionAlloc);
 
  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");
 
  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));          
 
  353       mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
 
  354       mobility.SetPositionAllocator (positionAlloc);
 
  355       mobility.Install (spectrumAnalyzerNodes);
 
  360       spectrumAnalyzerHelper.
SetChannel (dlChannel);
 
  365       spectrumAnalyzerHelper.
EnableAsciiAll (
"spectrum-analyzer-output");
 
  366       spectrumAnalyzerHelper.
Install (spectrumAnalyzerNodes);
 
  375       remHelper = CreateObject<RadioEnvironmentMapHelper> ();
 
  
 
holds a vector of ns3::NetDevice pointers
static Vector GetPosition(Ptr< Node > node)
void SetPhyAttribute(std::string name, const AttributeValue &v)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Parse command-line arguments.
void Add(Vector v)
Add a position to the list of positions.
AttributeValue implementation for Boolean.
uint16_t GetCellId() const
static Iterator Begin(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The LteSpectrumPhy models the physical layer of LTE.
double zMin
The z coordinate of the down bound of the box.
Hold a signed integer type.
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
double xMin
The x coordinate of the left bound of the box.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
NetDeviceContainer Install(NodeContainer c) const
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...
Hold objects of type Ptr<T>.
void PrintGnuplottableUeListToFile(std::string filename)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint64_t GetImsi() const
Get the IMSI.
double yMin
The y coordinate of the bottom bound of the box.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold variables of type enum.
static void SetRun(uint64_t run)
Set the run number of simulation.
std::string GetFfrAlgorithmType() const
void PrintGnuplottableEnbListToFile(std::string filename)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Class to allow the Spectrum Analysis.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
The LteUeNetDevice class implements the UE net device.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
static void SetSeed(uint32_t seed)
Set the seed.
double zMax
The z coordinate of the up bound of the box.
static void Run(void)
Run the simulation.
Hold variables of type string.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
static Iterator End(void)
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals.
This class contains the specification of EPS Bearers.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Time Seconds(double value)
Construct a Time in the indicated unit.
@ GBR_CONV_VOICE
GBR Conversational Voice.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void SetFfrAlgorithmType(std::string type)
Set the type of FFR algorithm to be used by eNodeB devices.
AttributeValue implementation for Time.
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
Ptr< Object > GetObject(void) const
Get the Object referenced by the PointerValue.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
uint32_t GetNDevices(void) const
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Ptr< SpectrumChannel > GetChannel()
double xMax
The x coordinate of the right bound of the box.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
The eNodeB device implementation.
Helper class used to assign positions and mobility models to nodes.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
double yMax
The y coordinate of the top bound of the box.