# 5.4. Propagator Settings: Dependent Variables¶

By default, the DynamicsSimulator propagates the state of a body which uniquely defines its position and velocity. However, it is possible to define a number of dependent variables that are derived from such state. These dependent variables can be used as termination conditions as discussed in Propagator Settings: Termination Settings or saved for further post-processing. This page describes the dependent variables currently available and how these are retrieved from Tudat.

## 5.4.1. Saving dependent variables¶

The dependent variables are computed during the body propagation, thus the user must provide a list of dependent variables to save prior creating the DynamicsSimulator:

// Define list of dependent variables to save.
std::vector< boost::shared_ptr< SingleDependentVariableSaveSettings > > dependentVariablesList;


where dependentVariableList is populated as follows:

dependentVariablesList.push_back(
boost::make_shared< SingleDependentVariableSaveSettings >( variableType , associatedBody , secondaryBody ) );


where:

• SingleDependentVariableSaveSettings

Defines the derived-class being used and must match with variableType.

• variableType

Indicates the variable type and must match with one of the enum values in PropagationDependentVariables. A detailed description of how is done is given in the next section.

• associatedBody

Indicates to which body the saved dependent variables are associated.

• secondaryBody

Optional argument that provides a secondary body that may be necessary to save the dependent variable. By default, this argument is empty.

Once the list of dependent variables to save has been populated, a boost::shared_ptr< DependentVariableSaveSettings > object needs to be created and passed to propagatorSettings:

// Create object with list of dependent variables
boost::shared_ptr< DependentVariableSaveSettings > dependentVariablesToSave =
boost::make_shared< DependentVariableSaveSettings >( dependentVariablesList );

// Create propagation settings.
boost::shared_ptr< TranslationalStatePropagatorSettings< double > > propagatorSettings =
boost::make_shared< TranslationalStatePropagatorSettings< double > >
( centralBodies, accelerationModelMap, bodiesToPropagate, systemInitialState,
terminationSettings, propagator, dependentVariablesToSave );


Note

In the example above, the TranslationalStatePropagatorSettings derived-class is used. Please note that any of the derived-classes described in Propagator Settings: Basics can be used, as long as these support dependent variable saving.

## 5.4.2. Available dependent variables¶

The framework discussed in the previous section explains how the dependentVariablesList is populated and passed to the PropagatorSettings. The goal of this section is to list the available dependent variables and to explain how these are pushed to the dependentVariablesList.

class SingleDependentVariableSaveSettings

This base-class is a generic method to retrieve a large number of dependent variables that are not classified under a particular group. Variables are saved to the dependentVariablesList using the following code:

dependentVariablesList.push_back(
boost::make_shared< SingleDependentVariableSaveSettings >( variableType, associatedBody, secondaryBody ) );


where:

• variableType

PropagationDependentVariables variable that can take the following values:

Variables returning a double

• mach_number_dependent_variable
• altitude_dependent_variable
• airspeed_dependent_variable
• local_density_dependent_variable
• relative_speed_dependent_variable
• relative_distance_dependent_variable
• radiation_pressure_dependent_variable
• total_aerodynamic_g_load_variable
• stagnation_point_heat_flux_dependent_variable
• local_temperature_dependent_variable
• geodetic_latitude_dependent_variable
• control_surface_deflection_dependent_variable
• total_mass_rate_dependent_variables
• periapsis_altitude_dependent_variable

Variables returning an Eigen::VectorXd

• relative_position_dependent_variable
• relative_velocity_dependent_variable
• body_fixed_airspeed_based_velocity_variable
• total_acceleration_norm_dependent_variable
• total_acceleration_dependent_variable
• aerodynamic_force_coefficients_dependent_variable
• aerodynamic_moment_coefficients_dependent_variable
• lvlh_to_inertial_frame_rotation_dependent_variable
• rotation_matrix_to_body_fixed_frame_variable
class SingleAccelerationDependentVariableSaveSettings

This derived-class is used to retrieve acceleration-related dependent variables. A large number of acceleration models are supported and both the acceleration-norm and the acceleration-vector can be saved. Variables are saved to the dependentVariablesList using the following code:

dependentVariablesList.push_back(
boost::make_shared< SingleAccelerationDependentVariableSaveSettings >(
accelerationModeType, bodyUndergoingAcceleration, bodyExertingAcceleration, useNorm ) );


where:

• accelerationModeType

AvailableAcceleration variable that defines the type of acceleration that must be retrieved. It can take the following values:

• undefined_acceleration
• central_gravity
• aerodynamic
• cannon_ball_radiation_pressure
• spherical_harmonic_gravity
• mutual_spherical_harmonic_gravity
• third_body_central_gravity
• third_body_spherical_harmonic_gravity
• third_body_mutual_spherical_harmonic_gravity
• thrust_acceleration
• bodyUndergoingAcceleration

std::string variable that indicates the body that experiences the acceleration that needs to be retrieved. Make sure that the body’s name is listed in BodyMap.

• bodyExertingAcceleration

std::string variable that indicates the body that exerts the acceleration that needs to be retrieved on bodyUndergoingAcceleration. Make sure that the body’s name is listed in BodyMap.

• useNorm

bool variable that indicates if the norm of the acceleration (true) or the acceleration vector (false) must be retrieved.

Warning

Make sure that the selected bodyExertingAcceleration is compatible with the accelerationModeType.

class IntermediateAerodynamicRotationVariableSaveSettings

This derived-class is used to retrieve the rotation matrix between two desired frames. Variables are saved to the dependentVariablesList using the following code:

dependentVariablesList.push_back(
boost::make_shared< IntermediateAerodynamicRotationVariableSaveSettings >(
associatedBody, baseFrame, targetFrame ) );


where:

• associatedBody

std::string variable that indicates the body for which a rotation matrix is to be saved. Make sure that the body’s name is listed in BodyMap.

• baseFrame

AerodynamicsReferenceFrames variable indicates the frame from which the rotation is to be saved. The following frames are available:

• inertial_frame
• corotating_frame
• vertical_frame
• trajectory_frame
• aerodynamic_frame
• body_frame
• targetFrame

AerodynamicsReferenceFrames variable indicates the frame to which the rotation is to be saved. The available frames are listed above.

class BodyAerodynamicAngleVariableSaveSettings

This derived-class is used to retrieve a number of rotation angles. Variables are saved to the dependentVariablesList using the following code:

dependentVariablesList.push_back(
boost::make_shared< BodyAerodynamicAngleVariableSaveSettings >(
associatedBody, angle ) );


where:

• associatedBody

std::string variable that indicates the body for which the angle is to be saved. Make sure that the body’s name is listed in BodyMap.

• angle

AerodynamicsReferenceFrameAngles variable that provides the angle to be saved. The following angles can be saved using this method:

• latitude_angle
• longitude_angle
• heading_angle
• flight_path_angle
• angle_of_attack
• angle_of_sideslip
• bank_angle

Warning

At the moment, all the multi-dimensional dependent variables are pushed to the end of the save-file. This is currently being fixed, such that the save order is the same as the declaration order. Please refer to the following Pull Request for further details: https://github.com/Tudat/tudat/pull/191