A Discrete-Event Network Simulator
API
two-ray-splm-test-suite.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 SIGNET Lab, Department of Information Engineering,
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17 
18 #include <ns3/abort.h>
19 #include <ns3/config.h>
20 #include <ns3/constant-position-mobility-model.h>
21 #include <ns3/double.h>
22 #include <ns3/isotropic-antenna-model.h>
23 #include <ns3/log.h>
24 #include <ns3/mobility-helper.h>
25 #include <ns3/node-container.h>
26 #include <ns3/pointer.h>
27 #include <ns3/simulator.h>
28 #include <ns3/string.h>
29 #include <ns3/test.h>
30 #include <ns3/three-gpp-antenna-model.h>
31 #include <ns3/three-gpp-channel-model.h>
32 #include <ns3/three-gpp-spectrum-propagation-loss-model.h>
33 #include <ns3/two-ray-spectrum-propagation-loss-model.h>
34 #include <ns3/uinteger.h>
35 #include <ns3/uniform-planar-array.h>
36 
37 #include <array>
38 
39 using namespace ns3;
40 
41 NS_LOG_COMPONENT_DEFINE("TwoRaySplmTestSuite");
42 
52 {
53  public:
58 
62  ~FtrFadingModelAverageTest() override;
63 
64  private:
68  void DoRun() override;
69 
75  double FtrSquaredNormAverage(
76  const TwoRaySpectrumPropagationLossModel::FtrParams& ftrParams) const;
77 
96  constexpr double FtrSquaredNormExpectedMean(double sigma, double k) const;
97 
99  static constexpr uint32_t N_MEASUREMENTS{100000};
100 
105  static constexpr double TOLERANCE{1e-2};
106 
108  static constexpr uint8_t NUM_VALUES{3};
109 
111  static constexpr uint16_t MAX_M_VALUE{1000};
112 };
113 
115  : TestCase("Check that the average of the Fluctuating Two Ray model is consistent with the "
116  "theoretical expectation")
117 {
118 }
119 
121 {
122 }
123 
124 double
126  const TwoRaySpectrumPropagationLossModel::FtrParams& ftrParams) const
127 {
128  NS_LOG_FUNCTION(this);
129  double sum = 0.0;
130  auto twoRaySplm = CreateObject<TwoRaySpectrumPropagationLossModel>();
131  twoRaySplm->AssignStreams(1);
132  for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
133  {
134  double value = twoRaySplm->GetFtrFastFading(ftrParams);
135  sum += value;
136  }
137  double valueMean = sum / N_MEASUREMENTS;
138  return valueMean;
139 }
140 
141 double constexpr FtrFadingModelAverageTest::FtrSquaredNormExpectedMean(double sigma, double k) const
142 {
143  return 2 * sigma * (1 + k);
144 }
145 
146 void
148 {
149  std::array<double, NUM_VALUES> sigma;
150  std::array<double, NUM_VALUES> k;
151  std::array<double, NUM_VALUES> delta;
152 
153  // Generate a set of values for the FTR model parameters
154  for (uint8_t j = 0; j < NUM_VALUES; j++)
155  {
156  double power = std::pow(2, j);
157 
158  sigma[j] = power;
159  k[j] = power;
160  delta[j] = double(j) / NUM_VALUES; // Delta must be in [0, 1]
161  }
162 
163  auto unifRv = CreateObject<UniformRandomVariable>();
164 
165  // Check the consistency of the empirical average for a set of values of the FTR model
166  // parameters
167  for (uint8_t l = 0; l < NUM_VALUES; l++)
168  {
169  for (uint8_t m = 0; m < NUM_VALUES; m++)
170  {
171  for (uint8_t n = 0; n < NUM_VALUES; n++)
172  {
174  unifRv->GetInteger(1, MAX_M_VALUE),
175  sigma[l], // Average should be independent from m
176  k[m],
177  delta[n]);
178  double valueMean = FtrSquaredNormAverage(ftrParams);
179  double expectedMean = FtrSquaredNormExpectedMean(ftrParams.m_sigma, ftrParams.m_k);
180 
181  NS_TEST_ASSERT_MSG_EQ_TOL(valueMean,
182  expectedMean,
183  expectedMean * TOLERANCE,
184  "wrong mean value");
185  }
186  }
187  }
188 }
189 
199 {
200  public:
214  Ptr<AntennaModel> rxAntElem,
215  uint16_t txNumAntennas,
216  uint16_t rxNumAntennas,
217  Vector txPosVec,
218  Vector rxPosVec,
219  double txBearing,
220  double rxBearing,
221  double expectedGain);
222 
226  ~ArrayResponseTest() override;
227 
228  private:
232  void DoRun() override;
233 
238  static constexpr double TOLERANCE{1e-8};
239 
242  uint16_t m_txNumAntennas;
243  uint16_t m_rxNumAntennas;
244  Vector m_txPosVec;
245  Vector m_rxPosVec;
246  double m_txBearing;
247  double m_rxBearing;
248  double m_expectedGain;
249 };
250 
252  Ptr<AntennaModel> rxAntElem,
253  uint16_t txNumAntennas,
254  uint16_t rxNumAntennas,
255  Vector txPosVec,
256  Vector rxPosVec,
257  double txBearing,
258  double rxBearing,
259  double expectedGain)
260  // TODO: Create a string with the test parameters as the test case name like in
261  // test-uniform-planar-array ?
262  : TestCase("Check that the overall array response gain has the proper trend with respect to "
263  "the number of antennas and the type of single element antenna"),
264  m_txAntElem(txAntElem),
265  m_rxAntElem(rxAntElem),
266  m_txNumAntennas(txNumAntennas),
267  m_rxNumAntennas(rxNumAntennas),
268  m_txPosVec(txPosVec),
269  m_rxPosVec(rxPosVec),
270  m_txBearing(txBearing),
271  m_rxBearing(rxBearing),
272  m_expectedGain(expectedGain)
273 {
274 }
275 
277 {
278 }
279 
280 void
282 {
283  auto twoRaySplm = CreateObject<TwoRaySpectrumPropagationLossModel>();
284  twoRaySplm->AssignStreams(1);
285 
286  // Create and assign the channel condition model
287  auto channelConditionModel = CreateObject<AlwaysLosChannelConditionModel>();
288  twoRaySplm->SetAttribute("ChannelConditionModel", PointerValue(channelConditionModel));
289 
290  // Create the TX and RX antenna arrays
291  auto txArray = CreateObject<UniformPlanarArray>();
292  auto rxArray = CreateObject<UniformPlanarArray>();
293  txArray->SetAttribute("AntennaElement", PointerValue(m_txAntElem));
294  rxArray->SetAttribute("AntennaElement", PointerValue(m_rxAntElem));
295 
296  // Create the corresponding mobility models
297  auto txPos = CreateObject<ConstantPositionMobilityModel>();
298  auto rxPos = CreateObject<ConstantPositionMobilityModel>();
299  txPos->SetAttribute("Position", VectorValue(m_txPosVec));
300  rxPos->SetAttribute("Position", VectorValue(m_rxPosVec));
301 
302  // Rotate the arrays
303  txArray->SetAttribute("BearingAngle", DoubleValue(m_txBearing));
304  rxArray->SetAttribute("BearingAngle", DoubleValue(m_rxBearing));
305 
306  // Set the antenna arrays dimensions. Arrays are assumed to be squared.
307  txArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_txNumAntennas)));
308  txArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_txNumAntennas)));
309  rxArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_rxNumAntennas)));
310  rxArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_rxNumAntennas)));
311 
312  // Compute the beamforming vectors
313  auto txBfVec = txArray->GetBeamformingVector(Angles(m_rxPosVec, m_txPosVec));
314  auto rxBfVec = rxArray->GetBeamformingVector(Angles(m_txPosVec, m_rxPosVec));
315  txArray->SetBeamformingVector(txBfVec);
316  rxArray->SetBeamformingVector(rxBfVec);
317 
318  // Compute the overall array response
319  double gainTxRx = twoRaySplm->CalcBeamformingGain(txPos, rxPos, txArray, rxArray);
320  double gainRxTx = twoRaySplm->CalcBeamformingGain(rxPos, txPos, rxArray, txArray);
321 
322  NS_TEST_EXPECT_MSG_EQ_TOL(gainTxRx, gainRxTx, gainTxRx * TOLERANCE, "gain should be symmetric");
323  NS_TEST_EXPECT_MSG_EQ_TOL(10 * log10(gainTxRx),
326  "gain different from the theoretically expected value");
327 }
328 
340 {
341  public:
352  Ptr<AntennaModel> rxAntElem,
353  uint16_t txNumAntennas,
354  uint16_t rxNumAntennas,
355  double fc,
356  std::string threeGppScenario);
357 
366 
376 
380  ~OverallGainAverageTest() override;
381 
382  private:
386  void DoRun() override;
387 
392  static constexpr double TOLERANCE{0.02};
393 
395  static constexpr uint32_t N_MEASUREMENTS{1000};
396 
398  static constexpr double M_BW{200e6};
399 
404  static constexpr double M_RB_WIDTH{1e6};
405 
408  uint16_t m_txNumAntennas;
409  uint16_t m_rxNumAntennas;
410  double m_fc;
411  std::string m_threeGppScenario;
412 };
413 
415  Ptr<AntennaModel> rxAntElem,
416  uint16_t txNumAntennas,
417  uint16_t rxNumAntennas,
418  double fc,
419  std::string threeGppScenario)
420  // TODO: Create a string with the test parameters as the test case name like in
421  // test-uniform-planar-array ?
422  : TestCase("Check that the overall array response gain has the proper trend with respect to"
423  "the number of antennas and the type of single element antenna"),
424  m_txAntElem(txAntElem),
425  m_rxAntElem(rxAntElem),
426  m_txNumAntennas(txNumAntennas),
427  m_rxNumAntennas(rxNumAntennas),
428  m_fc(fc),
429  m_threeGppScenario(threeGppScenario)
430 {
431 }
432 
434 {
435 }
436 
437 double
439 {
440  return Integral(*psd);
441 }
442 
445 {
446  uint32_t numRbs = std::floor(M_BW / M_RB_WIDTH);
447  double f = fc - (numRbs * M_RB_WIDTH / 2.0);
448  double powerTx = 0.0;
449 
450  Bands rbs; // A vector representing each resource block
451  std::vector<int> rbsId; // A vector representing the resource block IDs
452  rbs.reserve(numRbs);
453  rbsId.reserve(numRbs);
454  for (uint32_t numrb = 0; numrb < numRbs; ++numrb)
455  {
456  BandInfo rb;
457  rb.fl = f;
458  f += M_RB_WIDTH / 2;
459  rb.fc = f;
460  f += M_RB_WIDTH / 2;
461  rb.fh = f;
462 
463  rbs.push_back(rb);
464  rbsId.push_back(numrb);
465  }
466  Ptr<SpectrumModel> model = Create<SpectrumModel>(rbs);
467  Ptr<SpectrumValue> txPsd = Create<SpectrumValue>(model);
468 
469  double powerTxW = std::pow(10., (powerTx - 30) / 10);
470  double txPowerDensity = powerTxW / M_BW;
471 
472  for (const auto& rbId : rbsId)
473  {
474  (*txPsd)[rbId] = txPowerDensity;
475  }
476 
477  return txPsd;
478 }
479 
480 void
482 {
483  // Create the Two Ray and 3GPP SPLMs
484  auto twoRaySplm = CreateObject<TwoRaySpectrumPropagationLossModel>();
485  auto threeGppSplm = CreateObject<ThreeGppSpectrumPropagationLossModel>();
486  auto threeGppChannelModel = CreateObject<ThreeGppChannelModel>();
487  auto channelConditionModel = CreateObject<AlwaysLosChannelConditionModel>();
488  twoRaySplm->AssignStreams(1);
489  threeGppChannelModel->AssignStreams(1);
490 
491  // Pass the needed pointers between the various spectrum instances
492  threeGppSplm->SetAttribute("ChannelModel", PointerValue(threeGppChannelModel));
493  threeGppChannelModel->SetAttribute("ChannelConditionModel",
494  PointerValue(channelConditionModel));
495  twoRaySplm->SetAttribute("ChannelConditionModel", PointerValue(channelConditionModel));
496 
497  // Create the TX and RX nodes and mobility models
499  nodes.Create(2);
501  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
502  Vector txPosVec(0.0, 0.0, 0.0);
503  Vector rxPosVec(5.0, 0.0, 0.0);
504  positionAlloc->Add(txPosVec);
505  positionAlloc->Add(rxPosVec);
506  mobility.SetPositionAllocator(positionAlloc);
507  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
508  mobility.Install(nodes);
509 
510  // Create the TX antenna array
511  auto txArray = CreateObject<UniformPlanarArray>();
512  txArray->SetAttribute("AntennaElement", PointerValue(m_txAntElem));
513 
514  // Rotate the array
515  txArray->SetAttribute("BearingAngle", DoubleValue(0));
516 
517  // Set the antenna array dimensions. Arrays are assumed to be squared.
518  txArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_txNumAntennas)));
519  txArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_txNumAntennas)));
520 
521  // Set the channel simulation parameters
522  threeGppChannelModel->SetAttribute("Frequency", DoubleValue(m_fc));
523  twoRaySplm->SetAttribute("Frequency", DoubleValue(m_fc));
524  threeGppChannelModel->SetAttribute("Scenario", StringValue(m_threeGppScenario));
525  twoRaySplm->SetAttribute("Scenario", StringValue(m_threeGppScenario));
526 
527  // Disable blockage in order to prevent unwanted variations around the mean value
528  threeGppChannelModel->SetAttribute("Blockage", BooleanValue(false));
529 
530  // Create the TX PSD
532  double txPower = ComputePowerSpectralDensityOverallPower(txPsd);
533 
534  // Create TX signal parameters
535  Ptr<SpectrumSignalParameters> signalParams = Create<SpectrumSignalParameters>();
536  signalParams->psd = txPsd;
537 
538  // Compute and set the TX beamforming vector
539  auto txBfVec = txArray->GetBeamformingVector(Angles(rxPosVec, txPosVec));
540  txArray->SetBeamformingVector(txBfVec);
541 
544 
545  double threeGppGainMean = 0;
546  double twoRayGainMean = 0;
547 
548  // Compute the overall array responses
549  for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
550  {
551  // Re-create the RX array at each iteration, to force resampling of the 3GPP channel
552  auto rxArray = CreateObject<UniformPlanarArray>();
553 
554  // Rotate the RX antenna array and set its dimensions
555  rxArray->SetAttribute("AntennaElement", PointerValue(m_rxAntElem));
556  rxArray->SetAttribute("BearingAngle", DoubleValue(-M_PI));
557  rxArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_rxNumAntennas)));
558  rxArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_rxNumAntennas)));
559 
560  // Compute and set the RX beamforming vector
561  auto rxBfVec = rxArray->GetBeamformingVector(Angles(txPosVec, rxPosVec));
562  rxArray->SetBeamformingVector(rxBfVec);
563 
564  auto twoRayRxParams =
565  twoRaySplm->DoCalcRxPowerSpectralDensity(signalParams, txMob, rxMob, txArray, rxArray);
566  auto threeGppRayRxParams = threeGppSplm->DoCalcRxPowerSpectralDensity(signalParams,
567  txMob,
568  rxMob,
569  txArray,
570  rxArray);
571  double twoRayRxPower = ComputePowerSpectralDensityOverallPower(twoRayRxParams->psd);
572  double threeGppRxPower = ComputePowerSpectralDensityOverallPower(threeGppRayRxParams->psd);
573 
574  twoRayGainMean += (twoRayRxPower / txPower);
575  threeGppGainMean += (threeGppRxPower / txPower);
576  }
577 
579  twoRayGainMean / N_MEASUREMENTS,
580  threeGppGainMean / N_MEASUREMENTS,
581  twoRayGainMean * TOLERANCE,
582  "The 3GPP and Two Ray models should provide similar average channel gains");
583 }
584 
591 {
592  public:
597 };
598 
600  : TestSuite("two-ray-splm-suite", UNIT)
601 {
602  // Test the GetFtrFastFading function of the TwoRaySpectrumPropagationLossModel class
603  AddTestCase(new FtrFadingModelAverageTest, TestCase::QUICK);
604 
605  // Test the CalcBeamformingGain function of the TwoRaySpectrumPropagationLossModel class
606  auto iso = CreateObject<IsotropicAntennaModel>();
607  auto tgpp = CreateObject<ThreeGppAntennaModel>();
608  const double maxTgppGain = tgpp->GetGainDb(Angles(0.0, M_PI / 2));
609 
610  // Deploy 2 squared antenna arrays which face each other. Steer their beam towards the boresight
611  // and check the resulting array gain. SE = single element radiation pattern, N = number of
612  // radiating elements, Phi = bearing angle
613  // SE tx, SE rx, N tx, N rx, position tx, position
614  // rx, Phi tx, Phi rx, expected gain
616  iso,
617  1,
618  1,
619  Vector(0.0, 0.0, 0.0),
620  Vector(5.0, 0.0, 0.0),
621  0.0,
622  -M_PI,
623  0.0),
624  TestCase::QUICK);
626  iso,
627  4,
628  1,
629  Vector(0.0, 0.0, 0.0),
630  Vector(5.0, 0.0, 0.0),
631  0.0,
632  -M_PI,
633  10 * log10(4)),
634  TestCase::QUICK);
636  iso,
637  16,
638  1,
639  Vector(0.0, 0.0, 0.0),
640  Vector(5.0, 0.0, 0.0),
641  0.0,
642  -M_PI,
643  10 * log10(16)),
644  TestCase::QUICK);
646  iso,
647  64,
648  1,
649  Vector(0.0, 0.0, 0.0),
650  Vector(5.0, 0.0, 0.0),
651  0.0,
652  -M_PI,
653  10 * log10(64)),
654  TestCase::QUICK);
656  iso,
657  4,
658  4,
659  Vector(0.0, 0.0, 0.0),
660  Vector(5.0, 0.0, 0.0),
661  0.0,
662  -M_PI,
663  2 * 10 * log10(4)),
664  TestCase::QUICK);
666  iso,
667  16,
668  16,
669  Vector(0.0, 0.0, 0.0),
670  Vector(5.0, 0.0, 0.0),
671  0.0,
672  -M_PI,
673  2 * 10 * log10(16)),
674  TestCase::QUICK);
676  iso,
677  64,
678  64,
679  Vector(0.0, 0.0, 0.0),
680  Vector(5.0, 0.0, 0.0),
681  0.0,
682  -M_PI,
683  2 * 10 * log10(64)),
684  TestCase::QUICK);
686  iso,
687  1,
688  1,
689  Vector(0.0, 0.0, 0.0),
690  Vector(5.0, 0.0, 0.0),
691  0.0,
692  -M_PI,
693  maxTgppGain),
694  TestCase::QUICK);
696  iso,
697  4,
698  1,
699  Vector(0.0, 0.0, 0.0),
700  Vector(5.0, 0.0, 0.0),
701  0.0,
702  -M_PI,
703  10 * log10(4) + maxTgppGain),
704  TestCase::QUICK);
706  iso,
707  16,
708  1,
709  Vector(0.0, 0.0, 0.0),
710  Vector(5.0, 0.0, 0.0),
711  0.0,
712  -M_PI,
713  10 * log10(16) + maxTgppGain),
714  TestCase::QUICK);
716  iso,
717  64,
718  1,
719  Vector(0.0, 0.0, 0.0),
720  Vector(5.0, 0.0, 0.0),
721  0.0,
722  -M_PI,
723  10 * log10(64) + maxTgppGain),
724  TestCase::QUICK);
726  tgpp,
727  1,
728  1,
729  Vector(0.0, 0.0, 0.0),
730  Vector(5.0, 0.0, 0.0),
731  0.0,
732  -M_PI,
733  2 * maxTgppGain),
734  TestCase::QUICK);
736  tgpp,
737  4,
738  1,
739  Vector(0.0, 0.0, 0.0),
740  Vector(5.0, 0.0, 0.0),
741  0.0,
742  -M_PI,
743  10 * log10(4) + 2 * maxTgppGain),
744  TestCase::QUICK);
746  tgpp,
747  16,
748  1,
749  Vector(0.0, 0.0, 0.0),
750  Vector(5.0, 0.0, 0.0),
751  0.0,
752  -M_PI,
753  10 * log10(16) + 2 * maxTgppGain),
754  TestCase::QUICK);
756  tgpp,
757  64,
758  1,
759  Vector(0.0, 0.0, 0.0),
760  Vector(5.0, 0.0, 0.0),
761  0.0,
762  -M_PI,
763  10 * log10(64) + 2 * maxTgppGain),
764  TestCase::QUICK);
766  tgpp,
767  4,
768  4,
769  Vector(0.0, 0.0, 0.0),
770  Vector(5.0, 0.0, 0.0),
771  0.0,
772  -M_PI,
773  2 * 10 * log10(4) + 2 * maxTgppGain),
774  TestCase::QUICK);
776  tgpp,
777  16,
778  16,
779  Vector(0.0, 0.0, 0.0),
780  Vector(5.0, 0.0, 0.0),
781  0.0,
782  -M_PI,
783  2 * 10 * log10(16) + 2 * maxTgppGain),
784  TestCase::QUICK);
786  tgpp,
787  64,
788  64,
789  Vector(0.0, 0.0, 0.0),
790  Vector(5.0, 0.0, 0.0),
791  0.0,
792  -M_PI,
793  2 * 10 * log10(64) + 2 * maxTgppGain),
794  TestCase::QUICK);
795 
796  // Deploy 2 squared antenna arrays which face each other. Steer their beam towards the boresight
797  // and check the overall resulting channel gain. SE = single element radiation pattern, N =
798  // number of radiating elements, Fc = carrier frequency, Scen = 3GPP scenario
799  // SE tx, SE rx, N tx, N rx, Fc, Scen
800  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 10e9, "RMa"), TestCase::EXTENSIVE);
801  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 10e9, "RMa"), TestCase::EXTENSIVE);
802  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 10e9, "RMa"), TestCase::EXTENSIVE);
803  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 10e9, "RMa"), TestCase::EXTENSIVE);
804  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 10e9, "UMa"), TestCase::EXTENSIVE);
805  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 10e9, "UMa"), TestCase::EXTENSIVE);
806  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 10e9, "UMa"), TestCase::EXTENSIVE);
807  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 10e9, "UMa"), TestCase::EXTENSIVE);
808  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 60e9, "UMi-StreetCanyon"),
809  TestCase::EXTENSIVE);
810  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 60e9, "UMi-StreetCanyon"),
811  TestCase::EXTENSIVE);
812  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 60e9, "UMi-StreetCanyon"),
813  TestCase::EXTENSIVE);
814  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 60e9, "UMi-StreetCanyon"),
815  TestCase::EXTENSIVE);
816  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 60e9, "InH-OfficeOpen"),
817  TestCase::EXTENSIVE);
818  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 60e9, "InH-OfficeOpen"),
819  TestCase::EXTENSIVE);
820  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 60e9, "InH-OfficeOpen"),
821  TestCase::EXTENSIVE);
822  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 60e9, "InH-OfficeOpen"),
823  TestCase::EXTENSIVE);
824  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 100e9, "InH-OfficeMixed"),
825  TestCase::EXTENSIVE);
826  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 100e9, "InH-OfficeMixed"),
827  TestCase::EXTENSIVE);
828  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 100e9, "InH-OfficeMixed"),
829  TestCase::EXTENSIVE);
830  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 100e9, "InH-OfficeMixed"),
831  TestCase::EXTENSIVE);
832 }
833 
834 // Static variable for test initialization
double f(double x, void *params)
Definition: 80211b.c:70
Test case for the TwoRaySpectrumPropagationLossModel class.
uint16_t m_txNumAntennas
the number of antenna elements of the TX antenna panel
~ArrayResponseTest() override
Destructor.
uint16_t m_rxNumAntennas
the number of antenna elements of the RX antenna panel
static constexpr double TOLERANCE
Tolerance for testing value produced by the simulator against expected theoretical value,...
double m_rxBearing
the bearing angle of the RX antenna panel [rad]
Vector m_rxPosVec
the position of the RX
Vector m_txPosVec
the position of the TX
double m_txBearing
the bearing angle of the TX antenna panel [rad]
Ptr< AntennaModel > m_txAntElem
the antenna element of the TX antenna panel
double m_expectedGain
the gain which is theoretically expected [db]
void DoRun() override
Build the test scenario.
Ptr< AntennaModel > m_rxAntElem
the antenna element of the RX antenna panel
ArrayResponseTest(Ptr< AntennaModel > txAntElem, Ptr< AntennaModel > rxAntElem, uint16_t txNumAntennas, uint16_t rxNumAntennas, Vector txPosVec, Vector rxPosVec, double txBearing, double rxBearing, double expectedGain)
The constructor of the test case.
Test case for the TwoRaySpectrumPropagationLossModel class.
static constexpr uint32_t N_MEASUREMENTS
Number of samples to draw when populating the distribution.
static constexpr uint16_t MAX_M_VALUE
Maximum value for the m parameter.
constexpr double FtrSquaredNormExpectedMean(double sigma, double k) const
Compute the expected mean of the FTR squared norm.
double FtrSquaredNormAverage(const TwoRaySpectrumPropagationLossModel::FtrParams &ftrParams) const
Compute the average of the FTR squared norm.
static constexpr uint8_t NUM_VALUES
Number of different values for each FTR parameter.
~FtrFadingModelAverageTest() override
Destructor.
static constexpr double TOLERANCE
Tolerance for testing FTR's expectations against theoretical values, expressed as a fraction of the e...
void DoRun() override
Build the test scenario.
Test case for the TwoRaySpectrumPropagationLossModel class.
Ptr< AntennaModel > m_txAntElem
the antenna element of the TX antenna panel
uint16_t m_rxNumAntennas
the number of antenna elements of the RX antenna panel
double m_fc
the carrier frequency
static constexpr double M_RB_WIDTH
The width of a RB, which in turn specifies the resolution of the generated PSDs.
double ComputePowerSpectralDensityOverallPower(Ptr< const SpectrumValue > psd)
Computes the overall power of a PSD.
static constexpr uint32_t N_MEASUREMENTS
Number of samples to draw when estimating the average.
static constexpr double M_BW
The simulation bandwidth. Results are independent from this parameter.
std::string m_threeGppScenario
the 3GPP scenario
~OverallGainAverageTest() override
Destructor.
Ptr< AntennaModel > m_rxAntElem
the antenna element of the RX antenna panel
OverallGainAverageTest(Ptr< AntennaModel > txAntElem, Ptr< AntennaModel > rxAntElem, uint16_t txNumAntennas, uint16_t rxNumAntennas, double fc, std::string threeGppScenario)
The constructor of the test case.
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fc)
Creates a PSD centered at fc, of bandwidth bw and sub-bands of width rbWidth.
void DoRun() override
Build the test scenario.
static constexpr double TOLERANCE
Tolerance for testing average channel gain produced by the Two Ray model with respect to the 3GPP mod...
uint16_t m_txNumAntennas
the number of antenna elements of the TX antenna panel
Test suite for the TwoRaySpectrumPropagationLossModel class.
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Hold variables of type string.
Definition: string.h:56
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1256
Hold an unsigned integer type.
Definition: uinteger.h:45
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Definition: vector.h:324
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Definition: test.h:510
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition: test.h:337
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
static const double TOLERANCE
Tolerance used to check reciprocal of two numbers.
value
Definition: second.py:48
mobility
Definition: third.py:105
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
Struct holding the Fluctuating Two Ray fast-fading model parameters.
static TwoRaySplmTestSuite myTestSuite