From 2ac1e9dfbb379bb44b158a0ee5a60ec62e136bd0 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Thu, 23 Feb 2012 14:32:22 +0100 Subject: [PATCH] cleanup BuildingsPropagationLossModel --- .../model/buildings-propagation-loss-model.cc | 246 +----------------- 1 file changed, 7 insertions(+), 239 deletions(-) diff --git a/src/buildings/model/buildings-propagation-loss-model.cc b/src/buildings/model/buildings-propagation-loss-model.cc index 028500194..8e166cb22 100644 --- a/src/buildings/model/buildings-propagation-loss-model.cc +++ b/src/buildings/model/buildings-propagation-loss-model.cc @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Author: Marco Miozzo + * Author: Marco Miozzo , + * Nicola Baldo * */ @@ -69,8 +70,6 @@ BuildingsPropagationLossModel::GetTypeId (void) .SetParent () - //.AddConstructor () - .AddAttribute ("Lambda", "The wavelength (default is 2.106 GHz at 300 000 km/s).", DoubleValue (300000000.0 / 2160e6), @@ -165,13 +164,6 @@ BuildingsPropagationLossModel::~BuildingsPropagationLossModel () { } -// void -// BuildingsPropagationLossModel::SetLambda (double frequency, double speed) -// { -// m_lambda = speed / frequency; -// m_frequency = frequency; -// } - void BuildingsPropagationLossModel::SetLambda (double lambda) { @@ -212,18 +204,6 @@ BuildingsPropagationLossModel::GetMinDistance (void) const void BuildingsPropagationLossModel::SetEnvironment (Environment env) { -// if (env==Urban) -// { -// NS_LOG_INFO (this << " Urban"); -// } -// else if (env==SubUrban) -// { -// NS_LOG_INFO (this << " SubUrban"); -// } -// else if (env==OpenAreas) -// { -// NS_LOG_INFO (this << " OpenAreas"); -// } m_environment = env; } @@ -477,44 +457,13 @@ BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr a, Ptr b) const -// { -// NS_LOG_INFO (this); -// // reflection pathloss -// double x1 = a->GetStreetCrossingDistence (); -// double x2 = b->GetStreetCrossingDistence (); -// double f_alpha = 0.0; -// if (m_cornerAngle<= 0.33) -// { -// f_alpha = -41.0 + 110*m_cornerAngle; -// } -// else if (m_cornerAngle<= 0.42) -// { -// f_alpha = -13.94 + 28*m_cornerAngle; -// } -// else if (m_cornerAngle<= 0.71) -// { -// f_alpha = -5.33 + 7.51*m_cornerAngle; -// } -// double pi = 3.141592653589793; -// double Lr = -20*log10 (x1+x2) + (x1*x2*f_alpha/(m_streetsWidth*m_streetsWidth)) - 20*log10 (4*pi/m_lambda); -// -// // diffraction pathloss -// double Da = -1*(40/(2*pi))*(atan (x2/m_streetsWidth) + atan (x1/m_streetsWidth) - (pi/2)); -// double Ld = -10*log10 (x2*x1*(x1+x2)) + 2*Da + 0.1*(90 - m_cornerAngle*(180/pi)) - 20*log10 (4*pi/m_lambda); -// -// double loss = -10*log10 (pow (10, Lr/10) + pow (10, Ld/10)); -// return (loss); -// } - double BuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr b) const { double N = 0.0; int n = abs (a->GetFloorNumber () - b->GetFloorNumber ()); -// NS_LOG_INFO (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n); + NS_LOG_LOGIC (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n); double Lf = 0.0; Ptr aBuilding = a->GetBuilding (); if (aBuilding->GetBuildingType () == Building::Residential) @@ -524,7 +473,7 @@ BuildingsPropagationLossModel::ItuR1238 (Ptr a, PtrGetBuildingType () == Building::Office) { @@ -533,7 +482,7 @@ BuildingsPropagationLossModel::ItuR1238 (Ptr a, PtrGetBuildingType () == Building::Commercial) { @@ -542,15 +491,14 @@ BuildingsPropagationLossModel::ItuR1238 (Ptr a, PtrGetPosition () << " <-> " << b->GetPosition ()); double loss = 20 * log10 (m_frequency / 1e6 /*MHz*/) + N*log10 (a->GetDistanceFrom (b)) + Lf - 28.0; - + NS_LOG_INFO (this << " Node " << a->GetPosition () << " <-> " << b->GetPosition () << " loss = " << loss << " dB"); return (loss); } @@ -600,186 +548,6 @@ BuildingsPropagationLossModel::InternalWallsLoss (Ptr a, -// double -// BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr b) const -// { -// NS_ASSERT_MSG ((a->GetPosition ().z > 0) && (b->GetPosition ().z > 0), "BuildingsPropagationLossModel does not support underground nodes (placed at z < 0)"); -// -// -// double distance = a->GetDistanceFrom (b); -// if (distance <= m_minDistance) -// { -// return 0.0; -// } -// -// // get the BuildingsMobilityModel pointers -// Ptr a1 = DynamicCast (a); -// Ptr b1 = DynamicCast (b); -// NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "BuildingsPropagationLossModel only works with BuildingsMobilityModel"); -// -// double loss = 0.0; -// -// if (a1->IsOutdoor ()) -// { -// if (b1->IsOutdoor ()) -// { -// if (distance > 1000) -// { -// NS_LOG_INFO (this << a1->GetPosition ().z << b1->GetPosition ().z << m_rooftopHeight); -// if ((a1->GetPosition ().z < m_rooftopHeight) -// && (b1->GetPosition ().z < m_rooftopHeight)) -// { -// // ITU limit in distance (i.e., < 2000 for small cells) -// if (distance < m_itu1411DistanceThreshold) -// { -// // short range communication -// loss = ItuR1411 (a1, b1); -// NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss); -// } -// else -// { -// // out of bound -// loss = std::numeric_limits::infinity (); -// NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> Infinity (out of bound) : " << loss); -// } -// } -// else -// { -// // Over the rooftop tranmission -> Okumura Hata -// loss = OkumuraHata (a1, b1); -// NS_LOG_INFO (this << " O-O (>1000): Over the rooftop -> OH : " << loss); -// } -// } -// else -// { -// // short range outdoor communication -// loss = ItuR1411 (a1, b1); -// NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss); -// } -// } -// else -// { -// // b indoor -// if (distance > 1000) -// { -// if ((a1->GetPosition ().z < m_rooftopHeight) -// && (b1->GetPosition ().z < m_rooftopHeight)) -// { -// -// // ITU limit in distance (i.e., < 2000 for small cells) -// if (distance < m_itu1411DistanceThreshold) -// { -// // short range communication -// loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (a1); -// NS_LOG_INFO (this << " 0-I (>1000): down rooftop -> ITUR1411 : " << loss); -// } -// else -// { -// // out of bound -// loss = std::numeric_limits::infinity (); -// NS_LOG_INFO (this << " 0-I (>2000): down rooftop -> ITUR1411 : " << loss); -// } -// } -// else -// { -// // Over the rooftop tranmission -> Okumura Hata -// loss = OkumuraHata (a1, b1) + ExternalWallLoss (b1); -// NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss); -// } -// } -// else -// { -// loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (b1); -// NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss); -// } -// } // end b1->isIndoor () -// } -// else -// { -// // a is indoor -// if (b1->IsIndoor ()) -// { -// if (a1->GetBuilding () == b1->GetBuilding ()) -// { -// // nodes are in same building -> indoor communication ITU-R P.1238 -// loss = ItuR1238 (a1, b1) + InternalWallsLoss (a1, b1);; -// NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss); -// -// } -// else -// { -// // nodes are in different buildings -// loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); -// NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss); -// } -// } -// else -// { -// // b is outdoor -// if (distance > 1000) -// { -// if ((a1->GetPosition ().z < m_rooftopHeight) -// && (b1->GetPosition ().z < m_rooftopHeight)) -// { -// -// // ITU limit in distance (i.e., < 2000 for small cells) -// if (distance < m_itu1411DistanceThreshold) -// { -// // short range communication -// loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); -// NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss); -// } -// else -// { -// // out of bound -// loss = std::numeric_limits::infinity (); -// NS_LOG_INFO (this << " I-O (>2000): down rooftop -> ITUR1411 : " << loss); -// } -// } -// else -// { -// // above rooftop -> OH -// 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) + ExternalWallLoss (a1) + HeightLoss (a1); -// NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss); -// } -// } // end b1->IsIndoor () -// } // end a1->IsOutdoor () -// -// // Evaluate the shadowing -// std::map, std::map, ShadowingLoss> >::iterator ait = m_shadowingLossMap.find (a); -// if (ait != m_shadowingLossMap.end ()) -// { -// std::map, ShadowingLoss>::iterator bit = ait->second.find (b); -// if (bit != ait->second.end ()) -// { -// return loss + bit->second.GetLoss (); -// } -// else -// { -// double sigma = EvaluateSigma (a1, b1); -// // side effect: will create new entry -// ait->second[b] = ShadowingLoss (0.0, sigma, b); -// return loss + ait->second[b].GetLoss (); -// } -// } -// else -// { -// double sigma = EvaluateSigma (a1, b1); -// // side effect: will create new entries in both maps -// m_shadowingLossMap[a][b] = ShadowingLoss (0.0, sigma, b); -// return loss + m_shadowingLossMap[a][b].GetLoss (); -// } -// -// } - - - double BuildingsPropagationLossModel::GetShadowing (Ptr a, Ptr b) const