46 lines
1.8 KiB
Julia
46 lines
1.8 KiB
Julia
@testset "Monotonic Basin Hopping" begin
|
|
|
|
using PlotlyJS, NLsolve, Dates
|
|
|
|
println("Testing Monotonic Basin Hopper")
|
|
|
|
# First we test the random mission guess generator
|
|
flybys = [Earth, Venus, Jupiter]
|
|
launch_window = ( DateTime(2021,12,25), DateTime(2025,12,25) )
|
|
max_C3 = 10.
|
|
max_v∞ = 8.
|
|
latest_arrival = DateTime(2035,12,25)
|
|
random_guess = Thesis.mission_guess(flybys, bepi, 12_000., launch_window, max_C3, max_v∞, latest_arrival)
|
|
@test typeof(random_guess) == Mission_Guess
|
|
|
|
# Then the perturb function
|
|
mission_guess = Thesis.perturb(test_mission)
|
|
@test mission_guess.launch_date != test_mission.launch_date
|
|
@test mission_guess.launch_v∞ != test_mission.launch_v∞
|
|
for i in 1:2
|
|
@test mission_guess.phases[i].v∞_in != test_mission.phases[i].v∞_in
|
|
@test mission_guess.phases[i].δ != test_mission.phases[i].δ
|
|
@test mission_guess.phases[i].tof != test_mission.phases[i].tof
|
|
end
|
|
@test !mission_guess.converged
|
|
|
|
# # Then the inner loop builder function
|
|
mission = Thesis.inner_loop_solve(test_mission_guess)
|
|
@test !mission.converged
|
|
|
|
# For the valid case we need to use a lambert's solver
|
|
# TODO: This is probably not acceptable for how close I have to be
|
|
leave = DateTime(1992,11,19)
|
|
arrive = DateTime(1993,4,1)
|
|
time_leave = utc2et(Dates.format(leave,"yyyy-mm-ddTHH:MM:SS"))
|
|
time_arrive = utc2et(Dates.format(arrive,"yyyy-mm-ddTHH:MM:SS"))
|
|
earth_state = [spkssb(Earth.id, time_leave, "ECLIPJ2000"); 0.0]
|
|
venus_state = [spkssb(Venus.id, time_arrive, "ECLIPJ2000"); 0.0]
|
|
v∞_out, v∞_in, tof = Thesis.lamberts(Earth, Venus, leave, arrive)
|
|
phase = Phase(Venus, 1.0001v∞_in, 0.2, tof, 0.0*ones(20,3))
|
|
mission_guess = Mission_Guess(bepi, 12_000., leave, v∞_out, [phase])
|
|
mission = Thesis.inner_loop_solve(mission_guess)
|
|
@test mission.converged
|
|
|
|
end
|