diff --git a/src/lte/test/lte-test-pathloss-model.cc b/src/lte/test/lte-test-pathloss-model.cc index 9f860d9b0..fff7282ff 100644 --- a/src/lte/test/lte-test-pathloss-model.cc +++ b/src/lte/test/lte-test-pathloss-model.cc @@ -79,9 +79,9 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () NodeContainer ueNodes; NodeContainer hueNodes; enbNodes.Create (1); - henbNodes.Create (1); - ueNodes.Create (3); - hueNodes.Create (1); + henbNodes.Create (2); + ueNodes.Create (5); + hueNodes.Create (3); // Install Mobility Model MobilityHelper mobility; @@ -124,11 +124,9 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () Ptr mm2 = ueNodes.Get (0)->GetObject (); mm2->SetPosition (Vector (distance, 0.0, hm)); Ptr building = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/); -// mm2->SetOutdoor (); -// mm2->SetIndoor (building1); -// mm2->SetFloorNumber (3); - - // Test Okumura Hata Model (150 < freq < 1500 MHz) + building->SetBuildingType(Building::Office); + + // Test #1 Okumura Hata Model (150 < freq < 1500 MHz) (Macro<->UE) freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101 AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 243.61, "OH Urban Large city = ??")); @@ -139,7 +137,7 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 215.89, "loss OH OpenAreas")); - // Test COST231 Model (1500 < freq < 2000~2170 MHz) + // Test #2 COST231 Model (1500 < freq < 2000~2170 MHz) (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 @@ -147,21 +145,21 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 256.32, "COST231 Urban small city and suburban")); - // Test 2.6 GHz model + // Test #3 2.6 GHz model (Macro<->UE) freq = 2.620e9; // E_UTRA BAND #7 see table 5.5-1 of 36.101 AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model")); - // Test ITU1411 LOS model + // Test #4 ITU1411 LOS model (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 distance = 100; Ptr mm3 = ueNodes.Get (1)->GetObject (); mm3->SetPosition (Vector (distance, 0.0, hm)); - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 80.605, "ITU1411 LOS")); + AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS")); - // Test ITU1411 NLOS model + // Test #5 ITU1411 NLOS model (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 distance = 900; @@ -170,7 +168,7 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () mm4->SetPosition (Vector (distance, 0.0, hm)); AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS")); - // Test ITUP1238 + // Test #6 ITUP1238 (HeNB <-> UE) distance = 30; freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 @@ -178,12 +176,61 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () Ptr mm5 = henbNodes.Get (0)->GetObject (); mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); Ptr building1 = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/); + building1->SetBuildingType (Building::Residential); mm5->SetIndoor (building1); Ptr mm6 = hueNodes.Get (0)->GetObject (); mm6->SetPosition (Vector (distance, 0.0, hm)); mm6->SetIndoor (building1); - mm6->SetFloorNumber (3); + mm6->SetFloorNumber (2); AddTestCase (new LtePathlossModelTestCase (freq, mm5, mm6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238")); + + // Test #7 Outdoor -> Indoor OkumuraHata (Macro<->UE) + + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 + distance = 2000; + // The loss is as in test #2 (large city) plus the building penetration loss + // which for ConcreteWithWindows is equal to 7 dB -> 254.22 + 7 = 261.22 + Ptr mm7 = ueNodes.Get (3)->GetObject (); + mm7->SetPosition (Vector (distance, 0.0, hm)); + mm7->SetIndoor (building1); + AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 261.22, "Okumura Hata Outdoor -> Indoor")); + + // Test #8 Outdoor -> Indoor ITU1411 (Macro<->UE) + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 + distance = 100; + Ptr mm8 = ueNodes.Get (4)->GetObject (); + mm8->SetPosition (Vector (distance, 0.0, hm)); + mm8->SetIndoor (building1); + // The loss is as in test #4 plus the building penetration loss + // which for ConcreteWithWindows is equal to 7 dB -> 81.000 + 7 = 88.000 + AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor")); + + // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE) + + distance = 100; + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 + Ptr mm9 = henbNodes.Get (1)->GetObject (); + mm9->SetPosition (Vector (0.0, 0.0, henbHeight)); + mm9->SetIndoor (building1); + mm9->SetFloorNumber (2); + Ptr mm10 = hueNodes.Get (1)->GetObject (); + mm10->SetPosition (Vector (distance, 0.0, hm)); + // The loss is similar of test #4 plus the building penetration loss + // which for ConcreteWithWindows is equal to 7 dB and the height gain + // (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838 + AddTestCase (new LtePathlossModelTestCase (freq, mm9, mm10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor")); + + // Test #9 Indoor -> Outdoor NLOS (HeNB <-> UE) + + distance = 500; + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 + Ptr mm11 = hueNodes.Get (2)->GetObject (); + mm11->SetPosition (Vector (distance, 0.0, hm)); + // The loss is as in test #4 plus the building penetration loss + // which for ConcreteWithWindows is equal to 7 dB and the height gain + // (2 floors x 2 dB/floor = 4) -> 180.90 + 7 - 4 = 183.90 + AddTestCase (new LtePathlossModelTestCase (freq, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor")); + } static LtePathlossModelTestSuite ltePathlossModelTestSuite; @@ -245,13 +292,13 @@ LtePathlossModelTestCase::DoRun (void) Ptr m_downlinkChannel = CreateObject (); Ptr m_uplinkChannel = CreateObject (); Ptr m_downlinkPropagationLossModel = CreateObject (); - m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); // E_UTRA BAND #1 see table 5.5-1 of 36.101 - m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); // E_UTRA BAND #1 see table 5.5-1 of 36.101 + m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); + m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env)); m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city)); Ptr m_uplinkPropagationLossModel = CreateObject (); - m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); // E_UTRA BAND #1 see table 5.5-1 of 36.101 - m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); // E_UTRA BAND #1 see table 5.5-1 of 36.101 + m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); + m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel); m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel); diff --git a/src/lte/test/reference/loss_ITU1238.m b/src/lte/test/reference/loss_ITU1238.m index 86f736ef8..96453f12b 100644 --- a/src/lte/test/reference/loss_ITU1238.m +++ b/src/lte/test/reference/loss_ITU1238.m @@ -18,17 +18,13 @@ function g = loss_ITU1238 (d, f, n_floors, build_t) N = 28; Lf = 4*n_floors; elseif (build_t==2) - N = 20 + N = 30 Lf = 15+4*(n_floors-1); else N = 22; Lf = 6 + 3*(n_floors-1); endif - N - Lf - d - log10(f) g(find(d > 0)) = 20*log10(f) + (N*log10(d)) + Lf - 28; g(find(d <= 0)) = 1; \ No newline at end of file diff --git a/src/lte/test/reference/loss_ITU1411_LOS.m b/src/lte/test/reference/loss_ITU1411_LOS.m index fbb6482b1..632a34029 100644 --- a/src/lte/test/reference/loss_ITU1411_LOS.m +++ b/src/lte/test/reference/loss_ITU1411_LOS.m @@ -21,9 +21,6 @@ function g = loss_ITU1411_LOS (d, hb, hm, hr, f) Lu = Lbp + 20 + 40.*log10(d./Rbp); endif - Lbp - Rbp -lambda g = zeros(size(d)); g(find(d > 0)) = (Ll.+Lu)./2; diff --git a/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m b/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m index 182f23924..40df85a78 100644 --- a/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m +++ b/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m @@ -14,6 +14,7 @@ function g = loss_ITU1411_NLOS_over_rooftop (d, hb, hm, hr, f, l, b, st_w, phi, fmhz = f/1e6; Dhb = hb - hr; ds = (lambda*d*d)/(Dhb*Dhb); +ds if (l>ds) if (fmhz>2000) kf = -8; @@ -45,15 +46,17 @@ function g = loss_ITU1411_NLOS_over_rooftop (d, hb, hm, hr, f, l, b, st_w, phi, else theta = atan (Dhb /b); rho = sqrt(Dhb^2 + b^2); - if (hb-hr<1) + if (abs(hb-hr)<1) Qm = b./d; elseif (hb>hr) Qm = 2.35*((Dhb./d)*sqrt(b/lambda))^0.9; else - Qm = (b/2*pi.*d)*sqrt(lambda/rho)*((1/theta)-(1/(2*pi+theta))); + Qm = (b/(2*pi.*d))*sqrt(lambda/rho)*((1/theta)-(1/(2*pi+theta))); + b endif Lmsd = -10*log10(Qm*Qm); endif +Lmsd Dhm = hr-hm; if (phi<35) Lori = -10+(0.354*phi); diff --git a/src/lte/test/reference/lte_pathloss.m b/src/lte/test/reference/lte_pathloss.m index 96591abf9..87c2856c7 100644 --- a/src/lte/test/reference/lte_pathloss.m +++ b/src/lte/test/reference/lte_pathloss.m @@ -14,6 +14,7 @@ hm = 1; hr = 20; fmhz = f/1e6; +% Test #1 g = loss_OH_large_cities_urban (d, hb, hm, fmhz); disp ("The value of OH for large cities is:"), disp (g) @@ -26,6 +27,7 @@ disp ("The value of OH in suburban is:"), disp (g) g = loss_OH_openareas (d, hb, hm, fmhz); disp ("The value of OH in openareas is:"), disp (g) +% Test #2 and #7 fmhz = 2114; g = loss_COST231_large_cities_urban (d, hb, hm, fmhz); disp ("The value of COST231 for large cities is:"), disp (g) @@ -33,14 +35,17 @@ disp ("The value of COST231 for large cities is:"), disp (g) g = loss_COST231_small_cities_urban (d, hb, hm, fmhz); disp ("The value of COST231 for small cities is:"), disp (g) +% Test #3 g = loss_OH_2_6GHz (d); disp ("The value of OH at 2.6 GHz is:"), disp (g) -d = 100; +% Test #4 +d = 104.12; f = 2114e6; g = loss_ITU1411_LOS (d, hb, hm, hr, f); disp ("The value of ITU1411 in LOS is:"), disp (g) +% Test #5 d = 900; l = 80; b = 50; @@ -50,12 +55,33 @@ big = 1; % metropolitan centre g = loss_ITU1411_NLOS_over_rooftop (d, hb, hm, hr, f, l, b, st_w, phi, big); disp ("The value of ITU1411 in NLOS over the roof-top is:"), disp (g) +% Test #6 n_floors = 2; -built_t = 1; +built_t = 2; d = 31.3209; g = loss_ITU1238 (d, fmhz, n_floors, built_t); disp ("The value of ITU1238 is:"), disp (g) +% Test #9 +d = 100.404; +f = 2114e6; +hb = 10; +g = loss_ITU1411_LOS (d, hb, hm, hr, f); +disp ("The value of ITU1411 in LOS is:"), disp (g) + + + +% Test #10 +d = 500; +l = 80; +b = 50; +st_w = 20; +phi = 45; +big = 1; % metropolitan centre +hb = 10; +g = loss_ITU1411_NLOS_over_rooftop (d, hb, hm, hr, f, l, b, st_w, phi, big); +disp ("The value of ITU1411 in NLOS over the roof-top is:"), disp (g) + %%snr = txPsd + g - kT - nf ; % dB diff --git a/src/mobility/model/building.cc b/src/mobility/model/building.cc index 41b3f9171..f58a4a02e 100644 --- a/src/mobility/model/building.cc +++ b/src/mobility/model/building.cc @@ -21,12 +21,12 @@ #include -// #include +#include + namespace ns3 { - Building::Building (double _xMin, double _xMax, double _yMin, double _yMax, double _zMin, double _zMax/*, @@ -43,9 +43,9 @@ Building::Building (double _xMin, double _xMax, Building::Building () - : m_floor (0), - m_roomX (0), - m_roomY (0), + : m_floor (1), + m_roomX (1), + m_roomY (1), m_buildingType (Residential), m_externalWalls (ConcreteWithWindows) { diff --git a/src/mobility/model/building.h b/src/mobility/model/building.h index 6b1610155..c9f9c8b9f 100644 --- a/src/mobility/model/building.h +++ b/src/mobility/model/building.h @@ -27,6 +27,7 @@ #include #include + namespace ns3 { /** @@ -36,6 +37,7 @@ namespace ns3 { class Building : public SimpleRefCount { public: + enum BuildingType_t { Residential, Office, Commercial @@ -144,7 +146,10 @@ public: private: Box m_buldingBounds; - + /** + * number of floors must be greater then 0 and 1 means only one floor + * (i.e., groundfloor) + */ uint8_t m_floor; uint8_t m_roomX; uint8_t m_roomY; diff --git a/src/mobility/model/buildings-mobility-model.cc b/src/mobility/model/buildings-mobility-model.cc index 289865d2f..86be94b9d 100644 --- a/src/mobility/model/buildings-mobility-model.cc +++ b/src/mobility/model/buildings-mobility-model.cc @@ -49,7 +49,7 @@ BuildingsMobilityModel::GetTypeId (void) BuildingsMobilityModel::BuildingsMobilityModel () { m_indoor = false; - m_nFloor = 1; + m_nFloor = 0; m_roomX = 1; m_roomY = 1; } diff --git a/src/mobility/model/buildings-mobility-model.h b/src/mobility/model/buildings-mobility-model.h index 02105306b..caa77aba1 100644 --- a/src/mobility/model/buildings-mobility-model.h +++ b/src/mobility/model/buildings-mobility-model.h @@ -85,6 +85,9 @@ class BuildingsMobilityModel : public MobilityModel std::list < Ptr > m_surroudingBuildings; // buildings blocks Ptr m_myBuilding; bool m_indoor; + /** + * floors numbering starts from 0 (basement) + */ uint8_t m_nFloor; uint8_t m_roomX; uint8_t m_roomY; diff --git a/src/propagation/model/buildings-propagation-loss-model.cc b/src/propagation/model/buildings-propagation-loss-model.cc index 0bab3724e..d44ce5c47 100644 --- a/src/propagation/model/buildings-propagation-loss-model.cc +++ b/src/propagation/model/buildings-propagation-loss-model.cc @@ -284,9 +284,9 @@ BuildingsPropagationLossModel::ItuR1411Los (Ptr a, PtrGetPosition ().z*b->GetPosition ().z))); + double Lbp = fabs (20*log10 ((m_lambda*m_lambda)/(8*pi*a->GetPosition ().z*b->GetPosition ().z))); double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / m_lambda; - NS_LOG_INFO (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda); +// NS_LOG_INFO (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda); if (dist <= Rbp) { lossLow = Lbp + 20*log10(dist/Rbp); @@ -333,7 +333,7 @@ BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr 0) { @@ -512,7 +511,7 @@ BuildingsPropagationLossModel::HeightGain (Ptr node) con double loss = 0.0; int nfloors = node->GetFloorNumber (); - loss = -2*nfloors; + loss = -2*(nfloors); return (loss); } @@ -538,6 +537,7 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr { if (distance > 1000) { + NS_LOG_INFO (this << a1->GetPosition ().z<GetPosition ().z<< m_rooftopHeight); if ((a1->GetPosition ().z < m_rooftopHeight) && (b1->GetPosition ().z < m_rooftopHeight)) { @@ -575,23 +575,29 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance > 1000) { if ((a1->GetPosition ().z < m_rooftopHeight) - || (b1->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) + BEWPL(a1) + HeightGain (a1); - NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss); + loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (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-0 (>2000): down rooftop -> ITUR1411 : " << loss); + NS_LOG_INFO (this << " 0-I (>2000): down rooftop -> ITUR1411 : " << loss); } } + else + { + // Over the rooftop tranmission -> Okumura Hata + loss = OkumuraHata (a1, b1) + BEWPL(b1); + NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss); + } } else { @@ -625,7 +631,7 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance > 1000) { if ((a1->GetPosition ().z < m_rooftopHeight) - || (b1->GetPosition ().z < m_rooftopHeight)) + && (b1->GetPosition ().z < m_rooftopHeight)) { // ITU limit in distance (i.e., < 2000 for small cells) @@ -633,26 +639,26 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr { // short range communication loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1); - NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss); + NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss); } else { // out of bound loss = std::numeric_limits::infinity (); - NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> ITUR1411 : " << loss); + NS_LOG_INFO (this << " I-O (>2000): down rooftop -> ITUR1411 : " << loss); } } else { // above rooftop -> OH loss = OkumuraHata (a1, b1) + BEWPL(a1) + HeightGain (a1); - NS_LOG_INFO (this << " I-0 (>1000) over rooftop OH + BEL : " << loss); + NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss); } } else { loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1); - NS_LOG_INFO (this << " I-0 (<1000) ITUR1411 + BEL : " << loss); + NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss); } } // end b1->IsIndoor () } // end a1->IsOutdoor ()