12#include <ns3/boolean.h>
13#include <ns3/buildings-helper.h>
14#include <ns3/config.h>
15#include <ns3/constant-position-mobility-model.h>
16#include <ns3/double.h>
17#include <ns3/integer.h>
19#include <ns3/lte-spectrum-value-helper.h>
20#include <ns3/mobility-building-info.h>
22#include <ns3/pointer.h>
23#include <ns3/rem-spectrum-phy.h>
24#include <ns3/simulator.h>
25#include <ns3/spectrum-channel.h>
26#include <ns3/string.h>
27#include <ns3/uinteger.h>
58 TypeId(
"ns3::RadioEnvironmentMapHelper")
64 "The DL spectrum channel for which the RadioEnvironment Map is to be generated. "
65 "Alternatively ChannelPath attribute can be used."
66 "Only one of the two (Channel or ChannelPath) should be set.",
72 "The path to the channel for which the Radio Environment Map is to be generated."
73 "This attribute is an alternative to Channel attribute and is only used if Channel "
74 "is not set (equal to nullptr). "
75 "Only one of the two (Channel or ChannelPath) should be set.",
79 .AddAttribute(
"OutputFile",
80 "the filename to which the Radio Environment Map is saved",
85 "The min x coordinate of the map.",
90 "The min y coordinate of the map.",
95 "The max x coordinate of the map.",
100 "The max y coordinate of the map.",
104 .AddAttribute(
"XRes",
105 "The resolution (number of points) of the map along the x axis.",
109 .AddAttribute(
"YRes",
110 "The resolution (number of points) of the map along the y axis.",
115 "The value of the z coordinate for which the map is to be generated",
121 "If true, Simulator::Stop () will be called as soon as the REM has been generated",
127 "the power of the measuring instrument noise, in Watts. Default to a kT of -174 "
128 "dBm with a noise figure of 9 dB and a bandwidth of 25 LTE Resource Blocks",
132 .AddAttribute(
"MaxPointsPerIteration",
133 "Maximum number of REM points to be calculated per iteration. Every "
134 "point consumes approximately 5KB of memory.",
138 .AddAttribute(
"Earfcn",
139 "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
140 "as per 3GPP 36.101 Section 5.7.3.",
144 .AddAttribute(
"Bandwidth",
145 "Transmission Bandwidth Configuration (in number of RBs) over which the "
146 "SINR will be calculated",
151 .AddAttribute(
"UseDataChannel",
152 "If true, REM will be generated for PDSCH and for PDCCH otherwise",
156 .AddAttribute(
"RbId",
157 "Resource block Id, for which REM will be generated, "
158 "default value is -1, what means REM will be averaged from all RBs",
197 NS_FATAL_ERROR(
"only one REM supported per instance of RadioEnvironmentMapHelper");
203 if (match.
GetN() != 1)
209 "object at " <<
m_channelPath <<
" is not of type SpectrumChannel");
219 double startDelay = 0.0026;
248 p.
bmm->AggregateObject(buildingInfo);
250 p.
phy->SetMobility(p.
bmm);
257 double remIterationStartTime = 0.0001;
260 uint32_t numPointsCurrentIteration = 0;
261 bool justScheduled =
false;
270 justScheduled =
false;
273 ++numPointsCurrentIteration;
284 remIterationStartTime += 0.001;
285 justScheduled =
true;
286 numPointsCurrentIteration = 0;
298 auto remIt =
m_rem.begin();
307 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 (
auto it =
m_rem.begin(); it !=
m_rem.end(); ++it)
336 if (!(it->phy->IsActive()))
342 Vector pos = it->bmm->GetPosition();
343 NS_LOG_LOGIC(
"output: " << pos.x <<
"\t" << pos.y <<
"\t" << pos.z <<
"\t"
345 m_outFile << pos.x <<
"\t" << pos.y <<
"\t" << pos.z <<
"\t"
hold a set of objects which match a specific search string.
Ptr< Object > Get(std::size_t i) const
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold a signed integer type.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
A base class which provides memory management and object aggregation.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Generates a 2D map of the SINR from the strongest transmitter in the downlink of an LTE FDD system.
~RadioEnvironmentMapHelper() override
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings.
uint16_t m_yRes
The YRes attribute.
static TypeId GetTypeId()
Register this type.
uint16_t m_xRes
The XRes attribute.
std::list< RemPoint > m_rem
List of listeners in the environment.
int32_t m_rbId
The RbId attribute.
Ptr< SpectrumChannel > m_channel
The Channel attribute, which is a direct pointer to the DL channel object for which will be created t...
std::ofstream m_outFile
Stream the output to a file.
bool m_useDataChannel
The UseDataChannel attribute.
double m_z
The Z attribute.
std::string m_outputFile
The OutputFile attribute.
double m_noisePower
The NoisePower attribute.
RadioEnvironmentMapHelper()
void SetBandwidth(uint16_t bw)
double m_yMin
The YMin attribute.
void Finalize()
Called when the map generation procedure has been completed.
void DoDispose() override
Destructor implementation.
uint16_t m_earfcn
The Earfcn attribute.
double m_xMax
The XMax attribute.
uint32_t m_maxPointsPerIteration
The MaxPointsPerIteration attribute.
double m_xStep
Distance along X axis between adjacent listening points.
void DelayedInstall()
Scheduled by Install() to perform the actual generation of map.
std::string m_channelPath
The ChannelPath attribute.
void PrintAndReset()
Go through every listener, write the computed SINR, and then reset it.
double m_xMin
The XMin attribute.
uint16_t m_bandwidth
The Bandwidth attribute.
uint16_t GetBandwidth() const
void RunOneIteration(double xMin, double xMax, double yMin, double yMax)
Mobilize all the listeners to a specified area.
double m_yStep
Distance along Y axis between adjacent listening points.
double m_yMax
The YMax attribute.
bool m_stopWhenDone
The StopWhenDone attribute.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Defines the interface for spectrum-aware channel implementations.
Hold variables of type string.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
MatchContainer LookupMatches(std::string path)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeIntegerChecker()
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
A complete Radio Environment Map is composed of many of this structure.
Ptr< RemSpectrumPhy > phy
Simplified listener which compute SINR over the DL channel.
Ptr< MobilityModel > bmm
Position of the listener in the environment.