Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/UnitTests/unitTestTwoWayDopplerPartials.cpp
//! Test partial derivatives of one-way doppler observable, using general test suite of observation partials.
Test partial derivatives of one-way doppler observable, using general test suite of observation partials.
Test partial derivatives of one - way doppler observable using general test suite of observation partials .
BOOST_AUTO_TEST_CASE( testTwoWayDopplerPartials )
{
    using namespace tudat::gravitation;
    using namespace tudat::gravitation;
    using namespace tudat::ephemerides;
    using namespace tudat::observation_models;
    using namespace tudat::simulation_setup;
    using namespace tudat::spice_interface;
    using namespace tudat::observation_partials;
    using namespace tudat::estimatable_parameters;
    std::vector< std::pair< std::string, std::string > > groundStations;
    groundStations.resize( 2 );
    groundStations[ 0 ] = std::make_pair( "Earth", "Graz" );
    groundStations[ 1 ] = std::make_pair( "Mars", "MSL" );
    {
        NamedBodyMap bodyMap = setupEnvironment( groundStations, 1.0E7, 1.2E7, 1.1E7, true );
        LinkEnds linkEnds;
        linkEnds[ transmitter ] = groundStations[ 1 ];
        linkEnds[ reflector1 ] = groundStations[ 0 ];
        linkEnds[ receiver ] = groundStations[ 1 ];
        for( unsigned int estimationCase  = 0; estimationCase  < 2; estimationCase ++ )
        {
            std::cout << "Case " << estimationCase << std::endl;
            std::shared_ptr< ObservationModel< 1 > > twoWayDopplerModel;
            std::vector< std::string > perturbingBodies;
            perturbingBodies.push_back( "Earth" );
            if( estimationCase  == 0 )
            {
                twoWayDopplerModel =
                        observation_models::ObservationModelCreator< 1, double, double >::createObservationModel(
                            linkEnds, std::make_shared< observation_models::ObservationSettings >(
                                observation_models::two_way_doppler,
                                std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                    perturbingBodies ) ), bodyMap  );
            }
            else
            {
                twoWayDopplerModel =
                        observation_models::ObservationModelCreator< 1, double, double >::createObservationModel(
                            linkEnds, std::make_shared< TwoWayDopplerObservationSettings >
                            (  std::make_shared< OneWayDopplerObservationSettings >(
                                   std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                       perturbingBodies ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Mars" ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Earth" ) ),
                               std::make_shared< OneWayDopplerObservationSettings >(
                                   std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                       perturbingBodies ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Earth" ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Mars" ) ) ), bodyMap );
            }
            std::shared_ptr< EstimatableParameterSet< double > > fullEstimatableParameterSet;
            Eigen::VectorXd parameterPerturbationMultipliers = Eigen::Vector4d::Constant( 1.0 );
            fullEstimatableParameterSet = createEstimatableParameters( bodyMap, 1.1E7 );
            printEstimatableParameterEntries( fullEstimatableParameterSet );
            testObservationPartials< 1 >(
                        twoWayDopplerModel, bodyMap, fullEstimatableParameterSet, linkEnds, two_way_doppler, 1.0E-5,
                        true, true, 10.0, parameterPerturbationMultipliers );
        }
    }
    {
        NamedBodyMap bodyMap = setupEnvironment( groundStations, 1.0E7, 1.2E7, 1.1E7, false );
        LinkEnds linkEnds;
        linkEnds[ transmitter ] = groundStations[ 1 ];
        linkEnds[ reflector1 ] = groundStations[ 0 ];
        linkEnds[ receiver ] = groundStations[ 1 ];
        for( unsigned int estimationCase = 0; estimationCase  < 2; estimationCase ++ )
        {
            std::cout << "Case (with motion): " << estimationCase << std::endl;
            std::shared_ptr< ObservationModel< 1 > > twoWayDopplerModel;
            std::vector< std::string > perturbingBodies;
            perturbingBodies.push_back( "Earth" );
            if( estimationCase  == 0 )
            {
                twoWayDopplerModel =
                        observation_models::ObservationModelCreator< 1, double, double >::createObservationModel(
                            linkEnds, std::make_shared< observation_models::ObservationSettings >(
                                observation_models::two_way_doppler,
                                std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                    perturbingBodies ) ), bodyMap  );
            }
            else
            {
                twoWayDopplerModel =
                        observation_models::ObservationModelCreator< 1, double, double >::createObservationModel(
                            linkEnds, std::make_shared< TwoWayDopplerObservationSettings >
                            (  std::make_shared< OneWayDopplerObservationSettings >(
                                   std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                       perturbingBodies ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Mars" ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Earth" ) ),
                               std::make_shared< OneWayDopplerObservationSettings >(
                                   std::make_shared< FirstOrderRelativisticLightTimeCorrectionSettings >(
                                       perturbingBodies ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Earth" ),
                                   std::make_shared< DirectFirstOrderDopplerProperTimeRateSettings >( "Mars" ) ) ), bodyMap );
            }
            std::shared_ptr< EstimatableParameterSet< double > > fullEstimatableParameterSet;
            Eigen::VectorXd parameterPerturbationMultipliers = Eigen::Vector4d::Constant( 1.0 );
            fullEstimatableParameterSet = createEstimatableParameters( bodyMap, 1.1E7 );
            printEstimatableParameterEntries( fullEstimatableParameterSet );
            testObservationPartials< 1 >(
                        twoWayDopplerModel, bodyMap, fullEstimatableParameterSet, linkEnds, two_way_doppler, 1.0E-4, false, true,
                        1.0, parameterPerturbationMultipliers );
        }
    }
}
BOOST_AUTO_TEST_CASE ( testTwoWayDopplerPartials ) { using namespace tudat :: gravitation ; using namespace tudat :: gravitation ; using namespace tudat :: ephemerides ; using namespace tudat :: observation_models ; using namespace tudat :: simulation_setup ; using namespace tudat :: spice_interface ; using namespace tudat :: observation_partials ; using namespace tudat :: estimatable_parameters ; std :: vector < std :: pair < std :: string , std :: string > > groundStations ; groundStations . resize ( 2 ) ; groundStations [ 0 ] = std :: make_pair ( " " , " " ) ; groundStations [ 1 ] = std :: make_pair ( " " , " " ) ; { NamedBodyMap bodyMap = setupEnvironment ( groundStations , 1.0E7 , 1.2E7 , 1.1E7 , true ) ; LinkEnds linkEnds ; linkEnds [ transmitter ] = groundStations [ 1 ] ; linkEnds [ reflector1 ] = groundStations [ 0 ] ; linkEnds [ receiver ] = groundStations [ 1 ] ; for ( unsigned int estimationCase = 0 ; estimationCase < 2 ; estimationCase ++ ) { std :: cout << " " << estimationCase << std :: endl ; std :: shared_ptr < ObservationModel < 1 > > twoWayDopplerModel ; std :: vector < std :: string > perturbingBodies ; perturbingBodies . push_back ( " " ) ; if ( estimationCase == 0 ) { twoWayDopplerModel = observation_models :: ObservationModelCreator < 1 , double , double > :: createObservationModel ( linkEnds , std :: make_shared < observation_models :: ObservationSettings > ( observation_models :: two_way_doppler , std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) ) , bodyMap ) ; } else { twoWayDopplerModel = observation_models :: ObservationModelCreator < 1 , double , double > :: createObservationModel ( linkEnds , std :: make_shared < TwoWayDopplerObservationSettings > ( std :: make_shared < OneWayDopplerObservationSettings > ( std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) ) , std :: make_shared < OneWayDopplerObservationSettings > ( std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) ) ) , bodyMap ) ; } std :: shared_ptr < EstimatableParameterSet < double > > fullEstimatableParameterSet ; Eigen :: VectorXd parameterPerturbationMultipliers = Eigen :: Vector4d :: Constant ( 1.0 ) ; fullEstimatableParameterSet = createEstimatableParameters ( bodyMap , 1.1E7 ) ; printEstimatableParameterEntries ( fullEstimatableParameterSet ) ; testObservationPartials < 1 > ( twoWayDopplerModel , bodyMap , fullEstimatableParameterSet , linkEnds , two_way_doppler , 1.0E-5 , true , true , 10.0 , parameterPerturbationMultipliers ) ; } } { NamedBodyMap bodyMap = setupEnvironment ( groundStations , 1.0E7 , 1.2E7 , 1.1E7 , false ) ; LinkEnds linkEnds ; linkEnds [ transmitter ] = groundStations [ 1 ] ; linkEnds [ reflector1 ] = groundStations [ 0 ] ; linkEnds [ receiver ] = groundStations [ 1 ] ; for ( unsigned int estimationCase = 0 ; estimationCase < 2 ; estimationCase ++ ) { std :: cout << " " << estimationCase << std :: endl ; std :: shared_ptr < ObservationModel < 1 > > twoWayDopplerModel ; std :: vector < std :: string > perturbingBodies ; perturbingBodies . push_back ( " " ) ; if ( estimationCase == 0 ) { twoWayDopplerModel = observation_models :: ObservationModelCreator < 1 , double , double > :: createObservationModel ( linkEnds , std :: make_shared < observation_models :: ObservationSettings > ( observation_models :: two_way_doppler , std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) ) , bodyMap ) ; } else { twoWayDopplerModel = observation_models :: ObservationModelCreator < 1 , double , double > :: createObservationModel ( linkEnds , std :: make_shared < TwoWayDopplerObservationSettings > ( std :: make_shared < OneWayDopplerObservationSettings > ( std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) ) , std :: make_shared < OneWayDopplerObservationSettings > ( std :: make_shared < FirstOrderRelativisticLightTimeCorrectionSettings > ( perturbingBodies ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) , std :: make_shared < DirectFirstOrderDopplerProperTimeRateSettings > ( " " ) ) ) , bodyMap ) ; } std :: shared_ptr < EstimatableParameterSet < double > > fullEstimatableParameterSet ; Eigen :: VectorXd parameterPerturbationMultipliers = Eigen :: Vector4d :: Constant ( 1.0 ) ; fullEstimatableParameterSet = createEstimatableParameters ( bodyMap , 1.1E7 ) ; printEstimatableParameterEntries ( fullEstimatableParameterSet ) ; testObservationPartials < 1 > ( twoWayDopplerModel , bodyMap , fullEstimatableParameterSet , linkEnds , two_way_doppler , 1.0E-4 , false , true , 1.0 , parameterPerturbationMultipliers ) ; } } }
Test partial derivatives of one-way doppler observable, using general test suite of observation partials.
Test partial derivatives of one - way doppler observable using general test suite of observation partials .
// Define and create ground stations. // Test partials with constant ephemerides (allows test of position partials) // Create environment // Set link ends for observation model // Generate one-way doppler model // Create parameter objects. // Test partials with real ephemerides (without test of position partials) // Create environment // Set link ends for observation model // Generate two-way doppler model // Create parameter objects.