Currently working on refactor, much work to do

This commit is contained in:
Connor
2021-09-25 16:10:02 -06:00
parent 7d0037f38d
commit af545ba1a7
23 changed files with 286 additions and 353 deletions

View File

@@ -6,26 +6,19 @@
# Set up
start_mass = 10_000.
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"]); start_mass]
stepsize = rand(100.0:0.01:500.0)
start = gen_orbit(rand(.5year : hour : 2year), start_mass)
stepsize = rand(hour : second : 6hour)
# Test that Laguerre-Conway is the default propagator for spacecrafts
craft = Sc("no_thrust")
state = prop_one([0., 0., 0.], start, craft, μs["Earth"], stepsize)
@test laguerre_conway(start, μs["Earth"], stepsize) state[1:6]
state = prop_one([0., 0., 0.], start, no_thrust, stepsize)
@test laguerre_conway(start, stepsize) state[1:6]
@test state[7] == start_mass
# Test that mass is reduced properly
craft = Sc("test")
state = prop_one([1., 0., 0.], start, craft, μs["Earth"], stepsize)
@test state[7] == start_mass - craft.mass_flow_rate*stepsize
state = prop_one([1., 0., 0.], start, bepi, stepsize)
@test state[7] == start_mass - bepi.mass_flow_rate*stepsize
# Test that a bad ΔV throws an error
@test_throws ErrorException prop_one([1.5, 0., 0.], start, craft, μs["Earth"], stepsize)
@test_throws Thesis.PropOne_Error prop_one([1.5, 0., 0.], start, bepi, stepsize)
end