22 #include "ns3/double.h" 23 #include "ns3/mobility-model.h" 26 #include "ns3/simulator.h" 27 #include "ns3/string.h" 40 .SetGroupName (
"Propagation")
128 if (cond == ChannelCondition::LosConditionValue::LOS)
132 else if (cond == ChannelCondition::LosConditionValue::NLOS)
136 else if (cond == ChannelCondition::LosConditionValue::NLOSv)
150 static TypeId tid =
TypeId (
"ns3::ChannelConditionModel")
152 .SetGroupName (
"Propagation")
170 static TypeId tid =
TypeId (
"ns3::AlwaysLosChannelConditionModel")
172 .SetGroupName (
"Propagation")
209 static TypeId tid =
TypeId (
"ns3::NeverLosChannelConditionModel")
211 .SetGroupName (
"Propagation")
248 static TypeId tid =
TypeId (
"ns3::NeverLosVehicleChannelConditionModel")
250 .SetGroupName (
"Propagation")
285 static TypeId tid =
TypeId (
"ns3::ThreeGppChannelConditionModel")
287 .SetGroupName (
"Propagation")
288 .AddAttribute (
"UpdatePeriod",
"Specifies the time period after which the channel condition is recomputed. If set to 0, the channel condition is never updated.",
320 uint32_t key =
GetKey (a, b);
322 bool notFound =
false;
329 NS_LOG_DEBUG (
"found the channel condition in the map");
330 cond = mapItem->second.m_condition;
347 if (notFound || update)
375 NS_LOG_DEBUG (
"pRef " << pRef <<
" pLos " << pLos <<
" pNlos " << pNlos);
381 cond->SetLosCondition (ChannelCondition::LosConditionValue::LOS);
383 else if (pRef <= pLos + pNlos)
386 cond->SetLosCondition (ChannelCondition::LosConditionValue::NLOS);
391 cond->SetLosCondition (ChannelCondition::LosConditionValue::NLOSv);
416 double x = a.x - b.x;
417 double y = a.y - b.y;
418 double distance2D = sqrt (
x *
x + y * y);
432 uint32_t key = (((x1 + x2) * (x1 + x2 + 1)) / 2) + x2;
444 static TypeId tid =
TypeId (
"ns3::ThreeGppRmaChannelConditionModel")
446 .SetGroupName (
"Propagation")
471 if (distance2D <= 10.0)
477 pLos = exp (-(distance2D - 10.0) / 1000.0);
490 static TypeId tid =
TypeId (
"ns3::ThreeGppUmaChannelConditionModel")
492 .SetGroupName (
"Propagation")
513 double h_UT =
std::min (a->GetPosition ().z, b->GetPosition ().z);
516 NS_LOG_WARN (
"The height of the UT should be smaller than 23 m (see TR 38.901, Table 7.4.2-1)");
520 double h_BS =
std::max (a->GetPosition ().z, b->GetPosition ().z);
523 NS_LOG_WARN (
"The LOS probability was derived assuming BS antenna heights of 25 m (see TR 38.901, Table 7.4.2-1)");
528 if (distance2D <= 18.0)
542 c = pow ((h_UT - 13.0) / 10.0, 1.5);
545 pLos = (18.0 / distance2D + exp (-distance2D / 63.0) * (1.0 - 18.0 / distance2D)) * (1.0 + c * 5.0 / 4.0 * pow (distance2D / 100.0, 3.0) * exp (-distance2D / 150.0));
558 static TypeId tid =
TypeId (
"ns3::ThreeGppUmiStreetCanyonChannelConditionModel")
560 .SetGroupName (
"Propagation")
585 if (a->GetPosition ().z != 10.0 && b->GetPosition ().z != 10.0)
587 NS_LOG_WARN (
"The LOS probability was derived assuming BS antenna heights of 10 m (see TR 38.901, Table 7.4.2-1)");
592 if (distance2D <= 18.0)
598 pLos = 18.0 / distance2D + exp (-distance2D / 36.0) * (1.0 - 18.0 / distance2D);
611 static TypeId tid =
TypeId (
"ns3::ThreeGppIndoorMixedOfficeChannelConditionModel")
613 .SetGroupName (
"Propagation")
637 double h_BS =
std::max (a->GetPosition ().z, b->GetPosition ().z);
640 NS_LOG_WARN (
"The LOS probability was derived assuming BS antenna heights of 3 m (see TR 38.901, Table 7.4.2-1)");
645 if (distance2D <= 1.2)
649 else if (distance2D > 1.2 && distance2D < 6.5)
651 pLos = exp (-(distance2D - 1.2) / 4.7);
655 pLos = exp (-(distance2D - 6.5) / 32.6) * 0.32;
668 static TypeId tid =
TypeId (
"ns3::ThreeGppIndoorOpenOfficeChannelConditionModel")
670 .SetGroupName (
"Propagation")
694 double h_BS =
std::max (a->GetPosition ().z, b->GetPosition ().z);
697 NS_LOG_WARN (
"The LOS probability was derived assuming BS antenna heights of 3 m (see TR 38.901, Table 7.4.2-1)");
702 if (distance2D <= 5.0)
706 else if (distance2D > 5.0 && distance2D <= 49.0)
708 pLos = exp (-(distance2D - 5.0) / 70.8);
712 pLos = exp (-(distance2D - 49.0) / 211.7) * 0.54;
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Compute the LOS probability.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
bool IsO2i() const
Return true if the channel is outdoor-to-indoor.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Models the channel condition.
uint32_t GetId(void) const
virtual ~NeverLosVehicleChannelConditionModel()
Destructor.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual ~ThreeGppIndoorOpenOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
LosConditionValue m_losCondition
contains the information about the LOS state of the channel
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMi-Street Canyon...
Struct to store the channel condition in the m_channelConditionMap.
ThreeGppChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
void SetO2iCondition(O2iConditionValue o2iCondition)
Set the O2iConditionValue contaning the information about the O2I state of the channel.
static TypeId GetTypeId(void)
Get the type ID.
bool IsLos() const
Return true if the channel condition is LOS.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always non-LoS.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
std::unordered_map< uint32_t, Item > m_channelConditionMap
map to store the channel conditions
virtual ~ChannelConditionModel()
Destructor for the ChannelConditionModel class.
#define NS_UNUSED(x)
Mark a local variable as unused.
bool IsNlosv() const
Return true if the channel condition is NLOSv.
ThreeGppUmiStreetCanyonChannelConditionModel()
Constructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel...
Ptr< UniformRandomVariable > m_uniformVar
uniform random variable
ThreeGppIndoorOpenOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
static uint32_t GetKey(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b)
Returns a unique and reciprocal key for the channel between a and b.
virtual ~ThreeGppIndoorMixedOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
ThreeGppUmaChannelConditionModel()
Constructor for the ThreeGppUmaChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
static TypeId GetTypeId(void)
Get the type ID.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
virtual ~AlwaysLosChannelConditionModel()
Destructor.
bool IsZero(void) const
Exactly equivalent to t == 0.
virtual ~ThreeGppUmiStreetCanyonChannelConditionModel() override
Destructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
AttributeValue implementation for Time.
Ptr< ChannelCondition > m_condition
the channel condition
static TypeId GetTypeId(void)
Get the type ID.
ThreeGppIndoorMixedOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
Base class for the 3GPP channel condition models.
bool IsNlos() const
Return true if the channel condition is NLOS.
Computes the channel condition for the RMa scenario.
Computes the channel condition for the UMa scenario.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the RMa scenario...
virtual ~ThreeGppRmaChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always LoS.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Computes the channel condition for the Indoor Mixed Office scenario.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Mixed Offi...
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Open Offic...
Computes the channel condition for the Indoor Open Office scenario.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
static TypeId GetTypeId(void)
Get the type ID.
virtual ~ChannelCondition()
Destructor for the ChannelCondition class.
static TypeId GetTypeId(void)
Get the type ID.
NeverLosVehicleChannelConditionModel()
Constructor.
virtual void DoDispose() override
Destructor implementation.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static TypeId GetTypeId(void)
Get the type ID.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Compute the NLOS probability.
static Time Now(void)
Return the current simulation virtual time.
bool IsEqual(Ptr< const ChannelCondition > otherCondition) const
Return true if this instance is equivalent to the one passed as argument.
ChannelConditionModel()
Constructor for the ChannelConditionModel class.
Time m_updatePeriod
the update period for the channel condition
ThreeGppRmaChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
O2iConditionValue
Possible values for Outdoor to Indoor condition.
virtual ~NeverLosChannelConditionModel()
Destructor.
void SetLosCondition(LosConditionValue losCondition)
Set the LosConditionValue with the information about the LOS/NLOS state of the channel.
NeverLosChannelConditionModel()
Constructor.
Models a never in-LoS condition model.
virtual ~ThreeGppChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
virtual ~ThreeGppUmaChannelConditionModel() override
Destructor for the ThreeGppUmaChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< ChannelCondition > ComputeChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
This method computes the channel condition based on a probabilistic model that is specific for the sc...
Time m_generatedTime
the time when the condition was generated
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
bool IsO2o() const
Return true if the channel is outdoor-to-outdoor.
Time Seconds(double value)
Construct a Time in the indicated unit.
Models a never in-LoS condition model caused by a blocking vehicle.
O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always NLOSv. ...
O2iConditionValue GetO2iCondition() const
Get the O2iConditionValue contaning the information about the O2I state of the channel.
Models an always in-LoS condition model.
A base class which provides memory management and object aggregation.
bool IsI2i() const
Return true if the channel is indoor-to-indoor.
static TypeId GetTypeId(void)
Get the type ID.
LosConditionValue
Possible values for Line-of-Sight condition.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
ChannelCondition()
Constructor for the ChannelCondition class.
Computes the channel condition for the UMi-Street canyon scenario.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Non Line of Sight due to a vehicle.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
AlwaysLosChannelConditionModel()
Constructor.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMa scenario...