9#include "ns3/geographic-positions.h" 
   66                              double originLongitude,
 
   69                              double maxDistFromOrigin,
 
   74    void DoRun() 
override;
 
   82    static std::string 
Name(
double originLatitude,
 
   83                            double originLongitude,
 
   84                            double maxDistFromOrigin);
 
 
   95                                double originLongitude,
 
   96                                double maxDistFromOrigin)
 
   98    std::ostringstream oss;
 
   99    oss << 
"origin latitude = " << originLatitude << 
" degrees, " 
  100        << 
"origin longitude = " << originLongitude << 
" degrees, " 
  101        << 
"max distance from origin = " << maxDistFromOrigin;
 
 
  106                                                     double originLongitude,
 
  109                                                     double maxDistFromOrigin,
 
  111    : 
TestCase(
Name(originLatitude, originLongitude, maxDistFromOrigin)),
 
 
  128    std::list<Vector> points =
 
  141    while (!points.empty())
 
  143        randPoint = points.front();
 
  147        double straightDistFromOrigin =
 
  148            sqrt(pow(randPoint.x - origin.x, 2) + pow(randPoint.y - origin.y, 2) +
 
  149                 pow(randPoint.z - origin.z, 2));
 
  152        double arcDistFromOrigin =
 
  157                              "random point (" << randPoint.x << 
", " << randPoint.y << 
", " 
  159                                               << 
") is outside of max radius from origin");
 
 
  177    NS_LOG_INFO(
"creating RandCartAroundGeoTestSuite");
 
  179    uniRand->SetStream(5);
 
  180    for (
double originLatitude = -89.9; originLatitude <= 89.9; originLatitude += 35.96)
 
  182        for (
double originLongitude = 0; originLongitude <= 360; originLongitude += 72)
 
  184            for (
double maxDistFromOrigin = 1000; maxDistFromOrigin <= 1000000;
 
  185                 maxDistFromOrigin *= 10)
 
 
Rand Cart Around Geo Test Case.
 
double m_maxAltitude
maximum altitude
 
void DoRun() override
Implementation to actually run this TestCase.
 
double m_originLongitude
origin longitude
 
double m_originLatitude
origin latitude
 
~RandCartAroundGeoTestCase() override
 
static std::string Name(double originLatitude, double originLongitude, double maxDistFromOrigin)
name function
 
RandCartAroundGeoTestCase(double originLatitude, double originLongitude, double maxAltitude, int numPoints, double maxDistFromOrigin, Ptr< UniformRandomVariable > uniRand)
Constructor.
 
int m_numPoints
number of points
 
double m_maxDistFromOrigin
maximum distance from origin
 
Ptr< UniformRandomVariable > m_uniRand
random number
 
Rand Cart Around Geo Test Suite.
 
RandCartAroundGeoTestSuite()
 
static std::list< Vector > RandCartesianPointsAroundGeographicPoint(double originLatitude, double originLongitude, double maxAltitude, int numPoints, double maxDistFromOrigin, Ptr< UniformRandomVariable > uniRand)
Generates uniformly distributed random points (in ECEF Cartesian coordinates) within a given altitude...
 
static Vector GeographicToCartesianCoordinates(double latitude, double longitude, double altitude, EarthSpheroidType sphType)
Converts earth geographic/geodetic coordinates (latitude and longitude in degrees) with a given altit...
 
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.
 
TestCase(const TestCase &)=delete
 
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
 
static RandCartAroundGeoTestSuite g_RandCartAroundGeoTestSuite
Static variable for test initialization.
 
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
 
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.
 
static const double TOLERANCE
Tolerance used to check reciprocal of two numbers.
 
static const double EARTH_RADIUS
earth's radius in meters if modeled as a perfect sphere