24 #include <ns3/abort.h>
26 #include <ns3/double.h>
27 #include <ns3/uinteger.h>
28 #include <ns3/string.h>
29 #include <ns3/boolean.h>
30 #include <ns3/spectrum-channel.h>
31 #include <ns3/config.h>
32 #include <ns3/rem-spectrum-phy.h>
33 #include <ns3/mobility-building-info.h>
34 #include <ns3/constant-position-mobility-model.h>
35 #include <ns3/simulator.h>
37 #include <ns3/buildings-helper.h>
38 #include <ns3/lte-spectrum-value-helper.h>
72 static TypeId tid =
TypeId (
"ns3::RadioEnvironmentMapHelper")
74 .AddConstructor<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.",
102 MakeUintegerChecker<uint32_t> (2,std::numeric_limits<uint16_t>::max ()))
103 .AddAttribute (
"YRes",
"The resolution (number of points) of the map along the y axis.",
106 MakeUintegerChecker<uint16_t> (2,std::numeric_limits<uint16_t>::max ()))
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",
114 MakeBooleanChecker ())
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.",
123 MakeUintegerChecker<uint32_t> (1,std::numeric_limits<uint32_t>::max ()))
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> ())
175 NS_FATAL_ERROR (
"only one REM supported per instance of RadioEnvironmentMapHelper");
178 if (match.
GetN () != 1)
213 p.
phy = CreateObject<RemSpectrumPhy> ();
214 p.
bmm = CreateObject<ConstantPositionMobilityModel> ();
223 double remIterationStartTime = 0.0001;
226 uint32_t numPointsCurrentIteration = 0;
227 bool justScheduled =
false;
236 justScheduled =
false;
239 ++numPointsCurrentIteration;
240 if ((numPointsCurrentIteration == m_maxPointsPerIteration)
245 this, xMinNext,
x, yMinNext, y);
246 remIterationStartTime += 0.001;
247 justScheduled =
true;
248 numPointsCurrentIteration = 0;
262 std::list<RemPoint>::iterator remIt =
m_rem.begin ();
267 for (y = (x == xMin) ? yMin :
m_yMin;
272 remIt->bmm->SetPosition (
Vector (x, y,
m_z));
278 if (remIt !=
m_rem.end ())
281 NS_LOG_LOGIC (
"deactivating RemSpectrumPhys that are unneeded in the last iteration");
282 while (remIt !=
m_rem.end ())
284 remIt->phy->Deactivate ();
297 for (std::list<RemPoint>::iterator it =
m_rem.begin ();
301 if (!(it->phy->IsActive ()))
307 Vector pos = it->bmm->GetPosition ();