44 * SPDX-License-Identifier: GPL-2.0-only
55 */
66
7+ #include " ns3/boolean.h"
78#include " ns3/circular-aperture-antenna-model.h"
89#include " ns3/double.h"
910#include " ns3/log.h"
@@ -56,21 +57,24 @@ class CircularApertureAntennaModelTestCase : public TestCase
5657 * @param testAzimuth test azimuth [rad]
5758 * @param testInclination test inclination [rad]
5859 * @param expectedGain the expected gain value [dB]
60+ * @param forceGainBounds restrict or not gain range to [antennaMinGainDb, antennaMaxGainDb]
5961 */
6062 TestPoint (double antennaMaxGainDb,
6163 double antennaMinGainDb,
6264 double antennaCircularApertureRadius,
6365 double operatingFrequency,
6466 double testAzimuth,
6567 double testInclination,
66- double expectedGain)
68+ double expectedGain,
69+ bool forceGainBounds)
6770 : m_antennaMaxGainDb(antennaMaxGainDb),
6871 m_antennaMinGainDb (antennaMinGainDb),
6972 m_antennaCircularApertureRadius(antennaCircularApertureRadius),
7073 m_operatingFrequency(operatingFrequency),
7174 m_testAzimuth(DegreesToRadians(testAzimuth)),
7275 m_testInclination(DegreesToRadians(testInclination)),
73- m_expectedGain(expectedGain)
76+ m_expectedGain(expectedGain),
77+ m_forceGainBounds(forceGainBounds)
7478 {
7579 }
7680
@@ -81,6 +85,7 @@ class CircularApertureAntennaModelTestCase : public TestCase
8185 double m_testAzimuth; // /< test azimuth [rad]
8286 double m_testInclination; // /< test inclination [rad]
8387 double m_expectedGain; // /< the expected gain value [dB]
88+ bool m_forceGainBounds; // /< enable bounds checking for GetGainDb
8489 };
8590
8691 /* *
@@ -136,7 +141,9 @@ CircularApertureAntennaModelTestCase::TestAntennaGain(TestPoint testPoint)
136141 " AntennaCircularApertureRadius" ,
137142 DoubleValue (testPoint.m_antennaCircularApertureRadius ),
138143 " OperatingFrequency" ,
139- DoubleValue (testPoint.m_operatingFrequency ));
144+ DoubleValue (testPoint.m_operatingFrequency ),
145+ " ForceGainBounds" ,
146+ BooleanValue (testPoint.m_forceGainBounds ));
140147
141148 Ptr<UniformPlanarArray> upa =
142149 CreateObjectWithAttributes<UniformPlanarArray>(" AntennaElement" ,
@@ -164,45 +171,50 @@ CircularApertureAntennaModelTestCase::DoRun()
164171 // MaxGainDb MinGainDb Radius (m) Freq (Hz) Azimuth (deg) Incl (deg) ExpGain (dB)
165172 // Test invariant: gain always equal to max gain at boresight (inclination 90, azimuth = 0)
166173 // for different frequency
167- {30 , -30 , 0.5 , 2e9 , 0 , 90 , 30 },
168- {30 , -30 , 2 , 20e9 , 0 , 90 , 30 },
174+ {30 , -30 , 0.5 , 2e9 , 0 , 90 , 30 , false },
175+ {30 , -30 , 2 , 20e9 , 0 , 90 , 30 , false },
169176 // Test invariant: gain always equal to max gain at boresight (inclination 90, azimuth = 0)
170177 // for different max gain
171- {20 , -30 , 0.5 , 2e9 , 0 , 90 , 20 },
172- {10 , -30 , 2 , 20e9 , 0 , 90 , 10 },
178+ {20 , -30 , 0.5 , 2e9 , 0 , 90 , 20 , false },
179+ {10 , -30 , 2 , 20e9 , 0 , 90 , 10 , false },
173180 // Test invariant: gain always equal to min gain outside of |theta| < 90 deg
174181 // for different frequency
175- {30 , -100 , 0.5 , 2e9 , 0 , 0 , -100 },
176- {30 , -100 , 2 , 20e9 , 0 , 0 , -100 },
182+ {30 , -100 , 0.5 , 2e9 , 0 , 0 , -100 , false },
183+ {30 , -100 , 2 , 20e9 , 0 , 0 , -100 , false },
177184 // Test invariant: gain always equal to min gain outside of |theta| < 90 deg
178185 // for different orientations
179- {30 , -100 , 0.5 , 2e9 , 180 , 90 , -100 },
180- {30 , -100 , 2 , 20e9 , -180 , 90 , -100 },
186+ {30 , -100 , 0.5 , 2e9 , 180 , 90 , -100 , false },
187+ {30 , -100 , 2 , 20e9 , -180 , 90 , -100 , false },
181188 // Fixed elevation to boresight (90deg) and azimuth varying in [-90, 0] deg with steps of 10
182189 // degrees
183- {0 , -50 , 0.10707 , 28000000000 , -90 , 90 , -50 },
184- {0 , -50 , 0.10707 , 28000000000 , -80 , 90 , -49.8022 },
185- {0 , -50 , 0.10707 , 28000000000 , -70 , 90 , -49.1656 },
186- {0 , -50 , 0.10707 , 28000000000 , -60 , 90 , -60.9132 },
187- {0 , -50 , 0.10707 , 28000000000 , -50 , 90 , -59.2368 },
188- {0 , -50 , 0.10707 , 28000000000 , -40 , 90 , -44.6437 },
189- {0 , -50 , 0.10707 , 28000000000 , -30 , 90 , -43.9686 },
190- {0 , -50 , 0.10707 , 28000000000 , -20 , 90 , -36.3048 },
191- {0 , -50 , 0.10707 , 28000000000 , -10 , 90 , -30.5363 },
192- {0 , -50 , 0.10707 , 28000000000 , 0 , 90 , 0 },
190+ {0 , -50 , 0.10707 , 28000000000 , -90 , 90 , -50 , false },
191+ {0 , -50 , 0.10707 , 28000000000 , -80 , 90 , -49.8022 , false },
192+ {0 , -50 , 0.10707 , 28000000000 , -70 , 90 , -49.1656 , false },
193+ {0 , -50 , 0.10707 , 28000000000 , -60 , 90 , -60.9132 , false },
194+ {0 , -50 , 0.10707 , 28000000000 , -60 , 90 , -50 , true },
195+ {0 , -50 , 0.10707 , 28000000000 , -50 , 90 , -59.2368 , false },
196+ {0 , -50 , 0.10707 , 28000000000 , -50 , 90 , -50 , true },
197+ {0 , -50 , 0.10707 , 28000000000 , -40 , 90 , -44.6437 , false },
198+ {0 , -50 , 0.10707 , 28000000000 , -30 , 90 , -43.9686 , false },
199+ {0 , -50 , 0.10707 , 28000000000 , -20 , 90 , -36.3048 , false },
200+ {0 , -50 , 0.10707 , 28000000000 , -10 , 90 , -30.5363 , false },
201+ {0 , -50 , 0.10707 , 28000000000 , 0 , 90 , 0 , false },
193202 // Fixed azimuth to boresight (0 deg) and azimuth varying in [0, 90] deg with steps of 9
194203 // degrees
195- {0 , -50 , 0.10707 , 28e9 , 0 , 0 , -50 },
196- {0 , -50 , 0.10707 , 28e9 , 0 , 9 , -49.7256 },
197- {0 , -50 , 0.10707 , 28e9 , 0 , 18 , -52.9214 },
198- {0 , -50 , 0.10707 , 28e9 , 0 , 27 , -48.6077 },
199- {0 , -50 , 0.10707 , 28e9 , 0 , 36 , -60.684 },
200- {0 , -50 , 0.10707 , 28e9 , 0 , 45 , -55.1468 },
201- {0 , -50 , 0.10707 , 28e9 , 0 , 54 , -42.9648 },
202- {0 , -50 , 0.10707 , 28e9 , 0 , 63 , -45.6472 },
203- {0 , -50 , 0.10707 , 28e9 , 0 , 72 , -48.6378 },
204- {0 , -50 , 0.10707 , 28e9 , 0 , 81 , -35.1613 },
205- {0 , -50 , 0.10707 , 28e9 , 0 , 90 , 0 }};
204+ {0 , -50 , 0.10707 , 28e9 , 0 , 0 , -50 , false },
205+ {0 , -50 , 0.10707 , 28e9 , 0 , 9 , -49.7256 , false },
206+ {0 , -50 , 0.10707 , 28e9 , 0 , 18 , -52.9214 , false },
207+ {0 , -50 , 0.10707 , 28e9 , 0 , 18 , -50 , true },
208+ {0 , -50 , 0.10707 , 28e9 , 0 , 27 , -48.6077 , false },
209+ {0 , -50 , 0.10707 , 28e9 , 0 , 36 , -60.684 , false },
210+ {0 , -50 , 0.10707 , 28e9 , 0 , 36 , -50 , true },
211+ {0 , -50 , 0.10707 , 28e9 , 0 , 45 , -55.1468 , false },
212+ {0 , -50 , 0.10707 , 28e9 , 0 , 45 , -50 , true },
213+ {0 , -50 , 0.10707 , 28e9 , 0 , 54 , -42.9648 , false },
214+ {0 , -50 , 0.10707 , 28e9 , 0 , 63 , -45.6472 , false },
215+ {0 , -50 , 0.10707 , 28e9 , 0 , 72 , -48.6378 , false },
216+ {0 , -50 , 0.10707 , 28e9 , 0 , 81 , -35.1613 , false },
217+ {0 , -50 , 0.10707 , 28e9 , 0 , 90 , 0 , false }};
206218
207219 // Call TestAntennaGain on each test point
208220 for (auto & point : testPoints)
0 commit comments