37 lines
1.3 KiB
Julia
37 lines
1.3 KiB
Julia
"""
|
|
This function propagates the spacecraft forward in time 1 Sim-Flanagan step (of variable length of time),
|
|
applying a thrust in the center.
|
|
"""
|
|
function prop_one(ΔV_unit::Vector{Float64},
|
|
state::Vector{Float64},
|
|
duty_cycle::Float64,
|
|
num_thrusters::Int,
|
|
max_thrust::Float64,
|
|
mass::Float64,
|
|
mass_flow_rate::Float64,
|
|
μ::Float64,
|
|
time::Float64)
|
|
|
|
if norm(ΔV_unit) > 1.
|
|
throw(ErrorException("ΔV input is too high"))
|
|
end
|
|
halfway = laguerre_conway(state, μ, time/2)
|
|
halfway[4:6] += ΔV_unit * max_ΔV(duty_cycle, num_thrusters, max_thrust, time, 0., mass)
|
|
return laguerre_conway(halfway, μ, time/2), mass - mass_flow_rate*norm(ΔV_unit)*time
|
|
|
|
end
|
|
|
|
"""
|
|
A convenience function for using spacecraft. Note that this function outputs a sc instead of a mass
|
|
"""
|
|
function prop_one(ΔV_unit::Vector{Float64},
|
|
state::Vector{Float64},
|
|
craft::sc,
|
|
μ::Float64,
|
|
time::Float64)
|
|
state, mass = prop_one(ΔV_unit, state, craft.duty_cycle, craft.num_thrusters, craft.max_thrust,
|
|
craft.mass, craft.mass_flow_rate, μ, time)
|
|
return state, sc(mass, craft.mass_flow_rate, craft.max_thrust, craft.num_thrusters, craft.duty_cycle)
|
|
end
|
|
|