I think tests are passing again

This commit is contained in:
Connor
2021-08-25 16:26:32 -06:00
parent 7f3df275e9
commit 54f2a5cb7f
3 changed files with 10 additions and 5 deletions

View File

@@ -7,4 +7,5 @@ unit-test-job:
- apt-get update
- apt-get -y upgrade
- apt-get install -y unzip
- mkdir julia/plots
- julia --project=julia/Project.toml -E 'using Pkg; Pkg.test()'

View File

@@ -12,8 +12,9 @@ function single_shoot(start::Vector{Float64},
t0::Float64,
tf::Float64,
x0::AbstractVector,
tol=1e-2)
tol=1e-8)
n::Int = length(x0)/3
function f!(F,x)
F[1:6] .= prop(treat_inputs(x), start, craft, μ, tf-t0)[1][end,:] - final
F[7:3n] .= 0.

View File

@@ -1,5 +1,8 @@
@testset "Find Closest" begin
using NLsolve
using Thesis: treat_inputs
# Initial Setup
sc = Sc("test")
a = rand(15000:1.:40000)
@@ -20,16 +23,16 @@
result = Thesis.single_shoot(start, final, sc, μs["Earth"], 0.0, prop_time, x0)
# Test and plot
@test result[3] == :XTOL_REACHED
@test converged(result)
path1 = prop(zeros((100,3)), start, sc, μs["Earth"], T)[1]
path2, mass = prop(treat_inputs(result[2]), start, sc, μs["Earth"], prop_time)
path2, mass = prop(treat_inputs(result.zero), start, sc, μs["Earth"], prop_time)
path3 = prop(zeros((100,3)), path2[end,:], sc, μs["Earth"], new_T)[1]
path4 = prop(zeros((100,3)), final, sc, μs["Earth"], new_T)[1]
savefig(plot_orbits([path1, path2, path3, path4],
labels=["inital", "transit", "after transit", "final"],
colors=["#FFFFFF","#FF4444","#44FF44","#4444FF"]),
"plots/find_closest_test.html")
if result[3] == :XTOL_REACHED
"../plots/find_closest_test.html")
if converged(result)
@test norm(path2[end,:] - final) < 1e-6
end