12#include "ns3/double.h"
13#include "ns3/isotropic-antenna-model.h"
15#include "ns3/pointer.h"
16#include "ns3/simulator.h"
18#include "ns3/three-gpp-antenna-model.h"
19#include "ns3/uinteger.h"
20#include "ns3/uniform-planar-array.h"
74 double expectedGainDb);
80 void DoRun()
override;
109 std::ostringstream oss;
110 oss <<
"UPA=" << rows <<
"x" << cols <<
", row spacing=" << rowSpace <<
"*lambda"
111 <<
", col spacing=" << colSpace <<
"*lambda, bearing=" <<
RadiansToDegrees(alpha) <<
" deg"
113 <<
", element=" << element->GetInstanceTypeId().GetName() <<
", direction=" << direction;
125 double expectedGainDb)
126 :
TestCase(BuildNameString(element, rows, cols, rowSpace, colSpace, alpha, beta, direction)),
130 m_rowSpace(rowSpace),
131 m_colSpace(colSpace),
134 m_direction(direction),
135 m_expectedGain(expectedGainDb)
147 std::pair<double, double> fp = a->GetElementFieldPattern(
m_direction);
150 std::complex<double> prod{0};
151 for (
size_t i = 0; i < sv.
GetSize(); i++)
153 prod += sv[i] * bf[i];
155 double bfGain = std::pow(std::abs(prod), 2);
156 double bfGainDb = 10 * std::log10(bfGain);
159 double elementPowerGain = std::pow(std::get<0>(fp), 2) + std::pow(std::get<1>(fp), 2);
160 double elementPowerGainDb = 10 * std::log10(elementPowerGain);
163 return bfGainDb + elementPowerGainDb;
191 "wrong value of the radiation pattern");
217 void DoRun()
override;
228 ant->SetAttribute(
"AntennaVerticalSpacing",
DoubleValue(0.5));
229 ant->SetAttribute(
"AntennaHorizontalSpacing",
DoubleValue(0.5));
237 ant2->SetAttribute(
"AntennaVerticalSpacing",
DoubleValue(0.5));
238 ant2->SetAttribute(
"AntennaHorizontalSpacing",
DoubleValue(0.5));
247 "Expecting update, since the pair was never setup");
249 ant2->IsChannelOutOfDate(ant),
251 "Not expecting update, since the pair was just updated and no settings changed");
255 "Expecting update, antenna parameter changed");
257 ant->IsChannelOutOfDate(ant2),
259 "Not expecting update, since the pair was just updated and no settings changed");
262 ant->IsChannelOutOfDate(ant2),
264 "Not expecting update, since the pair was just updated and angle was not changed");
268 "Expecting update, antenna parameter changed");
270 ant->IsChannelOutOfDate(ant2),
272 "Not expecting update, since the pair was just updated and angle was not changed");
276 "Expecting update, antenna parameter changed");
309 TestCase::Duration::QUICK);
319 TestCase::Duration::QUICK);
329 TestCase::Duration::QUICK);
339 TestCase::Duration::QUICK);
349 TestCase::Duration::QUICK);
359 TestCase::Duration::QUICK);
369 TestCase::Duration::QUICK);
379 TestCase::Duration::QUICK);
389 TestCase::Duration::QUICK);
399 TestCase::Duration::QUICK);
411 TestCase::Duration::QUICK);
421 TestCase::Duration::QUICK);
431 TestCase::Duration::QUICK);
443 TestCase::Duration::QUICK);
453 TestCase::Duration::QUICK);
463 TestCase::Duration::QUICK);
465 "Test IsChannelOutOfDate() and InvalidateChannels() for "
466 "UniformPlanarArray with 3GPP antenna element"),
467 TestCase::Duration::QUICK);
UpdateOnChange Test Case.
UpdateOnChangeTestCase(Ptr< AntennaModel > element, std::string name)
The constructor of the test case.
Ptr< AntennaModel > m_element
the antenna element
void DoRun() override
Run the test.
Class holding the azimuth and inclination angles of spherical coordinates.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
#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 ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#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 ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double DegreesToRadians(double degrees)
converts degrees to radians
double RadiansToDegrees(double radians)
converts radians to degrees