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> 71 static TypeId tid =
TypeId (
"ns3::RadioEnvironmentMapHelper")
75 .AddAttribute (
"ChannelPath",
"The path to the channel for which the Radio Environment Map is to be generated",
79 .AddAttribute (
"OutputFile",
"the filename to which the Radio Environment Map is saved",
83 .AddAttribute (
"XMin",
"The min x coordinate of the map.",
86 MakeDoubleChecker<double> ())
87 .AddAttribute (
"YMin",
"The min y coordinate of the map.",
90 MakeDoubleChecker<double> ())
91 .AddAttribute (
"XMax",
"The max x coordinate of the map.",
94 MakeDoubleChecker<double> ())
95 .AddAttribute (
"YMax",
"The max y coordinate of the map.",
98 MakeDoubleChecker<double> ())
99 .AddAttribute (
"XRes",
"The resolution (number of points) of the map along the x axis.",
103 .AddAttribute (
"YRes",
"The resolution (number of points) of the map along the y axis.",
107 .AddAttribute (
"Z",
"The value of the z coordinate for which the map is to be generated",
110 MakeDoubleChecker<double> ())
111 .AddAttribute (
"StopWhenDone",
"If true, Simulator::Stop () will be called as soon as the REM has been generated",
115 .AddAttribute (
"NoisePower",
116 "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",
119 MakeDoubleChecker<double> ())
120 .AddAttribute (
"MaxPointsPerIteration",
"Maximum number of REM points to be calculated per iteration. Every point consumes approximately 5KB of memory.",
124 .AddAttribute (
"Earfcn",
125 "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) " 126 "as per 3GPP 36.101 Section 5.7.3. ",
129 MakeUintegerChecker<uint16_t> ())
130 .AddAttribute (
"Bandwidth",
131 "Transmission Bandwidth Configuration (in number of RBs) over which the SINR will be calculated",
135 MakeUintegerChecker<uint16_t> ())
136 .AddAttribute (
"UseDataChannel",
137 "If true, REM will be generated for PDSCH and for PDCCH otherwise ",
141 .AddAttribute (
"RbId",
142 "Resource block Id, for which REM will be generated," 143 "default value is -1, what means REM will be averaged from all RBs",
146 MakeIntegerChecker<int32_t> ())
186 NS_FATAL_ERROR (
"only one REM supported per instance of RadioEnvironmentMapHelper");
189 if (match.
GetN () != 1)
203 double startDelay = 0.0026;
232 p.
phy = CreateObject<RemSpectrumPhy> ();
233 p.
bmm = CreateObject<ConstantPositionMobilityModel> ();
237 p.
phy->SetMobility (p.
bmm);
244 double remIterationStartTime = 0.0001;
247 uint32_t numPointsCurrentIteration = 0;
248 bool justScheduled =
false;
257 justScheduled =
false;
260 ++numPointsCurrentIteration;
266 this, xMinNext,
x, yMinNext, y);
267 remIterationStartTime += 0.001;
268 justScheduled =
true;
269 numPointsCurrentIteration = 0;
284 std::list<RemPoint>::iterator remIt =
m_rem.begin ();
289 for (y = (
x == xMin) ? yMin :
m_yMin;
294 remIt->bmm->SetPosition (Vector (
x, y,
m_z));
300 if (remIt !=
m_rem.end ())
303 NS_LOG_LOGIC (
"deactivating RemSpectrumPhys that are unneeded in the last iteration");
304 while (remIt !=
m_rem.end ())
306 remIt->phy->Deactivate ();
319 for (std::list<RemPoint>::iterator it =
m_rem.begin ();
323 if (!(it->phy->IsActive ()))
329 Vector pos = it->bmm->GetPosition ();
Generates a 2D map of the SINR from the strongest transmitter in the downlink of an LTE FDD system...
Ptr< const AttributeChecker > MakeStringChecker(void)
Smart pointer class similar to boost::intrusive_ptr.
void PrintAndReset()
Go through every listener, write the computed SINR, and then reset it.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
uint16_t m_xRes
The XRes attribute.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void DelayedInstall()
Scheduled by Install() to perform the actual generation of map.
Hold variables of type string.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
std::ofstream m_outFile
Stream the output to a file.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Ptr< MobilityModel > bmm
Position of the listener in the environment.
uint32_t m_maxPointsPerIteration
The MaxPointsPerIteration attribute.
#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)
Register this type.
Hold a signed integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void Finalize()
Called when the map generation procedure has been completed.
double m_xMax
The XMax attribute.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Ptr< Object > Get(std::size_t i) const
std::size_t GetN(void) const
bool m_stopWhenDone
The StopWhenDone attribute.
double m_yMin
The YMin attribute.
Ptr< RemSpectrumPhy > phy
Simplified listener which compute SINR over the DL channel.
uint16_t m_bandwidth
The Bandwidth attribute.
static void MakeConsistent(Ptr< MobilityModel > bmm)
Make the given mobility model consistent, by determining whether its position falls inside any of the...
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void RunOneIteration(double xMin, double xMax, double yMin, double yMax)
Mobilize all the listeners to a specified area.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Hold an unsigned integer type.
std::list< RemPoint > m_rem
List of listeners in the environment.
uint8_t GetBandwidth() const
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint8_t bandwidth)
bool m_useDataChannel
The UseDataChannel attribute.
double m_yStep
Distance along Y axis between adjacent listening points.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_yMax
The YMax attribute.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings...
void SetBandwidth(uint8_t bw)
double m_z
The Z attribute.
std::string m_channelPath
The ChannelPath attribute.
hold a set of objects which match a specific search string.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
A complete Radio Environment Map is composed of many of this structure.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual ~RadioEnvironmentMapHelper()
uint16_t m_earfcn
The Earfcn attribute.
MatchContainer LookupMatches(std::string path)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Ptr< SpectrumChannel > m_channel
The channel object taken from the ChannelPath attribute.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time Seconds(double value)
Construct a Time in the indicated unit.
Defines the interface for spectrum-aware channel implementations.
uint16_t m_yRes
The YRes attribute.
RadioEnvironmentMapHelper()
int32_t m_rbId
The RbId attribute.
A base class which provides memory management and object aggregation.
std::string m_outputFile
The OutputFile attribute.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double m_xStep
Distance along X axis between adjacent listening points.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
virtual void DoDispose(void)
Destructor implementation.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
double m_noisePower
The NoisePower attribute.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double m_xMin
The XMin attribute.