22 #include "ns3/string.h"
23 #include "ns3/mobility-model.h"
35 static TypeId tid =
TypeId (
"ns3::ProbabilisticV2vUrbanChannelConditionModel")
37 .SetGroupName (
"Propagation")
39 .AddAttribute (
"Density",
"Specifies the density of the vehicles in the scenario."
40 "It can be set to Low, Medium or High.",
42 MakeEnumAccessor (&ProbabilisticV2vUrbanChannelConditionModel::m_densityUrban),
44 VehicleDensity::MEDIUM,
"Medium",
45 VehicleDensity::HIGH,
"High"))
65 switch (m_densityUrban)
67 case VehicleDensity::LOW:
70 case VehicleDensity::MEDIUM:
73 case VehicleDensity::HIGH:
77 NS_FATAL_ERROR (
"Undefined density, choose between Low, Medium and High");
92 switch (m_densityUrban)
94 case VehicleDensity::LOW:
95 pNlosv =
std::min (1.0,
std::max (0.0, 1 / (0.0396 * distance2D) * exp (-(log (distance2D) - 5.2718) * (log (distance2D) - 5.2718) / 3.4827)));
97 case VehicleDensity::MEDIUM:
98 pNlosv =
std::min (1.0,
std::max (0.0, 1 / (0.0312 * distance2D) * exp (-(log (distance2D) - 5.0063) * (log (distance2D) - 5.0063) / 2.4544)));
100 case VehicleDensity::HIGH:
101 pNlosv =
std::min (1.0,
std::max (0.0, 1 / (0.0242 * distance2D) * exp (-(log (distance2D) - 5.0115) * (log (distance2D) - 5.0115) / 2.2092)));
104 NS_FATAL_ERROR (
"Undefined density, choose between Low, Medium and High");
119 static TypeId tid =
TypeId (
"ns3::ProbabilisticV2vHighwayChannelConditionModel")
121 .SetGroupName (
"Propagation")
123 .AddAttribute (
"Density",
"Specifies the density of the vehicles in the scenario."
124 "It can be set to Low, Medium or High.",
126 MakeEnumAccessor (&ProbabilisticV2vHighwayChannelConditionModel::m_densityHighway),
128 VehicleDensity::MEDIUM,
"Medium",
129 VehicleDensity::HIGH,
"High"))
151 switch (m_densityHighway)
153 case VehicleDensity::LOW:
158 case VehicleDensity::MEDIUM:
163 case VehicleDensity::HIGH:
169 NS_FATAL_ERROR (
"Undefined density, choose between Low, Medium and High");
172 double pLos =
std::min (1.0,
std::max (0.0, aLos * distance2D * distance2D + bLos * distance2D + cLos));
187 switch (m_densityHighway)
189 case VehicleDensity::LOW:
194 case VehicleDensity::MEDIUM:
199 case VehicleDensity::HIGH:
205 NS_FATAL_ERROR (
"Undefined density, choose between Low, Medium and High");
208 double pNlos =
std::min (1.0,
std::max (0.0, aNlos * pow (distance2D, 2) + bNlos * distance2D + cNlos));
Hold variables of type enum.
Computes the channel condition for the V2V Highway scenario.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the NLOS probability.
virtual ~ProbabilisticV2vHighwayChannelConditionModel() override
Destructor for the ProbabilisticV2vHighwayChannelConditionModel class.
ProbabilisticV2vHighwayChannelConditionModel()
Constructor for the ProbabilisticV2vHighwayChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
static TypeId GetTypeId(void)
Get the type ID.
Computes the channel condition for the V2V Urban scenario.
static TypeId GetTypeId(void)
Get the type ID.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the NLOS probability.
virtual ~ProbabilisticV2vUrbanChannelConditionModel() override
Destructor for the ProbabilisticV2vUrbanChannelConditionModel class.
ProbabilisticV2vUrbanChannelConditionModel()
Constructor for the ProbabilisticV2vUrbanChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
Smart pointer class similar to boost::intrusive_ptr.
Base class for the 3GPP channel condition models.
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.