Tudat/Astrodynamics/BasicAstrodynamics/UnitTests/unitTestConvertMeanAnomalyToEccentricAnomaly.cpp
//! Test 5: Test conversion for near-parabolic orbits.
Test 5: Test conversion for near-parabolic orbits.
Test 5 : Test conversion for near - parabolic orbits .
BOOST_AUTO_TEST_CASE( test_convertMeanAnomalyToEccentricAnomaly_nearParabolic )
{
    const double testEccentricity = 1.0 - 1.0e-15;
    const double arrayOfTestMeanAnomalies [ 17 ] = { 0.0,
                                                     1.0e-10,
                                                     0.5,
                                                     PI / 2 - 1.0e-10,
                                                     PI / 2,
                                                     PI / 2 + 1.0e-10,
                                                     2.5,
                                                     PI - 1.0e-10,
                                                     PI,
                                                     PI + 1.0e-10,
                                                     4.0,
                                                     3.0 / 2.0 * PI - 1.0e-10,
                                                     3.0 / 2.0 * PI,
                                                     3.0 / 2.0 * PI + 1.0e-10,
                                                     5.5,
                                                     2.0 * PI - 1.0e-10,
                                                     2.0 * PI };
    const double arrayOfExpectedEccentricAnomalies [ 17 ] = { 0.0,
                                                              0.000843432672832182,
                                                              1.49730038909589,
                                                              2.30988145995031,
                                                              2.30988146001006,
                                                              2.30988146006981,
                                                              2.81798706288006,
                                                              3.14159265353979,
                                                              3.14159265358979,
                                                              3.14159265363979,
                                                              3.57764001198758,
                                                              3.97330384710978,
                                                              3.97330384722928,
                                                              3.97330384722972,
                                                              4.51869928040234,
                                                              6.28234187379524,
                                                              0.0 };
    double eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly(
                testEccentricity, arrayOfTestMeanAnomalies[ 0 ] );
    BOOST_CHECK_SMALL( eccentricAnomaly, 1.0E-9 );
    eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly(
                testEccentricity, arrayOfTestMeanAnomalies[ 16 ] );
    BOOST_CHECK_SMALL( eccentricAnomaly, 1.0E-9 );
    for ( int counter = 1; counter < 16; counter++ )
    {
        eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly(
                    testEccentricity, arrayOfTestMeanAnomalies[ counter ] );
        BOOST_CHECK_CLOSE_FRACTION( eccentricAnomaly, arrayOfExpectedEccentricAnomalies[ counter ],
                                    1.0E-9 );
    }
}
BOOST_AUTO_TEST_CASE ( test_convertMeanAnomalyToEccentricAnomaly_nearParabolic ) { const double testEccentricity = 1.0 - 1.0e-15 ; const double arrayOfTestMeanAnomalies [ 17 ] = { 0.0 , 1.0e-10 , 0.5 , PI / 2 - 1.0e-10 , PI / 2 , PI / 2 + 1.0e-10 , 2.5 , PI - 1.0e-10 , PI , PI + 1.0e-10 , 4.0 , 3.0 / 2.0 * PI - 1.0e-10 , 3.0 / 2.0 * PI , 3.0 / 2.0 * PI + 1.0e-10 , 5.5 , 2.0 * PI - 1.0e-10 , 2.0 * PI } ; const double arrayOfExpectedEccentricAnomalies [ 17 ] = { 0.0 , 0.000843432672832182 , 1.49730038909589 , 2.30988145995031 , 2.30988146001006 , 2.30988146006981 , 2.81798706288006 , 3.14159265353979 , 3.14159265358979 , 3.14159265363979 , 3.57764001198758 , 3.97330384710978 , 3.97330384722928 , 3.97330384722972 , 4.51869928040234 , 6.28234187379524 , 0.0 } ; double eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly ( testEccentricity , arrayOfTestMeanAnomalies [ 0 ] ) ; BOOST_CHECK_SMALL ( eccentricAnomaly , 1.0E-9 ) ; eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly ( testEccentricity , arrayOfTestMeanAnomalies [ 16 ] ) ; BOOST_CHECK_SMALL ( eccentricAnomaly , 1.0E-9 ) ; for ( int counter = 1 ; counter < 16 ; counter ++ ) { eccentricAnomaly = convertMeanAnomalyToEccentricAnomaly ( testEccentricity , arrayOfTestMeanAnomalies [ counter ] ) ; BOOST_CHECK_CLOSE_FRACTION ( eccentricAnomaly , arrayOfExpectedEccentricAnomalies [ counter ] , 1.0E-9 ) ; } }
Test 5: Test conversion for near-parabolic orbits.
Test 5 : Test conversion for near - parabolic orbits .
// Set test value for eccentricity, which is just below  1.0. // Set test values for mean anomaly, to verify that a wide range can be handled. The set was // selected such that it contains all possible limit cases, and a wide enough variety of random // values. // Set the expected eccentric anomalies corresponding to the corresponding test mean anomaly // array. These values were obtained using the convertMeanAnomalyToEccentricAnomaly method, // and subsequently verified using the eccentric -> mean anomaly method, by running GTOP code // with the same values and by running ODTBX code with the same values. The iteration scheme // converges very rapidly except for values close to zero or 2*n*pi. Still Newton Raphson // converges in 20-40 iterations for these cases. // Test the values which are supposed to be 0.0. // Test the values that are supposed to be equal to certain other values. // Compute eccentric anomaly. // Check whether the expected value is set to the eccentric anomaly.