diff --git a/src/lte/test/lte-test-pathloss-model.cc b/src/lte/test/lte-test-pathloss-model.cc index 04aaeedf9..2a67f684a 100644 --- a/src/lte/test/lte-test-pathloss-model.cc +++ b/src/lte/test/lte-test-pathloss-model.cc @@ -77,93 +77,6 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () { - LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); - // - // LogComponentEnable ("LenaHelper", logLevel); - LogComponentEnable ("LtePathlossModelTest", logLevel); - // LogComponentEnable ("BuildingsPropagationLossModel", logLevel); - - - struct SnrEfficiencyMcs - { - double snrDb; - double efficiency; - int mcsIndex; - }; - - /** - * Test vectors: SNRDB, Spectral Efficiency, MCS index - * From XXX - */ - SnrEfficiencyMcs snrEfficiencyMcs[] = { - { -5.00000, 0.08024, -1}, - { -4.00000, 0.10030, -1}, - { -3.00000, 0.12518, -1}, - { -2.00000, 0.15589, 0}, - { -1.00000, 0.19365, 0}, - { 0.00000, 0.23983, 2}, - { 1.00000, 0.29593, 2}, - { 2.00000, 0.36360, 2}, - { 3.00000, 0.44451, 4}, - { 4.00000, 0.54031, 4}, - { 5.00000, 0.65251, 6}, - { 6.00000, 0.78240, 6}, - { 7.00000, 0.93086, 8}, - { 8.00000, 1.09835, 8}, - { 9.00000, 1.28485, 10}, - { 10.00000, 1.48981, 12}, - { 11.00000, 1.71229, 12}, - { 12.00000, 1.95096, 14}, - { 13.00000, 2.20429, 14}, - { 14.00000, 2.47062, 16}, - { 15.00000, 2.74826, 18}, - { 16.00000, 3.03560, 18}, - { 17.00000, 3.33115, 20}, - { 18.00000, 3.63355, 20}, - { 19.00000, 3.94163, 22}, - { 20.00000, 4.25439, 22}, - { 21.00000, 4.57095, 24}, - { 22.00000, 4.89060, 24}, - { 23.00000, 5.21276, 26}, - { 24.00000, 5.53693, 26}, - { 25.00000, 5.86271, 28}, - { 26.00000, 6.18980, 28}, - { 27.00000, 6.51792, 28}, - { 28.00000, 6.84687, 28}, - { 29.00000, 7.17649, 28}, - { 30.00000, 7.50663, 28}, - }; - - - double txPowerDbm = 30; // default eNB TX power over whole bandwdith - double ktDbm = -174; // reference LTE noise PSD - double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units - double receiverNoiseFigureDb = 9.0; // default UE noise figure - - double loss[] = {80.605, 243.62}; - double dist[] = {100.0, 1000.0}; - - int numOfTests = sizeof (loss) / sizeof (double); - for ( int i = 0 ; i < numOfTests; i++ ) - { -// double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb; - - double sinrDb = txPowerDbm- noisePowerDbm - receiverNoiseFigureDb - loss[i]; - NS_LOG_INFO (" Ptx " << txPowerDbm << " Pn " << noisePowerDbm << " Fn " << receiverNoiseFigureDb << " Pl " << loss[i] << " dist " << dist); - std::ostringstream name; - name << " snr= " << sinrDb << " dB, " - << " mcs= " << snrEfficiencyMcs[i].mcsIndex; -// AddTestCase (new LtePathlossModelSystemTestCase (name.str (), sinrDb, dist[i], snrEfficiencyMcs[i].mcsIndex)); - } - - - - - - - - - // -------------- COMPOUND TESTS ---------------------------------- LogComponentEnable ("LtePathlossModelTest", LOG_LEVEL_ALL); @@ -321,6 +234,96 @@ LtePathlossModelTestSuite::LtePathlossModelTestSuite () // (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")); + +//------------------- SYSTEM TEST ------------------------------ + +LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); +// +// LogComponentEnable ("LenaHelper", logLevel); +LogComponentEnable ("LtePathlossModelTest", logLevel); +// LogComponentEnable ("BuildingsPropagationLossModel", logLevel); +// LogComponentEnable ("LteInterference", logLevel); +// LogComponentEnable ("LteSpectrumValueHelper", logLevel); + + +struct SnrEfficiencyMcs +{ + double snrDb; + double efficiency; + int mcsIndex; +}; + +/** +* Test vectors: SNRDB, Spectral Efficiency, MCS index +* From XXX +*/ +SnrEfficiencyMcs snrEfficiencyMcs[] = { + { -5.00000, 0.08024, -1}, + { -4.00000, 0.10030, -1}, + { -3.00000, 0.12518, -1}, + { -2.00000, 0.15589, 0}, + { -1.00000, 0.19365, 0}, + { 0.00000, 0.23983, 2}, + { 1.00000, 0.29593, 2}, + { 2.00000, 0.36360, 2}, + { 3.00000, 0.44451, 4}, + { 4.00000, 0.54031, 4}, + { 5.00000, 0.65251, 6}, + { 6.00000, 0.78240, 6}, + { 7.00000, 0.93086, 8}, + { 8.00000, 1.09835, 8}, + { 9.00000, 1.28485, 10}, + { 10.00000, 1.48981, 12}, + { 11.00000, 1.71229, 12}, + { 12.00000, 1.95096, 14}, + { 13.00000, 2.20429, 14}, + { 14.00000, 2.47062, 16}, + { 15.00000, 2.74826, 18}, + { 16.00000, 3.03560, 18}, + { 17.00000, 3.33115, 20}, + { 18.00000, 3.63355, 20}, + { 19.00000, 3.94163, 22}, + { 20.00000, 4.25439, 22}, + { 21.00000, 4.57095, 24}, + { 22.00000, 4.89060, 24}, + { 23.00000, 5.21276, 26}, + { 24.00000, 5.53693, 26}, + { 25.00000, 5.86271, 28}, + { 26.00000, 6.18980, 28}, + { 27.00000, 6.51792, 28}, + { 28.00000, 6.84687, 28}, + { 29.00000, 7.17649, 28}, + { 30.00000, 7.50663, 28}, +}; + + +double txPowerDbm = 30; // default eNB TX power over whole bandwdith +double txPowerLin = pow (10, (txPowerDbm - 30)/10); +double ktDbm = -174; // reference LTE noise PSD +double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units +double receiverNoiseFigureDb = 9.0; // default UE noise figure +double noiseLin = pow (10, (noisePowerDbm-30+receiverNoiseFigureDb)/10); +double loss[] = {81.0000, 134.0125, 144.1489}; +double dist[] = {100.0, 500.0, 1500}; + +int numOfTests = sizeof (loss) / sizeof (double); +for ( int i = 0 ; i < numOfTests; i++ ) +{ + // double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb; + double sinrLin = (txPowerLin*(pow(10, loss[i]/10))) / noiseLin; + // double sinrDb = txPowerDbm- noisePowerDbm - receiverNoiseFigureDb - loss[i]; + double sinrDb = 10*log10(sinrLin); + NS_LOG_INFO (" Ptx " << txPowerDbm << " Pn " << noisePowerDbm << " Fn " << receiverNoiseFigureDb << " Pl " << loss[i] << " dist " << dist[i]); + std::ostringstream name; + name << " snr= " << sinrDb << " dB, " + << " mcs= " << snrEfficiencyMcs[i].mcsIndex; + AddTestCase (new LtePathlossModelSystemTestCase (name.str (), sinrDb, dist[i], snrEfficiencyMcs[i].mcsIndex)); +} + + + + + } static LtePathlossModelTestSuite ltePathlossModelTestSuite; @@ -432,13 +435,14 @@ LtePathlossModelSystemTestCase::DoRun (void) /** * Simulation Topology */ - LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); +// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); // LogComponentEnable ("LteAmc", LOG_LEVEL_ALL); // LogComponentEnable ("LtePhy", LOG_LEVEL_ALL); // LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL); // LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL); // LogComponentEnable ("SingleModelSpectrumChannel", LOG_LEVEL_ALL); - LogComponentEnable ("BuildingsPropagationLossModel", logLevel); +// LogComponentEnable ("BuildingsPropagationLossModel", logLevel); + LogComponentDisable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); // Ptr lena = CreateObject (); // lena->EnableLogComponents (); @@ -470,6 +474,8 @@ LtePathlossModelSystemTestCase::DoRun (void) Ptr mm_ue = ueNodes.Get (0)->GetObject (); mm_ue->SetPosition (Vector (m_distance, 0.0, 1.0)); + NS_LOG_INFO (" DISTANCE " << mm_ue->GetDistanceFrom (mm_enb)); + Ptr lteEnbDev = enbDevs.Get (0)->GetObject (); Ptr enbPhy = lteEnbDev->GetPhy (); enbPhy->SetAttribute ("TxPower", DoubleValue (30.0)); @@ -494,8 +500,8 @@ LtePathlossModelSystemTestCase::DoRun (void) Ptr testSinr = Create (uePhy); uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr); - Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", - MakeBoundCallback (&LteTestPathlossDlSchedCallback, this)); +// Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", +// MakeBoundCallback (&LteTestPathlossDlSchedCallback, this)); Simulator::Stop (Seconds (0.005)); Simulator::Run (); @@ -503,7 +509,7 @@ LtePathlossModelSystemTestCase::DoRun (void) double calculatedSinrDb = 10.0 * log10 (testSinr->GetSinr ()[0]); NS_LOG_INFO ("Distance " << m_distance << " Calculated SINR " << calculatedSinrDb << " ref " << m_snrDb); Simulator::Destroy (); - NS_TEST_ASSERT_MSG_EQ_TOL (calculatedSinrDb, m_snrDb, 0.0000001, "Wrong SINR !"); + NS_TEST_ASSERT_MSG_EQ_TOL (calculatedSinrDb, m_snrDb, 0.001, "Wrong SINR !"); } 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 40df85a78..b8bcc192e 100644 --- a/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m +++ b/src/lte/test/reference/loss_ITU1411_NLOS_over_rooftop.m @@ -14,7 +14,6 @@ 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; @@ -56,7 +55,6 @@ ds endif Lmsd = -10*log10(Qm*Qm); endif -Lmsd Dhm = hr-hm; if (phi<35) Lori = -10+(0.354*phi); @@ -72,7 +70,7 @@ Lmsd if (Lrts+Lmsd>0) L = Lbf + Lrts + Lmsd; else - L0 Lbf + L = Lbf endif g(find(d > 0)) = L; diff --git a/src/lte/test/reference/lte_pathloss.m b/src/lte/test/reference/lte_pathloss.m index 87c2856c7..4bc5949c1 100644 --- a/src/lte/test/reference/lte_pathloss.m +++ b/src/lte/test/reference/lte_pathloss.m @@ -8,7 +8,7 @@ close all; %f = 1900e6; % carrier freq Hz, EARFCN = 500 (downlink) f = 869e6; %f = 2620e6; -d = 2000; +d = 2; %km hb = 30; hm = 1; hr = 20; @@ -16,34 +16,34 @@ 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) +disp ("Test #1: the value of OH for large cities is:"), disp (g) g = loss_OH_small_cities_urban (d, hb, hm, fmhz); -disp ("The value of OH for small cities is:"), disp (g) +disp ("Test #1: the value of OH for small cities is:"), disp (g) g = loss_OH_suburban (d, hb, hm, fmhz); -disp ("The value of OH in suburban is:"), disp (g) +disp ("Test #1: 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) +disp ("Test #1: 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) +disp ("Test #2: 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) +disp ("Test #2: 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) +g = loss_OH_2_6GHz (d*1000); +disp ("Test #3: the value of OH at 2.6 GHz is:"), disp (g) % Test #4 -d = 104.12; +d = 1041.2; %m f = 2114e6; g = loss_ITU1411_LOS (d, hb, hm, hr, f); -disp ("The value of ITU1411 in LOS is:"), disp (g) +disp ("Test #4: the value of ITU1411 in LOS is:"), disp (g) % Test #5 d = 900; @@ -53,21 +53,21 @@ st_w = 20; phi = 45; 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) +disp ("Test #5: the value of ITU1411 in NLOS over the roof-top is:"), disp (g) % Test #6 n_floors = 2; built_t = 2; d = 31.3209; g = loss_ITU1238 (d, fmhz, n_floors, built_t); -disp ("The value of ITU1238 is:"), disp (g) +disp ("Test #6: 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) +disp ("Test #9: the value of ITU1411 in LOS is:"), disp (g) @@ -80,7 +80,25 @@ 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) +disp ("Test #10: the value of ITU1411 in NLOS over the roof-top is:"), disp (g) + +% Test #11 +d = 104.12; +fmhz = 2114; +hb = 30; +hm = 1; +hr = 20; +g = loss_ITU1411_LOS (d, hb, hm, hr, f); +printf ("Test #11: the value of ITU1411 in LOS is: %f\n", g); + +d = d = 500.84; +g = loss_ITU1411_NLOS_over_rooftop (d, hb, hm, hr, f, l, b, st_w, phi, big); +printf ("Test #10: the value of ITU1411 in NLOS over the roof-top is: %f\n", g); + + +d = 1.50028; % km +g = loss_COST231_large_cities_urban (d, hb, hm, fmhz); +printf ("Test #11: the value of COST231 for large cities is: %f\n", g); %%snr = txPsd + g - kT - nf ; % dB