23#include "ns3/double.h"
26#include "ns3/mobility-model.h"
42 TypeId(
"ns3::OkumuraHataPropagationLossModel")
44 .SetGroupName(
"Propagation")
46 .AddAttribute(
"Frequency",
47 "The propagation frequency in Hz",
50 MakeDoubleChecker<double>())
53 "Environment Scenario",
64 "Dimension of the city",
85 double log_fMhz = std::log10(fmhz);
88 double distKm = a->GetDistanceFrom(b) / 1000.0;
90 Vector aPosition = a->GetPosition();
91 Vector bPosition = b->GetPosition();
93 double hb = std::max(aPosition.z, bPosition.z);
94 double hm = std::min(aPosition.z, bPosition.z);
96 NS_ASSERT_MSG(hb > 0 && hm > 0,
"nodes' height must be greater then 0");
98 double log_hb = std::log10(hb);
99 double log_aHeight = 13.82 * log_hb;
100 double log_bHeight = 0.0;
111 log_bHeight = 8.29 * std::pow(log10(1.54 * hm), 2) - 1.1;
115 log_bHeight = 3.2 * std::pow(log10(11.75 * hm), 2) - 4.97;
120 log_bHeight = 0.8 + (1.1 * log_fMhz - 0.7) * hm - 1.56 * log_fMhz;
123 NS_LOG_INFO(
this <<
" logf " << 26.16 * log_fMhz <<
" loga " << log_aHeight <<
" X "
124 << ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) <<
" logb "
126 loss = 69.55 + (26.16 * log_fMhz) - log_aHeight +
127 ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) - log_bHeight;
130 loss += -2 * (std::pow(std::log10(fmhz / 28), 2)) - 5.4;
134 loss += -4.70 * std::pow(log_fMhz, 2) + 18.33 * log_fMhz - 40.94;
146 log_bHeight = 3.2 * std::pow(std::log10(11.75 * hm), 2);
151 log_bHeight = (1.1 * log_fMhz - 0.7) * hm - (1.56 * log_fMhz - 0.8);
154 loss = 46.3 + (33.9 * log_fMhz) - log_aHeight +
155 ((44.9 - (6.55 * log_hb)) * std::log10(distKm)) - log_bHeight + C;
165 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...
#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.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)