Still a lot of changes to make
This commit is contained in:
@@ -7,8 +7,11 @@ This is it. The outer function call for the inner loop. After this is done,
|
||||
there's only the outer loop left to do. And that's pretty easy.
|
||||
"""
|
||||
function inner_loop(launch_date::DateTime,
|
||||
craft::Sc,
|
||||
phases::Vector{Phase};
|
||||
min_flyby::Float64=1000.)
|
||||
min_flyby::Float64=1000.,
|
||||
mbh_specs=nothing,
|
||||
verbose=false)
|
||||
|
||||
# First we need to do some quick checks that the mission is well formed
|
||||
for i in 1:length(phases)
|
||||
@@ -43,14 +46,24 @@ function inner_loop(launch_date::DateTime,
|
||||
end
|
||||
|
||||
time = utc2et(Dates.format(launch_date,"yyyy-mm-ddTHH:MM:SS"))
|
||||
thrust_profiles = []
|
||||
for phase in phases
|
||||
planet1_state = spkssb(ids[phase.from_planet], time, "J2000")
|
||||
println(planet1_state)
|
||||
time += phase.time_of_flight
|
||||
planet2_state = spkssb(ids[phase.to_planet], time, "J2000")
|
||||
println(planet2_state)
|
||||
# TODO: Come up with improved method of calculating "n"
|
||||
start = planet1_state + [0., 0., 0., phase.v∞_outgoing...]
|
||||
final = planet2_state + [0., 0., 0., phase.v∞_incoming...]
|
||||
if mbh_specs == nothing
|
||||
best = mbh(start, final, craft, μs["Sun"], 0.0, phase.time_of_flight, 10,
|
||||
verbose=verbose)[1]
|
||||
else
|
||||
best = mbh(start, final, craft, μs["Sun"], 0.0, phase.time_of_flight, 10,
|
||||
verbose=verbose, num_iters=mbh_specs[1], patience_level=mbh_specs[2])[1]
|
||||
end
|
||||
push!(thrust_profiles, best)
|
||||
craft.mass = prop(tanh.(best.zero), planet1_state, sc, μs["Sun"], prop_time)[2][end]
|
||||
end
|
||||
|
||||
|
||||
return phases[1].v∞_incoming[1]
|
||||
end
|
||||
return craft.mass, thrust_profiles
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user