21#include "ns3/double.h"
23#include "ns3/string.h"
38 TypeId(
"ns3::ThreeGppV2vUrbanPropagationLossModel")
40 .SetGroupName(
"Propagation")
44 "The percentage of vehicles of type 3 (i.e., trucks) in the scenario",
47 MakeDoubleChecker<double>(0.0, 100.0));
56 m_logNorVar = CreateObject<LogNormalRandomVariable>();
76 double loss = 38.77 + 16.7 * log10(distance3D) + 18.2 * log10(
m_frequency / 1e9);
85 NS_LOG_WARN(
"O2I car penetration loss not yet implemented");
106 double hBs = std::max(a->GetPosition().z, b->GetPosition().z);
107 double hUt = std::min(a->GetPosition().z, b->GetPosition().z);
115 double additionalLoss = 0;
116 double blockerHeight = 0;
132 if (std::min(hUt, hBs) > blockerHeight)
137 else if (std::max(hUt, hBs) < blockerHeight)
140 mu_a = 9.0 + std::max(0.0, 15 * log10(distance3D) - 41.0);
144 DoubleValue(log(pow(mu_a, 2) / sqrt(pow(sigma_a, 2) + pow(mu_a, 2)))));
146 DoubleValue(sqrt(log(pow(sigma_a, 2) / pow(mu_a, 2) + 1))));
147 additionalLoss = std::max(0.0,
m_logNorVar->GetValue());
152 mu_a = 5.0 + std::max(0.0, 15 * log10(distance3D) - 41.0);
157 DoubleValue(log(pow(mu_a, 2) / sqrt(pow(sigma_a, 2) + pow(mu_a, 2)))));
159 DoubleValue(sqrt(log(pow(sigma_a, 2) / pow(mu_a, 2) + 1))));
160 additionalLoss = std::max(0.0,
m_logNorVar->GetValue());
163 return additionalLoss;
173 double loss = 36.85 + 30 * log10(distance3D) + 18.9 * log10(
m_frequency / 1e9);
209 double correlationDistance;
214 correlationDistance = 10;
219 correlationDistance = 13;
226 return correlationDistance;
247 static TypeId tid =
TypeId(
"ns3::ThreeGppV2vHighwayPropagationLossModel")
249 .SetGroupName(
"Propagation")
273 double loss = 32.4 + 20 * log10(distance3D) + 20 * log10(
m_frequency / 1e9);
LosConditionValue
Possible values for Line-of-Sight condition.
@ NLOSv
Non Line of Sight due to a vehicle.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Base class for the 3GPP propagation models.
Ptr< NormalRandomVariable > m_normRandomVariable
normal random variable
double m_frequency
operating frequency in Hz
Implements the pathloss model defined in 3GPP TR 37.885, Table 6.2.1-1 for the Highway scenario.
~ThreeGppV2vHighwayPropagationLossModel() override
Destructor.
ThreeGppV2vHighwayPropagationLossModel()
Constructor.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
static TypeId GetTypeId()
Get the type ID.
Implements the pathloss model defined in 3GPP TR 37.885, Table 6.2.1-1 for the Urban scenario.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed by a building.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetAdditionalNlosvLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Computes the additional loss due to an obstruction caused by a vehicle.
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double m_percType3Vehicles
percentage of Type 3 vehicles in the scenario (i.e., trucks)
Ptr< LogNormalRandomVariable > m_logNorVar
log normal random variable
ThreeGppV2vUrbanPropagationLossModel()
Constructor.
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
~ThreeGppV2vUrbanPropagationLossModel() override
Destructor.
Ptr< UniformRandomVariable > m_uniformVar
uniform random variable
double GetLossNlosv(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed by a vehicle.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
#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_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#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.
double CalculateDistance(const Vector3D &a, const Vector3D &b)