9#include "ns3/boolean.h"
10#include "ns3/channel-condition-model.h"
11#include "ns3/config.h"
12#include "ns3/constant-position-mobility-model.h"
13#include "ns3/constant-velocity-mobility-model.h"
14#include "ns3/double.h"
15#include "ns3/ism-spectrum-value-helper.h"
16#include "ns3/isotropic-antenna-model.h"
18#include "ns3/node-container.h"
19#include "ns3/pointer.h"
20#include "ns3/rng-seed-manager.h"
21#include "ns3/simulator.h"
22#include "ns3/spectrum-signal-parameters.h"
23#include "ns3/string.h"
25#include "ns3/three-gpp-antenna-model.h"
26#include "ns3/three-gpp-channel-model.h"
27#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
28#include "ns3/uinteger.h"
29#include "ns3/uniform-planar-array.h"
71 void DoRun()
override;
99 :
TestCase(
"Check the dimensions and the norm of the channel matrix")
118 uint64_t txAntennaElements = txAntenna->GetNumElems();
119 uint64_t rxAntennaElements = rxAntenna->GetNumElems();
122 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
124 double channelNorm = 0;
125 uint16_t numTotalClusters = channelMatrix->m_channel.GetNumPages();
126 for (uint16_t cIndex = 0; cIndex < numTotalClusters; cIndex++)
128 double clusterNorm = 0;
129 for (uint64_t sIndex = 0; sIndex < txAntennaElements; sIndex++)
131 for (uint64_t uIndex = 0; uIndex < rxAntennaElements; uIndex++)
134 std::pow(std::abs(channelMatrix->m_channel(uIndex, sIndex, cIndex)), 2);
137 channelNorm += clusterNorm;
156 channelModel->SetAttribute(
"Frequency",
DoubleValue(60.0e9));
157 channelModel->SetAttribute(
"Scenario",
StringValue(
"RMa"));
158 channelModel->SetAttribute(
"ChannelConditionModel",
PointerValue(channelConditionModel));
160 channelModel->AssignStreams(1);
168 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
170 rxMob->SetPosition(Vector(30.0, 0.0, 10.0));
171 rxMob->SetVelocity(Vector(50, 0, 0));
174 nodes.Get(0)->AggregateObject(txMob);
175 nodes.Get(1)->AggregateObject(rxMob);
187 "NumHorizontalPorts",
199 "NumHorizontalPorts",
203 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
207 channelMatrix->m_channel.GetNumCols(),
209 "The third dimension of H should be equal to the number of tx antenna elements");
211 channelMatrix->m_channel.GetNumRows(),
213 "The second dimension of H should be equal to the number of rx antenna elements");
216 uint16_t numIt = 2000;
217 for (uint16_t i = 0; i < numIt; i++)
232 double sampleMean = 0;
240 double sampleStd = 0;
243 const double diff = i - sampleMean;
244 sampleStd += diff * diff;
246 sampleStd = std::sqrt(sampleStd / (numIt - 1));
250 "The STD should be different from zero. Channel matrix not updated");
260 (sampleStd / std::sqrt(numIt));
269 "We reject the hypothesis E[|H|^2] = M*N with a significance level of 0.05");
309 void DoRun()
override;
344 :
TestCase(
"Check if the channel realizations are correctly updated during the simulation")
367 rxMob->SetPosition(Vector(rxMob->GetPosition().x + 0.01,
368 rxMob->GetPosition().y + 0.01,
369 rxMob->GetPosition().z));
373 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
386 std::complex<double> tol(1e-12, 0.0);
388 bool changed = !equal;
394 <<
" The channel matrix is not updated respecting the updatePeriod configuration");
420 channelModel->SetAttribute(
"Frequency",
DoubleValue(60.0e9));
421 channelModel->SetAttribute(
"Scenario",
StringValue(
"UMa"));
422 channelModel->SetAttribute(
"ChannelConditionModel",
PointerValue(channelConditionModel));
431 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
433 rxMob->SetPosition(Vector(100.0, 0.0, 1.6));
436 nodes.Get(0)->AggregateObject(txMob);
437 nodes.Get(1)->AggregateObject(rxMob);
449 "NumHorizontalPorts",
461 "NumHorizontalPorts",
588 this->channelNorm = this->channelNorm + other.
channelNorm;
604 result.channelNorm = this->channelNorm / iterations;
605 result.thirdClusterPower_dB = this->thirdClusterPower_dB / iterations;
606 result.thirdClusterDelay = this->thirdClusterDelay / iterations;
607 result.thirdClusterAoa = this->thirdClusterAoa / iterations;
608 result.thirdClusterZoa = this->thirdClusterZoa / iterations;
619 *
this = *
this / iterations;
676 void DoRun()
override;
705 std::vector<ChannelConsistencyMetrics>* metricsVectorToBeUsed,
706 std::vector<ChannelConsistencyMetrics>* distancesVectorToBeUsed);
737 :
TestCase(
std::string(
"Check the channel consistency feature for losCondition ") +
739 ", speed=" +
std::to_string(speedKmh) +
740 " kmph, and freq=" +
std::to_string(freqHz / 1e9) +
" GHz.")
758 std::vector<ChannelConsistencyMetrics>* metricsVectorToBeUsed,
759 std::vector<ChannelConsistencyMetrics>* distancesVectorToBeUsed)
761 uint64_t txAntennaElements = txAntenna->GetNumElems();
762 uint64_t rxAntennaElements = rxAntenna->GetNumElems();
765 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
767 double channelNorm = 0;
768 uint16_t numTotalClusters = channelMatrix->m_channel.GetNumPages();
769 for (uint16_t cIndex = 0; cIndex < numTotalClusters; cIndex++)
771 double clusterNorm = 0;
772 for (uint64_t sIndex = 0; sIndex < txAntennaElements; sIndex++)
774 for (uint64_t uIndex = 0; uIndex < rxAntennaElements; uIndex++)
777 std::pow(std::abs(channelMatrix->m_channel(uIndex, sIndex, cIndex)), 2);
780 channelNorm += clusterNorm;
784 channelModel->GetParams(txMob, rxMob);
788 double thirdClusterPower_dB = std::numeric_limits<double>::quiet_NaN();
790 double thirdClusterDelay = std::numeric_limits<double>::quiet_NaN();
792 double thirdClusterAoa = std::numeric_limits<double>::quiet_NaN();
794 double thirdClusterZoa = std::numeric_limits<double>::quiet_NaN();
796 if (channelParams->m_clusterPower.size() > 2)
798 uint8_t thirdClusterIndex = 2;
799 thirdClusterPower_dB = 10 * log10(channelParams->m_clusterPower.at(thirdClusterIndex));
801 thirdClusterDelay = channelParams->m_delay.at(thirdClusterIndex);
803 thirdClusterAoa = channelParams->m_angle.at(0).at(thirdClusterIndex);
805 thirdClusterZoa = channelParams->m_angle.at(1).at(thirdClusterIndex);
808 metricsVectorToBeUsed->push_back(
809 {channelNorm, thirdClusterPower_dB, thirdClusterDelay, thirdClusterAoa, thirdClusterZoa});
811 if (metricsVectorToBeUsed->size() > 1)
814 ComputeDeltas(metricsVectorToBeUsed->at(metricsVectorToBeUsed->size() - 2),
815 metricsVectorToBeUsed->at(metricsVectorToBeUsed->size() - 1));
817 distancesVectorToBeUsed->push_back(deltas);
828 double fDoppler = (speedMps *
m_freqHz) / 3e8;
832 const Time& updatePeriod = cTime;
834 uint16_t iterations = 100;
855 channelModel->SetAttribute(
"Scenario",
StringValue(
"RMa"));
856 channelModel->SetAttribute(
"ChannelConditionModel",
PointerValue(channelConditionModel));
857 channelModel->SetAttribute(
"UpdatePeriod",
TimeValue(updatePeriod));
858 channelModel->AssignStreams(1);
873 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
875 rxMob->SetPosition(Vector(30.0, 0.0, 1.0));
876 rxMob->SetVelocity(Vector(speedMps, 0, 0));
882 std::vector<Ptr<ConstantVelocityMobilityModel>> rxMobCopies{100};
883 rxMobCopies.reserve(100);
889 rxMobCopy->SetPosition(Vector(30.0, 0.0, 1.0));
890 rxMobCopy->SetVelocity(Vector(speedMps, 0, 0));
892 rxMobCopies[i] = rxMobCopy;
917 for (uint16_t i = 0; i < iterations; i++)
952 metricMeanChannelUpdates += i.
abs();
958 metricMeanNewChannelRealizations += i.
abs();
964 "Check that the average distances between the consistency metrics of "
965 "the consecutive channel updates "
966 " are lower than of the consecutive new channel generations.");
994 void DoRun()
override;
1022 :
TestCase(
"Check if the channel realizations are correctly updated after antenna port changes "
1023 "during the simulation")
1041 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
1049 <<
" The channel matrix is not correctly updated");
1066 channelModel->SetAttribute(
"Frequency",
DoubleValue(60.0e9));
1067 channelModel->SetAttribute(
"Scenario",
StringValue(
"UMa"));
1068 channelModel->SetAttribute(
"ChannelConditionModel",
PointerValue(channelConditionModel));
1077 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
1079 rxMob->SetPosition(Vector(100.0, 0.0, 1.6));
1082 nodes.Get(0)->AggregateObject(txMob);
1083 nodes.Get(1)->AggregateObject(rxMob);
1095 "NumHorizontalPorts",
1107 "NumHorizontalPorts",
1138 [&txAntenna]() { txAntenna->SetNumRows(txAntenna->GetNumRows() + 1); });
1162 [&rxAntenna]() { rxAntenna->SetNumRows(rxAntenna->GetNumRows() + 1); });
1245 void DoRun()
override;
1288 :
TestCase(
"Test case for the ThreeGppSpectrumPropagationLossModel class")
1306 Vector aPos = thisMob->GetPosition();
1307 Vector bPos = otherMob->GetPosition();
1310 Angles completeAngle(bPos, aPos);
1313 thisAntenna->GetBeamformingVector(completeAngle);
1314 thisAntenna->SetBeamformingVector(antennaWeights);
1322 auto rxPsdNewParams = params.lossModel->DoCalcRxPowerSpectralDensity(params.txParams,
1330 "Changing the positions and BF vectors the rx PSD does not change");
1333 (*params.rxSpectrumChannelMatrix == *rxPsdNewParams->spectrumChannelMatrix),
1335 "Changing the BF should change de frequency domain channel matrix");
1345 params.txMob->SetPosition(Vector(params.txMob->GetPosition().x + 0.1,
1346 params.txMob->GetPosition().y,
1347 params.txMob->GetPosition().z));
1349 auto rxPsdNewParams = params.lossModel->DoCalcRxPowerSpectralDensity(params.txParams,
1356 "The long term is not updated when the channel matrix is recomputed");
1373 lossModel->SetChannelModelAttribute(
"Frequency",
DoubleValue(2.4e9));
1374 lossModel->SetChannelModelAttribute(
"Scenario",
StringValue(
"UMa"));
1375 lossModel->SetChannelModelAttribute(
1376 "ChannelConditionModel",
1386 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
1389 Vector(15.0, 0.0, 10.0));
1392 nodes.Get(0)->AggregateObject(txMob);
1393 nodes.Get(1)->AggregateObject(rxMob);
1405 "NumHorizontalPorts",
1417 "NumHorizontalPorts",
1426 double txPower = 0.1;
1430 txParams->psd = txPsd->Copy();
1434 lossModel->DoCalcRxPowerSpectralDensity(txParams, txMob, rxMob, txAntenna, rxAntenna);
1438 lossModel->DoCalcRxPowerSpectralDensity(txParams, rxMob, txMob, rxAntenna, txAntenna);
1439 if ((rxParamsOld->spectrumChannelMatrix->GetNumCols() ==
1440 rxParamsNew->spectrumChannelMatrix->GetNumCols()) &&
1441 (rxParamsOld->spectrumChannelMatrix->GetNumRows() ==
1442 rxParamsNew->spectrumChannelMatrix->GetNumRows()) &&
1443 (rxParamsOld->spectrumChannelMatrix->GetNumCols() == 1) &&
1444 (rxParamsOld->spectrumChannelMatrix->GetNumRows() == 1))
1447 const auto& oldValues = rxParamsOld->psd->GetValues();
1448 const auto& newValues = rxParamsNew->psd->GetValues();
1452 "The long term for the direct and the reverse channel are different");
1453 for (
size_t i = 0; i < oldValues.size(); i++)
1459 "The long term for the direct and the reverse channel are different");
1465 rxMob->SetPosition(Vector(10.0, 5.0, 10.0));
1467 txBfVector[0] = std::complex<double>(0.0, 0.0);
1468 txAntenna->SetBeamformingVector(txBfVector);
1474 rxParamsOld->spectrumChannelMatrix,
1481 paramsPositionUpdate);
1489 rxParamsOld->spectrumChannelMatrix,
1544 void DoRun()
override;
1548 :
TestCase(
"Check long term channel matrix generation when multiple ports at TX and RX are "
1566 channelModel->SetAttribute(
"Frequency",
DoubleValue(2.0e9));
1567 channelModel->SetAttribute(
"Scenario",
StringValue(
"RMa"));
1568 channelModel->SetAttribute(
"ChannelConditionModel",
PointerValue(channelConditionModel));
1576 txMob->SetPosition(Vector(0.0, 0.0, 10.0));
1578 rxMob->SetPosition(Vector(10.0, 0.0, 10.0));
1581 nodes.Get(0)->AggregateObject(txMob);
1582 nodes.Get(1)->AggregateObject(rxMob);
1594 "NumHorizontalPorts",
1606 "NumHorizontalPorts",
1610 Angles completeAngleTxRx(rxMob->GetPosition(), txMob->GetPosition());
1611 Angles completeAngleRxTx(txMob->GetPosition(), rxMob->GetPosition());
1613 txAntenna1->SetBeamformingVector(txAntenna1->GetBeamformingVector(completeAngleTxRx));
1614 rxAntenna1->SetBeamformingVector(rxAntenna1->GetBeamformingVector(completeAngleRxTx));
1618 channelModel->GetChannel(txMob, rxMob, txAntenna1, rxAntenna1);
1626 threeGppSplm->CalcLongTerm(channelMatrixM0, txAntenna1, rxAntenna1);
1638 "NumHorizontalPorts",
1650 "NumHorizontalPorts",
1653 txAntenna2->SetBeamformingVector(txAntenna2->GetBeamformingVector(completeAngleTxRx));
1654 rxAntenna2->SetBeamformingVector(rxAntenna2->GetBeamformingVector(completeAngleRxTx));
1657 threeGppSplm->CalcLongTerm(channelMatrixM0, txAntenna2, rxAntenna2);
1669 "NumHorizontalPorts",
1671 "AntennaHorizontalSpacing",
1683 "NumHorizontalPorts",
1685 "AntennaHorizontalSpacing",
1690 channelMatrixMA->m_channel = *matrixA;
1692 txAntenna3->SetBeamformingVector(txAntenna3->GetBeamformingVector(completeAngleTxRx));
1693 rxAntenna3->SetBeamformingVector(rxAntenna3->GetBeamformingVector(completeAngleRxTx));
1696 threeGppSplm->CalcLongTerm(channelMatrixMA, txAntenna3, rxAntenna3);
1700 "Matrix B and Matrix C should be equal.");
1782 std::valarray<std::complex<double>> testChannel,
1794 void DoRun()
override;
1809 std::valarray<std::complex<double>>
1816 std::string testCaseName,
1821 std::valarray<std::complex<double>> testChannel,
1823 :
TestCase(
"Test MIMO using dual polarization." + testCaseName),
1842 if (params.m_isotropic)
1859 "NumHorizontalPorts",
1876 channelModel->SetAttribute(
"Frequency",
DoubleValue(60e9));
1877 channelModel->SetAttribute(
"Scenario",
StringValue(
"RMa"));
1878 channelModel->SetAttribute(
"ChannelConditionModel",
1881 int64_t randomStream = 1;
1882 randomStream += channelModel->AssignStreams(randomStream);
1895 nodes.Get(0)->AggregateObject(txMob);
1896 nodes.Get(1)->AggregateObject(rxMob);
1903 txAntenna->SetBeamformingVector(
1904 txAntenna->GetBeamformingVector(
Angles(rxMob->GetPosition(), txMob->GetPosition())));
1905 rxAntenna->SetBeamformingVector(
1906 rxAntenna->GetBeamformingVector(
Angles(txMob->GetPosition(), rxMob->GetPosition())));
1910 channelModel->GetChannel(txMob, rxMob, txAntenna, rxAntenna);
1915 const std::complex<double>* strongestClusterPtr = channelMatrix->m_channel.GetPagePtr(0);
1917 channelMatrix->m_channel.GetNumRows() * channelMatrix->m_channel.GetNumCols();
1920 channelMatrix->m_channel.GetNumRows(),
1921 channelMatrix->m_channel.GetNumCols(),
1922 std::valarray<std::complex<double>>(strongestClusterPtr, matrixSize));
1925 channelMatrix->m_channel.GetNumCols(),
1928 NS_LOG_INFO(
"Channel matrix:" << strongestCluster);
1929 NS_LOG_INFO(
"Test channel matrix: " << testChannel);
1934 "The strongest cluster and the test channel matrix should be almost equal");
2014 std::valarray<std::complex<double>> testChannel1 =
2015 {5.9, 5.9, 0, 0, 5.9, 5.9, 0, 0, 0, 0, -5.8, -5.8, 0, 0, -5.8, -5.8};
2041 {5, 5, 3, 3, 5, 5, 3, 3, 3, 3, -5, -5, 3, 3, -5, -5},
2061 {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, -4, 4, 4, -4, -4},
2076 "Face-to-face. 90 and 0 pol. slant angles.",
2081 {0, 0, 5.8, 5.8, 0, 0, 5.8, 5.8, 5.9, 5.9, 0, 0, 5.9, 5.9, 0, 0},
2101 "angles. 0 and 0 pol. slant angles.",
2104 Vector{6.363961031, 6.363961031, 3},
2121 "Not face-to-face. Different heights. 0 and 0 pol. slant angles.",
Test case for the ThreeGppChannelModel class.
uint32_t m_rxPorts
number of horizontal and vertical ports of rx antenna array
~ThreeGppAntennaSetupChangedTest() override
Destructor.
uint32_t m_txPorts
number of horizontal and vertical ports of tx antenna array
uint32_t m_rxAntennaElements
number of rows and columns of rx antenna array
uint32_t m_txAntennaElements
number of rows and columns of tx antenna array
void DoGetChannel(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< PhasedArrayModel > txAntenna, Ptr< PhasedArrayModel > rxAntenna, bool update)
This method is used to schedule the channel matrix computation at different time instants and to chec...
Ptr< const ThreeGppChannelModel::ChannelMatrix > m_currentChannel
used by DoGetChannel to store the current channel matrix
ThreeGppAntennaSetupChangedTest()
Constructor.
void DoRun() override
Build the test scenario.
Test case that test the correct use of the multi-port antennas in spectrum.
~ThreeGppCalcLongTermMultiPortTest() override
Destructor.
void DoRun() override
Build the test scenario.
ThreeGppCalcLongTermMultiPortTest()
Constructor.
Test case for channel consistency Procedure A (according to 3GPP 38.901 Section 7....
void DoComputeConsistencyMetrics(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< PhasedArrayModel > txAntenna, Ptr< PhasedArrayModel > rxAntenna, std::vector< ChannelConsistencyMetrics > *metricsVectorToBeUsed, std::vector< ChannelConsistencyMetrics > *distancesVectorToBeUsed)
Compute the channel consistency metrics to evaluate the varying rate of general channel metrics like:
double m_freqHz
The carrier frequency to be used in the test case.
std::vector< ChannelConsistencyMetrics > m_consistencyMetricsDeltasNewChannelRealizations
consistency metric deltas for the new channel realizations
ChannelConsistencyMetrics ComputeDeltas(ChannelConsistencyMetrics metrics1, ChannelConsistencyMetrics metrics2)
Used for the calculation of the delta of all the metrics between 2 channel consistency metric objects...
void DoRun() override
Build the test scenario.
std::vector< ChannelConsistencyMetrics > m_consistencyMetricsChannelUpdates
consistency metrics for the channel updates
~ThreeGppChannelConsistencyTest() override
Destructor.
ThreeGppChannelConsistencyTest(ChannelCondition::LosConditionValue losCondition, double speedKmh, double freqHz)
Constructor.
uint32_t m_txAntennaElements
number of rows and columns of tx antenna array
uint32_t m_rxAntennaElements
number of rows and columns of rx antenna array
double m_speedKmh
The speed of the user to be used in the test case.
ChannelCondition::LosConditionValue m_losCondition
The type of channel condition to be set; can be LOS or NLOS.
std::vector< ChannelConsistencyMetrics > m_consistencyMetricsDeltasChannelUpdates
consistency metric deltas for the channel updates
std::vector< ChannelConsistencyMetrics > m_consistencyMetricsNewChannelRealizations
consistency metrics for the new channel realizations
Test case for the ThreeGppChannelModel class.
ThreeGppChannelMatrixComputationTest(uint32_t txAntennaElements=2, uint32_t rxAntennaElements=2, uint32_t txPorts=1, uint32_t rxPorts=1)
Constructor.
void DoRun() override
Build the test scenario.
uint32_t m_rxPorts
number of horizontal and vertical ports of rx antenna array
~ThreeGppChannelMatrixComputationTest() override
Destructor.
std::vector< double > m_normVector
each element is the norm of a channel realization
void DoComputeNorm(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< PhasedArrayModel > txAntenna, Ptr< PhasedArrayModel > rxAntenna)
Compute the Frobenius norm of the channel matrix and stores it in m_normVector.
uint32_t m_rxAntennaElements
number of rows and columns of rx antenna array
uint32_t m_txAntennaElements
number of rows and columns of tx antenna array
uint32_t m_txPorts
number of horizontal and vertical ports of tx antenna array
Test case for the ThreeGppChannelModel class.
void MoveRxAndComputerSnr(Ptr< ThreeGppChannelModel > channelModel, Ptr< MobilityModel > txMob, Ptr< MobilityModel > rxMob, Ptr< PhasedArrayModel > txAntenna, Ptr< PhasedArrayModel > rxAntenna, bool update)
This method first slightly moves the user and then calculates the channel matrix.
ThreeGppChannelMatrixUpdateTest(uint32_t txAntennaElements=2, uint32_t rxAntennaElements=4, uint32_t txPorts=1, uint32_t rxPorts=1)
Constructor.
uint32_t m_txAntennaElements
number of rows and columns of tx antenna array
void DoRun() override
Build the test scenario.
bool m_initialized
tracks whether previous matrix snapshot is set
~ThreeGppChannelMatrixUpdateTest() override
Destructor.
uint32_t m_rxPorts
number of horizontal and vertical ports of rx antenna array
Ptr< const ThreeGppChannelModel::ChannelMatrix > m_currentChannel
used by DoGetChannel to store the current channel matrix
uint32_t m_txPorts
number of horizontal and vertical ports of tx antenna array
ComplexMatrixArray m_previousChannelMatrix
snapshot of previous channel matrix
uint32_t m_rxAntennaElements
number of rows and columns of rx antenna array
Test suite for the ThreeGppChannelModel class.
ThreeGppChannelTestSuite()
Constructor.
This test tests that the channel matrix is correctly generated when dual-polarized antennas are being...
void DoRun() override
Build the test scenario.
Vector m_txLoc
Position of the TX device.
Vector m_rxLoc
Position of the RX device.
Ptr< PhasedArrayModel > CreateAndConfigureAntenna(const MimoPolarizationAntennaParams ¶ms)
Function that can be used to configure the antenna using the set of parameters.
MimoPolarizationAntennaParams m_txParams
Parameters used to configure the TX antenna array.
double m_tolerance
The tolerance to be used when comparing the channel matrix with the test matrix.
std::valarray< std::complex< double > > m_testChannel
The test value for the matrix representing the strongest cluster.
ThreeGppMimoPolarizationTest(std::string testCaseName, Vector txLoc, const MimoPolarizationAntennaParams &txAntennaParams, Vector rxLoc, const MimoPolarizationAntennaParams &rxAntennaParams, std::valarray< std::complex< double > > testChannel, double tolerance)
Constructor that receives MIMO polarization parameters of TX and RX devices.
~ThreeGppMimoPolarizationTest() override
Destructor.
MimoPolarizationAntennaParams m_rxParams
Parameters used to configure the RX antenna array.
Test case for the ThreeGppSpectrumPropagationLossModelTest class.
ThreeGppSpectrumPropagationLossModelTest(uint32_t txAntennaElements=4, uint32_t rxAntennaElements=4, uint32_t txPorts=1, uint32_t rxPorts=1)
Constructor.
void DoRun() override
Build the test scenario.
uint32_t m_txPorts
number of horizontal and vertical ports of tx antenna array
Ptr< SpectrumSignalParameters > m_rxParamsOld
used as the input for the long-term update check after the update period expires
uint32_t m_rxAntennaElements
number of rows and columns of rx antenna array
void CheckUpdateAfterChangingPositionsAndBeamforming(const CheckLongTermUpdateParams ¶ms)
Test of the long-term component is correctly updated when the positions and beamforming change.
uint32_t m_rxPorts
number of horizontal and vertical ports of rx antenna array
~ThreeGppSpectrumPropagationLossModelTest() override
Destructor.
void DoBeamforming(Ptr< MobilityModel > thisMob, Ptr< PhasedArrayModel > thisAntenna, Ptr< MobilityModel > otherMob, Ptr< PhasedArrayModel > otherAntenna)
Perform beamforming from this node towards the other node.
void CheckLongTermUpdate(CheckLongTermUpdateParams ¶ms)
Test of the long-term component is correctly updated when the update period expires.
uint32_t m_txAntennaElements
number of rows and columns of tx antenna array
Class holding the azimuth and inclination angles of spherical coordinates.
AttributeValue implementation for Boolean.
Carries information about the LOS/NLOS channel state.
LosConditionValue
Possible values for Line-of-Sight condition.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
ComplexMatrixArray Complex2DVector
Create an alias for 2D complex vectors.
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.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
ComplexMatrixArray ComplexVector
the underlying Valarray
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
Implements Wifi SpectrumValue for the 2.4 GHz ISM band only, with a 5 MHz spectrum resolution.
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...
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Hold an unsigned integer type.
bool IsAlmostEqual(const ValArray< T > &rhs, T tol) const
Compare Valarray up to a given absolute tolerance.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
#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...
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
MatrixArray< std::complex< double > > ComplexMatrixArray
Create an alias for MatrixArray using complex type.
A structure that holds the parameters for the function CheckLongTermUpdate.
Ptr< ThreeGppSpectrumPropagationLossModel > lossModel
the ThreeGppSpectrumPropagationLossModel object used to compute the rx PSD
Ptr< MobilityModel > txMob
the mobility model of the tx device
Ptr< SpectrumValue > rxPsdOld
the previously received PSD
Ptr< SpectrumSignalParameters > txParams
the params of the tx signal
Ptr< PhasedArrayModel > rxAntenna
the antenna array of the rx device
Ptr< MobilityModel > rxMob
the mobility model of the rx device
Ptr< const ComplexMatrixArray > rxSpectrumChannelMatrix
the spectrum channel matrix of the received signal
Ptr< PhasedArrayModel > txAntenna
the antenna array of the tx device
Structure that contains some of the main configuration parameters of the antenna array that are used ...
uint32_t m_rows
the number of rows of antenna array
double m_bearingAngle
bearing angle of the antenna array
MimoPolarizationAntennaParams(bool isotropic, double polSlantAngle=0, double bearingAngle=0)
Constructor Currently only configurable through constructor are polSlantAngle and bearingAngle.
bool m_isotropic
defines whether the antenna elements are isotropic
uint32_t m_hPorts
the number of horizontal ports of antenna array
double m_polSlantAngle
polarization angle of the antenna array
uint32_t m_cols
the number of columns of antenna array
uint32_t m_vPorts
the number of vertical ports of antenna array
ChannelConsistencyMetrics structure contains the metrics that are needed to test the channel consiste...
double channelNorm
the channel norm value
ChannelConsistencyMetrics operator+(const ChannelConsistencyMetrics &other) const
Operator + for easier calculations of the other metrics (e.g., mean values).
ChannelConsistencyMetrics operator/=(double iterations)
Operator /= used for easier calculations of the statistics, and test conditions.
double thirdClusterZoa
the third cluster ZOA
double thirdClusterPower_dB
the third cluster power in dB
bool operator<(const ChannelConsistencyMetrics &other) const
Used for checking the channel consistency test condition.
ChannelConsistencyMetrics operator+=(const ChannelConsistencyMetrics &other)
Operator += for easier calculations of the other metrics (e.g., mean).
ChannelConsistencyMetrics operator/(double iterations) const
Operator / used for easier calculations of the statistics, and test conditions.
double thirdClusterDelay
the third cluster delay
ChannelConsistencyMetrics abs() const
Used for easier calculations of the statistics, and test conditions.
double thirdClusterAoa
the third cluster AOA
static ThreeGppChannelTestSuite myTestSuite
Static variable for test initialization.