Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CompatHelper CI, initial documentation #23

Merged
merged 6 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: '00 00 * * *'
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
17 changes: 17 additions & 0 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ git-tree-sha1 = "f0464e499ab9973b43c20f8216d088b61fda80c6"
uuid = "adafc99b-e345-5852-983c-f28acb93d879"
version = "0.2.2"

[[Crayons]]
git-tree-sha1 = "3f71217b538d7aaee0b69ab47d9b7724ca8afa0d"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.0.4"

[[DataAPI]]
git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Expand Down Expand Up @@ -256,6 +261,12 @@ git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.3"

[[Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "fb1ff838470573adc15c71ba79f8d31328f035da"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.25.2"

[[EarCut_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "eabac56550a7d7e0be499125673fbff560eb8b20"
Expand Down Expand Up @@ -488,6 +499,12 @@ version = "7.1.0"
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[LiveServer]]
deps = ["Crayons", "FileWatching", "HTTP", "Pkg", "Sockets", "Test"]
git-tree-sha1 = "41b8ef80352c22135016c3431518969101f359f3"
uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589"
version = "0.5.7"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ version = "0.1.0"
[deps]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,12 @@ true_anomoly,
periapsis_radius
apoapsis_radius
periapsis_velocity
apoapsis_velocity,
radius
radius_vector
apoapsis_velocity
radius
velocity
velocity_vector
orbital_period
time_since_periapsis
mean_motion
mean_motion_vector
semi_parameter
conic_anomoly
specific_angular_momentum
Expand Down
47 changes: 47 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Documenter, Astrodynamics

makedocs(modules=[Astrodynamics],
format=Documenter.HTML(),
sitename="Astrodynamics.jl",
pages=[
"Home" => "index.md",
"Overview" => Any[
"About" => "Overview/about.md",
"Usage" => "Overview/usage.md"
],
"`TwoBody`" => Any[
"Data Structures and Types" => "TwoBody/types.md",
"Functions" => "TwoBody/functions.md"
],
"`NBody`" => Any[
"Data Structures and Types" => "NBody/types.md",
"Functions" => "NBody/functions.md"
],
"`Propagators`" => Any[
"Data Structures and Types" => "Propagators/types.md",
"Functions" => "Propagators/functions.md"
],
"`Plots`" => Any[
"Functions" => "Plots/functions.md"
],
"Common `AbstractTypes`" => Any[
"Types" => "AbstractTypes/types.md"
]
]
)

deploydocs(
root = "docs/",
target = "build",
repo = "github.com/cadojo/Astrodynamics.jl",
branch = "gh-pages",
deps = nothing | <Function>,
make = nothing | <Function>,
devbranch = "main",
devurl = "dev",
versions = ["stable" => "v^", "v#.#", devurl => devurl],
push_preview = false,
repo_previews = repo,
branch_previews = branch,
)

9 changes: 9 additions & 0 deletions docs/src/AbstractTypes/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Common `AbstractTypes`

The following abstract types are defined, which are common parent types for all submodules within `Astrodynamics`.

```@docs
AbstractBody
OrbitalSystem
PropagationResult
```
8 changes: 8 additions & 0 deletions docs/src/NBody/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## `NBody` Calculations

Currently, two functions are provided to calculate information for a `MultibodySystem`: [`system_energy`](@ref), which calculates the total energy for the system, and [`system_angular_momentum`](@ref), which calculates the total angular momentum for the system.

```@docs
system_energy
system_angular_momentum
```
8 changes: 8 additions & 0 deletions docs/src/NBody/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## `NBody` Data Structures

As with [`TwoBody` Data Structures](@ref), the `NBody` submodule includes data structures for storing multibody orbital states. The `Body` structure holds position, velocity, and mass information for a single body. A `MultibodySystem` contains an array of `Body` structures, and is used to completely describe a multibody orbital state.

```@docs
Body
MultibodySystem
```
17 changes: 17 additions & 0 deletions docs/src/Overview/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Package Overview

`Astrodynamics.jl` is a `Unitful` Astrodynamics library, which includes `TwoBody` and `NBody` problem calculations, as well as orbit propagation and plotting!

## Motivation

This package was created to learn more about Astrodynamics, and will be developed alongside a Graduate Astrodynamics course at the University of Maryland. The package [JuliaSpace/Astrodynamics.jl](https://github.com/JuliaSpace/Astrodynamics.jl) is much more thought out, and is more fully featured. Basically, if you're not me, use that one!

## Credits

\[1\] Vallado, David A. Fundamentals of astrodynamics and applications. Vol. 12. Springer Science & Business Media, 2001.
* All equations and algorithms within `Astrodynamics` are pulled from Vallado's _Fundamentals of Astrodynamics and Applications_, as well as course notes from ENAE 601 (Astrodynamics) at the University of Maryland.

\[2\] [JuliaAstro/AstroBase.jl](https://github.com/JuliaAstro/AstroBase.jl)
* `AstroBase` is referenced as a well thought-out Julia package structure example (I'm new to Julia!), as well as feature ideas.
* For example: my first shot at implementing `TwoBody` used separate structures for Cartesian two-body orbits, and Keplerian two-body orbits. `AstroBase` seems to keep these in one structure - that's way better!
* Now my `Orbit` structure tracks both Cartesian and Keplerian representations for orbit conditions _in the background_. You provide a Cartesian or Keplerian representation to the `Orbit` constructor, and `TwoBody` handles the transformations behind the scenes.
127 changes: 127 additions & 0 deletions docs/src/Overview/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
## Getting Started

### Units are Required!

Currently, `Astrodynamics.jl` `reexport`'s `Unitful`, `UnitfulAstro`, and `UnitfulAngles`. Units are required for all `TwoBody` and `NBody` computations. In the future, I'd like to make units optional.

### Two-body Problem

The `TwoBody` module handles Astrodynamics scenarios within the two-body problem. You can make a `Orbit` by specifying a `CelestialBody` (Sun, Earth, Moon, Mars, etc.), and a Cartesian or Keplerian state.

```Julia
# Cartesian state to Orbit
r̅ = [0.0, 11681.0, 0.0]u"km"
v̅ = [5.134, 4.226, 2.787]u"km/s"
orbit1 = Orbit(r̅, v̅, Earth)

# Keplerian state to Orbit
e = 0.3 * u"rad"
a = 15000 * u"km" + Earth.R
i = 10 * u"°"
Ω = 0 * u"°"
ω = 10 * u"°"
ν = 0 * u"°"
orbit2 = Orbit(e, a, i, Ω, ω, ν, Earth)

# This is a true fact!
orbit1 ≈ orbit2

# For the rest of this section...
orbit = orbit1
```

Now you can solve __Kepler's Prediction Problem__, __propagate__ the satellite's trajectory over a specified intervol in time, and __plot__ the resultant trajectory with `Plots.jl`.

```Julia
# Kepler's Prediction problem
orbit_later = kepler(orbit, orbital_period(orbit))

# Orbit propagation
sols = propagate(orbit, orbital_period(orbit))

# Plotting (with Plots.jl kwargs)
plot3d(sols; title="Plots.jl keywords work!", xlabel="Woo")

# Another true fact!
sols.step[end] ≈ orbit_later
```

You may have noticed the `orbital_period` function. All common two-body problem equations have been included as functions with common arguments,`orbital_period(a, μ)`, and with `Astrodynamics.jl` structure arguments, `orbital_period(orbit)`. The current list of supported functions is shown below, and is described in [`TwoBody` Calculations](@ref).

```Julia
# Look at ~all~ those functions
semimajor_axis
eccentricity
eccentricity_vector
inclination
true_anomoly,
periapsis_radius
apoapsis_radius
periapsis_velocity
apoapsis_velocity,
radius
radius_vector
velocity
velocity_vector
orbital_period
time_since_periapsis
mean_motion
semi_parameter
conic_anomoly
specific_angular_momentum
specific_angular_momentum_vector
specific_energy
```

Not sure how to use one of those? Check the docstrings in Julia's REPL!

```Julia
help?> eccentricity
search: eccentricity eccentricity_vector

eccentricity(r̅, v̅, μ)
eccentricity(orbit::Orbit)

Returns orbital eccentricity, e.
```

### NBody

The `NBody` module helps to solve the classical gravitational `NBody` problem. This is the baby version - point mass bodies, and no relativity. But it's still useful!

You can make your own `Body` by specifying an initial Cartesian state, and a mass.

```Julia
# It's MY Earth, and I want it now
r̅₁ = [0.0, 0.0, 0.0]u"km"
v̅₁ = [0.0, 0.0, 0.0]u"km/s"
m₁ = Earth.m
myEarth = Body(r̅₁, v̅₁, m₁)

# And we'll need a satellite...
r̅₂ = [0.0, 11681.0, 0.0]u"km"
v̅₂ = [5.134, 4.226, 2.787]u"km/s"
m₂ = 1000.0u"kg"
mySatellite = Body(r̅₂, v̅₂, m₂)
```

A `MultibodySystem` contains an array of `Bodies`.

```Julia
# Construct a MultibodySystem
sys = MultibodySystem([myEarth, mySatellite])
```

And you can __propagate__ a `MultibodySystem` through time to numerically find the final states for each `Body`. The package `DifferentialEquations.jl` is used for the numerical integration. For all __propagation__ functions in `Astrodynamics.jl`, you can specify `kwargs` as you would for a `DifferentialEquations.jl` `solve` call.

```Julia
# Propagate n-body system
sols = propagate(sys, 10000u"s"; abstol=1e-14, reltol=1e-14)
```

As with a two-body `Orbit`, you can also plot each timestep in the n-body propagation.

```Julia
# Plot n-body propagation results
plot3d(sols; title="Plots.jl keywords work!", xlabel="Woo")
```
7 changes: 7 additions & 0 deletions docs/src/Plots/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Plotting `TwoBody` and `NBody` Systems

Currently, two functions are provided to calculate information for a `MultibodySystem`: [`system_energy`](@ref), which calculates the total energy for the system, and [`system_angular_momentum`](@ref), which calculates the total angular momentum for the system.

```@docs
plot3d
```
7 changes: 7 additions & 0 deletions docs/src/Propagators/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Propagating Orbits

A function `propagate` is defined for both `TwoBody` and `NBody` orbits.

```@docs
propagate
```
8 changes: 8 additions & 0 deletions docs/src/Propagators/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Storing Propagation Results

Both `TwoBody` and `NBody` systems have a structure for storing propagation results.

```@docs
TwobodyPropagationResult
MultibodyPropagationResult
```
49 changes: 49 additions & 0 deletions docs/src/TwoBody/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## `TwoBody` Calculations

For convenience, common `TwoBody` problem calculations are provided through functions.
Often, these functions are provided with common arguments (such as `orbital_period(a,μ)`), _and_ with [`TwoBody` Data Structures](@ref) arguments (such as `orbital_period(::Orbit)`).

## Orbital Representations

You can convert between Cartesian and Keplerian `TwoBody` orbital representations by using [`cartesian`](@ref) and [`orbital_elements`](@ref).

```@docs
cartesian
orbital_elements
```

## Kepler's Prediction Problem

The function `kepler` can solve Kepler's Prediction Problem for an `Orbit`.

```@docs
kepler
```

## Common `TwoBody` Problem Calculations

```@docs
semimajor_axis
eccentricity
eccentricity_vector
inclination
true_anomoly
periapsis_radius
apoapsis_radius
periapsis_velocity
apoapsis_velocity
radius
velocity
orbital_period
time_since_periapsis
mean_motion
semi_parameter
conic_anomoly
specific_angular_momentum
specific_angular_momentum_vector
specific_energy
conic
isinvalid
isapprox
isequal
```
Loading