# Multi-type dynamics

Tudat permits the propagation of any combination of types of dynamics, for any number of bodies. One example is the simulation of coupled translational-rotational dynamics of one or more bodies, or the combined translational and mass dynamics of a body (e.g. spacecraft under thrust).

To define multi-type propagator settings, you must first define the propagator settings for each type of dynamics separately, after which you combine these using the `multitype()`

function as follows:

Required

Show/Hide# Create physical environment bodies = environment_setup.create_system_of_bodies( ... ) # Define central bodies central_bodies = ["Earth"] # Define bodies that are propagated bodies_to_propagate = ["Spacecraft"] # Define acceleration settings acting on spacecraft acceleration_settings_spacecraft = dict( Sun=[propagation_setup.acceleration.point_mass_gravity()]) acceleration_settings = {"Spacecraft": acceleration_settings_spacecraft} # Create acceleration models. acceleration_models = propagation_setup.create_acceleration_models( bodies, acceleration_settings, bodies_to_propagate, central_bodies) # Define initial conditions as Cartesian elements w.r.t. central body (Earth) with axes along global orientation initial_state = [5.89960424e+06, 2.30545977e+06, 1.74910449e+06, -1.53482795e+03, -1.71707683e+03, 7.44010957e+03] # Define numerical integrator (RK4; step size 2 seconds) integrator_settings = propagation_setup.integrator.runge_kutta_4( 2.0 ) # Start of simulation simulation_start_epoch = 9120.0 * constants.JULIAN_DAY # Define termination settings simulation_end_epoch = 9140.0 * constants.JULIAN_DAY termination_settings = propagation_setup.propagator.time_termination( simulation_end_epoch ) # Define propagator type propagator_type = propagation_setup.propagator.encke # Define dependent variables dependent_variables_to_save = [propagation_setup.dependent_variable.total_acceleration( "Spacecraft" )] # Define translational propagator settings translational_propagator_settings = propagation_setup.propagator.translational( central_bodies, acceleration_models, bodies_to_propagate, initial_state, simulation_start_epoch, integrator_settings, termination_settings, propagator=propagator_type, output_variables= dependent_variables_to_save)# Create physical environment bodies = environment_setup.create_system_of_bodies( ... ) # Define bodies that are propagated bodies_to_propagate = ["Spacecraft"] # Define torque models # Define torque settings acting on spacecraft torque_settings_spacecraft = dict( Sun=[propagation_setup.torque.second_degree_gravitational()]) torque_settings = {"Spacecraft": torque_settings_spacecraft} # Create torque models. torque_models = propagation_setup.create_torque_models( bodies, torque_settings, bodies_to_propagate) # Below, we define the initial state in a somewhat trivial manner (body axes along global frame # axes; no initial rotation). A real application should use a more realistic initial rotational state # Set initial rotation matrix (identity matrix) initial_rotation_matrix = np.eye(3) # Set initial orientation by converting a rotation matrix to a Tudat-compatible quaternion initial_state = element_conversion.rotation_matrix_to_quaternion_entries(initial_rotation_matrix) # Complete initial state by adding angular velocity vector (zero in this case) initial_state = np.hstack((inital_state, [0,0,0])) # Define numerical integrator (RK4; step size 2 seconds) integrator_settings = propagation_setup.integrator.runge_kutta_4( 2.0 ) # Start of simulation simulation_start_epoch = 9120.0 * constants.JULIAN_DAY # Define termination settings simulation_end_epoch = 9140.0 * constants.JULIAN_DAY termination_settings = propagation_setup.propagator.time_termination( simulation_end_epoch ) # Define propagator type propagator_type = propagation_setup.propagator.modified_rodrigues_parameters # Define dependent variables dependent_variables_to_save = [propagation_setup.dependent_variable.total_torque_norm("Spacecraft")] # Define rotational propagator settings rotational_propagator_settings = propagation_setup.propagator.rotational( torque_models, bodies_to_propagate, initial_state, simulation_start_epoch, integrator_settings, termination_settings, propagator=propagator_type, output_variables=dependent_variables_to_save)# Create physical environment bodies = environment_setup.create_system_of_bodies( ... ) # Define bodies that are propagated bodies_to_propagate = ["Spacecraft"] # Create mass rate models, note that the model below will only work as part of a # multitype propagation, where mass and translational state are propagated, and # a thrust acceleration is acting on the spacecraft mass_rate_settings = dict(Vehicle=[propagation_setup.mass_rate.from_thrust()]) mass_rate_models = propagation_setup.create_mass_rate_models( bodies, mass_rate_settings, acceleration_models ) # Define initial conditions initial_mass = 3400.0 # kg # Define numerical integrator (RK4; step size 2 seconds) integrator_settings = propagation_setup.integrator.runge_kutta_4( 2.0 ) # Start of simulation simulation_start_epoch = 9120.0 * constants.JULIAN_DAY # Define termination settings simulation_end_epoch = 9140 * constants.JULIAN_DAY termination_settings = propagation_setup.propagator.time_termination( simulation_end_epoch ) # Define dependent variables dependent_variables_to_save = [propagation_setup.dependent_variable.total_mass_rate("Spacecraft")] # Define mass propagator settings mass_propagator_settings = propagation_setup.propagator.mass( mass_rate_models, bodies_to_propagate, initial_mass, simulation_start_epoch, integrator_settings, termination_settings, output_variables=dependent_variables_to_save)# Create list of propagator settings propagator_settings_list =[ translational_propagator_settings, rotational_propagator_settings, mass_propagator_settings ] # Define settings for multi-type propagator propagator_settings = propagation_setup.propagator.multitype( propagator_settings_list, integrator_settings, simulation_start_epoch, termination_condition, output_variables = dependent_variables_to_save )// required include statements #include <tudat/simulation/simulation.h> // required using-declarations using tudat::simulation_setup; using tudat;

This example (note the collapsed combined code for the translational, rotational, and mass dynamics examples) shows the use of the translational, rotational and mass dynamics of a single body `Spacecraft`

. However, the framework is not limited to propagating the different types of dynamics for only one body. You may for instance propagate the translational state and mass of a spacecraft concurrently with the rotational state of the Earth. Also, you may propagate any number of any type of dynamics of any body, e.g. translational dynamics of 6 bodies, rotational dynamics of 4 bodies and mass of 2 bodies, where these three sets of bodies may but need not fully or partially overlap).

When using multi-type propagator settings, the following settings:

**Output variables****Termination settings****Integrator settings****Initial time****Console output and processing settings**

that are passed tothe `propagation_setup.propagator.multitype`

function are used. Settings of the same kind are also stored in the constituent single-type propagator settings (above, in the `propagator_settings_list`

input), but these *are fully ignored when using multi-type settings*! Only the settings of these types explicitly added to the `propagation_setup.propagator.multitype`

function are used.

Conversely, the `propagation_setup.propagator.multitype`

function does not take any initial states as inputs. The complete, multitype, initial state vector is set up from its contituent single-arc settings (with the order as noted below)

Note

The order of the state entries in the multi-type state vector will, in general, be different from the order provided in the propagator_settings_list When different state types are propagated, the state output contains the states in following order:

Translational state (

T)Rotational state (

R)Body mass state (

M)Custom state (

C)To retrieve the definition of the multitype state vector, see Console Output.