from tudatpy.kernel.simulation import environment_setup
from tudatpy.kernel.simulation import propagation_setup

# Define simulation time and step size
simulation_start_epoch = 0.0
simulation_end_epoch = constants.JULIAN_DAY
fixed_step_size = 100.0

# Load spice kernels.
spice_interface.load_standard_kernels()

# Create body objects
bodies_to_create = ["Sun"]

body_settings = environment_setup.get_default_body_settings(
    bodies_to_create, simulation_start_epoch, simulation_end_epoch,
    fixed_step_size)

bodies = environment_setup.create_bodies(body_settings)

# Create vehicle object
bodies["Apollo"] = environment_setup.Body()

# Set mass of vehicle
bodies["Apollo"].set_constant_body_mass(2000.0)

global_frame_origin = "SSB"
global_frame_orientation = "ECLIPJ2000"
environment_setup.set_global_frame_body_ephemerides(bodies,
                                                    global_frame_origin,
                                                    global_frame_orientation)
예제 #2
0
###########################################################################

# Set simulation start epoch
simulation_start_epoch = 0.0  # s
# Load spice kernels
spice_interface.load_standard_kernels()
# Define settings for celestial bodies
bodies_to_create = ['Moon']
# Define coordinate system
global_frame_origin = 'Moon'
global_frame_orientation = 'ECLIPJ2000'
# Create body settings
# N.B.: all the bodies added after this function is called will automatically
# be placed in the same reference frame, which is the same for the full
# system of bodies
body_settings = environment_setup.get_default_body_settings(
    bodies_to_create, global_frame_origin, global_frame_orientation)
# Create bodies
bodies = environment_setup.create_system_of_bodies(body_settings)

###########################################################################
# CREATE VEHICLE ##########################################################
###########################################################################

# Create vehicle object and add it to the existing system of bodies
bodies.create_empty_body('Vehicle')
# Set mass of vehicle
bodies.get_body('Vehicle').set_constant_mass(vehicle_mass)

###########################################################################
# CREATE ACCELERATIONS ####################################################
###########################################################################
예제 #3
0
파일: main.py 프로젝트: tudat-team/tudatpy
# Set vehicle thrust magnitude.
thrust_magnitude = 25.0

# Set vehicle specific impulse.
specific_impulse = 5.0E3

################################################################################
# SETUP ENVIRONMENT ############################################################
################################################################################

# 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)
body_system = environment_setup.create_bodies(body_settings)
environment_setup.set_global_frame_body_ephemerides(body_system, "SSB",
                                                    "ECLIPJ2000")

################################################################################
# SETUP ENVIRONMENT : CREATE VEHICLE ###########################################
################################################################################

body_system["Vehicle"] = environment_setup.Body()
body_system["Vehicle"].set_constant_body_mass(vehicle_mass)

################################################################################
# SETUP ENVIRONMENT : FINALIZE BODY CREATION ###################################
################################################################################
SC_NAMES = []
for i in range(0, number_RAAN):
    SC_NAMES.append('CHESS' +
                    str(RAAN[i]))  # creates the name of each spacecraft

# Simulation Setup
spice_interface.load_standard_kernels()

simulation_start_epoch = 631108800.0
simulation_end_epoch = 631126800.0

# Bodies
bodies_to_create = ["Earth", "Sun"]

body_settings = environment_setup.get_default_body_settings(
    bodies_to_create, simulation_start_epoch, simulation_end_epoch, "Earth",
    "J2000")

bodies = environment_setup.create_system_of_bodies(body_settings)

reference_area_radiation = 0.1159
radiation_pressure_coefficient = 1.2

occulting_bodies = ["Earth"]
radiation_pressure_settings = environment_setup.radiation_pressure.cannonball(
    "Sun", reference_area_radiation, radiation_pressure_coefficient,
    occulting_bodies)

central_bodies = []

bodies_to_propagate = SC_NAMES
def create_simulation_bodies(
    itokawa_radius: float
) -> tudatpy.kernel.simulation.environment_setup.SystemOfBodies:
    """
    It creates all the body settings and body objects required by the simulation.

    Parameters
    ----------
    itokawa_radius : float
        Radius of Itokawa, assuming a spherical shape.

    Returns
    -------
    tudatpy.kernel.simulation.environment_setup.SystemOfBodies
        System of bodies to be used in the simulation.
    """
    ### 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")
    # Gravity field definition
    itokawa_gravity_field_settings = get_itokawa_gravity_field_settings(
        itokawa_body_frame_name, itokawa_radius)
    # Adds Itokawa settings
    # Gravity field
    body_settings.get(
        "Itokawa").gravity_field_settings = itokawa_gravity_field_settings
    # 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(
            itokawa_gravity_field_settings.gravitational_parameter)
    # 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_body("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