A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
GeoToAndFromTopocentricTestCase Class Reference

Geographic to/from Topocentric Test Case. More...

+ Inheritance diagram for GeoToAndFromTopocentricTestCase:
+ Collaboration diagram for GeoToAndFromTopocentricTestCase:

Public Member Functions

 GeoToAndFromTopocentricTestCase (const std::vector< Vector > posToConvert, Vector refPoint, const std::vector< Vector > expectedTopoCoord, GeographicPositions::EarthSpheroidType sphereType)
 Constructor.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

bool CheckTestPass (double actual, double limit, double tol, std::string coord)
 Manually check the test condition, i.e.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void TestReferencePoint (Vector posToConvert, Vector refPoint, Vector expectedTopoCoord, GeographicPositions::EarthSpheroidType sphereType)
 Test the forward and backward conversion for geocentric to topocentric coordinates for a given reference point.
 

Private Attributes

const std::vector< Vector > m_expectedTopoCoord
 The expected corresponding topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point.
 
const std::vector< Vector > m_posToConvertGeoCoord
 The position to convert, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg)///< altitude (m))
 
Vector m_refPointGeoCoord
 The reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
 
GeographicPositions::EarthSpheroidType m_sphereType
 spheroid type
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
using TestDuration = Duration
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto QUICK = Duration::QUICK
 
static constexpr auto TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Geographic to/from Topocentric Test Case.

This test verifies the accuracy of the GeographicToTopocentricCoordinates and TopocentricToGeographicCoordinates methods in the GeographicPositions class, which convert geocentric (topocentric) coordinates to topocentric (geocentric) coordinates, respectively. In "IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, part 2 – September 2019", the two operations are also referred to as EPSG Dataset coordinate operation method code 9837.

To this end, the values generated using the above methods are compared with the coordinates obtained using PROJ coordinate conversion utilities (https://proj.org/en/latest/operations/conversions/topocentric.html), for both sphere, GRS80 and WGS84 ellipsoid models. For instance, the coordinate (long, lat, alt) has been first converted to the topocentric coordinate system with reference point in (LONG_0, LAT_0, ALT_0) with the command echo $long $lat $alt | cct -d 3 +proj=pipeline +ellps=$ellps +step +proj=cart +step +proj=topocentric +lon_0=$LONG_0 +lat_0=$LAT_0 +h_0=$ALT_0. Then, the value obtained via PROJ is used to check both the forward (geo -> topo) and reverse (topo -> geo) conversion

Definition at line 386 of file geocentric-topocentric-conversion-test.cc.

Constructor & Destructor Documentation

◆ GeoToAndFromTopocentricTestCase()

GeoToAndFromTopocentricTestCase::GeoToAndFromTopocentricTestCase ( const std::vector< Vector >  posToConvert,
Vector  refPoint,
const std::vector< Vector >  expectedTopoCoord,
GeographicPositions::EarthSpheroidType  sphereType 
)

Constructor.

Parameters
posToConverta vector of positions to convert in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
refPointthe reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
expectedTopoCoorda vector of the corresponding expected topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point
sphereTypespheroid type

Definition at line 452 of file geocentric-topocentric-conversion-test.cc.

Member Function Documentation

◆ CheckTestPass()

bool GeoToAndFromTopocentricTestCase::CheckTestPass ( double  actual,
double  limit,
double  tol,
std::string  coord 
)
private

Manually check the test condition, i.e.

equality between the expected and the obtained values, up to a given tolerance.

Parameters
actualthe obtained test value
limitthe expected test value
tolthe tolerance error
coordthe string to display to describe the value
Returns
whether the provided values satisfy the equality condition

Definition at line 516 of file geocentric-topocentric-conversion-test.cc.

References NS_TEST_EXPECT_MSG_EQ_TOL.

Referenced by TestReferencePoint().

+ Here is the caller graph for this function:

◆ DoRun()

void GeoToAndFromTopocentricTestCase::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 503 of file geocentric-topocentric-conversion-test.cc.

References m_expectedTopoCoord, m_posToConvertGeoCoord, m_refPointGeoCoord, m_sphereType, and TestReferencePoint().

+ Here is the call graph for this function:

◆ TestReferencePoint()

void GeoToAndFromTopocentricTestCase::TestReferencePoint ( Vector  posToConvert,
Vector  refPoint,
Vector  expectedTopoCoord,
GeographicPositions::EarthSpheroidType  sphereType 
)
private

Test the forward and backward conversion for geocentric to topocentric coordinates for a given reference point.

Parameters
posToConvertthe position to convert, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
refPointthe reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
expectedTopoCoordthe expected corresponding topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point
sphereTypespheroid type

Definition at line 466 of file geocentric-topocentric-conversion-test.cc.

References CheckTestPass(), ns3::GeographicPositions::GeographicToTopocentricCoordinates(), anonymous_namespace{geocentric-topocentric-conversion-test.cc}::TOLERANCE_DEG, anonymous_namespace{geocentric-topocentric-conversion-test.cc}::TOLERANCE_M, ns3::GeographicPositions::TopocentricToGeographicCoordinates(), and ns3::WrapTo360().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_expectedTopoCoord

const std::vector<Vector> GeoToAndFromTopocentricTestCase::m_expectedTopoCoord
private

The expected corresponding topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point.

Definition at line 447 of file geocentric-topocentric-conversion-test.cc.

Referenced by DoRun().

◆ m_posToConvertGeoCoord

const std::vector<Vector> GeoToAndFromTopocentricTestCase::m_posToConvertGeoCoord
private

The position to convert, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg)///< altitude (m))

Definition at line 438 of file geocentric-topocentric-conversion-test.cc.

Referenced by DoRun().

◆ m_refPointGeoCoord

Vector GeoToAndFromTopocentricTestCase::m_refPointGeoCoord
private

The reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))

Definition at line 442 of file geocentric-topocentric-conversion-test.cc.

Referenced by DoRun().

◆ m_sphereType

GeographicPositions::EarthSpheroidType GeoToAndFromTopocentricTestCase::m_sphereType
private

spheroid type

Definition at line 449 of file geocentric-topocentric-conversion-test.cc.

Referenced by DoRun().


The documentation for this class was generated from the following file: