32 lines
967 B
Julia
32 lines
967 B
Julia
@testset "Single Shooting" begin
|
|
|
|
# Initial Setup
|
|
sc = Sc("test")
|
|
a = rand(15000:1.:40000)
|
|
e = rand(0.01:0.01:0.5)
|
|
i = rand(0.01:0.01:π/6)
|
|
T = 2π*√(a^3/μs["Earth"])
|
|
n = 50
|
|
|
|
# A simple orbit raising
|
|
start = oe_to_xyz([ a, e, i, 0., 0., 0. ], μs["Earth"])
|
|
ΔVs = repeat([0.6, 0., 0.]', outer=(n,1))
|
|
final = prop(ΔVs, start, sc, μs["Earth"], T)[1][end,:]
|
|
|
|
# This should be close enough to 0.6
|
|
x0 = repeat([atanh((0.4-0.5)/0.5), 0., 0.], n)
|
|
result = single_shoot(start, final, sc, μs["Earth"], 0.0, T, n, x0)
|
|
|
|
# Test and plot
|
|
@test converged(result)
|
|
path1 = prop(zeros((100,3)), start, sc, μs["Earth"], T)[1]
|
|
path2, mass = prop(treat_inputs(result.zero, n), start, sc, μs["Earth"], T)
|
|
path3 = prop(zeros((100,3)), path2[end,:], sc, μs["Earth"], T)[1]
|
|
savefig(plot_orbits([path1, path2, path3]), "single_shoot_test.html")
|
|
if converged(result)
|
|
@test norm(path2[end,:] - final) < 2e-2
|
|
sc = Sc("test")
|
|
end
|
|
|
|
end
|