Tudat/Astrodynamics/Gravitation/UnitTests/unitTestJacobiEnergy.cpp
//! Test if Jacobi energy is computed correctly.
Test if Jacobi energy is computed correctly.
Test if Jacobi energy is computed correctly .
BOOST_AUTO_TEST_CASE( testJacobiEnergy )
{
    {
        double massParameter = 0.01215;
        Eigen::VectorXd stateAtL1 = Eigen::VectorXd::Zero( 6 );
        stateAtL1( xCartesianPositionIndex ) = 0.836914;
        double expectedJacobiEnergy = 3.1883;
        double computedJacobiEnergy = computeJacobiEnergy( massParameter, stateAtL1 );
        BOOST_CHECK_CLOSE_FRACTION( expectedJacobiEnergy,  computedJacobiEnergy, 1.0e-4 );
    }
    {
        double massParameter = 0.01215;
        Eigen::VectorXd stateAtL4 = Eigen::VectorXd::Zero( 6 );
        stateAtL4( xCartesianPositionIndex ) = 0.487849;
        stateAtL4( yCartesianPositionIndex ) = 0.866025;
        double expectedJacobiEnergy = 2.9880;
        double computedJacobiEnergy = computeJacobiEnergy( massParameter, stateAtL4 );
        BOOST_CHECK_CLOSE_FRACTION( expectedJacobiEnergy,  computedJacobiEnergy, 1.0e-6 );
    }
}
BOOST_AUTO_TEST_CASE ( testJacobiEnergy ) { { double massParameter = 0.01215 ; Eigen :: VectorXd stateAtL1 = Eigen :: VectorXd :: Zero ( 6 ) ; stateAtL1 ( xCartesianPositionIndex ) = 0.836914 ; double expectedJacobiEnergy = 3.1883 ; double computedJacobiEnergy = computeJacobiEnergy ( massParameter , stateAtL1 ) ; BOOST_CHECK_CLOSE_FRACTION ( expectedJacobiEnergy , computedJacobiEnergy , 1.0e-4 ) ; } { double massParameter = 0.01215 ; Eigen :: VectorXd stateAtL4 = Eigen :: VectorXd :: Zero ( 6 ) ; stateAtL4 ( xCartesianPositionIndex ) = 0.487849 ; stateAtL4 ( yCartesianPositionIndex ) = 0.866025 ; double expectedJacobiEnergy = 2.9880 ; double computedJacobiEnergy = computeJacobiEnergy ( massParameter , stateAtL4 ) ; BOOST_CHECK_CLOSE_FRACTION ( expectedJacobiEnergy , computedJacobiEnergy , 1.0e-6 ) ; } }
Test if Jacobi energy is computed correctly.
Test if Jacobi energy is computed correctly .
// Test 1: test Jacobi energy at L1. // Set mass parameter for Earth-moon system. Value from Table 3.1 (Wakker, 2007). // Initialize position L1, from Table 3.4 (Wakker, 2007). // Set expected value of Jacobi energy at L1. // Compute Jacobi energy. // Check if expected Jacobi energy matches computed. // Test 2: test Jacobi energy at L4. // Set mass parameter for Earth-moon system. Value from Table 3.1 (Wakker, 2007). // Initialize position L4, from Table 3.4 (Wakker, 2007). // Set expected value of Jacobi energy at L4. // Compute Jacobi energy. // Check if expected Jacobi energy matches computed.