|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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/pointer.h>
32 #include <ns3/spectrum-channel.h>
33 #include <ns3/config.h>
34 #include <ns3/rem-spectrum-phy.h>
35 #include <ns3/mobility-building-info.h>
36 #include <ns3/constant-position-mobility-model.h>
37 #include <ns3/simulator.h>
39 #include <ns3/buildings-helper.h>
40 #include <ns3/lte-spectrum-value-helper.h>
72 static TypeId tid =
TypeId (
"ns3::RadioEnvironmentMapHelper")
76 .AddAttribute (
"Channel",
77 "The DL spectrum channel for which the RadioEnvironment Map is to be generated. "
78 "Alternatively ChannelPath attribute can be used."
79 "Only one of the two (Channel or ChannelPath) should be set.",
82 MakePointerChecker<SpectrumChannel> ())
83 .AddAttribute (
"ChannelPath",
"The path to the channel for which the Radio Environment Map is to be generated."
84 "This attribute is an alternative to Channel attribute and is only used if Channel is not set (equal to nullptr). "
85 "Only one of the two (Channel or ChannelPath) should be set.",
89 .AddAttribute (
"OutputFile",
"the filename to which the Radio Environment Map is saved",
93 .AddAttribute (
"XMin",
"The min x coordinate of the map.",
96 MakeDoubleChecker<double> ())
97 .AddAttribute (
"YMin",
"The min y coordinate of the map.",
100 MakeDoubleChecker<double> ())
101 .AddAttribute (
"XMax",
"The max x coordinate of the map.",
104 MakeDoubleChecker<double> ())
105 .AddAttribute (
"YMax",
"The max y coordinate of the map.",
108 MakeDoubleChecker<double> ())
109 .AddAttribute (
"XRes",
"The resolution (number of points) of the map along the x axis.",
113 .AddAttribute (
"YRes",
"The resolution (number of points) of the map along the y axis.",
117 .AddAttribute (
"Z",
"The value of the z coordinate for which the map is to be generated",
120 MakeDoubleChecker<double> ())
121 .AddAttribute (
"StopWhenDone",
"If true, Simulator::Stop () will be called as soon as the REM has been generated",
125 .AddAttribute (
"NoisePower",
126 "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",
129 MakeDoubleChecker<double> ())
130 .AddAttribute (
"MaxPointsPerIteration",
"Maximum number of REM points to be calculated per iteration. Every point consumes approximately 5KB of memory.",
134 .AddAttribute (
"Earfcn",
135 "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
136 "as per 3GPP 36.101 Section 5.7.3. ",
139 MakeUintegerChecker<uint16_t> ())
140 .AddAttribute (
"Bandwidth",
141 "Transmission Bandwidth Configuration (in number of RBs) over which the SINR will be calculated",
145 MakeUintegerChecker<uint16_t> ())
146 .AddAttribute (
"UseDataChannel",
147 "If true, REM will be generated for PDSCH and for PDCCH otherwise ",
151 .AddAttribute (
"RbId",
152 "Resource block Id, for which REM will be generated,"
153 "default value is -1, what means REM will be averaged from all RBs",
156 MakeIntegerChecker<int32_t> ())
196 NS_FATAL_ERROR (
"only one REM supported per instance of RadioEnvironmentMapHelper");
202 if (match.
GetN () != 1)
217 double startDelay = 0.0026;
246 p.
phy = CreateObject<RemSpectrumPhy> ();
247 p.
bmm = CreateObject<ConstantPositionMobilityModel> ();
251 p.
phy->SetMobility (p.
bmm);
258 double remIterationStartTime = 0.0001;
261 uint32_t numPointsCurrentIteration = 0;
262 bool justScheduled =
false;
271 justScheduled =
false;
274 ++numPointsCurrentIteration;
280 this, xMinNext,
x, yMinNext, y);
281 remIterationStartTime += 0.001;
282 justScheduled =
true;
283 numPointsCurrentIteration = 0;
298 std::list<RemPoint>::iterator remIt =
m_rem.begin ();
303 for (y = (
x == xMin) ? yMin :
m_yMin;
308 remIt->bmm->SetPosition (Vector (
x, y,
m_z));
310 buildingInfo->MakeConsistent (remIt->bmm);
315 if (remIt !=
m_rem.end ())
318 NS_LOG_LOGIC (
"deactivating RemSpectrumPhys that are unneeded in the last iteration");
319 while (remIt !=
m_rem.end ())
321 remIt->phy->Deactivate ();
334 for (std::list<RemPoint>::iterator it =
m_rem.begin ();
338 if (!(it->phy->IsActive ()))
344 Vector pos = it->bmm->GetPosition ();
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
AttributeValue implementation for Boolean.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Defines the interface for spectrum-aware channel implementations.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void PrintAndReset()
Go through every listener, write the computed SINR, and then reset it.
uint16_t GetBandwidth() const
Hold a signed integer type.
virtual void DoDispose(void)
Destructor implementation.
bool m_stopWhenDone
The StopWhenDone attribute.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
double m_xMin
The XMin attribute.
uint16_t m_bandwidth
The Bandwidth attribute.
double m_yMax
The YMax attribute.
Ptr< MobilityModel > bmm
Position of the listener in the environment.
bool m_useDataChannel
The UseDataChannel attribute.
Hold objects of type Ptr<T>.
std::string m_channelPath
The ChannelPath attribute.
MatchContainer LookupMatches(std::string path)
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
hold a set of objects which match a specific search string.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void DelayedInstall()
Scheduled by Install() to perform the actual generation of map.
double m_yMin
The YMin attribute.
Ptr< SpectrumChannel > m_channel
The Channel attribute, which is a direct pointer to the DL channel object for which will be created t...
void RunOneIteration(double xMin, double xMax, double yMin, double yMax)
Mobilize all the listeners to a specified area.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
A complete Radio Environment Map is composed of many of this structure.
uint16_t m_xRes
The XRes attribute.
A base class which provides memory management and object aggregation.
double m_xStep
Distance along X axis between adjacent listening points.
Generates a 2D map of the SINR from the strongest transmitter in the downlink of an LTE FDD system.
std::list< RemPoint > m_rem
List of listeners in the environment.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void SetBandwidth(uint16_t bw)
Ptr< const AttributeChecker > MakeBooleanChecker(void)
uint32_t m_maxPointsPerIteration
The MaxPointsPerIteration attribute.
double m_xMax
The XMax attribute.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Hold variables of type string.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
std::size_t GetN(void) const
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
Time Seconds(double value)
Construct a Time in the indicated unit.
static TypeId GetTypeId(void)
Register this type.
Ptr< Object > Get(std::size_t i) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
uint16_t m_earfcn
The Earfcn attribute.
void Finalize()
Called when the map generation procedure has been completed.
Ptr< const AttributeChecker > MakeStringChecker(void)
double m_z
The Z attribute.
Hold an unsigned integer type.
virtual ~RadioEnvironmentMapHelper()
std::string m_outputFile
The OutputFile attribute.
uint16_t m_yRes
The YRes attribute.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings.
int32_t m_rbId
The RbId attribute.
Ptr< RemSpectrumPhy > phy
Simplified listener which compute SINR over the DL channel.
double m_yStep
Distance along Y axis between adjacent listening points.
RadioEnvironmentMapHelper()
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_noisePower
The NoisePower attribute.
std::ofstream m_outFile
Stream the output to a file.