14#include "ns3/double.h"
17#include "ns3/mobility-model.h"
32 TypeId(
"ns3::ItuR1238PropagationLossModel")
35 .SetGroupName(
"Buildings")
37 .AddAttribute(
"Frequency",
38 "The Frequency (default is 2.106 GHz).",
52 NS_ASSERT_MSG(a && b,
"ItuR1238PropagationLossModel only works with MobilityBuildingInfo");
53 NS_ASSERT_MSG(a->GetBuilding()->GetId() == b->GetBuilding()->GetId(),
54 "ITU-R 1238 applies only to nodes that are in the same building");
56 int n = std::abs(a->GetFloorNumber() - b->GetFloorNumber());
57 NS_LOG_LOGIC(
this <<
" A floor " << (uint16_t)a->GetFloorNumber() <<
" B floor "
58 << (uint16_t)b->GetFloorNumber() <<
" n " << n);
75 Lf = 15 + (4 * (n - 1));
84 Lf = 6 + (3 * (n - 1));
93 N * std::log10(a1->GetDistanceFrom(b1)) + Lf - 28.0;
94 NS_LOG_INFO(
this <<
" Node " << a1->GetPosition() <<
" <-> " << b1->GetPosition()
95 <<
" loss = " << loss <<
" dB");
105 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)
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.
#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.