22 #include "ns3/propagation-loss-model.h" 24 #include "ns3/mobility-model.h" 25 #include "ns3/double.h" 26 #include "ns3/pointer.h" 39 static TypeId tid =
TypeId (
"ns3::Cost231PropagationLossModel")
41 .SetGroupName (
"Propagation")
43 .AddAttribute (
"Lambda",
44 "The wavelength (default is 2.3 GHz at 300 000 km/s).",
47 MakeDoubleChecker<double> ())
48 .AddAttribute (
"Frequency",
49 "The Frequency (default is 2.3 GHz).",
52 MakeDoubleChecker<double> ())
53 .AddAttribute (
"BSAntennaHeight",
54 "BS Antenna Height (default is 50m).",
57 MakeDoubleChecker<double> ())
58 .AddAttribute (
"SSAntennaHeight",
59 "SS Antenna Height (default is 3m).",
62 MakeDoubleChecker<double> ())
63 .AddAttribute (
"MinDistance",
64 "The distance under which the propagation model refuses to give results (m) ",
67 MakeDoubleChecker<double> ());
154 double distance_km = distance * 1e-3;
156 double C_H = 0.8 + ((1.11 * std::log10(frequency_MHz)) - 0.7) *
m_SSAntennaHeight - (1.56 * std::log10(frequency_MHz));
162 double loss_in_db = 46.3 + (33.9 * std::log10(frequency_MHz)) - (13.82 * std::log10 (
m_BSAntennaHeight)) - C_H
165 NS_LOG_DEBUG (
"dist =" << distance <<
", Path Loss = " << loss_in_db);
167 return (0 - loss_in_db);
174 return txPowerDbm +
GetLoss (a, b);
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Cost231PropagationLossModel()
double GetMinDistance(void) const
Get the minimum model distance.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagationLossModel.
void SetShadowing(double shadowing)
Set the shadowing value.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
The COST-Hata-Model is the most often cited of the COST 231 models.
static TypeId GetTypeId(void)
Get the type ID.
double m_SSAntennaHeight
SS Antenna Height [m].
double GetDistanceFrom(Ptr< const MobilityModel > position) const
double m_minDistance
minimum distance [m]
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
double GetShadowing(void)
Get the shadowing value.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_shadowing
Shadowing loss [dB].
double m_lambda
The wavelength.
void SetBSAntennaHeight(double height)
Set the BS antenna height.
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Get the propagation loss.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void SetSSAntennaHeight(double height)
Set the SS antenna height.
double GetBSAntennaHeight(void) const
Get the BS antenna height.
void SetMinDistance(double minDistance)
Set the minimum model distance.
Models the propagation loss through a transmission medium.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
double m_frequency
frequency [Hz]
void SetLambda(double lambda)
Set the wavelength.
double m_BSAntennaHeight
BS Antenna Height [m].
double GetLambda(void) const
Get the wavelength.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double GetSSAntennaHeight(void) const
Get the SS antenna height.