Added some better logging
This commit is contained in:
@@ -25,4 +25,10 @@ unit-test-job:
|
|||||||
- julia/plots/plot_test_planet_move.html
|
- julia/plots/plot_test_planet_move.html
|
||||||
- julia/plots/plot_test_planet_no_move.html
|
- julia/plots/plot_test_planet_no_move.html
|
||||||
- julia/plots/plot_test_planet_solar_system.html
|
- julia/plots/plot_test_planet_solar_system.html
|
||||||
|
- julia/test/missions/nlp_1_phase
|
||||||
|
- julia/test/missions/nlp_2_phase
|
||||||
|
- julia/test/missions/nlp_5_phase
|
||||||
|
- julia/test/missions/mbh_1_phase
|
||||||
|
- julia/test/missions/mbh_2_phase
|
||||||
|
- julia/test/missions/mbh_5_phase
|
||||||
expire_in: 10 weeks
|
expire_in: 10 weeks
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export Phase, Mission_Guess, Mission, Bad_Mission
|
export Phase, Mission_Guess, Mission, Bad_Mission
|
||||||
export test_phase1, test_phase2
|
export test_phase1, test_phase2
|
||||||
export test_mg
|
export test_mg
|
||||||
|
export store
|
||||||
export Vector
|
export Vector
|
||||||
|
|
||||||
struct Phase
|
struct Phase
|
||||||
@@ -178,3 +179,44 @@ end
|
|||||||
Bad_Mission(s::String) = Bad_Mission(s,false)
|
Bad_Mission(s::String) = Bad_Mission(s,false)
|
||||||
Bad_Mission(s::Symbol) = Bad_Mission(String(s),false)
|
Bad_Mission(s::Symbol) = Bad_Mission(String(s),false)
|
||||||
|
|
||||||
|
function Base.write(io::IO, m::Mission)
|
||||||
|
write(io, m.sc)
|
||||||
|
write(io, "Launch Mass: $(m.start_mass)\n")
|
||||||
|
write(io, "Launch Date: $(m.launch_date)\n")
|
||||||
|
write(io, "Launch V∞: $(m.launch_v∞)\n")
|
||||||
|
i = 1
|
||||||
|
for phase in m.phases
|
||||||
|
write(io, "Phase $(i):\n")
|
||||||
|
write(io, "\tPlanet: $(phase.planet.name)\n")
|
||||||
|
write(io, "\tV∞_in: $(phase.v∞_in)\n")
|
||||||
|
write(io, "\tV∞_out: $(phase.v∞_out)\n")
|
||||||
|
write(io, "\ttime of flight: $(phase.tof)\n")
|
||||||
|
write(io, "\tthrust profile: $(phase.thrust_profile)\n")
|
||||||
|
i += 1
|
||||||
|
end
|
||||||
|
write(io, "\n")
|
||||||
|
write(io, "Mass Used: $(m.start_mass - prop(m)[7])\n")
|
||||||
|
write(io, "Launch C3: $(m.launch_v∞ ⋅ m.launch_v∞)\n")
|
||||||
|
write(io, "||V∞_in||: $(norm(m.phases[end].v∞_in))\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
function store(m::Union{Mission, Mission_Guess}, filename::AbstractString)
|
||||||
|
open(filename, "w") do file
|
||||||
|
write(file, filename)
|
||||||
|
write(file, "---------------------------\n")
|
||||||
|
write(file, "\n")
|
||||||
|
write(file, m)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function store(ms::Union{Vector{Mission}, Vector{Mission_Guess}}, filename::AbstractString)
|
||||||
|
open(filename, "w") do file
|
||||||
|
write(file, filename)
|
||||||
|
write(file, "\n")
|
||||||
|
for m in ms
|
||||||
|
write(file, "---------------------------\n")
|
||||||
|
write(file, m)
|
||||||
|
write(file, "\n\n\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export Sc, test_sc, bepi, no_thrust
|
export Sc, test_sc, bepi, no_thrust
|
||||||
|
|
||||||
mutable struct Sc
|
mutable struct Sc
|
||||||
|
name::AbstractString
|
||||||
dry_mass::Float64
|
dry_mass::Float64
|
||||||
mass_flow_rate::Float64
|
mass_flow_rate::Float64
|
||||||
max_thrust::Float64
|
max_thrust::Float64
|
||||||
@@ -8,6 +9,16 @@ mutable struct Sc
|
|||||||
duty_cycle::Float64
|
duty_cycle::Float64
|
||||||
end
|
end
|
||||||
|
|
||||||
const test_sc = Sc(8000., 0.00025/(2000*0.00981), 0.00025, 50, 0.9)
|
function Base.write(io::IO, sc::Sc)
|
||||||
const bepi = Sc(2000., 2*0.00025/(2800*0.00981), 0.00025, 2, 0.9)
|
write(io, "Spacecraft: $(sc.name)\n")
|
||||||
const no_thrust = Sc(0., 0.01, 0., 0, 0.)
|
write(io, "\tdry_mass: $(sc.dry_mass)\n")
|
||||||
|
write(io, "\tmass_flow_rate: $(sc.mass_flow_rate)\n")
|
||||||
|
write(io, "\tmax_thrust: $(sc.max_thrust)\n")
|
||||||
|
write(io, "\tnum_thrusters: $(sc.num_thrusters)\n")
|
||||||
|
write(io, "\tduty_cycle: $(sc.duty_cycle)\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
const test_sc = Sc("test", 8000., 0.00025/(2000*0.00981), 0.00025, 50, 0.9)
|
||||||
|
const bepi = Sc("bepi", 2000., 2*0.00025/(2800*0.00981), 0.00025, 2, 0.9)
|
||||||
|
const no_thrust = Sc("no thrust", 0., 0.01, 0., 0, 0.)
|
||||||
|
|
||||||
|
|||||||
@@ -28,20 +28,24 @@
|
|||||||
launch_window = DateTime(1992,11,1), DateTime(1992,12,1)
|
launch_window = DateTime(1992,11,1), DateTime(1992,12,1)
|
||||||
latest_arrival = DateTime(1993,6,1)
|
latest_arrival = DateTime(1993,6,1)
|
||||||
planets = [ Earth, Venus ]
|
planets = [ Earth, Venus ]
|
||||||
best, archive = mbh(planets, launch_window, latest_arrival, 2, 3)
|
best, archive = mbh(planets, launch_window, latest_arrival, 10, 5)
|
||||||
@test typeof(best) == Mission
|
@test typeof(best) == Mission
|
||||||
p = plot(best, title="MBH Test Solution")
|
p = plot(best, title="MBH Test Solution")
|
||||||
savefig(p,"../plots/mbh_test_1_phase.html")
|
savefig(p,"../plots/mbh_test_1_phase.html")
|
||||||
|
store(best, "missions/mbh_1_phase_best")
|
||||||
|
store(archive, "missions/mbh_1_phase_archive")
|
||||||
|
|
||||||
# Now for a more complicated two-phase mission, with a bigger date range
|
# Now for a more complicated two-phase mission, with a bigger date range
|
||||||
# This is known to have a solution though
|
# This is known to have a solution though
|
||||||
planets = [Earth, Venus, Mars]
|
planets = [Earth, Venus, Mars]
|
||||||
launch_window = DateTime(2021,6,1), DateTime(2022,6,1)
|
launch_window = DateTime(2021,6,1), DateTime(2022,6,1)
|
||||||
latest_arrival = DateTime(2024,1,1)
|
latest_arrival = DateTime(2024,1,1)
|
||||||
best, archive = mbh(planets, launch_window, latest_arrival, 10, 3)
|
best, archive = mbh(planets, launch_window, latest_arrival, 20, 5)
|
||||||
@test typeof(best) == Mission
|
@test typeof(best) == Mission
|
||||||
p = plot(best, title="MBH Test Solution")
|
p = plot(best, title="MBH Test Solution")
|
||||||
savefig(p,"../plots/mbh_test_2_phase.html")
|
savefig(p,"../plots/mbh_test_2_phase.html")
|
||||||
|
store(best, "missions/mbh_2_phase_best")
|
||||||
|
store(archive, "missions/mbh_2_phase_archive")
|
||||||
|
|
||||||
# Now for a real stress test - the old ten-year, 5-phase Jovian mission
|
# Now for a real stress test - the old ten-year, 5-phase Jovian mission
|
||||||
# This is known to have a solution... tough to find though
|
# This is known to have a solution... tough to find though
|
||||||
@@ -49,9 +53,11 @@
|
|||||||
planets = [Earth, Venus, Earth, Mars, Earth, Jupiter]
|
planets = [Earth, Venus, Earth, Mars, Earth, Jupiter]
|
||||||
launch_window = DateTime(2023,4,1), DateTime(2023,7,1)
|
launch_window = DateTime(2023,4,1), DateTime(2023,7,1)
|
||||||
latest_arrival = DateTime(2033,1,1)
|
latest_arrival = DateTime(2033,1,1)
|
||||||
best, archive = mbh(planets, launch_window, latest_arrival, 100, 3)
|
best, archive = mbh(planets, launch_window, latest_arrival, 200, 10)
|
||||||
@test typeof(best) == Mission
|
@test typeof(best) == Mission
|
||||||
p = plot(best, title="MBH Test Solution")
|
p = plot(best, title="MBH Test Solution")
|
||||||
savefig(p,"../plots/mbh_test_5_phase.html")
|
savefig(p,"../plots/mbh_test_5_phase.html")
|
||||||
|
store(best, "missions/mbh_5_phase_best")
|
||||||
|
store(archive, "missions/mbh_5_phase_archive")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
# Now we can plot the results to check visually
|
# Now we can plot the results to check visually
|
||||||
p = plot(m, title="NLP Test Solution")
|
p = plot(m, title="NLP Test Solution")
|
||||||
savefig(p,"../plots/nlp_test_1_phase.html")
|
savefig(p,"../plots/nlp_test_1_phase.html")
|
||||||
|
store(m, "missions/nlp_1_phase")
|
||||||
|
|
||||||
# Now we can look at a slightly more complicated trajectory
|
# Now we can look at a slightly more complicated trajectory
|
||||||
flybys = [Earth, Venus, Mars]
|
flybys = [Earth, Venus, Mars]
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
@test typeof(m) == Mission
|
@test typeof(m) == Mission
|
||||||
p = plot(m, title="NLP Test Solution (2 Phases)")
|
p = plot(m, title="NLP Test Solution (2 Phases)")
|
||||||
savefig(p,"../plots/nlp_test_2_phase.html")
|
savefig(p,"../plots/nlp_test_2_phase.html")
|
||||||
|
store(m, "missions/nlp_2_phase")
|
||||||
|
|
||||||
# Here is the final, most complicated, trajectory to test
|
# Here is the final, most complicated, trajectory to test
|
||||||
flybys = [Earth, Venus, Earth, Mars, Earth, Jupiter]
|
flybys = [Earth, Venus, Earth, Mars, Earth, Jupiter]
|
||||||
@@ -67,5 +69,6 @@
|
|||||||
@test typeof(m) == Mission
|
@test typeof(m) == Mission
|
||||||
p = plot(m, title="NLP Test Solution (5 Phases)")
|
p = plot(m, title="NLP Test Solution (5 Phases)")
|
||||||
savefig(p,"../plots/nlp_test_5_phase.html")
|
savefig(p,"../plots/nlp_test_5_phase.html")
|
||||||
|
store(m, "missions/nlp_5_phase")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ catch
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "All Tests" begin
|
@testset "All Tests" begin
|
||||||
# include("plotting.jl")
|
include("plotting.jl")
|
||||||
# include("inner_loop/laguerre-conway.jl")
|
include("inner_loop/laguerre-conway.jl")
|
||||||
# include("inner_loop/propagator.jl")
|
include("inner_loop/propagator.jl")
|
||||||
# include("inner_loop/nlp_solver.jl")
|
include("inner_loop/nlp_solver.jl")
|
||||||
include("inner_loop/monotonic_basin_hopping.jl")
|
include("inner_loop/monotonic_basin_hopping.jl")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user