A lot of progress on the propagator

This commit is contained in:
rconnorjohnstone
2021-05-19 17:36:47 -06:00
parent 2460b9734b
commit 376f18556c
7 changed files with 126 additions and 3 deletions

33
julia/test/propagator.jl Normal file
View File

@@ -0,0 +1,33 @@
@testset "Propagator" begin
# Set up
start = oe_to_xyz([ (μs["Earth"]*(rand(3600*1.5:0.01:3600*4)/(2π))^2)^(1/3),
rand(0.01:0.01:0.5),
rand(0.01:0.01:0.45π),
0.,
0.,
1. ], μs["Earth"])
stepsize = rand(100.0:0.01:500.0)
# Test that Laguerre-Conway is the default propagator
propped = prop_one([0., 0., 0.], start, 0., 0, 0., 1000., 0.1, μs["Earth"], stepsize)
@test laguerre_conway(start, μs["Earth"], stepsize) propped[1]
# Test that Laguerre-Conway is the default propagator for spacecrafts
craft = sc("no_thrust")
state, craft = prop_one([0., 0., 0.], start, craft, μs["Earth"], stepsize)
@test laguerre_conway(start, μs["Earth"], stepsize) state
@test craft.mass == 1000.
# Test that mass is reduced properly
craft = sc("test")
start_mass = craft.mass
state, craft = prop_one([1., 1., 1.]/(3), start, craft, μs["Earth"], stepsize)
@test craft.mass == start_mass - craft.mass_flow_rate*stepsize
# Test that a bad ΔV throws an error
craft = sc("test")
start_mass = craft.mass
@test_throws ErrorException prop_one([1., 1., -1.], start, craft, μs["Earth"], stepsize)
end