ast2000tools.shortcuts.SpaceMissionShortcuts

class ast2000tools.shortcuts.SpaceMissionShortcuts(mission, codes)

Bases: object

Provides a set of shortcuts allowing you to proceed with the space mission when you are stuck.

When you have been unable to proceed with a part of the mission for too long, it is important that you make use of the shortcuts so that you can continue without loosing a lot of time. Simply identify the shortcut method(s) that you require in order to proceed, and ask the project group teacher for the necessary code(s). Specify the name of the method and the seed value you are using.

Parameters

Methods

compute_engine_performance(number_density, …)

Computes the thrust and mass loss rate for a single simulation box of the rocket combustion chamber.

compute_planet_trajectories(times)

Computes the evolution of positions of each planet in the system over the given times.

get_launch_results()

Returns the results of the previous launch.

get_orientation_data()

Returns the orientation data for the spacecraft directly after the previous launch.

place_spacecraft_in_stable_orbit(time, …)

Places the spacecraft in a circular orbit around the specified planet.

place_spacecraft_in_unstable_orbit(time, …)

Places the spacecraft in a randomized elliptical orbit around the specified planet.

place_spacecraft_on_escape_trajectory(…)

Places the spacecraft on an escape trajectory pointing directly away from the home planet.

Attributes

codes

The provided codes for unlocking shortcuts.

mission

The mission to apply shortcuts to.

system

The system associated with the mission to apply shortcuts to.

property mission

The mission to apply shortcuts to.

Type

ast2000tools.space_mission.SpaceMission

property system

The system associated with the mission to apply shortcuts to.

Type

ast2000tools.solar_system.SolarSystem

property codes

The provided codes for unlocking shortcuts.

Type

tuple(int)

compute_engine_performance(number_density, temperature, hole_area)

Computes the thrust and mass loss rate for a single simulation box of the rocket combustion chamber.

Parameters
  • number_density (float) – The number density of particles in the box, in particles per cubic meter.

  • temperature (float) – The temperature in the box, in kelvin.

  • hole_area (float) – The area of the nozzle hole that the particles can escape through, in square meters.

Returns

  • float – The thrust per box in Newtons.

  • float – The mass loss rate per box in kilograms per second.

Raises

RuntimeError – When none of the provided codes are valid for unlocking this method.

get_launch_results()

Returns the results of the previous launch.

Returns

  • float – The total mass of fuel burned during the launch, in kilograms.

  • float – The time when the launch was completed, in years since the initial solar system time.

  • 1-D numpy.ndarray – Array of shape (2,) containing the x and y-position of the spacecraft, in astronomical units relative to the star.

  • 1-D numpy.ndarray – Array of shape (2,) containing the x and y-velocity of the spacecraft, in astronomical units per year relative to the star.

Raises
place_spacecraft_on_escape_trajectory(rocket_thrust, rocket_mass_loss_rate, time, height_above_surface, direction_angle, remaining_fuel_mass)

Places the spacecraft on an escape trajectory pointing directly away from the home planet.

Parameters
  • rocket_thrust (float) – The total thrust of the rocket, in Newtons.

  • rocket_mass_loss_rate (float) – The total mass loss rate of the rocket, in kilograms per second.

  • time (float) – The time at which the spacecraft should be placed on the escape trajectory, in years from the initial system time.

  • height_above_surface (float) – The heigh above the home planet surface to place the spacecraft, in meters.

  • direction_angle (float) – The angle of the direction of motion of the spacecraft with respect to the x-axis, in degrees.

  • remaining_fuel_mass (float) – The mass of fuel carried by the spacecraft after placing it on the escape trajectory, in kilograms.

Raises

RuntimeError – When none of the provided codes are valid for unlocking this method.

compute_planet_trajectories(times)

Computes the evolution of positions of each planet in the system over the given times.

Parameters

times (1-D array_like) – Array of times for which to obtain the positions, in years.

Returns

Array of shape (2, number_of_planets, len(times)) containing the positions of the planets in astronomical units.

Return type

3-D numpy.ndarray

Raises

RuntimeError – When none of the provided codes are valid for unlocking this method.

get_orientation_data()

Returns the orientation data for the spacecraft directly after the previous launch.

Returns

  • 1-D numpy.ndarray – Array of shape (2,) containing the x and y-position of the spacecraft, in astronomical units relative to the star.

  • 1-D numpy.ndarray – Array of shape (2,) containing the x and y-velocity of the spacecraft, in astronomical units per year relative to the star.

  • float – The azimuthal angle of the spacecraft’s pointing, in degrees.

Raises
place_spacecraft_in_unstable_orbit(time, planet_idx)

Places the spacecraft in a randomized elliptical orbit around the specified planet.

Parameters
  • time (float) – The time at which the spacecraft should be placed in orbit, in years from the initial system time.

  • planet_idx (int) – The index of the planet that the spacecraft should orbit.

Raises
place_spacecraft_in_stable_orbit(time, orbital_height, orbital_angle, planet_idx)

Places the spacecraft in a circular orbit around the specified planet.

Note

This shortcut is meant for students who are having problems achieving a low, stable orbit around the destination planet after getting there. If your problem is just about getting close enough to the destination planet, but you believe you can stabilize the orbit once you get there, please consider using place_spacecraft_in_unstable_orbit() instead.

Parameters
  • time (float) – The time at which the spacecraft should be placed in orbit, in years from the initial system time.

  • orbital_height (float) – The height of the orbit above the planet surface, in meters.

  • orbital_angle (float) – The angle of the initial position of the spacecraft in orbit, in radians relative to the x-axis.

  • planet_idx (int) – The index of the planet that the spacecraft should orbit.

Raises