Ejemplo n.º 1
0
                r[t - 1, i])**3 * r[t - 1, i]
            r[t, i] = r[t - 1,
                        i] + v[t - 1, i] * dt + 0.5 * acceleration[t - 1,
                                                                   i] * dt**2
            acceleration[t, i] = -(G * (system.star_mass)) / np.linalg.norm(
                r[t, i])**3 * r[t, i]
            v[t, i] = v[t - 1, i] + 0.5 * (acceleration[t - 1, i] +
                                           acceleration[t, i]) * dt

    for planets in range(system.number_of_planets):
        plt.plot(r[:, planets, 0], r[:, planets, 1])
    plt.axis('equal')
    plt.show()

    return times, np.transpose(r), P, dt


init_x, init_y = system.initial_positions
pos_on_planet = (system.radii[0] / const.AU, 0 / const.AU)

# Koden er 74952.

mission.set_launch_parameters(
    thrust_force, fuel_consumption, fuel_mass, t,
    (init_x[0] + pos_on_planet[0], init_y[0] + pos_on_planet[1]), 0)
mission.launch_rocket()
consumed_fuel_mass, final_time, final_position, final_velocity = shortcuts.get_launch_results(
)
mission.verify_launch_result(final_position)
# print(time.process_time())
Ejemplo n.º 2
0
    plt.axis('equal')
    plt.show()

    return times, np.transpose(r), P, dt

# times, r, P, dt = simulate_orbits(system, 25, 10000)



def area(r, P, dt):
    for i in range(system.number_of_planets):
        a1 = 1/2 * r[:, i, 0:1000] * (2*np.pi*r[:, i, 0:1000])/P * dt
        a2 = 1/2 * r[:, i, 5000:6000] * (2*np.pi*r[:, i, 5000:6000])/P * dt
        print(f'Differansen mellom de to arealene til planet {i}: {np.abs(np.sum(a1)-np.sum(a2)):16.14}   |  Den relative feilen: {np.abs(np.sum(a1)-np.sum(a2))/np.abs(np.sum(a2))}')

# area(r, P, dt)

print(time.process_time())

from ast2000tools.shortcuts import SpaceMissionShortcuts
from ast2000tools.space_mission import SpaceMission
# Koden er 74952.
mission = SpaceMission(seed)
shortcuts = SpaceMissionShortcuts(mission, [74952])
# set_launch_parameters() missing 6 required positional arguments: 'thrust', 'mass_loss_rate', 'initial_fuel_mass', 'estimated_launch_duration', 'launch_position', and 'time_of_launch'
shortcuts.thrust
mission.set_launch_parameters(shortcuts.thru)
mission.launch_rocket()
consumed_fuel_mass, final_time, final_position, final_velocity = shortcuts.get_launch_results()
mission.verify_launch_result(final_position)
Ejemplo n.º 3
0
# Calculating the rocets Mass, time and speed during liftoff
    i = 0
    while v < v_esc and mass > 1100:
        mass =  mass - fuel_consumption*dt
        g = (gamma*M_planet) / (R+r)**2
        G = mass * g
        a = (thrust_force - G) / mass
        v += a*dt
        r += v*dt
        t += dt
        v_esc = np.sqrt( (2*gamma*M_planet)/(R+r) )
        i += 1

    # return print(f'Masse:{mass}, Tid (minutter): {t/60}, Posisjon: {r}, Fart: {v}')
    return thrust_force, fuel_consumption, fuel_mass, t

L = 10**(-7)        # Length of box (m)
T = 3*10**3         # Temperature of gas (K)
N = 10**5           # amt of particles

thrust_force, fuel_consumption, fuel_mass, t = rocket_launch(T, L, N, 15*1000, 10**18,  1)

# Koden er 74952.
print(shortcuts)

mission.set_launch_parameters(thrust_force, fuel_consumption, fuel_mass, t, (0, 0), 0)
mission.launch_rocket()
consumed_fuel_mass, final_time, final_position, final_velocity = shortcuts.get_launch_results()
mission.verify_launch_result(final_position)
# print(time.process_time())