Fully working mbh for two phase missions!

This commit is contained in:
Connor
2021-10-11 21:53:23 -06:00
parent 504d83b390
commit a2c1aedc08
11 changed files with 106 additions and 167 deletions

View File

@@ -21,9 +21,6 @@ function prop_one(ΔV_unit::Vector{<:Real},
time::Float64,
primary::Body=Sun)
for direction in ΔV_unit
abs(direction) <= 1.0 || throw(PropOne_Error(ΔV_unit))
end
ΔV = max_ΔV(craft.duty_cycle, craft.num_thrusters, craft.max_thrust, time, 0., state[7]) * ΔV_unit
halfway = laguerre_conway(state, time/2, primary) + [zeros(3); ΔV]
final = laguerre_conway(halfway, time/2, primary)
@@ -81,3 +78,24 @@ end
Convenience function for propagating a state with no thrust
"""
prop(x::Vector{Float64}, t::Float64, p::Body=Sun) = prop(zeros(1000,3), [x;1.], no_thrust, t, p)[1]
"""
This is solely for the purposes of getting the final state of a mission or guess
"""
function prop(m::Mission)
time = m.launch_date
current_planet = Earth
start = state(current_planet, time, m.launch_v∞, m.start_mass)
final = zeros(7)
for phase in m.phases
final = prop(phase.thrust_profile, start, m.sc, phase.tof)[2]
mass = final[7]
current_planet = phase.planet
time += Dates.Second(floor(phase.tof))
start = state(current_planet, time, phase.v∞_out, mass)
end
return final
end