25 #include "ns3/double.h"
28 #include "ns3/mobility-model.h"
43 TypeId(
"ns3::ItuR1238PropagationLossModel")
46 .SetGroupName(
"Buildings")
48 .AddAttribute(
"Frequency",
49 "The Frequency (default is 2.106 GHz).",
52 MakeDoubleChecker<double>());
63 NS_ASSERT_MSG(a && b,
"ItuR1238PropagationLossModel only works with MobilityBuildingInfo");
64 NS_ASSERT_MSG(a->GetBuilding()->GetId() == b->GetBuilding()->GetId(),
65 "ITU-R 1238 applies only to nodes that are in the same building");
67 int n = std::abs(a->GetFloorNumber() - b->GetFloorNumber());
68 NS_LOG_LOGIC(
this <<
" A floor " << (uint16_t)a->GetFloorNumber() <<
" B floor "
69 << (uint16_t)b->GetFloorNumber() <<
" n " << n);
86 Lf = 15 + (4 * (n - 1));
95 Lf = 6 + (3 * (n - 1));
103 double loss = 20 * std::log10(
m_frequency / 1e6 ) +
106 <<
" loss = " << loss <<
" dB");
116 return (txPowerDbm -
GetLoss(a, b));
This class can be used to hold variables of floating point type such as 'double' or 'float'.
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
double m_frequency
frequency in MHz
mobility buildings information (to be used by mobility models)
double GetDistanceFrom(Ptr< const MobilityModel > position) const
Vector GetPosition() const
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Models the propagation loss through a transmission medium.
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_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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 AttributeAccessor > MakeDoubleAccessor(T1 a1)