24 #include <ns3/abort.h> 
   26 #include <ns3/double.h> 
   27 #include <ns3/integer.h> 
   28 #include <ns3/uinteger.h> 
   29 #include <ns3/string.h> 
   30 #include <ns3/boolean.h> 
   31 #include <ns3/spectrum-channel.h> 
   32 #include <ns3/config.h> 
   33 #include <ns3/rem-spectrum-phy.h> 
   34 #include <ns3/mobility-building-info.h> 
   35 #include <ns3/constant-position-mobility-model.h> 
   36 #include <ns3/simulator.h> 
   38 #include <ns3/buildings-helper.h> 
   39 #include <ns3/lte-spectrum-value-helper.h> 
   73   static TypeId tid = 
TypeId (
"ns3::RadioEnvironmentMapHelper")
 
   75     .AddConstructor<RadioEnvironmentMapHelper> ()
 
   76     .AddAttribute (
"ChannelPath", 
"The path to the channel for which the Radio Environment Map is to be generated",
 
   80     .AddAttribute (
"OutputFile", 
"the filename to which the Radio Environment Map is saved",
 
   84     .AddAttribute (
"XMin", 
"The min x coordinate of the map.",
 
   87                    MakeDoubleChecker<double> ())
 
   88     .AddAttribute (
"YMin", 
"The min y coordinate of the map.",
 
   91                    MakeDoubleChecker<double> ())
 
   92    .AddAttribute (
"XMax", 
"The max x coordinate of the map.",
 
   95                    MakeDoubleChecker<double> ())
 
   96     .AddAttribute (
"YMax", 
"The max y coordinate of the map.",
 
   99                    MakeDoubleChecker<double> ())
 
  100    .AddAttribute (
"XRes", 
"The resolution (number of points) of the map along the x axis.",
 
  103                   MakeUintegerChecker<uint32_t> (2,std::numeric_limits<uint16_t>::max ()))
 
  104     .AddAttribute (
"YRes", 
"The resolution (number of points) of the map along the y axis.",
 
  107                    MakeUintegerChecker<uint16_t> (2,std::numeric_limits<uint16_t>::max ()))
 
  108     .AddAttribute (
"Z", 
"The value of the z coordinate for which the map is to be generated",
 
  111                    MakeDoubleChecker<double> ())
 
  112     .AddAttribute (
"StopWhenDone", 
"If true, Simulator::Stop () will be called as soon as the REM has been generated",
 
  115                    MakeBooleanChecker ())
 
  116     .AddAttribute (
"NoisePower",
 
  117                    "the power of the measuring instrument noise, in Watts. Default to a kT of -174 dBm with a noise figure of 9 dB and a bandwidth of 25 LTE Resource Blocks",
 
  120                    MakeDoubleChecker<double> ())
 
  121     .AddAttribute (
"MaxPointsPerIteration", 
"Maximum number of REM points to be calculated per iteration. Every point consumes approximately 5KB of memory.",
 
  124                    MakeUintegerChecker<uint32_t> (1,std::numeric_limits<uint32_t>::max ()))
 
  125     .AddAttribute (
"Earfcn",
 
  126                    "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) " 
  127                    "as per 3GPP 36.101 Section 5.7.3. ",
 
  130                    MakeUintegerChecker<uint16_t> ())
 
  131     .AddAttribute (
"Bandwidth",
 
  132                    "Transmission Bandwidth Configuration (in number of RBs) over which the SINR will be calculated",
 
  136                    MakeUintegerChecker<uint16_t> ())
 
  137     .AddAttribute (
"UseDataChannel",
 
  138                    "If true, REM will be generated for PDSCH and for PDCCH otherwise ",
 
  141                    MakeBooleanChecker ())
 
  142     .AddAttribute (
"RbId",
 
  143                    "Resource block Id, for which REM will be generated," 
  144                    "default value is -1, what means REM will be averaged from all RBs",
 
  147                    MakeIntegerChecker<int32_t> ())
 
  187       NS_FATAL_ERROR (
"only one REM supported per instance of RadioEnvironmentMapHelper");
 
  190   if (match.
GetN () != 1)
 
  204   double startDelay = 0.0026;
 
  233       p.
phy = CreateObject<RemSpectrumPhy> ();
 
  234       p.
bmm = CreateObject<ConstantPositionMobilityModel> ();
 
  238       p.
phy->SetMobility (p.
bmm);
 
  245   double remIterationStartTime = 0.0001;
 
  248   uint32_t numPointsCurrentIteration = 0;
 
  249   bool justScheduled = 
false;
 
  258               justScheduled = 
false;
 
  261           ++numPointsCurrentIteration;
 
  262           if ((numPointsCurrentIteration == m_maxPointsPerIteration)
 
  267                                    this, xMinNext, 
x, yMinNext, y);
 
  268               remIterationStartTime += 0.001;
 
  269               justScheduled = 
true;
 
  270               numPointsCurrentIteration = 0;
 
  285   std::list<RemPoint>::iterator remIt = 
m_rem.begin ();
 
  290       for (y = (x == xMin) ? yMin : 
m_yMin;
 
  295           remIt->bmm->SetPosition (
Vector (x, y, 
m_z));
 
  301   if (remIt != 
m_rem.end ())
 
  304       NS_LOG_LOGIC (
"deactivating RemSpectrumPhys that are unneeded in the last iteration");
 
  305       while (remIt != 
m_rem.end ())
 
  307           remIt->phy->Deactivate ();
 
  320   for (std::list<RemPoint>::iterator it = 
m_rem.begin ();
 
  324       if (!(it->phy->IsActive ()))
 
  330       Vector pos = it->bmm->GetPosition ();
 
double x
x coordinate of vector 
smart pointer class similar to boost::intrusive_ptr 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory. 
hold variables of type string 
uint32_t m_maxPointsPerIteration
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
static TypeId GetTypeId(void)
Hold a signed integer type. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
#define NS_FATAL_ERROR(msg)
fatal error handling 
static Ptr< SpectrumModel > GetSpectrumModel(uint16_t earfcn, uint8_t bandwidth)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached. 
Ptr< RemSpectrumPhy > phy
static void MakeConsistent(Ptr< MobilityModel > bmm)
Make the given mobility model consistent, by determining whether its position falls inside any of the...
Config::MatchContainer LookupMatches(std::string path)
void RunOneIteration(double xMin, double xMax, double yMin, double yMax)
Hold an unsigned integer type. 
uint8_t GetBandwidth() const 
std::list< RemPoint > m_rem
void AggregateObject(Ptr< Object > other)
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC. 
uint32_t GetN(void) const 
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings...
void SetBandwidth(uint8_t bw)
Ptr< Object > Get(uint32_t i) const 
double y
y coordinate of vector 
std::string m_channelPath
hold a set of objects which match a specific search string. 
virtual ~RadioEnvironmentMapHelper()
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true. 
Ptr< SpectrumChannel > m_channel
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Time Seconds(double value)
Construct a Time in the indicated unit. 
Defines the interface for spectrum-aware channel implementations. 
RadioEnvironmentMapHelper()
a base class which provides memory management and object aggregation 
Hold a floating point type. 
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Ptr< T > GetObject(void) const 
a unique identifier for an interface. 
TypeId SetParent(TypeId tid)
double z
z coordinate of vector