12#include "ns3/double.h"
15#include "ns3/mobility-model.h"
31 TypeId(
"ns3::OkumuraHataPropagationLossModel")
33 .SetGroupName(
"Propagation")
35 .AddAttribute(
"Frequency",
36 "The propagation frequency in Hz",
42 "Environment Scenario",
53 "Dimension of the city",
74 double log_fMhz = std::log10(fmhz);
77 double distKm = a->GetDistanceFrom(b) / 1000.0;
79 Vector aPosition = a->GetPosition();
80 Vector bPosition = b->GetPosition();
82 double hb = std::max(aPosition.z, bPosition.z);
83 double hm = std::min(aPosition.z, bPosition.z);
85 NS_ASSERT_MSG(hb > 0 && hm > 0,
"nodes' height must be greater then 0");
87 double log_hb = std::log10(hb);
88 double log_aHeight = 13.82 * log_hb;
89 double log_bHeight = 0.0;
100 log_bHeight = 8.29 * std::pow(log10(1.54 * hm), 2) - 1.1;
104 log_bHeight = 3.2 * std::pow(log10(11.75 * hm), 2) - 4.97;
109 log_bHeight = 0.8 + (1.1 * log_fMhz - 0.7) * hm - 1.56 * log_fMhz;
112 NS_LOG_INFO(
this <<
" logf " << 26.16 * log_fMhz <<
" loga " << log_aHeight <<
" X "
113 << ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) <<
" logb "
115 loss = 69.55 + (26.16 * log_fMhz) - log_aHeight +
116 ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) - log_bHeight;
119 loss += -2 * (std::pow(std::log10(fmhz / 28), 2)) - 5.4;
123 loss += -4.70 * std::pow(log_fMhz, 2) + 18.33 * log_fMhz - 40.94;
135 log_bHeight = 3.2 * std::pow(std::log10(11.75 * hm), 2);
140 log_bHeight = (1.1 * log_fMhz - 0.7) * hm - (1.56 * log_fMhz - 0.8);
143 loss = 46.3 + (33.9 * log_fMhz) - log_aHeight +
144 ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) - log_bHeight + C;
154 return (txPowerDbm -
GetLoss(a, b));
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
this class implements the Okumura Hata propagation loss model
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
EnvironmentType m_environment
Environment Scenario.
double m_frequency
frequency in Hz
static TypeId GetTypeId()
Get the type ID.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
OkumuraHataPropagationLossModel()
CitySize m_citySize
Size of the city.
~OkumuraHataPropagationLossModel() override
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#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(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.