diff --git a/src/buildings/model/buildings-propagation-loss-model.cc b/src/buildings/model/buildings-propagation-loss-model.cc index 992175524..098d23492 100644 --- a/src/buildings/model/buildings-propagation-loss-model.cc +++ b/src/buildings/model/buildings-propagation-loss-model.cc @@ -139,7 +139,12 @@ BuildingsPropagationLossModel::GetTypeId (void) MakeEnumAccessor (&BuildingsPropagationLossModel::SetCitySize), MakeEnumChecker (BuildingsPropagationLossModel::Small, "Small", BuildingsPropagationLossModel::Medium, "Medium", - BuildingsPropagationLossModel::Large, "Large")); + BuildingsPropagationLossModel::Large, "Large")) + .AddAttribute ("InternalWallLoss", + "Additional loss for each internal wall [dB]", + DoubleValue (5.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_lossInternalWall), + MakeDoubleChecker ()); return tid; @@ -551,7 +556,7 @@ BuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr a) const +BuildingsPropagationLossModel::ExternalWallLoss (Ptr a) const { double loss = 0.0; Ptr aBuilding = a->GetBuilding (); @@ -571,14 +576,11 @@ BuildingsPropagationLossModel::BEWPL (Ptr a) const { loss = 12; } - - return (loss); } - double -BuildingsPropagationLossModel::HeightGain (Ptr node) const +BuildingsPropagationLossModel::HeightLoss (Ptr node) const { double loss = 0.0; @@ -587,8 +589,14 @@ BuildingsPropagationLossModel::HeightGain (Ptr node) con return (loss); } - - +double +BuildingsPropagationLossModel::InternalWallsLoss (Ptr a, Ptrb) const +{ + // approximate the number of internal walls with the Manhattan distance in "rooms" units + double dx = abs (a->GetRoomNumberX () - b->GetRoomNumberX ()); + double dy = abs (a->GetRoomNumberY () - b->GetRoomNumberY ()); + return m_lossInternalWall * (dx+dy); +} double BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr b) const @@ -660,7 +668,7 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance < m_itu1411DistanceThreshold) { // short range communication - loss = ItuR1411 (a1, b1) + BEWPL (b1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (a1); NS_LOG_INFO (this << " 0-I (>1000): down rooftop -> ITUR1411 : " << loss); } else @@ -673,13 +681,13 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr else { // Over the rooftop tranmission -> Okumura Hata - loss = OkumuraHata (a1, b1) + BEWPL (b1); + loss = OkumuraHata (a1, b1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss); } } else { - loss = ItuR1411 (a1, b1) + BEWPL (b1) + HeightGain (b1); + loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (b1); NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss); } } // end b1->isIndoor () @@ -692,14 +700,14 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (a1->GetBuilding () == b1->GetBuilding ()) { // nodes are in same building -> indoor communication ITU-R P.1238 - loss = ItuR1238 (a1, b1); - NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss); + loss = ItuR1238 (a1, b1) + InternalWallsLoss (a1, b1); + NS_LOG_INFO (this << " I-I (same building) ITUR1238 + internal walls: " << loss); } else { // nodes are in different buildings - loss = ItuR1411 (a1, b1) + BEWPL (a1) + BEWPL (b1); + loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss); } } @@ -716,7 +724,7 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance < m_itu1411DistanceThreshold) { // short range communication - loss = ItuR1411 (a1, b1) + BEWPL (a1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss); } else @@ -729,13 +737,13 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr else { // above rooftop -> OH - loss = OkumuraHata (a1, b1) + BEWPL (a1) + HeightGain (a1); + loss = OkumuraHata (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss); } } else { - loss = ItuR1411 (a1, b1) + BEWPL (a1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss); } } // end b1->IsIndoor () diff --git a/src/buildings/model/buildings-propagation-loss-model.h b/src/buildings/model/buildings-propagation-loss-model.h index 94e4bf7df..8c7db13f7 100644 --- a/src/buildings/model/buildings-propagation-loss-model.h +++ b/src/buildings/model/buildings-propagation-loss-model.h @@ -102,9 +102,10 @@ private: double ItuR1411NlosOverRooftop (Ptr a, Ptr b) const; // double ItuR1411NlosStreetCanyons (Ptr a, Ptr b) const; double ItuR1238 (Ptr a, Ptr b) const; - double BEWPL (Ptr a) const; - double HeightGain (Ptr n) const; + double ExternalWallLoss (Ptr a) const; + double HeightLoss (Ptr n) const; + double InternalWallsLoss (Ptr a, Ptr b) const; double C; // OH loss coefficient for the environment double N; // ITU-R P.1238: power loss coefficient @@ -120,7 +121,9 @@ private: double m_streetsWidth; // in meters double m_buildingsExtend; // in meters double m_buildingSeparation; // in meters + double m_lossInternalWall; // in meters + class ShadowingLoss { public: