A Discrete-Event Network Simulator
API
three-gpp-channel-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 
19 #include "ns3/log.h"
20 #include "ns3/abort.h"
21 #include "ns3/test.h"
22 #include "ns3/config.h"
23 #include "ns3/double.h"
24 #include "ns3/uinteger.h"
25 #include "ns3/string.h"
26 #include "ns3/angles.h"
27 #include "ns3/pointer.h"
28 #include "ns3/node-container.h"
29 #include "ns3/constant-position-mobility-model.h"
30 #include "ns3/three-gpp-antenna-array-model.h"
31 #include "ns3/three-gpp-channel-model.h"
32 #include "ns3/simple-net-device.h"
33 #include "ns3/simulator.h"
34 #include "ns3/channel-condition-model.h"
35 #include "ns3/three-gpp-spectrum-propagation-loss-model.h"
36 #include "ns3/wifi-spectrum-value-helper.h"
37 #include "ns3/buildings-channel-condition-model.h"
38 
39 using namespace ns3;
40 
41 NS_LOG_COMPONENT_DEFINE ("ThreeGppChannelTestSuite");
42 
49 {
50 public:
55 
60 
61 private:
65  virtual void DoRun (void);
66 
75  void DoComputeNorm (Ptr<ThreeGppChannelModel> channelModel, Ptr<MobilityModel> txMob, Ptr<MobilityModel> rxMob, Ptr<ThreeGppAntennaArrayModel> txAntenna, Ptr<ThreeGppAntennaArrayModel> rxAntenna);
76 
77  std::vector<double> m_normVector;
78 };
79 
81  : TestCase ("Check the dimensions and the norm of the channel matrix")
82 {
83 }
84 
86 {
87 }
88 
89 void
91 {
92  uint64_t txAntennaElements = txAntenna->GetNumberOfElements ();
93  uint64_t rxAntennaElements = rxAntenna->GetNumberOfElements ();
94 
95  Ptr<const ThreeGppChannelModel::ThreeGppChannelMatrix> channelMatrix = channelModel->GetChannel (txMob, rxMob, txAntenna, rxAntenna);
96 
97  double channelNorm = 0;
98  uint8_t numTotClusters = channelMatrix->m_channel.at (0).at (0).size ();
99  for (uint8_t cIndex = 0; cIndex < numTotClusters; cIndex++)
100  {
101  double clusterNorm = 0;
102  for (uint64_t sIndex = 0; sIndex < txAntennaElements; sIndex++)
103  {
104  for (uint32_t uIndex = 0; uIndex < rxAntennaElements; uIndex++)
105  {
106  clusterNorm += std::pow (std::abs (channelMatrix->m_channel.at (uIndex).at (sIndex).at (cIndex)), 2);
107  }
108  }
109  channelNorm += clusterNorm;
110  }
111  m_normVector.push_back (channelNorm);
112 }
113 
114 void
116 {
117  // Build the scenario for the test
118  uint8_t txAntennaElements[] {2, 2}; // tx antenna dimensions
119  uint8_t rxAntennaElements[] {2, 2}; // rx antenna dimensions
120  uint32_t updatePeriodMs = 100; // update period in ms
121 
122  // create the channel condition model
123  Ptr<ChannelConditionModel> channelConditionModel = CreateObject<NeverLosChannelConditionModel> ();
124 
125  // create the ThreeGppChannelModel object used to generate the channel matrix
126  Ptr<ThreeGppChannelModel> channelModel = CreateObject<ThreeGppChannelModel> ();
127  channelModel->SetAttribute ("Frequency", DoubleValue (60.0e9));
128  channelModel->SetAttribute ("Scenario", StringValue ("RMa"));
129  channelModel->SetAttribute ("ChannelConditionModel", PointerValue (channelConditionModel));
130  channelModel->SetAttribute ("UpdatePeriod", TimeValue (MilliSeconds (updatePeriodMs-1)));
131 
132  // create the tx and rx nodes
134  nodes.Create (2);
135 
136  // create the tx and rx devices
137  Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> ();
138  Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> ();
139 
140  // associate the nodes and the devices
141  nodes.Get (0)->AddDevice (txDev);
142  txDev->SetNode (nodes.Get (0));
143  nodes.Get (1)->AddDevice (rxDev);
144  rxDev->SetNode (nodes.Get (1));
145 
146  // create the tx and rx mobility models and set their positions
147  Ptr<MobilityModel> txMob = CreateObject<ConstantPositionMobilityModel> ();
148  txMob->SetPosition (Vector (0.0,0.0,10.0));
149  Ptr<MobilityModel> rxMob = CreateObject<ConstantPositionMobilityModel> ();
150  rxMob->SetPosition (Vector (100.0,0.0,10.0));
151 
152  // associate the nodes and the mobility models
153  nodes.Get (0)->AggregateObject (txMob);
154  nodes.Get (1)->AggregateObject (rxMob);
155 
156  // create the tx and rx antennas and set the their dimensions
157  Ptr<ThreeGppAntennaArrayModel> txAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (txAntennaElements [0]), "NumRows", UintegerValue (txAntennaElements [1]), "IsotropicElements", BooleanValue (true));
158  Ptr<ThreeGppAntennaArrayModel> rxAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (rxAntennaElements [0]), "NumRows", UintegerValue (rxAntennaElements [1]), "IsotropicElements", BooleanValue (true));
159 
160  // generate the channel matrix
161  Ptr<const ThreeGppChannelModel::ThreeGppChannelMatrix> channelMatrix = channelModel->GetChannel (txMob, rxMob, txAntenna, rxAntenna);
162 
163  // check the channel matrix dimensions
164  NS_TEST_ASSERT_MSG_EQ (channelMatrix->m_channel.at (0).size (), txAntennaElements [0] * txAntennaElements [1], "The second dimension of H should be equal to the number of tx antenna elements");
165  NS_TEST_ASSERT_MSG_EQ (channelMatrix->m_channel.size (), rxAntennaElements [0] * rxAntennaElements [1], "The first dimension of H should be equal to the number of rx antenna elements");
166 
167  // test if the channel matrix is correctly generated
168  uint16_t numIt = 1000;
169  for (uint16_t i = 0; i < numIt; i++)
170  {
171  Simulator::Schedule (MilliSeconds (updatePeriodMs * i), &ThreeGppChannelMatrixComputationTest::DoComputeNorm, this, channelModel, txMob, rxMob, txAntenna, rxAntenna);
172  }
173 
174  Simulator::Run ();
175 
176  // compute the sample mean
177  double sampleMean = 0;
178  for (auto i : m_normVector)
179  {
180  sampleMean += i;
181  }
182  sampleMean /= numIt;
183 
184  // compute the sample standard deviation
185  double sampleStd = 0;
186  for (auto i : m_normVector)
187  {
188  sampleStd += ((i - sampleMean) * (i - sampleMean));
189  }
190  sampleStd = std::sqrt (sampleStd / (numIt - 1));
191 
192  // perform the one sample t-test with a significance level of 0.05 to test
193  // the hypothesis "E [|H|^2] = M*N, where |H| indicates the Frobenius norm of
194  // H, M is the number of transmit antenna elements, and N is the number of
195  // the receive antenna elements"
196  double t = (sampleMean - txAntennaElements [0] * txAntennaElements [1] * rxAntennaElements [0] * rxAntennaElements [1]) / (sampleMean / std::sqrt (numIt));
197 
198  // Using a significance level of 0.05, we reject the null hypothesis if |t| is
199  // greater than the critical value from a t-distribution with df = numIt-1
200  NS_TEST_ASSERT_MSG_EQ_TOL (std::abs (t), 0, 1.65, "We reject the hypothesis E[|H|^2] = M*N with a significance level of 0.05");
201 
202  Simulator::Destroy ();
203 }
204 
211 {
212 public:
217 
222 
223 private:
227  virtual void DoRun (void);
228 
240 
242 };
243 
245  : TestCase ("Check if the channel realizations are correctly updated during the simulation")
246 {
247 }
248 
250 {
251 }
252 
253 void
255 {
256  // retrieve the channel matrix
257  Ptr<const ThreeGppChannelModel::ThreeGppChannelMatrix> channelMatrix = channelModel->GetChannel (txMob, rxMob, txAntenna, rxAntenna);
258 
259  if (m_currentChannel == 0)
260  {
261  // this is the first time we compute the channel matrix, we initialize
262  // m_currentChannel
263  m_currentChannel = channelMatrix;
264  }
265  else
266  {
267  // compare the old and the new channel matrices
268  NS_TEST_ASSERT_MSG_EQ ((m_currentChannel != channelMatrix), update, Simulator::Now ().GetMilliSeconds () << " The channel matrix is not correctly updated");
269  }
270 }
271 
272 void
274 {
275  // Build the scenario for the test
276 
277  uint8_t txAntennaElements[] {2, 2}; // tx antenna dimensions
278  uint8_t rxAntennaElements[] {4, 4}; // rx antenna dimensions
279  uint32_t updatePeriodMs = 100; // update period in ms
280 
281  // create the channel condition model
282  Ptr<ChannelConditionModel> channelConditionModel = CreateObject<AlwaysLosChannelConditionModel> ();
283 
284  // create the ThreeGppChannelModel object used to generate the channel matrix
285  Ptr<ThreeGppChannelModel> channelModel = CreateObject<ThreeGppChannelModel> ();
286  channelModel->SetAttribute ("Frequency", DoubleValue (60.0e9));
287  channelModel->SetAttribute ("Scenario", StringValue ("UMa"));
288  channelModel->SetAttribute ("ChannelConditionModel", PointerValue (channelConditionModel));
289  channelModel->SetAttribute ("UpdatePeriod", TimeValue (MilliSeconds (updatePeriodMs)));
290 
291  // create the tx and rx nodes
293  nodes.Create (2);
294 
295  // create the tx and rx devices
296  Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> ();
297  Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> ();
298 
299  // associate the nodes and the devices
300  nodes.Get (0)->AddDevice (txDev);
301  txDev->SetNode (nodes.Get (0));
302  nodes.Get (1)->AddDevice (rxDev);
303  rxDev->SetNode (nodes.Get (1));
304 
305  // create the tx and rx mobility models and set their positions
306  Ptr<MobilityModel> txMob = CreateObject<ConstantPositionMobilityModel> ();
307  txMob->SetPosition (Vector (0.0,0.0,10.0));
308  Ptr<MobilityModel> rxMob = CreateObject<ConstantPositionMobilityModel> ();
309  rxMob->SetPosition (Vector (100.0,0.0,1.6));
310 
311  // associate the nodes and the mobility models
312  nodes.Get (0)->AggregateObject (txMob);
313  nodes.Get (1)->AggregateObject (rxMob);
314 
315  // create the tx and rx antennas and set the their dimensions
316  Ptr<ThreeGppAntennaArrayModel> txAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (txAntennaElements [0]), "NumRows", UintegerValue (txAntennaElements [1]), "IsotropicElements", BooleanValue (true));
317  Ptr<ThreeGppAntennaArrayModel> rxAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (rxAntennaElements [0]), "NumRows", UintegerValue (rxAntennaElements [1]), "IsotropicElements", BooleanValue (true));
318 
319  // check if the channel matrix is correctly updated
320 
321  // compute the channel matrix for the first time
322  uint32_t firstTimeMs = 1; // time instant at which the channel matrix is generated for the first time
323  Simulator::Schedule (MilliSeconds (firstTimeMs), &ThreeGppChannelMatrixUpdateTest::DoGetChannel, this, channelModel, txMob, rxMob, txAntenna, rxAntenna, true);
324 
325  // call GetChannel before the update period is exceeded, the channel matrix
326  // should not be updated
327  Simulator::Schedule (MilliSeconds (firstTimeMs + updatePeriodMs / 2), &ThreeGppChannelMatrixUpdateTest::DoGetChannel, this, channelModel, txMob, rxMob, txAntenna, rxAntenna, false);
328 
329  // call GetChannel when the update period is exceeded, the channel matrix
330  // should be recomputed
331  Simulator::Schedule (MilliSeconds (firstTimeMs + updatePeriodMs + 1), &ThreeGppChannelMatrixUpdateTest::DoGetChannel, this, channelModel, txMob, rxMob, txAntenna, rxAntenna, true);
332 
333  Simulator::Run ();
334  Simulator::Destroy ();
335 }
336 
346 {
347 public:
352 
357 
358 private:
362  virtual void DoRun (void);
363 
371  void DoBeamforming (Ptr<NetDevice> thisDevice, Ptr<ThreeGppAntennaArrayModel> thisAntenna, Ptr<NetDevice> otherDevice, Ptr<ThreeGppAntennaArrayModel> otherAntenna);
372 
384 
392 };
393 
395  : TestCase ("Test case for the ThreeGppSpectrumPropagationLossModel class")
396 {
397 }
398 
400 {
401 }
402 
403 void
405 {
406  uint8_t noPlane = 1;
408 
409  Vector aPos = thisDevice->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
410  Vector bPos = otherDevice->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
411 
412  Angles completeAngle (bPos,aPos);
413 
414  double posX = bPos.x - aPos.x;
415  double phiAngle = atan ((bPos.y - aPos.y) / posX);
416 
417  if (posX < 0)
418  {
419  phiAngle = phiAngle + M_PI;
420  }
421  if (phiAngle < 0)
422  {
423  phiAngle = phiAngle + 2 * M_PI;
424  }
425 
426  double hAngleRadian = fmod ((phiAngle + (M_PI / noPlane)),2 * M_PI / noPlane) - (M_PI / noPlane);
427  double vAngleRadian = completeAngle.theta;
428 
429  int totNoArrayElements = thisAntenna->GetNumberOfElements ();
430  double power = 1 / sqrt (totNoArrayElements);
431 
432  for (int ind = 0; ind < totNoArrayElements; ind++)
433  {
434  Vector loc = thisAntenna->GetElementLocation (ind);
435  double phase = -2 * M_PI * (sin (vAngleRadian) * cos (hAngleRadian) * loc.x
436  + sin (vAngleRadian) * sin (hAngleRadian) * loc.y
437  + cos (vAngleRadian) * loc.z);
438  antennaWeights.push_back (exp (std::complex<double> (0, phase)) * power);
439  }
440 
441  thisAntenna->SetBeamformingVector (antennaWeights);
442 }
443 
444 bool
446 {
447  bool ret = true;
448  for (uint8_t i = 0; i < first->GetSpectrumModel ()->GetNumBands (); i++)
449  {
450  if ((*first) [i] != (*second) [i])
451  {
452  ret = false;
453  continue;
454  }
455  }
456  return ret;
457 }
458 
459 void
461 {
462  Ptr<SpectrumValue> rxPsdNew = lossModel->DoCalcRxPowerSpectralDensity (txPsd, txMob, rxMob);
463  NS_TEST_ASSERT_MSG_EQ (ArePsdEqual (rxPsdOld, rxPsdNew), false, "The long term is not updated when the channel matrix is recomputed");
464 }
465 
466 void
468 {
469  // Build the scenario for the test
470  Config::SetDefault ("ns3::ThreeGppChannelModel::UpdatePeriod", TimeValue (MilliSeconds (100)));
471 
472  uint8_t txAntennaElements[] {4, 4}; // tx antenna dimensions
473  uint8_t rxAntennaElements[] {4, 4}; // rx antenna dimensions
474 
475  // create the ChannelConditionModel object to be used to retrieve the
476  // channel condition
477  Ptr<ChannelConditionModel> condModel = CreateObject<AlwaysLosChannelConditionModel> ();
478 
479  // create the ThreeGppSpectrumPropagationLossModel object, set frequency,
480  // scenario and channel condition model to be used
481  Ptr<ThreeGppSpectrumPropagationLossModel> lossModel = CreateObject<ThreeGppSpectrumPropagationLossModel> ();
482  lossModel->SetChannelModelAttribute ("Frequency", DoubleValue(2.4e9));
483  lossModel->SetChannelModelAttribute ("Scenario", StringValue("UMa"));
484  lossModel->SetChannelModelAttribute ("ChannelConditionModel", PointerValue (condModel)); // create the ThreeGppChannelModel object used to generate the channel matrix
485 
486  // create the tx and rx nodes
488  nodes.Create (2);
489 
490  // create the tx and rx devices
491  Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> ();
492  Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> ();
493 
494  // associate the nodes and the devices
495  nodes.Get (0)->AddDevice (txDev);
496  txDev->SetNode (nodes.Get (0));
497  nodes.Get (1)->AddDevice (rxDev);
498  rxDev->SetNode (nodes.Get (1));
499 
500  // create the tx and rx mobility models and set their positions
501  Ptr<MobilityModel> txMob = CreateObject<ConstantPositionMobilityModel> ();
502  txMob->SetPosition (Vector (0.0,0.0,10.0));
503  Ptr<MobilityModel> rxMob = CreateObject<ConstantPositionMobilityModel> ();
504  rxMob->SetPosition (Vector (15.0,0.0,10.0)); // in this position the channel condition is always LOS
505 
506  // associate the nodes and the mobility models
507  nodes.Get (0)->AggregateObject (txMob);
508  nodes.Get (1)->AggregateObject (rxMob);
509 
510  // create the tx and rx antennas and set the their dimensions
511  Ptr<ThreeGppAntennaArrayModel> txAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (txAntennaElements [0]), "NumRows", UintegerValue (txAntennaElements [1]));
512  Ptr<ThreeGppAntennaArrayModel> rxAntenna = CreateObjectWithAttributes<ThreeGppAntennaArrayModel> ("NumColumns", UintegerValue (rxAntennaElements [0]), "NumRows", UintegerValue (rxAntennaElements [1]));
513 
514  // initialize ThreeGppSpectrumPropagationLossModel
515  lossModel->AddDevice (txDev, txAntenna);
516  lossModel->AddDevice (rxDev, rxAntenna);
517 
518  // set the beamforming vectors
519  DoBeamforming (txDev, txAntenna, rxDev, rxAntenna);
520  DoBeamforming (rxDev, rxAntenna, txDev, txAntenna);
521 
522  // create the tx psd
524  double txPower = 0.1; // Watts
525  uint32_t channelNumber = 1;
526  Ptr<SpectrumValue> txPsd = sf.CreateTxPowerSpectralDensity (txPower, channelNumber);
527 
528  // compute the rx psd
529  Ptr<SpectrumValue> rxPsdOld = lossModel->DoCalcRxPowerSpectralDensity (txPsd, txMob, rxMob);
530 
531  // 1) check that the rx PSD is equal for both the direct and the reverse channel
532  Ptr<SpectrumValue> rxPsdNew = lossModel->DoCalcRxPowerSpectralDensity (txPsd, rxMob, txMob);
533  NS_TEST_ASSERT_MSG_EQ (ArePsdEqual (rxPsdOld, rxPsdNew), true, "The long term for the direct and the reverse channel are different");
534 
535  // 2) check if the long term is updated when changing the BF vector
536  // change the position of the rx device and recompute the beamforming vectors
537  rxMob->SetPosition (Vector (10.0, 5.0, 10.0));
539  txBfVector [0] = std::complex<double> (0.0, 0.0);
540  txAntenna->SetBeamformingVector (txBfVector);
541 
542  rxPsdNew = lossModel->DoCalcRxPowerSpectralDensity (txPsd, rxMob, txMob);
543  NS_TEST_ASSERT_MSG_EQ (ArePsdEqual (rxPsdOld, rxPsdNew), false, "Changing the BF vectors the rx PSD does not change");
544 
545  // update rxPsdOld
546  rxPsdOld = rxPsdNew;
547 
548  // 3) check if the long term is updated when the channel matrix is recomputed
549  Simulator::Schedule (MilliSeconds (101), &ThreeGppSpectrumPropagationLossModelTest::CheckLongTermUpdate, this, lossModel, txPsd, txMob, rxMob, rxPsdOld);
550 
551  Simulator::Run ();
552  Simulator::Destroy ();
553 }
554 
561 {
562 public:
567 };
568 
570  : TestSuite ("three-gpp-channel", UNIT)
571 {
572  AddTestCase (new ThreeGppChannelMatrixComputationTest, TestCase::QUICK);
573  AddTestCase (new ThreeGppChannelMatrixUpdateTest, TestCase::QUICK);
575 }
576 
virtual uint64_t GetNumberOfElements(void) const
Returns the number of antenna elements.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:36
std::vector< std::complex< double > > ComplexVector
type definition for complex vectors
Definition: second.py:1
virtual Ptr< SpectrumValue > DoCalcRxPowerSpectralDensity(Ptr< const SpectrumValue > txPsd, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Computes the received PSD.
Hold variables of type string.
Definition: string.h:41
A suite of tests to run.
Definition: test.h:1343
virtual Ptr< Node > GetNode(void) const =0
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1078
virtual void DoRun(void)
Build the test scenario.
double theta
the inclination angle in radians
Definition: angles.h:117
encapsulates test code
Definition: test.h:1153
static bool ArePsdEqual(Ptr< SpectrumValue > first, Ptr< SpectrumValue > second)
Checks if two PSDs are equal.
static Vector GetPosition(Ptr< Node > node)
Definition: wifi-ap.cc:96
Test case for the ThreeGppChannelModel class.
Ptr< const ThreeGppChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const ThreeGppAntennaArrayModel > aAntenna, Ptr< const ThreeGppAntennaArrayModel > bAntenna)
Looks for the channel matrix associated to the aMob and bMob pair in m_channelMap.
Complex3DVector m_channel
channel matrix H[u][s][n].
virtual Vector GetElementLocation(uint64_t index) const
Returns the location of the antenna element with the specified index assuming the left bottom corner ...
Keep track of the current position and velocity of an object.
virtual void SetNode(Ptr< Node > node)
nodes
Definition: first.py:32
AttributeValue implementation for Time.
Definition: nstime.h:1132
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
std::vector< double > m_normVector
each element is the norm of a channel realization
Hold an unsigned integer type.
Definition: uinteger.h:44
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:166
Test case for the ThreeGppSpectrumPropagationLossModelTest class.
#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:378
static ThreeGppChannelTestSuite myTestSuite
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:464
void SetBeamformingVector(const ComplexVector &beamformingVector)
Sets the beamforming vector to be used.
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint8_t channel)
Creates a SpectrumValue instance that represents the TX Power Spectral Density of a wifi device corre...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
Test suite for the ThreeGppChannelModel class.
void DoGetChannel(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< ThreeGppAntennaArrayModel > txAntenna, Ptr< ThreeGppAntennaArrayModel > rxAntenna, bool update)
This method is used to schedule the channel matrix computation at different time instants and to chec...
const ComplexVector & GetBeamformingVector(void) const
Returns the beamforming vector that is currently being used.
Ptr< const ThreeGppChannelModel::ThreeGppChannelMatrix > m_currentChannel
used by DoGetChannel to store the current channel matrix
void SetPosition(const Vector &position)
virtual void DoRun(void)
Build the test scenario.
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:812
void CheckLongTermUpdate(Ptr< ThreeGppSpectrumPropagationLossModel > lossModel, Ptr< SpectrumValue > txPsd, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< SpectrumValue > rxPsdOld)
Test of the long term component is correctly updated when the channel matrix is recomputed.
void DoComputeNorm(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< ThreeGppAntennaArrayModel > txAntenna, Ptr< ThreeGppAntennaArrayModel > rxAntenna)
Compute the Frobenius norm of the channel matrix and stores it in m_normVector.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:309
void DoBeamforming(Ptr< NetDevice > thisDevice, Ptr< ThreeGppAntennaArrayModel > thisAntenna, Ptr< NetDevice > otherDevice, Ptr< ThreeGppAntennaArrayModel > otherAntenna)
Points the beam of thisDevice towards otherDevice.
struct holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:71
Test case for the ThreeGppChannelModel class.
Definition: first.py:1
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
Implements Wifi SpectrumValue for the 2.4 GHz ISM band only, with a 5 MHz spectrum resolution...
virtual void DoRun(void)
Build the test scenario.