Geographic to/from Topocentric Test Case. More...
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 |
TestCase & | operator= (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... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::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. | |
TestCase * | GetParent () 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. | |
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 375 of file geocentric-topocentric-conversion-test.cc.
GeoToAndFromTopocentricTestCase::GeoToAndFromTopocentricTestCase | ( | const std::vector< Vector > | posToConvert, |
Vector | refPoint, | ||
const std::vector< Vector > | expectedTopoCoord, | ||
GeographicPositions::EarthSpheroidType | sphereType ) |
Constructor.
posToConvert | a vector of positions to convert in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m)) |
refPoint | the reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m)) |
expectedTopoCoord | a vector of the corresponding expected topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point |
sphereType | spheroid type |
Definition at line 441 of file geocentric-topocentric-conversion-test.cc.
|
private |
Manually check the test condition, i.e.
equality between the expected and the obtained values, up to a given tolerance.
actual | the obtained test value |
limit | the expected test value |
tol | the tolerance error |
coord | the string to display to describe the value |
Definition at line 505 of file geocentric-topocentric-conversion-test.cc.
References NS_TEST_EXPECT_MSG_EQ_TOL.
Referenced by TestReferencePoint().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 492 of file geocentric-topocentric-conversion-test.cc.
References m_expectedTopoCoord, m_posToConvertGeoCoord, m_refPointGeoCoord, m_sphereType, and TestReferencePoint().
|
private |
Test the forward and backward conversion for geocentric to topocentric coordinates for a given reference point.
posToConvert | the position to convert, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m)) |
refPoint | the reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m)) |
expectedTopoCoord | the expected corresponding topocentric coordinates, i.e., represented as (U (m), V (m), W (m)) with respect to the provided reference point |
sphereType | spheroid type |
Definition at line 455 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().
|
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 436 of file geocentric-topocentric-conversion-test.cc.
Referenced by DoRun().
|
private |
The position to convert, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg)///< altitude (m))
Definition at line 427 of file geocentric-topocentric-conversion-test.cc.
Referenced by DoRun().
|
private |
The reference point, in geocentric coordinates, i.e., represented as a vector (latitude (deg), longitude (deg), altitude (m))
Definition at line 431 of file geocentric-topocentric-conversion-test.cc.
Referenced by DoRun().
|
private |
spheroid type
Definition at line 438 of file geocentric-topocentric-conversion-test.cc.
Referenced by DoRun().