Files
thesis/julia/test/propagator.jl
2022-02-19 12:30:54 -07:00

28 lines
725 B
Julia

@testset "Propagator" begin
using PlotlyJS: savefig
println("Testing Propagator")
# Set up
start_mass = 10_000.
start = gen_orbit(rand(.5year : hour : 2year), start_mass)
time = rand(0.2year : second : 0.5year)
n = 1_000
# Test that Propagation works
states = prop(zeros(n,3), start, no_thrust, time)
@test states[1,:] != states[end,:]
# Test that mass is reduced properly
states = prop(ones(n,3)/3, start, bepi, time)
@test states[end,7] start_mass - mfr(bepi)*time
# Test that the propagator works backwards
backwards = prop(ones(n,3)/3, states[end,:], bepi, -time)
p = plot([states, backwards])
savefig(p,"../plots/prop_back.html")
@test backwards[end,:] start
end