def create_simulation_bodies(itokawa_radius): ### CELESTIAL BODIES ### # Define Itokawa body frame name itokawa_body_frame_name = "Itokawa_Frame" # Create default body settings for selected celestial bodies bodies_to_create = ["Sun", "Earth", "Jupiter", "Saturn", "Mars"] # Create default body settings for bodies_to_create, with "Earth"/"J2000" as # global frame origin and orientation. This environment will only be valid # in the indicated time range [simulation_start_epoch --- simulation_end_epoch] body_settings = environment_setup.get_default_body_settings( bodies_to_create, "SSB", "ECLIPJ2000") # Add Itokawa body body_settings.add_empty_settings("Itokawa") # Adds Itokawa settings # Gravity field body_settings.get("Itokawa").gravity_field_settings = get_itokawa_gravity_field_settings(itokawa_body_frame_name, itokawa_radius) # Rotational model body_settings.get("Itokawa").rotation_model_settings = get_itokawa_rotation_settings(itokawa_body_frame_name) # Ephemeris body_settings.get("Itokawa").ephemeris_settings = get_itokawa_ephemeris_settings( spice.get_body_gravitational_parameter( 'Sun') ) # Shape (spherical) body_settings.get("Itokawa").shape_settings = get_itokawa_shape_settings(itokawa_radius) # Create system of selected bodies bodies = environment_setup.create_system_of_bodies(body_settings) ### VEHICLE BODY ### # Create vehicle object bodies.create_empty_body("Spacecraft") bodies.get("Spacecraft").set_constant_mass(400.0) # Create radiation pressure settings, and add to vehicle reference_area_radiation = 4.0 radiation_pressure_coefficient = 1.2 radiation_pressure_settings = environment_setup.radiation_pressure.cannonball( "Sun", reference_area_radiation, radiation_pressure_coefficient) environment_setup.add_radiation_pressure_interface( bodies, "Spacecraft", radiation_pressure_settings) return bodies
def create_bodies(): # Define string names for bodies to be created from default. bodies_to_create = ["Mars"] # Use "Earth"/"J2000" as global frame origin and orientation. global_frame_origin = "Mars" global_frame_orientation = "J2000" # Create default body settings, usually from `spice`. body_settings = environment_setup.get_default_body_settings( bodies_to_create, global_frame_origin, global_frame_orientation) # Add a predefined exponential atmosphere model for Mars body_settings.get( "Mars" ).atmosphere_settings = environment_setup.atmosphere.exponential_predefined( "Mars") # Return the system of selected celestial bodies return environment_setup.create_system_of_bodies(body_settings)
Bodies can be created by making a list of strings with the bodies that is to be included in the simulation. The default body settings (such as atmosphere, body shape, rotation model) are taken from `SPICE`. These settings can be adjusted. Please refere to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details. Finally, the system of bodies is created using the settings. This system of bodies is stored into the variable `bodies`. """ # Create default body settings for "Earth" bodies_to_create = ["Earth"] # Create default body settings for bodies_to_create, with "Earth"/"J2000" as the global frame origin and orientation global_frame_origin = "Earth" global_frame_orientation = "J2000" body_settings = environment_setup.get_default_body_settings( bodies_to_create, global_frame_origin, global_frame_orientation) # Create system of bodies (in this case only Earth) bodies = environment_setup.create_system_of_bodies(body_settings) ### Create the vehicle """ Let's now create the massless satellite for which the orbit around Earth will be propagated. """ # Add vehicle object to system of bodies bodies.create_empty_body("Delfi-C3") ## Propagation setup """ Now that the environment is created, the propagation setup is defined.
### Create the bodies """ Bodies can be created by making a list of strings with the bodies that is to be included in the simulation. The default body settings (such as atmosphere, body shape, rotation model) are taken from `SPICE`. These settings can be adjusted. Please refere to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details. Finally, the system of bodies is created using the settings. This system of bodies is stored into the variable `bodies`. """ # Define bodies in simulation bodies_to_create = ["Sun", "Earth", "Moon"] # Create bodies in simulation body_settings = environment_setup.get_default_body_settings(bodies_to_create) system_of_bodies = environment_setup.create_system_of_bodies(body_settings) ### Create the vehicle """ Let's now create the 5000kg Vehicle for which the trajectory bewteen the Earth and the Moon will be propagated. """ # Create the vehicle body in the environment system_of_bodies.create_empty_body("Vehicle") system_of_bodies.get_body("Vehicle").set_constant_mass(5e3) ## Propagation setup """ Now that the environment is created, the propagation setup is defined.