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/buildings-mobility-model.h>
34 #include <ns3/simulator.h>
36 #include <ns3/buildings-helper.h>
37 #include <ns3/lte-spectrum-value-helper.h>
71 static TypeId tid =
TypeId (
"ns3::RadioEnvironmentMapHelper")
73 .AddConstructor<RadioEnvironmentMapHelper> ()
74 .AddAttribute (
"ChannelPath",
"The path to the channel for which the Radio Environment Map is to be generated",
78 .AddAttribute (
"OutputFile",
"the filename to which the Radio Environment Map is saved",
82 .AddAttribute (
"XMin",
"The min x coordinate of the map.",
85 MakeDoubleChecker<double> ())
86 .AddAttribute (
"YMin",
"The min y coordinate of the map.",
89 MakeDoubleChecker<double> ())
90 .AddAttribute (
"XMax",
"The max x coordinate of the map.",
93 MakeDoubleChecker<double> ())
94 .AddAttribute (
"YMax",
"The max y coordinate of the map.",
97 MakeDoubleChecker<double> ())
98 .AddAttribute (
"XRes",
"The resolution (number of points) of the map along the x axis.",
101 MakeUintegerChecker<uint32_t> (2,std::numeric_limits<uint16_t>::max ()))
102 .AddAttribute (
"YRes",
"The resolution (number of points) of the map along the y axis.",
105 MakeUintegerChecker<uint16_t> (2,std::numeric_limits<uint16_t>::max ()))
106 .AddAttribute (
"Z",
"The value of the z coordinate for which the map is to be generated",
109 MakeDoubleChecker<double> ())
110 .AddAttribute (
"StopWhenDone",
"If true, Simulator::Stop () will be called as soon as the REM has been generated",
113 MakeBooleanChecker ())
114 .AddAttribute (
"NoisePower",
115 "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",
118 MakeDoubleChecker<double> ())
119 .AddAttribute (
"MaxPointsPerIteration",
"Maximum number of REM points to be calculated per iteration. Every point consumes approximately 5KB of memory.",
122 MakeUintegerChecker<uint32_t> (1,std::numeric_limits<uint32_t>::max ()))
123 .AddAttribute (
"Earfcn",
124 "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
125 "as per 3GPP 36.101 Section 5.7.3. ",
128 MakeUintegerChecker<uint16_t> ())
129 .AddAttribute (
"Bandwidth",
130 "Transmission Bandwidth Configuration (in number of RBs) over which the SINR will be calculated",
134 MakeUintegerChecker<uint16_t> ())
174 NS_FATAL_ERROR (
"only one REM supported per instance of RadioEnvironmentMapHelper");
177 if (match.
GetN () != 1)
212 p.
phy = CreateObject<RemSpectrumPhy> ();
213 p.
bmm = CreateObject<BuildingsMobilityModel> ();
220 double remIterationStartTime = 0.0001;
223 uint32_t numPointsCurrentIteration = 0;
224 bool justScheduled =
false;
233 justScheduled =
false;
236 ++numPointsCurrentIteration;
237 if ((numPointsCurrentIteration == m_maxPointsPerIteration)
242 this, xMinNext,
x, yMinNext, y);
243 remIterationStartTime += 0.001;
244 justScheduled =
true;
245 numPointsCurrentIteration = 0;
259 std::list<RemPoint>::iterator remIt =
m_rem.begin ();
264 for (y = (x == xMin) ? yMin :
m_yMin;
269 remIt->bmm->SetPosition (
Vector (x, y,
m_z));
275 if (remIt !=
m_rem.end ())
278 NS_LOG_LOGIC (
"deactivating RemSpectrumPhys that are unneeded in the last iteration");
279 while (remIt !=
m_rem.end ())
281 remIt->phy->Deactivate ();
294 for (std::list<RemPoint>::iterator it =
m_rem.begin ();
298 if (!(it->phy->IsActive ()))
304 Vector pos = it->bmm->GetPosition ();