Latest attempt at jump. Does not work yet.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe
|
||||
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe, conv_T
|
||||
|
||||
function oe_to_rθh(oe::Vector,μ::Real) :: Vector
|
||||
|
||||
@@ -68,3 +68,45 @@ function xyz_to_oe(cart_vec::Vector,μ::Real)
|
||||
return [a,e,i,Ω,ω,ν]
|
||||
|
||||
end
|
||||
|
||||
function conv_T(Tr::Vector{Float64},
|
||||
TΘ::Vector{Float64},
|
||||
Th::Vector{Float64},
|
||||
init_state::Vector{Float64},
|
||||
m::Float64,
|
||||
craft::Sc,
|
||||
time::Float64,
|
||||
μ::Float64)
|
||||
|
||||
Txs = Float64[]
|
||||
Tys = Float64[]
|
||||
Tzs = Float64[]
|
||||
state = init_state
|
||||
for i in 1:length(Tr)
|
||||
mag, α, β = Tr[i], TΘ[i], Th[i]
|
||||
|
||||
if mag > 1 || mag < 0
|
||||
throw(ErrorException("ΔV input is too high: $mag"))
|
||||
elseif α > π || α < -π
|
||||
throw(ErrorException("α angle is incorrect: $α"))
|
||||
elseif β > π/2 || β < -π/2
|
||||
throw(ErrorException("β angle is incorrect: $β"))
|
||||
end
|
||||
|
||||
thrust_rθh = mag * [cos(β)*sin(α), cos(β)*cos(α), sin(β)]
|
||||
_,_,i,Ω,ω,ν = xyz_to_oe(state, μ)
|
||||
θ = ω+ν
|
||||
cΩ,sΩ,ci,si,cθ,sθ = cos(Ω),sin(Ω),cos(i),sin(i),cos(θ),sin(θ)
|
||||
DCM = [cΩ*cθ-sΩ*ci*sθ -cΩ*sθ-sΩ*ci*cθ sΩ*si;
|
||||
sΩ*cθ+cΩ*ci*sθ -sΩ*sθ+cΩ*ci*cθ -cΩ*si;
|
||||
si*sθ si*cθ ci]
|
||||
ΔV = DCM*thrust_rθh
|
||||
Tx, Ty, Tz = max_ΔV(craft.duty_cycle, craft.num_thrusters, craft.max_thrust, time, 0., m) * ΔV
|
||||
x, y, z, dx, dy, dz = state
|
||||
state = prop_one_simple(Tx, Ty, Tz, x, y, z, dx, dy, dz, time/length(Tr), μ)
|
||||
push!(Txs, Tx)
|
||||
push!(Tys, Ty)
|
||||
push!(Tzs, Tz)
|
||||
end
|
||||
return Txs, Tys, Tzs
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user