11#include "ns3/mobility-building-info.h"
27 static TypeId tid =
TypeId(
"ns3::BuildingPenetrationLoss")
58 double externalWallLoss = 0;
64 if ((b1->IsIndoor() && !a1->IsIndoor()))
73 else if ((!b1->IsIndoor() && a1->IsIndoor()))
83 else if (!a1->IsIndoor() && !b1->IsIndoor())
85 NS_LOG_DEBUG(
"No penetration loss since both devices are outside");
87 else if (a1->IsIndoor() && b1->IsIndoor())
90 if (a1->GetBuilding() == b1->GetBuilding())
108 NS_LOG_DEBUG(
"Building penetration loss: externalWallLoss = " << externalWallLoss <<
", tor1 = "
109 << tor1 <<
", tor3 = " << tor3
110 <<
", GFH = " << gfh);
113 double loss = externalWallLoss + std::max(tor1, tor3) - gfh;
115 NS_LOG_DEBUG(
"Total loss due to building penetration: " << loss);
117 return txPowerDbm - loss;
140 else if (random < 0.566)
144 else if (random < 0.85)
167 else if (random < 0.9)
182 std::map<Ptr<MobilityModel>,
int>::const_iterator it;
212 std::map<Ptr<MobilityModel>,
int>::const_iterator it;
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.
A class implementing the TR 45.820 model for building losses.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
int GetWallLossValue() const
Get a value to compute the wall loss.
int GetPValue() const
Generate a random p value.
std::map< Ptr< MobilityModel >, int > m_wallLossMap
A map linking each mobility model to a value deciding its external wall loss.
Ptr< UniformRandomVariable > m_uniformRV
An uniform RV.
static TypeId GetTypeId()
Register this type.
double GetTor1(Ptr< MobilityModel > b) const
Get the Tor1 value used in the TR 45.820 standard to account for internal wall loss.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
~BuildingPenetrationLoss() override
Destructor.
BuildingPenetrationLoss()
Default constructor.
std::map< Ptr< MobilityModel >, int > m_pMap
A map linking each mobility model to a p value.
double GetWallLoss(Ptr< MobilityModel > b) const
Compute the wall loss associated to this mobility model.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.