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  sigma[j] = std::pow(2, j);
157  k[j] = std::pow(2, j);
158  delta[j] = double(j) / NUM_VALUES; // Delta must be in [0, 1]
159  }
160 
161  auto unifRv = CreateObject<UniformRandomVariable>();
162 
163  // Check the consistency of the empirical average for a set of values of the FTR model
164  // parameters
165  for (uint8_t l = 0; l < NUM_VALUES; l++)
166  {
167  for (uint8_t m = 0; m < NUM_VALUES; m++)
168  {
169  for (uint8_t n = 0; n < NUM_VALUES; n++)
170  {
172  unifRv->GetInteger(1, MAX_M_VALUE),
173  sigma[l], // Average should be independent from m
174  k[m],
175  delta[n]);
176  double valueMean = FtrSquaredNormAverage(ftrParams);
177  double expectedMean = FtrSquaredNormExpectedMean(ftrParams.m_sigma, ftrParams.m_k);
178 
179  NS_TEST_ASSERT_MSG_EQ_TOL(valueMean,
180  expectedMean,
181  expectedMean * TOLERANCE,
182  "wrong mean value");
183  }
184  }
185  }
186 }
187 
197 {
198  public:
212  Ptr<AntennaModel> rxAntElem,
213  uint16_t txNumAntennas,
214  uint16_t rxNumAntennas,
215  Vector txPosVec,
216  Vector rxPosVec,
217  double txBearing,
218  double rxBearing,
219  double expectedGain);
220 
224  ~ArrayResponseTest() override;
225 
226  private:
230  void DoRun() override;
231 
236  static constexpr double TOLERANCE{1e-8};
237 
240  uint16_t m_txNumAntennas;
241  uint16_t m_rxNumAntennas;
242  Vector m_txPosVec;
243  Vector m_rxPosVec;
244  double m_txBearing;
245  double m_rxBearing;
246  double m_expectedGain;
247 };
248 
250  Ptr<AntennaModel> rxAntElem,
251  uint16_t txNumAntennas,
252  uint16_t rxNumAntennas,
253  Vector txPosVec,
254  Vector rxPosVec,
255  double txBearing,
256  double rxBearing,
257  double expectedGain)
258  // TODO: Create a string with the test parameters as the test case name like in
259  // test-uniform-planar-array ?
260  : TestCase("Check that the overall array response gain has the proper trend with respect to"
261  "the number of antennas and the type of single element antenna"),
262  m_txAntElem(txAntElem),
263  m_rxAntElem(rxAntElem),
264  m_txNumAntennas(txNumAntennas),
265  m_rxNumAntennas(rxNumAntennas),
266  m_txPosVec(txPosVec),
267  m_rxPosVec(rxPosVec),
268  m_txBearing(txBearing),
269  m_rxBearing(rxBearing),
270  m_expectedGain(expectedGain)
271 {
272 }
273 
275 {
276 }
277 
278 void
280 {
281  auto twoRaySplm = CreateObject<TwoRaySpectrumPropagationLossModel>();
282  twoRaySplm->AssignStreams(1);
283 
284  // Create and assign the channel condition model
285  auto channelConditionModel = CreateObject<AlwaysLosChannelConditionModel>();
286  twoRaySplm->SetAttribute("ChannelConditionModel", PointerValue(channelConditionModel));
287 
288  // Create the TX and RX antenna arrays
289  auto txArray = CreateObject<UniformPlanarArray>();
290  auto rxArray = CreateObject<UniformPlanarArray>();
291  txArray->SetAttribute("AntennaElement", PointerValue(m_txAntElem));
292  rxArray->SetAttribute("AntennaElement", PointerValue(m_rxAntElem));
293 
294  // Create the corresponding mobility models
295  auto txPos = CreateObject<ConstantPositionMobilityModel>();
296  auto rxPos = CreateObject<ConstantPositionMobilityModel>();
297  txPos->SetAttribute("Position", VectorValue(m_txPosVec));
298  rxPos->SetAttribute("Position", VectorValue(m_rxPosVec));
299 
300  // Rotate the arrays
301  txArray->SetAttribute("BearingAngle", DoubleValue(m_txBearing));
302  rxArray->SetAttribute("BearingAngle", DoubleValue(m_rxBearing));
303 
304  // Set the antenna arrays dimensions. Arrays are assumed to be squared.
305  txArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_txNumAntennas)));
306  txArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_txNumAntennas)));
307  rxArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_rxNumAntennas)));
308  rxArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_rxNumAntennas)));
309 
310  // Compute the beamforming vectors
311  auto txBfVec = txArray->GetBeamformingVector(Angles(m_rxPosVec, m_txPosVec));
312  auto rxBfVec = rxArray->GetBeamformingVector(Angles(m_txPosVec, m_rxPosVec));
313  txArray->SetBeamformingVector(txBfVec);
314  rxArray->SetBeamformingVector(rxBfVec);
315 
316  // Compute the overall array response
317  double gainTxRx = twoRaySplm->CalcBeamformingGain(txPos, rxPos, txArray, rxArray);
318  double gainRxTx = twoRaySplm->CalcBeamformingGain(rxPos, txPos, rxArray, txArray);
319 
320  NS_TEST_EXPECT_MSG_EQ_TOL(gainTxRx, gainRxTx, gainTxRx * TOLERANCE, "gain should be symmetric");
321  NS_TEST_EXPECT_MSG_EQ_TOL(10 * log10(gainTxRx),
324  "gain different from the theoretically expected value");
325 }
326 
338 {
339  public:
350  Ptr<AntennaModel> rxAntElem,
351  uint16_t txNumAntennas,
352  uint16_t rxNumAntennas,
353  double fc,
354  std::string threeGppScenario);
355 
364 
374 
378  ~OverallGainAverageTest() override;
379 
380  private:
384  void DoRun() override;
385 
390  static constexpr double TOLERANCE{0.02};
391 
393  static constexpr uint32_t N_MEASUREMENTS{1000};
394 
396  static constexpr double M_BW{200e6};
397 
402  static constexpr double M_RB_WIDTH{1e6};
403 
406  uint16_t m_txNumAntennas;
407  uint16_t m_rxNumAntennas;
408  double m_fc;
409  std::string m_threeGppScenario;
410 };
411 
413  Ptr<AntennaModel> rxAntElem,
414  uint16_t txNumAntennas,
415  uint16_t rxNumAntennas,
416  double fc,
417  std::string threeGppScenario)
418  // TODO: Create a string with the test parameters as the test case name like in
419  // test-uniform-planar-array ?
420  : TestCase("Check that the overall array response gain has the proper trend with respect to"
421  "the number of antennas and the type of single element antenna"),
422  m_txAntElem(txAntElem),
423  m_rxAntElem(rxAntElem),
424  m_txNumAntennas(txNumAntennas),
425  m_rxNumAntennas(rxNumAntennas),
426  m_fc(fc),
427  m_threeGppScenario(threeGppScenario)
428 {
429 }
430 
432 {
433 }
434 
435 double
437 {
438  return Integral(*psd);
439 }
440 
443 {
444  uint32_t numRbs = std::floor(M_BW / M_RB_WIDTH);
445  double f = fc - (numRbs * M_RB_WIDTH / 2.0);
446  double powerTx = 0.0;
447 
448  Bands rbs; // A vector representing each resource block
449  std::vector<int> rbsId; // A vector representing the resource block IDs
450  rbs.reserve(numRbs);
451  rbsId.reserve(numRbs);
452  for (uint32_t numrb = 0; numrb < numRbs; ++numrb)
453  {
454  BandInfo rb;
455  rb.fl = f;
456  f += M_RB_WIDTH / 2;
457  rb.fc = f;
458  f += M_RB_WIDTH / 2;
459  rb.fh = f;
460 
461  rbs.push_back(rb);
462  rbsId.push_back(numrb);
463  }
464  Ptr<SpectrumModel> model = Create<SpectrumModel>(rbs);
465  Ptr<SpectrumValue> txPsd = Create<SpectrumValue>(model);
466 
467  double powerTxW = std::pow(10., (powerTx - 30) / 10);
468  double txPowerDensity = powerTxW / M_BW;
469 
470  for (const auto& rbId : rbsId)
471  {
472  (*txPsd)[rbId] = txPowerDensity;
473  }
474 
475  return txPsd;
476 }
477 
478 void
480 {
481  // Create the Two Ray and 3GPP SPLMs
482  auto twoRaySplm = CreateObject<TwoRaySpectrumPropagationLossModel>();
483  auto threeGppSplm = CreateObject<ThreeGppSpectrumPropagationLossModel>();
484  auto threeGppChannelModel = CreateObject<ThreeGppChannelModel>();
485  auto channelConditionModel = CreateObject<AlwaysLosChannelConditionModel>();
486  twoRaySplm->AssignStreams(1);
487  threeGppChannelModel->AssignStreams(1);
488 
489  // Pass the needed pointers between the various spectrum instances
490  threeGppSplm->SetAttribute("ChannelModel", PointerValue(threeGppChannelModel));
491  threeGppChannelModel->SetAttribute("ChannelConditionModel",
492  PointerValue(channelConditionModel));
493  twoRaySplm->SetAttribute("ChannelConditionModel", PointerValue(channelConditionModel));
494 
495  // Create the TX and RX nodes and mobility models
497  nodes.Create(2);
499  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
500  Vector txPosVec(0.0, 0.0, 0.0);
501  Vector rxPosVec(5.0, 0.0, 0.0);
502  positionAlloc->Add(txPosVec);
503  positionAlloc->Add(rxPosVec);
504  mobility.SetPositionAllocator(positionAlloc);
505  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
506  mobility.Install(nodes);
507 
508  // Create the TX antenna array
509  auto txArray = CreateObject<UniformPlanarArray>();
510  txArray->SetAttribute("AntennaElement", PointerValue(m_txAntElem));
511 
512  // Rotate the array
513  txArray->SetAttribute("BearingAngle", DoubleValue(0));
514 
515  // Set the antenna array dimensions. Arrays are assumed to be squared.
516  txArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_txNumAntennas)));
517  txArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_txNumAntennas)));
518 
519  // Set the channel simulation parameters
520  threeGppChannelModel->SetAttribute("Frequency", DoubleValue(m_fc));
521  twoRaySplm->SetAttribute("Frequency", DoubleValue(m_fc));
522  threeGppChannelModel->SetAttribute("Scenario", StringValue(m_threeGppScenario));
523  twoRaySplm->SetAttribute("Scenario", StringValue(m_threeGppScenario));
524 
525  // Disable blockage in order to prevent unwanted variations around the mean value
526  threeGppChannelModel->SetAttribute("Blockage", BooleanValue(false));
527 
528  // Create the TX PSD
530  double txPower = ComputePowerSpectralDensityOverallPower(txPsd);
531 
532  // Create TX signal parameters
533  Ptr<SpectrumSignalParameters> signalParams = Create<SpectrumSignalParameters>();
534  signalParams->psd = txPsd;
535 
536  // Compute and set the TX beamforming vector
537  auto txBfVec = txArray->GetBeamformingVector(Angles(rxPosVec, txPosVec));
538  txArray->SetBeamformingVector(txBfVec);
539 
542 
543  double threeGppGainMean = 0;
544  double twoRayGainMean = 0;
545 
546  // Compute the overall array responses
547  for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
548  {
549  // Re-create the RX array at each iteration, to force resampling of the 3GPP channel
550  auto rxArray = CreateObject<UniformPlanarArray>();
551 
552  // Rotate the RX antenna array and set its dimensions
553  rxArray->SetAttribute("AntennaElement", PointerValue(m_rxAntElem));
554  rxArray->SetAttribute("BearingAngle", DoubleValue(-M_PI));
555  rxArray->SetAttribute("NumRows", UintegerValue(std::sqrt(m_rxNumAntennas)));
556  rxArray->SetAttribute("NumColumns", UintegerValue(std::sqrt(m_rxNumAntennas)));
557 
558  // Compute and set the RX beamforming vector
559  auto rxBfVec = rxArray->GetBeamformingVector(Angles(txPosVec, rxPosVec));
560  rxArray->SetBeamformingVector(rxBfVec);
561 
562  auto twoRayRxPsd =
563  twoRaySplm->DoCalcRxPowerSpectralDensity(signalParams, txMob, rxMob, txArray, rxArray);
564  auto threeGppRayRxPsd = threeGppSplm->DoCalcRxPowerSpectralDensity(signalParams,
565  txMob,
566  rxMob,
567  txArray,
568  rxArray);
569  double twoRayRxPower = ComputePowerSpectralDensityOverallPower(twoRayRxPsd);
570  double threeGppRxPower = ComputePowerSpectralDensityOverallPower(threeGppRayRxPsd);
571 
572  twoRayGainMean += (twoRayRxPower / txPower);
573  threeGppGainMean += (threeGppRxPower / txPower);
574  }
575 
577  twoRayGainMean / N_MEASUREMENTS,
578  threeGppGainMean / N_MEASUREMENTS,
579  twoRayGainMean * TOLERANCE,
580  "The 3GPP and Two Ray models should provide similar average channel gains");
581 }
582 
589 {
590  public:
595 };
596 
598  : TestSuite("two-ray-splm-suite", UNIT)
599 {
600  // Test the GetFtrFastFading function of the TwoRaySpectrumPropagationLossModel class
601  AddTestCase(new FtrFadingModelAverageTest, TestCase::QUICK);
602 
603  // Test the CalcBeamformingGain function of the TwoRaySpectrumPropagationLossModel class
604  auto iso = CreateObject<IsotropicAntennaModel>();
605  auto tgpp = CreateObject<ThreeGppAntennaModel>();
606  const double maxTgppGain = tgpp->GetGainDb(Angles(0.0, M_PI / 2));
607 
608  // Deploy 2 squared antenna arrays which face each other. Steer their beam towards the boresight
609  // and check the resulting array gain. SE = single element radiation pattern, N = number of
610  // radiating elements, Phi = bearing angle
611  // SE tx, SE rx, N tx, N rx, position tx, position
612  // rx, Phi tx, Phi rx, expected gain
614  iso,
615  1,
616  1,
617  Vector(0.0, 0.0, 0.0),
618  Vector(5.0, 0.0, 0.0),
619  0.0,
620  -M_PI,
621  0.0),
622  TestCase::QUICK);
624  iso,
625  4,
626  1,
627  Vector(0.0, 0.0, 0.0),
628  Vector(5.0, 0.0, 0.0),
629  0.0,
630  -M_PI,
631  10 * log10(4)),
632  TestCase::QUICK);
634  iso,
635  16,
636  1,
637  Vector(0.0, 0.0, 0.0),
638  Vector(5.0, 0.0, 0.0),
639  0.0,
640  -M_PI,
641  10 * log10(16)),
642  TestCase::QUICK);
644  iso,
645  64,
646  1,
647  Vector(0.0, 0.0, 0.0),
648  Vector(5.0, 0.0, 0.0),
649  0.0,
650  -M_PI,
651  10 * log10(64)),
652  TestCase::QUICK);
654  iso,
655  4,
656  4,
657  Vector(0.0, 0.0, 0.0),
658  Vector(5.0, 0.0, 0.0),
659  0.0,
660  -M_PI,
661  2 * 10 * log10(4)),
662  TestCase::QUICK);
664  iso,
665  16,
666  16,
667  Vector(0.0, 0.0, 0.0),
668  Vector(5.0, 0.0, 0.0),
669  0.0,
670  -M_PI,
671  2 * 10 * log10(16)),
672  TestCase::QUICK);
674  iso,
675  64,
676  64,
677  Vector(0.0, 0.0, 0.0),
678  Vector(5.0, 0.0, 0.0),
679  0.0,
680  -M_PI,
681  2 * 10 * log10(64)),
682  TestCase::QUICK);
684  iso,
685  1,
686  1,
687  Vector(0.0, 0.0, 0.0),
688  Vector(5.0, 0.0, 0.0),
689  0.0,
690  -M_PI,
691  maxTgppGain),
692  TestCase::QUICK);
694  iso,
695  4,
696  1,
697  Vector(0.0, 0.0, 0.0),
698  Vector(5.0, 0.0, 0.0),
699  0.0,
700  -M_PI,
701  10 * log10(4) + maxTgppGain),
702  TestCase::QUICK);
704  iso,
705  16,
706  1,
707  Vector(0.0, 0.0, 0.0),
708  Vector(5.0, 0.0, 0.0),
709  0.0,
710  -M_PI,
711  10 * log10(16) + maxTgppGain),
712  TestCase::QUICK);
714  iso,
715  64,
716  1,
717  Vector(0.0, 0.0, 0.0),
718  Vector(5.0, 0.0, 0.0),
719  0.0,
720  -M_PI,
721  10 * log10(64) + maxTgppGain),
722  TestCase::QUICK);
724  tgpp,
725  1,
726  1,
727  Vector(0.0, 0.0, 0.0),
728  Vector(5.0, 0.0, 0.0),
729  0.0,
730  -M_PI,
731  2 * maxTgppGain),
732  TestCase::QUICK);
734  tgpp,
735  4,
736  1,
737  Vector(0.0, 0.0, 0.0),
738  Vector(5.0, 0.0, 0.0),
739  0.0,
740  -M_PI,
741  10 * log10(4) + 2 * maxTgppGain),
742  TestCase::QUICK);
744  tgpp,
745  16,
746  1,
747  Vector(0.0, 0.0, 0.0),
748  Vector(5.0, 0.0, 0.0),
749  0.0,
750  -M_PI,
751  10 * log10(16) + 2 * maxTgppGain),
752  TestCase::QUICK);
754  tgpp,
755  64,
756  1,
757  Vector(0.0, 0.0, 0.0),
758  Vector(5.0, 0.0, 0.0),
759  0.0,
760  -M_PI,
761  10 * log10(64) + 2 * maxTgppGain),
762  TestCase::QUICK);
764  tgpp,
765  4,
766  4,
767  Vector(0.0, 0.0, 0.0),
768  Vector(5.0, 0.0, 0.0),
769  0.0,
770  -M_PI,
771  2 * 10 * log10(4) + 2 * maxTgppGain),
772  TestCase::QUICK);
774  tgpp,
775  16,
776  16,
777  Vector(0.0, 0.0, 0.0),
778  Vector(5.0, 0.0, 0.0),
779  0.0,
780  -M_PI,
781  2 * 10 * log10(16) + 2 * maxTgppGain),
782  TestCase::QUICK);
784  tgpp,
785  64,
786  64,
787  Vector(0.0, 0.0, 0.0),
788  Vector(5.0, 0.0, 0.0),
789  0.0,
790  -M_PI,
791  2 * 10 * log10(64) + 2 * maxTgppGain),
792  TestCase::QUICK);
793 
794  // Deploy 2 squared antenna arrays which face each other. Steer their beam towards the boresight
795  // and check the overall resulting channel gain. SE = single element radiation pattern, N =
796  // number of radiating elements, Fc = carrier frequency, Scen = 3GPP scenario
797  // SE tx, SE rx, N tx, N rx, Fc, Scen
798  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 10e9, "RMa"), TestCase::EXTENSIVE);
799  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 10e9, "RMa"), TestCase::EXTENSIVE);
800  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 10e9, "RMa"), TestCase::EXTENSIVE);
801  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 10e9, "RMa"), TestCase::EXTENSIVE);
802  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 10e9, "UMa"), TestCase::EXTENSIVE);
803  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 10e9, "UMa"), TestCase::EXTENSIVE);
804  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 10e9, "UMa"), TestCase::EXTENSIVE);
805  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 10e9, "UMa"), TestCase::EXTENSIVE);
806  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 60e9, "UMi-StreetCanyon"),
807  TestCase::EXTENSIVE);
808  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 60e9, "UMi-StreetCanyon"),
809  TestCase::EXTENSIVE);
810  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 60e9, "UMi-StreetCanyon"),
811  TestCase::EXTENSIVE);
812  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 60e9, "UMi-StreetCanyon"),
813  TestCase::EXTENSIVE);
814  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 60e9, "InH-OfficeOpen"),
815  TestCase::EXTENSIVE);
816  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 60e9, "InH-OfficeOpen"),
817  TestCase::EXTENSIVE);
818  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 60e9, "InH-OfficeOpen"),
819  TestCase::EXTENSIVE);
820  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 60e9, "InH-OfficeOpen"),
821  TestCase::EXTENSIVE);
822  AddTestCase(new OverallGainAverageTest(iso, iso, 1, 1, 100e9, "InH-OfficeMixed"),
823  TestCase::EXTENSIVE);
824  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 1, 1, 100e9, "InH-OfficeMixed"),
825  TestCase::EXTENSIVE);
826  AddTestCase(new OverallGainAverageTest(iso, iso, 4, 4, 100e9, "InH-OfficeMixed"),
827  TestCase::EXTENSIVE);
828  AddTestCase(new OverallGainAverageTest(tgpp, tgpp, 4, 4, 100e9, "InH-OfficeMixed"),
829  TestCase::EXTENSIVE);
830 }
831 
832 // Static variable for test initialization
double f(double x, void *params)
Definition: 80211b.c:71
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
AttributeValue implementation for Boolean.
Definition: boolean.h:37
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:305
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
AttributeValue implementation for Vector.
#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:41
mobility
Definition: third.py:96
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