Documentation
All docstrings!
AstrodynamicalModels.AstrodynamicalModels
— ModuleProvides astrodynamical models as AstrodynamicalModels.ODESystems
. Check out the ModelingToolkit
docs to learn how to use these systems for orbit propagation with DifferentialEquations
, or see GeneralAstrodynamics
for some convenient orbit propagation wrappers.
Extended help
License
MIT License
Copyright (c) 2023 Joseph D Carpinelli
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Exports
AttitudeFunction
AttitudeParameters
AttitudeState
AttitudeSystem
CR3BFunction
CR3BOrbit
CR3BParameters
CR3BState
CR3BSystem
CartesianOrbit
CartesianState
KeplerianOrbit
KeplerianParameters
KeplerianState
NBFunction
NBSystem
Orbit
OrbitalElements
PlanarEntryFunction
PlanarEntryParameters
PlanarEntryState
PlanarEntrySystem
R2BFunction
R2BOrbit
R2BParameters
R2BState
R2BSystem
dynamics
parameters
state
system
Imports
Base
Core
DocStringExtensions
LinearAlgebra
Memoize
ModelingToolkit
SciMLBase
StaticArrays
Symbolics
AstrodynamicalModels.AstrodynamicalOrbit
— Typeabstract type AstrodynamicalOrbit{U, P}
An abstract supertype for all orbits.
Extended Help
To support the AstrodynamicalOrbit
interface, you must implement the following methods.
AstrodynamicalModels.states(orbit)
AstrodynamicalModels.parameters(orbit)
AstrodynamicalModels.AstrodynamicalParameters
— Typeabstract type AstrodynamicalParameters{F, N} <: StaticArraysCore.FieldVector{N, F}
An abstract supertype for all astrodynamical parameter vectors.
AstrodynamicalModels.AstrodynamicalState
— Typeabstract type AstrodynamicalState{F, N} <: StaticArraysCore.FieldVector{N, F}
An abstract supertype for all astrodynamical state vectors.
AstrodynamicalModels.AttitudeParameters
— Typestruct AttitudeParameters{F} <: AstrodynamicalModels.AstrodynamicalParameters{F, 15}
A parameter vector for attitude dynamics.
AstrodynamicalModels.AttitudeState
— Typemutable struct AttitudeState{F} <: AstrodynamicalModels.AstrodynamicalState{F, 7}
A mutable state vector for attitude dynamics.
AstrodynamicalModels.CR3BOrbit
— Typestruct Orbit{var"#s22667"<:CartesianState, var"#s22666"<:CR3BParameters} <: AstrodynamicalModels.AstrodynamicalOrbit{var"#s22667"<:CartesianState, var"#s22666"<:CR3BParameters}
An Orbit
which exists within CR3BP dynamics.
AstrodynamicalModels.CR3BParameters
— Typestruct CR3BParameters{F} <: AstrodynamicalModels.AstrodynamicalParameters{F, 1}
A paremeter vector for CR3BP dynamics.
AstrodynamicalModels.CR3BState
— Typemutable struct CartesianState{F} <: AstrodynamicalModels.AstrodynamicalState{F, 6}
CartesianState
AstrodynamicalModels.CartesianOrbit
— Typestruct Orbit{var"#s22667"<:CartesianState, P<:(AbstractVector)} <: AstrodynamicalModels.AstrodynamicalOrbit{var"#s22667"<:CartesianState, P<:(AbstractVector)}
An Orbit
which exists within R2BP dynamics.
AstrodynamicalModels.CartesianSTM
— Typemutable struct CartesianSTM{F} <: StaticArraysCore.FieldMatrix{6, 6, F}
A mutable matrix, with labels, for a 6DOF Cartesian state transition matrix.
AstrodynamicalModels.CartesianState
— Typemutable struct CartesianState{F} <: AstrodynamicalModels.AstrodynamicalState{F, 6}
A mutable vector, with labels, for 6DOF Cartesian states.
AstrodynamicalModels.KeplerianOrbit
— Typestruct Orbit{var"#s22667"<:OrbitalElements, var"#s22666"<:KeplerianParameters} <: AstrodynamicalModels.AstrodynamicalOrbit{var"#s22667"<:OrbitalElements, var"#s22666"<:KeplerianParameters}
An Orbit
which exists within Keplerian dynamics.
AstrodynamicalModels.KeplerianParameters
— Typestruct KeplerianParameters{F} <: AstrodynamicalModels.AstrodynamicalParameters{F, 1}
A parameter vector for Keplerian dynamics.
AstrodynamicalModels.KeplerianState
— Typemutable struct OrbitalElements{F} <: AstrodynamicalModels.AstrodynamicalState{F, 6}
OrbitalElements
AstrodynamicalModels.Orbit
— Typestruct Orbit{U<:(AbstractVector), P<:(AbstractVector)} <: AstrodynamicalModels.AstrodynamicalOrbit{U<:(AbstractVector), P<:(AbstractVector)}
A full representation of an orbit, including a numerical state, and the parameters of the system.
AstrodynamicalModels.OrbitalElements
— Typemutable struct OrbitalElements{F} <: AstrodynamicalModels.AstrodynamicalState{F, 6}
A mutable vector, with labels, for 6DOF Keplerian states.
AstrodynamicalModels.PlanarEntryParameters
— Typestruct PlanarEntryParameters{F} <: AstrodynamicalModels.AstrodynamicalParameters{F, 7}
A parameter vector for planar entry dynamics.
AstrodynamicalModels.PlanarEntryState
— Typemutable struct PlanarEntryState{F} <: AstrodynamicalModels.AstrodynamicalState{F, 4}
A state vector for planar entry dynamics.
AstrodynamicalModels.R2BOrbit
— Typestruct Orbit{var"#s22667"<:CartesianState, var"#s22666"<:R2BParameters} <: AstrodynamicalModels.AstrodynamicalOrbit{var"#s22667"<:CartesianState, var"#s22666"<:R2BParameters}
An Orbit
which exists within R2BP dynamics.
AstrodynamicalModels.R2BParameters
— Typestruct R2BParameters{F} <: AstrodynamicalModels.AstrodynamicalParameters{F, 1}
A parameter vector for R2BP dynamics.
AstrodynamicalModels.R2BState
— Typemutable struct CartesianState{F} <: AstrodynamicalModels.AstrodynamicalState{F, 6}
CartesianState
AstrodynamicalModels.AttitudeFunction
— MethodAttitudeFunction(; stm, name, kwargs...)
Returns an ODEFunction
for spacecraft attitude dynamics.
Extended Help
Usage
The stm
and name
keyword arguments are passed to Attitude
. All other keyword arguments are passed directly to SciMLBase.ODEFunction
.
f = AttitudeFunction()
let u = randn(7), p = randn(15), t = NaN # time invariant
f(u, p, t)
end
AstrodynamicalModels.AttitudeSystem
— MethodAttitudeSystem(; stm, name, defaults, kwargs...)
A ModelingToolkit.ODESystem
for atmospheric entry. Currently, only exponential atmosphere models are provided! The output model is cached with Memoize.jl
. Planet-specific parameters default to Earth values.
The order of the states follows: [q₁, q₂, q₃, q₄, ω₁, ω₂, ω₃]
.
The order of the parameters follows: []
Extended Help
This model describes how an object moves through an exponential atmosphere, above a spherical planet.
States
q
: scalar-last attitude quaternionω
: body rates (radians per second)
Parameters
J
: inertial matrixL
: lever arm where input torque is appliedf
: torques on the vehicle body (Newton-meters)
Usage
model = Attitude()
AstrodynamicalModels.CR3BFunction
— MethodCR3BFunction(; stm, name, kwargs...)
Returns an ODEFunction
for CR3B dynamics.
The order of the states follows: [μ]
.
The order of the parameters follows: [μ]
.
Extended Help
Usage
The stm
, and name
keyword arguments are passed to CR3B
. All other keyword arguments are passed directly to SciMLBase.ODEFunction
.
f = CR3BFunction(; stm=false, jac=true)
let u = randn(6), p = randn(1), t = 0
f(u, p, t)
end
AstrodynamicalModels.CR3BProblem
— MethodCR3BProblem(u0, tspan, p; kwargs...)
Return an ODEProblem
for the provided CR3B system.
AstrodynamicalModels.CR3BSystem
— MethodCR3BSystem(; stm, name, defaults, kwargs...)
A ModelingToolkit.ODESystem
for the Circular Restricted Three-body Problem.
The order of the states follows: [x, y, z, ẋ, ẏ, ż]
.
The order of the parameters follows: [μ]
.
Extended Help
The Circular Restricted Three-body Problem is a simplified dynamical model describing one small body (spacecraft, etc.) and two celestial bodies moving in a circle about their common center of mass. This may seem like an arbitrary simplification, but this assumption holds reasonably well for the Earth-Moon, Sun-Earth, and many other systems in our solar system.
Usage
model = CR3BSystem(; stm=true)
AstrodynamicalModels.NBFunction
— MethodNBFunction(N; stm, name, kwargs...)
Returns an ODEFunction
for NBP dynamics. The order of states and parameters in the ODEFunction
arguments are equivalent to the order of states and parameters for the system produced with NBP(N)
. As a general rule, the order of the states follows: [x₁, y₁, z₁, ..., xₙ, yₙ, zₙ, ẋ₁, ẏ₁, ż₁, ..., ẋₙ, ẏₙ, żₙ]
.
Unlike R2BP
and CR3BP
, jac
is set to false
by default. The number of states for NBP
systems can be very large for relatively small numbers of bodies (N
). Enabling jac=true
by default would cause unnecessarily long waiting times for this @memoize function to return for N ≥ 3
or so. If N=2
and stm=true
, setting jac=true
could still result in several minutes of calculations, depending on the computer you're using.
Be careful about specifying stm=true
for systems with N ≥ 3
! If state transition matrix dynamics are enabled, you can calculate the total number of system states with N*6 + (N*6)^2
. Note that this increases exponentially as N
grows! For N == 6
, unless you're using parallelization, your computer may run for several hours.
Extended Help
Usage
The stm
, and name
keyword arguments are passed to NBP
. All other keyword arguments are passed directly to SciMLBase.ODEFunction
.
f = NBFunction(3; stm=false, name=:NBP, jac=false, sparse=false)
let u = randn(3*6), p = randn(1 + 3), t = 0
f(u, p, t)
end
AstrodynamicalModels.NBSystem
— MethodNBSystem(N; stm, name, defaults, kwargs...)
A ModelingToolkit.ODESystem
for the Newtonian N-body Problem.
The order of the states follows: [x₁, y₁, z₁, ..., xₙ, yₙ, zₙ, ẋ₁, ẏ₁, ż₁, ..., ẋₙ, ẏₙ, żₙ]
.
The order of the parameters follows: [G, m₁, m₂, ..., mₙ]
.
Be careful about specifying stm=true
for systems with N ≥ 3
! If state transition matrix dynamics are enabled, you can calculate the total number of system states with N*6 + (N*6)^2
. Note that this increases exponentially as N
grows! For N == 6
, unless you're using parallelization, your computer may run for several hours.
Extended Help
The N-body problem is a model which describes how N
bodies will move with respect to a common origin. This problem typically involves many bodies which act due to one force: electromagentism, gravity, etc. This model applies most closely to many celestial bodies moving due to gravity. That's about right for a model in a package called AstrodynamicalModels
!
Usage
# One model for ALL the planets in our solar system 😎
model = NBSystem(9)
AstrodynamicalModels.PlanarEntryFunction
— MethodPlanarEntryFunction(; name, kwargs...)
Returns an ODEFunction
for Planar Entry dynamics. Results are cached with Memoize.jl
.
The order of the states follows: [γ, v, r, θ]
.
The order of the parameters follows: [R, P, H, m, A, C, μ]
Extended Help
Usage
The name
keyword argument is ]passed to PlanarEntry
. All other keyword arguments are passed directly to SciMLBase.ODEFunction
.
f = PlanarEntryFunction()
let u = randn(4), p = randn(7), t = NaN # time invariant
f(u, p, t)
end
AstrodynamicalModels.PlanarEntrySystem
— MethodPlanarEntrySystem(; name, defaults, kwargs...)
A ModelingToolkit.ODESystem
for atmospheric entry. Currently, only exponential atmosphere models are provided! The output model is cached with Memoize.jl
. Planet-specific parameters default to Earth values.
The order of the states follows: [γ, v, r, θ]
.
The order of the parameters follows: [R, P, H, m, A, C, μ]
Extended Help
This model describes how an object moves through an exponential atmosphere, above a spherical planet.
Usage
model = PlanarEntrySystem()
AstrodynamicalModels.R2BFunction
— MethodR2BFunction(; stm, name, kwargs...)
Returns an ODEFunction
for R2B dynamics.
The order of the states follows: [x, y, z, ẋ, ẏ, ż]
.
The order of the parameters follows: [μ]
.
Extended Help
Usage
The stm
, and name
keyword arguments are passed to R2B
. All other keyword arguments are passed directly to SciMLBase.ODEFunction
.
f = R2BFunction(; stm=false, name=:R2B, jac=true)
let u = randn(6), p = randn(1), t = 0
f(u, p, t)
end
AstrodynamicalModels.R2BProblem
— MethodR2BProblem(u0, tspan, p; kwargs...)
Return an ODEProblem
for the provided R2B system.
AstrodynamicalModels.R2BSystem
— MethodR2BSystem(; stm, name, defaults, kwargs...)
A ModelingToolkit.ODESystem
for the Restricted Two-body Problem.
The order of the states follows: [x, y, z, ẋ, ẏ, ż]
.
The order of the parameters follows: [μ]
.
Extended Help
The Restricted Two-body Problem is a simplified dynamical model describing one small body (spacecraft, etc.) and one celestial body. The gravity of the celestial body exhibits a force on the small body. This model is commonly used as a simplification to descibe our solar systems' planets orbiting our sun, or a spacecraft orbiting Earth.
Usage
model = R2BSystem()
AstrodynamicalModels.dynamics
— Methoddynamics(orbit, args; kwargs...)
Return the underlying dynamics of the system in the form of a ModelingToolkit.ODEFunction
.
AstrodynamicalModels.parameters
— Methodparameters(orbit)
Return the parameter vector for an Orbit
.
AstrodynamicalModels.state
— Methodstate(orbit)
Return the state vector for an Orbit
.
AstrodynamicalModels.system
— Methodsystem(orbit, args; kwargs...)
Return the underlying dynamics of the system in the form of a ModelingToolkit.ODESystem
.