# -*- coding: utf-8 -*- """ Template for the main solution code in Part 3 of the project. The objective of the template files is to give you an idea of the most important functions that you have to implement, what input they will need and what output they should produce. To make things work in practice you will have to add more functionalities than the ones outlined, and you might have to adapt the interfaces to fit your specific approach. You are of course free (and encouraged) to structure the code in any way you want! """ import ast2000tools.constants as const import part_1 def compute_blackbody_surface_temperature(system, distance_from_star): """ Here you can implement the surface temperature calculation for task 1 of Part 3 of the project. """ # Insert awesome code here... # You will probably also need these quantities: # const.pi # const.AU # const.sigma # system.star_radius # system.star_temperature def convert_to_solar_system_frame(system, final_height_above_surface, final_upward_speed, launch_duration, launch_direction, time_of_launch): """ Here you can implement the orbital simulation for task 3 of Part 3 of the project. """ # Load the exact planet trajectories from Part 2 times, planet_positions = np.load('planet_trajectories.npy') # Insert awesome code here... # You will probably also need these quantities: # const.AU # const.day # const.yr # system.radii # system.rotational_periods # Return quantities in the solar system units and frame of reference return rocket_position_before_launch, \ rocket_position_after_launch, \ rocket_velocity_after_launch, \ time_after_launch def simulate_full_launch(mission, number_of_boxes, number_of_particles_in_box, box_side_length, temperature, box_hole_area, initial_fuel_mass, launch_direction, time_of_launch): """ This function runs the engine and rocket simulations from Part 1 and converts the results to the solar system frame. """ # Run engine and launch simulations and get results relative to planet thrust_per_box, \ mass_loss_rate_per_box, \ final_height_above_surface, \ final_upward_speed, \ fuel_mass_after_launch, \ launch_duration \ = part_1.run_engine_and_launch_simulation(mission, number_of_boxes, number_of_particles_in_box, box_side_length, temperature, box_hole_area, initial_fuel_mass) # Convert simulated launch results to the solar system frame rocket_position_before_launch, \ rocket_position_after_launch, \ rocket_velocity_after_launch, \ time_after_launch \ = convert_to_solar_system_frame(mission.system, final_height_above_surface, final_upward_speed, launch_duration, launch_direction, time_of_launch) return thrust_per_box, \ mass_loss_rate_per_box, \ launch_duration, \ rocket_position_before_launch, \ rocket_position_after_launch, \ rocket_velocity_after_launch, \ fuel_mass_after_launch, \ time_after_launch def simulate_and_perform_launch(mission, number_of_boxes, number_of_particles_in_box, box_side_length, temperature, box_hole_area, initial_fuel_mass, launch_direction, time_of_launch): """ This function runs the engine and rocket simulations from Part 1 and converts the results to the solar system frame. It then performs the actual launch and verifies the simulated result. """ # Simulate launch thrust_per_box, \ mass_loss_rate_per_box, \ launch_duration, \ rocket_position_before_launch, \ rocket_position_after_launch, \ = simulate_full_launch(mission, number_of_boxes, number_of_particles_in_box, box_side_length, temperature, box_hole_area, initial_fuel_mass, launch_direction, time_of_launch)[:5] # Perform real launch mission.set_launch_parameters(thrust_per_box*number_of_boxes, mass_loss_rate_per_box*number_of_boxes, initial_fuel_mass, launch_duration, rocket_position_before_launch, time_of_launch) mission.launch_rocket() # Verify simulated launch results mission.verify_launch_result(rocket_position_after_launch)