View Source SpaceDust.State.KeplerianElements (Space Dust v0.3.0)

Classical Keplerian orbital elements.

Represents an orbit using the six classical orbital elements:

  • Semi-major axis (a): Size of the orbit
  • Eccentricity (e): Shape of the orbit (0 = circular, 0-1 = elliptical)
  • Inclination (i): Tilt relative to the equatorial plane
  • RAAN (Ω): Right Ascension of the Ascending Node
  • Argument of perigee (ω): Orientation of the orbit in its plane
  • True anomaly (ν): Position along the orbit

All angles are in radians. Semi-major axis is in kilometers.

Summary

Functions

Calculate specific angular momentum magnitude in km^2/s.

Calculate apoapsis radius in kilometers.

Create Keplerian elements from Nx tensor.

Calculate mean motion in radians per second.

Calculate periapsis radius in kilometers.

Calculate orbital period in seconds.

Calculate specific orbital energy in km^2/s^2.

Convert Keplerian elements to Nx tensor representation. Returns tensor of shape {6}: [a, e, i, Ω, ω, ν]

Convert true anomaly to eccentric anomaly.

Convert true anomaly to mean anomaly.

Types

t()

@type t() :: %SpaceDust.State.KeplerianElements{
  arg_perigee: float(),
  eccentricity: float(),
  epoch: DateTime.t() | nil,
  inclination: float(),
  mu: float() | nil,
  raan: float(),
  semi_major_axis: float(),
  true_anomaly: float()
}

Functions

angular_momentum(keplerian_elements)

@spec angular_momentum(t()) :: float()

Calculate specific angular momentum magnitude in km^2/s.

apoapsis(keplerian_elements)

@spec apoapsis(t()) :: float()

Calculate apoapsis radius in kilometers.

from_tensor(tensor, opts \\ [])

@spec from_tensor(
  Nx.Tensor.t(),
  keyword()
) :: t()

Create Keplerian elements from Nx tensor.

mean_motion(elements)

@spec mean_motion(t()) :: float()

Calculate mean motion in radians per second.

new(semi_major_axis, eccentricity, inclination, raan, arg_perigee, true_anomaly, opts \\ [])

@spec new(float(), float(), float(), float(), float(), float(), keyword()) :: t()

Create new Keplerian elements.

Parameters

  • semi_major_axis: Semi-major axis in kilometers
  • eccentricity: Orbital eccentricity (0 to < 1 for elliptical)
  • inclination: Inclination in radians
  • raan: Right Ascension of Ascending Node in radians
  • arg_perigee: Argument of perigee in radians
  • true_anomaly: True anomaly in radians
  • opts: Optional parameters
    • :epoch - DateTime for the elements
    • :mu - Gravitational parameter (defaults to Earth)

periapsis(keplerian_elements)

@spec periapsis(t()) :: float()

Calculate periapsis radius in kilometers.

period(keplerian_elements)

@spec period(t()) :: float()

Calculate orbital period in seconds.

specific_energy(keplerian_elements)

@spec specific_energy(t()) :: float()

Calculate specific orbital energy in km^2/s^2.

to_tensor(keplerian_elements)

@spec to_tensor(t()) :: Nx.Tensor.t()

Convert Keplerian elements to Nx tensor representation. Returns tensor of shape {6}: [a, e, i, Ω, ω, ν]

true_to_eccentric_anomaly(keplerian_elements)

@spec true_to_eccentric_anomaly(t()) :: float()

Convert true anomaly to eccentric anomaly.

true_to_mean_anomaly(elements)

@spec true_to_mean_anomaly(t()) :: float()

Convert true anomaly to mean anomaly.