Sidereon.Constellation (Sidereon v0.8.0)

Copy Markdown View Source

Manage and propagate satellite constellations.

Load TLEs for an entire constellation and propagate all satellites to a given time. Useful for coverage analysis, constellation status monitoring, and visibility computations.

Examples

# Load from CelesTrak
{:ok, constellation} = Sidereon.Constellation.load("globalstar")
constellation.count
#=> 85

# Propagate all satellites to now
positions = Sidereon.Constellation.propagate_all(constellation, DateTime.utc_now())
Enum.each(positions, fn {norad_id, pos} ->
  IO.puts("#{norad_id}: #{inspect(pos)}")
end)

# Find visible satellites from a ground station
{:ok, visible} = Sidereon.Constellation.visible_from(constellation, station, datetime)

Summary

Functions

Create a constellation from a list of TLEs.

Load a constellation from CelesTrak by group name.

Propagate all satellites to a given time.

Find satellites visible from a ground station at a given time.

Types

invalid_satellites()

@type invalid_satellites() :: [{String.t() | nil, {:error, term()}}]

t()

@type t() :: %Sidereon.Constellation{
  count: non_neg_integer(),
  name: String.t(),
  satellites: [Sidereon.Elements.t()]
}

visible_error()

@type visible_error() ::
  {:invalid_satellites, invalid_satellites()} | {:nif_error, String.t()}

visible_satellite()

@type visible_satellite() :: %{
  catalog_number: String.t(),
  elevation: float(),
  azimuth: float(),
  range_km: float(),
  position: {float(), float(), float()}
}

Functions

from_tles(name, tles)

@spec from_tles(String.t(), [Sidereon.Elements.t()]) :: t()

Create a constellation from a list of TLEs.

Examples

constellation = Sidereon.Constellation.from_tles("custom", tles)

load(group_name)

@spec load(String.t()) :: {:ok, t()} | {:error, term()}

Load a constellation from CelesTrak by group name.

Examples

{:ok, c} = Sidereon.Constellation.load("globalstar")
c.count
#=> 85

propagate_all(constellation, datetime)

@spec propagate_all(t(), DateTime.t()) :: [
  {String.t() | nil, {:ok, Sidereon.TemeState.t()} | {:error, term()}}
]

Propagate all satellites to a given time.

Returns a list of {catalog_number, {:ok, teme_state}} or {catalog_number, {:error, reason}} tuples.

Examples

results = Sidereon.Constellation.propagate_all(constellation, ~U[2024-07-04 00:00:00Z])
for {id, {:ok, teme}} <- results do
  IO.puts("#{id}: #{inspect(teme.position)}")
end

visible_from(constellation, station, datetime, opts \\ [])

@spec visible_from(t(), map(), DateTime.t(), keyword()) ::
  {:ok, [visible_satellite()]} | {:error, visible_error()}

Find satellites visible from a ground station at a given time.

Returns satellites above min_elevation degrees, sorted by elevation (highest first).

Options

  • :min_elevation - minimum elevation in degrees (default: 10.0)

Examples

{:ok, visible} = Sidereon.Constellation.visible_from(constellation, station, datetime)
for sat <- visible do
  IO.puts("#{sat.catalog_number}: el=#{sat.elevation}° range=#{sat.range_km} km")
end