Sgp4Ex (Sgp4Ex v0.1.0)
View SourceSGP4 propagation module for Elixir.
Summary
Functions
parse a two line element set (TLE) from a pair of strings
Propagate a TLE to a specific epoch using the SGP4 algorithm. The epoch is the time to which the TLE should be propagated.
Functions
@spec parse_tle(String.t(), String.t()) :: {:ok, Sgp4Ex.TLE.t()} | {:error, String.t()}
parse a two line element set (TLE) from a pair of strings
@spec propagate_tle_to_epoch(Sgp4Ex.TLE.t(), DateTime.t()) :: {:ok, Sgp4Ex.TemeState.t()} | {:error, String.t()}
Propagate a TLE to a specific epoch using the SGP4 algorithm. The epoch is the time to which the TLE should be propagated.
Parameters
tle
: The TLE data structure containing the satellite's orbital elements.epoch
: The epoch to which the TLE should be propagated.
Returns
{:ok, TemeState.t()}
: The propagated Teme state of the satellite.{:error, String.t()}
: An error message if the propagation fails.
Example
iex> tle = %Sgp4Ex.TLE{
...> line1: "1 25544U 98067A 21275.54791667 .00001264 00000-0 39629-5 0 9993",
...> line2: "2 25544 51.6456 23.4367 0001234 45.6789 314.3210 15.48999999 12",
...> epoch: ~U[2021-10-02T13:00:00Z]
...> }
iex> epoch = ~U[2021-10-02T14:00:00Z]
iex> Sgp4Ex.propagate_tle_to_epoch(tle, epoch)
{:ok, %Sgp4Ex.TemeState{position: {x, y, z}, velocity: {vx, vy, vz}}}