Skip to content

Commit

Permalink
Flatten package imports. Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
duncaneddy committed Aug 28, 2019
1 parent 956385e commit 1c9e024
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SatelliteDynamics"
uuid = "0e7c1a32-1b9f-5532-88a4-e668712d6a4c"
authors = ["Duncan Eddy <[email protected]>"]
version = "0.2.2"
version = "0.3.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ using SatelliteDynamics

The documentation for the package can be found here: <https://sisl.github.io/SatelliteDynamics.jl/latest>

More example code and more thorough documentation will be added as time permits.
More example code and more thorough documentation will be added as time permits.

## Development Roadmap

These are currently features lacking from SatelliteDynamics, but being considered
for future development. Please feel free to leave feedback or comments here:

[Future Feature List](https://github.com/sisl/SatelliteDynamics.jl/issues/4)
23 changes: 11 additions & 12 deletions src/SatelliteDynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ __precompile__(true)
module SatelliteDynamics

# Usings
using Reexport
using Dates
using Printf
using LinearAlgebra
using SOFA

using StaticArrays: SVector, SMatrix

# Define constants for array indexing
const idx1t3 = SVector(1, 2, 3)
const idx4t6 = SVector(4, 5, 6)
const idx1t6 = SVector(1, 2, 3, 4, 5, 6)

# Includes
include("constants.jl")
Expand All @@ -15,17 +25,6 @@ include("astrodynamics.jl")
include("orbit_dynamics.jl")
include("sgp_models.jl")

# Export Values
@reexport using SatelliteDynamics.Constants
@reexport using SatelliteDynamics.Universe
@reexport using SatelliteDynamics.Time
@reexport using SatelliteDynamics.ReferenceSystems
@reexport using SatelliteDynamics.Attitude
@reexport using SatelliteDynamics.Coordinates
@reexport using SatelliteDynamics.Astrodynamics
@reexport using SatelliteDynamics.OrbitDynamics
@reexport using SatelliteDynamics.SGPModels

# Export EarthEnvironment submodule
include(joinpath(".", "earth_environment", "earth_environment.jl"))
include(joinpath(".", "simulation", "simulation.jl"))
Expand Down
20 changes: 5 additions & 15 deletions src/astrodynamics.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
__precompile__(true)
module Astrodynamics


using LinearAlgebra
using SatelliteDynamics.Constants: GM_EARTH, R_EARTH, J2_EARTH


export mean_motion
"""
Compute the mean motion given a semi-major axis.
Arguments:
- `a::Real`: Semi-major axis. [m]
- `use_degrees:Bool`: If `true` returns result in units of degrees
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.Constants.GM_EARTH` if none is provided.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.GM_EARTH` if none is provided.
Returns:
- `n::Real`: Orbital mean motion. [rad/s] or [deg/s]
Expand All @@ -35,7 +27,7 @@ Calculate semi-major axis given mean-motion.
Arguments:
- `n::Real`: Orbital mean motion. [rad/s] or [deg/s]
- `use_degrees:Bool`: If `true` interpret input as being in degrees.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.Constants.GM_EARTH` if none is provided.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.GM_EARTH` if none is provided.
Returns:
- `a::Real`: Semi-major axis. [m]
Expand All @@ -56,7 +48,7 @@ Compute the satellite orbital period given the semi-major axis.
Arguments:
- `a::Real`: Semi-major axis. [m]
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.Constants.GM_EARTH` if none is provided.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.GM_EARTH` if none is provided.
Returns:
- `T::Real`: Orbital period. [s]
Expand Down Expand Up @@ -193,7 +185,7 @@ The osculating elements are assumed to be (in order):
Arguments:
- x_oe `x::Array{<:Real, 1}`: Osculating orbital elements. See above for desription of the elements and their required order.
- `use_degrees:Bool`: If `true` interpret input will be interpreted as being in degrees, and output will be returned in degrees.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.Constants.GM_EARTH` if none is provided.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.GM_EARTH` if none is provided.
# Returns
- x `x::Array{<:Real, 1}`: Cartesean inertial state. Returns position and velocity. [m; m/s]
Expand Down Expand Up @@ -248,7 +240,7 @@ The osculating elements are assumed to be (in order):
Arguments:
- x `x::Array{<:Real, 1}`: Cartesean inertial state. Returns position and velocity. [m; m/s]
- `use_degrees:Bool`: If `true` interpret input will be interpreted as being in degrees, and output will be returned in degrees.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.Constants.GM_EARTH` if none is provided.
- `GM::Real`: Gravitational constant of central body. Defaults to `SatelliteDynamics.GM_EARTH` if none is provided.
# Returns
- x_oe `x::Array{<:Real, 1}`: Osculating orbital elements. See above for desription of the elements and their required order.
Expand Down Expand Up @@ -299,6 +291,4 @@ function sCARTtoOSC(x::Array{<:Real, 1}; use_degrees::Bool=false, GM::Real=GM_EA
end

return x_oe
end

end
9 changes: 1 addition & 8 deletions src/attitude.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
__precompile__(true)
module Attitude

using LinearAlgebra

#############
# Rotations #
#############
Expand Down Expand Up @@ -835,6 +830,4 @@ end

####################
# Type Conversions #
####################

end # End module Coordinates
####################
7 changes: 1 addition & 6 deletions src/constants.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
__precompile__(true)
module Constants

# Mathematical Constants
export RAD2DEG
"""
Expand Down Expand Up @@ -307,6 +304,4 @@ Gravitational constant of the Pluto. [m^3/s^2]
O. Montenbruck, and E. Gill, _Satellite Orbits: Models, Methods and
Applications_, 2012.
"""
const GM_PLUTO = 977.000000*1e9

end
const GM_PLUTO = 977.000000*1e9
9 changes: 0 additions & 9 deletions src/coordinates.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
__precompile__(true)
module Coordinates

using LinearAlgebra

using SatelliteDynamics.Constants: WGS84_a, WGS84_f

####################
# Helper Constants #
####################
Expand Down Expand Up @@ -663,6 +656,4 @@ function sSEZtoAZEL(x::Array{<:Real, 1} ; use_degrees::Bool=false)
else
return azel
end
end

end
12 changes: 1 addition & 11 deletions src/earth_environment/earth_environment.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
__precompile__(true)
module EarthEnvironment

using Reexport

# EarthEnvironment submodules
include("space_weather.jl")
include("nrlmsise00.jl")

@reexport using SatelliteDynamics.EarthEnvironment.SpaceWeather
@reexport using SatelliteDynamics.EarthEnvironment.NRLMSISE00

end # EarthEnvironment Module
include("nrlmsise00.jl")
21 changes: 5 additions & 16 deletions src/earth_environment/nrlmsise00.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
__precompile__(true)
module NRLMSISE00
"""
Julia NRLMSISE00 implementation is Dominik Brodowski's C implmenation adapted
for Julia.
Ref: https://www.brodo.de/space/nrlmsise/
"""

using Printf
using SatelliteDynamics.Time: Epoch, mjd, day_of_year
using SatelliteDynamics.Coordinates: sECEFtoGEOD
using SatelliteDynamics.EarthEnvironment.SpaceWeather
# Julia NRLMSISE00 implementation is Dominik Brodowski's C implmenation adapted
# for Julia.
#
# Ref: https://www.brodo.de/space/nrlmsise/

##############
# Model Data #
Expand Down Expand Up @@ -1680,6 +1671,4 @@ function density_nrlmsise00(epc::Epoch, x::Array{<:Real, 1}; use_degrees::Bool=f
# Return local density
rho = output.d[6]
return rho
end

end # NRLMSISE00 Module
end
10 changes: 1 addition & 9 deletions src/earth_environment/space_weather.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
__precompile__(true)
module SpaceWeather

# Julia Imports
using SatelliteDynamics.Time: caldate_to_mjd, Epoch, mjd

##########################
# Geomagnetic Index Data #
##########################
Expand Down Expand Up @@ -379,6 +373,4 @@ function f107AdjustedAvg(solarflux::SolarFluxData, mjd::Real)
end

f107AdjustedAvg(mjd::Real) = f107AdjustedAvg(SOLAR_FLUX_DATA, mjd)
f107AdjustedAvg(epc::Epoch) = f107AdjustedAvg(SOLAR_FLUX_DATA, mjd(epc, tsys="UT1"))

end # SpaceWeather
f107AdjustedAvg(epc::Epoch) = f107AdjustedAvg(SOLAR_FLUX_DATA, mjd(epc, tsys="UT1"))
21 changes: 4 additions & 17 deletions src/orbit_dynamics.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
__precompile__(true)
module OrbitDynamics

using SatelliteDynamics.Constants
using SatelliteDynamics.Universe
using SatelliteDynamics.Time: Epoch, mjd
using SatelliteDynamics.Coordinates: sECEFtoGEOD
using SatelliteDynamics.Attitude: Rx, Ry, Rz
using SatelliteDynamics.ReferenceSystems
using LinearAlgebra

#####################
# Utility Functions #
#####################
Expand Down Expand Up @@ -65,8 +54,8 @@ Assumes the satellite is much, much less massive than the central body.
Arguments:
- `r_sat::Array{<:Real, 1}`: satellite position in a commonn inertial frame [m]
- `r_body::Array{<:Real, 1}`: position of body in a commonn inertial frame [m]
- `GM::Array{<:Real, 1}`: gravitational coeffient of attracting body [m^3/s^2] Default: SatelliteDynamics.Constants.GM_EARTH)
(Default: SatelliteDynamics.Constants.GM_EARTH
- `GM::Array{<:Real, 1}`: gravitational coeffient of attracting body [m^3/s^2] Default: SatelliteDynamics.GM_EARTH)
(Default: SatelliteDynamics.GM_EARTH
Return:
- `a::Array{<:Real, 1}`: Acceleration in X, Y, and Z inertial directions [m/s^2]
Expand All @@ -91,8 +80,8 @@ of a massive body. Returns the acceleration vector of the satellite.
Arguments:
- `r_sat::Array{<:Real, 1}`: satellite position in the inertial frame [m]
- `GM::Array{<:Real, 1}`: gravitational coeffient of attracting body [m^3/s^2] Default: SatelliteDynamics.Constants.GM_EARTH)
(Default: SatelliteDynamics.Constants.GM_EARTH
- `GM::Array{<:Real, 1}`: gravitational coeffient of attracting body [m^3/s^2] Default: SatelliteDynamics.GM_EARTH)
(Default: SatelliteDynamics.GM_EARTH
Return:
- `a::Array{<:Real, 1}`: Acceleration in X, Y, and Z inertial directions [m/s^2]
Expand Down Expand Up @@ -738,6 +727,4 @@ function accel_relativity(x::Array{<:Real, 1})
a_rel = GM_EARTH/r2 * ( (4*GM_EARTH/(c2*norm_r) - v2/c2)*er + 4*v2/c2*dot(er, ev)*ev)

return a_rel
end

end
21 changes: 1 addition & 20 deletions src/reference_systems.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
__precompile__(true)
module ReferenceSystems

using LinearAlgebra

using StaticArrays: SVector, SMatrix

using SOFA
using SatelliteDynamics.Constants
using SatelliteDynamics.Universe: UT1_UTC, POLE_LOCATOR
using SatelliteDynamics.Time: Epoch, mjd

const idx1t3 = SVector(1, 2, 3)
const idx4t6 = SVector(4, 5, 6)
const idx1t6 = SVector(1, 2, 3, 4, 5, 6)


##############
# RTN | LVLH #
##############
Expand Down Expand Up @@ -452,6 +435,4 @@ function sECEFtoECI(epc::Epoch, x::AbstractVector{<:Real})
end

return x_eci
end

end
end
19 changes: 2 additions & 17 deletions src/sgp_models.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
__precompile__(true)
module SGPModels

# Imports
using Printf
using LinearAlgebra

using SatelliteDynamics.Constants: RAD2DEG, DEG2RAD, SECONDS_IN_DAY, OMEGA_EARTH
using SatelliteDynamics.Time: Epoch
using SatelliteDynamics.Attitude: Rz
using SatelliteDynamics.ReferenceSystems: sECEFtoECI

########################
# Two Line Element Set #
########################
Expand Down Expand Up @@ -181,7 +169,7 @@ end
##################



export tle_checksum
"""
Compute Two-Line Element checksum for a given line string.
Expand Down Expand Up @@ -2463,7 +2451,4 @@ function eci(tle::TLE, epc::Epoch)
s = ecef(tle, epc)

return sECEFtoECI(epc, s)
end


end # Module
end
11 changes: 1 addition & 10 deletions src/simulation/integrators.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
__precompile__(true)
module Integrators

# Imports
using SatelliteDynamics.Time: Epoch

# Exports

export RK4, istep

#######
Expand Down Expand Up @@ -125,6 +118,4 @@ function istep(rk4::RK4, epc::Union{Real,Epoch}, dt::Real, x::Array{<:Real, 1},
phiu = phi + (dt/6.0)*(phik1 + 2.0*phik2 + 2.0*phik3 + phik4)

return xu, phiu
end

end # Module
end
Loading

0 comments on commit 1c9e024

Please sign in to comment.