Library

Documentation for SatelliteToolboxTle.jl.

SatelliteToolboxTle.TLEType
struct TLE

Store the elements of a TLE (two-line elements) using the same units.

Note

We do not have fields for the line checksum since they are only required when creating or parsing a TLE string.

Fields

  • name: Name of the satellite.

First line

  • satellite_number: Satellite number.
  • classification: Classification ('U', 'C', or 'S').
  • international_designator: International designator.
  • epoch_year: Epoch year (two digits).
  • epoch_day: Epoch day (day + fraction of the day).
  • dn_o2: 1st time derivative of mean motion / 2 [rev/day²].
  • ddn_o6: 2nd time derivative of mean motion / 6 [rev/day³].
  • bstar: B* drag term.
  • element_set_number: Element set number.

Second line

  • inclination: Inclination [deg].
  • raan: Right ascension of the ascending node [deg].
  • eccentricity: Eccentricity [ ].
  • argument_of_perigee: Argument of perigee [deg].
  • mean_anomaly: Mean anomaly [deg].
  • mean_motion: Mean motion [rev/day].
  • revolution_number: Revolution number at epoch [rev].

Creating TLEs

You can manually create a TLE by calling the function TLE(; kwargs...), where kwargs... are keyword arguments with the same name as the fields. In this case, the following elements are required:

  • epoch_year, epoch_day, inclination, raan, eccentricity, argument_of_perigee, mean_anomaly and mean_motion.

The other ones are optional and default values will be assigned if not present.

source
Base.convertMethod
convert(::Type{String}, tle::TLE) -> String

Convert tle to its string representation, returning the satellite name line followed by the two TLE lines with recomputed checksums.

The angles (inclination, RAAN, argument of perigee, and mean anomaly) are normalized to the interval [0, 360)° before being written. If a value cannot be represented in its TLE field, the field is saturated and a warning is emitted.

source
SatelliteToolboxTle._show_tleMethod
_show_tle(io::IO, tle::TLE; color::Bool = true) -> Nothing

Show the TLE tle in the IO io.

Keywords

  • color::Bool: If true, the text will be printed using colors. (Default = true)
source
SatelliteToolboxTle.create_tle_fetcherMethod
create_tle_fetcher(::Type{CelestrakTleFetcher}; kwargs...) -> CelestrakTleFetcher

Create a TLE fetcher from Celestrak service.

Keywords

  • url::String: Default PHP webpage address that will be used to perform the queries. (Default: "https://celestrak.org/NORAD/elements/gp.php")
source
SatelliteToolboxTle.fetch_tlesMethod
fetch_tles(fetcher::CelestrakTleFetcher; kwargs...) -> Union{Nothing, Vector{TLE}}

Fetch TLEs from the Celestrak using fetch with the parameters in kwargs....

This function returns a Vector{TLE} with the fetched TLEs. If an error is found, it returns nothing.

Keywords

  • international_designator::Union{Nothing, AbstractString}: International designator using the Celestrak format YYYY-NNN, where YYYY is the launch year, and the NNN is the launch number. (Default: nothing)
  • satellite_number::Union{Nothing, Number}: Satellite catalog number (NORAD). (Default = nothing)
  • satellite_name::Union{Nothing, AbstractString}: Satellite name. Notice that the system will search for all satellites whose name contains this string. (Default: nothing)
Note

Only one search parameter is supported. If more than one is given, the precedence is: 1) satellite_number; 2) international_designator; and 3) and satellite_name.

Note

If no search parameter is provided, the function throws an error.

source
SatelliteToolboxTle.fetch_tlesMethod
fetch_tles(fetcher::T; kwargs...) -> Vector{TLE}

Fetch TLEs using fetcher.

The keywords kwargs... are used to customize the search. It depends on the fetcher type T.

source
SatelliteToolboxTle.read_tleMethod
read_tle(l1::AbstractString, l2::AbstractString; kwargs...) -> TLE

Read the TLE in which the first line is l1 and second line is l2.

Keywords

  • name::AbstractString: The satellite name in the returned TLE object. (Default = "UNDEFINED")
  • verify_checksum::Bool: If true, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default = true)
source
SatelliteToolboxTle.read_tleMethod
read_tle(str::AbstractString; verify_checksum::Bool = true) -> TLE

Read the TLE in the string str.

Note

str must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character # are discarded.

Keywords

  • verify_checksum::Bool: If true, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default = true)
source
SatelliteToolboxTle.read_tlesMethod
read_tles(tles::AbstractString; verify_checksum::Bool = true) -> Vector{TLE}

Parse a set of TLEs in the string tles. This function returns a Vector{TLE} with the parsed TLEs.

Keywords

  • verify_checksum::Bool: If true, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default = true)
source
SatelliteToolboxTle.read_tles_from_fileMethod
read_tles_from_file(filename::String; verify_checksum::Bool = true) -> Vector{TLE}

Read the TLEs in the file filename and return a Vector{TLE} with the parsed TLEs.

Keywords

  • verify_checksum::Bool: If true, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default = true)
source
SatelliteToolboxTle.tle_line_checksumMethod
tle_line_checksum(str::AbstractString) -> Int

Compute the checksum of the line str modulo 10.

The algorithm is simple: add all the numbers in the line, ignoring letters, spaces, periods, and plus signs, but assigning +1 to the minus signs. The checksum is the remainder of the division by 10.

source
SatelliteToolboxTle.@tle_nc_strMacro
@tle_nc_str(str) -> TLE

Parse one TLE in the string str.

This function returns the parsed TLE or nothing, if an error occurred.

Note

This function does not verify the checksums of the TLE. If the checksum verification is desired, use @tle_str.

Note

str must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character # are discarded.

Example

julia> tles = tle_nc"""
       CBERS 4
       1 40336U 14079A   18166.15595376 -.00000014  00000-0  10174-4 0  9993
       2 40336  98.4141 237.7928 0001694  75.7582 284.3804 14.35485112184485
       """
source
SatelliteToolboxTle.@tle_strMacro
@tle_str(str) -> TLE

Parse one TLE in the string str.

This function returns the parsed TLE or nothing, if an error occurred.

Note

This function verifies the checksums of the TLE. If the checksum verification is not desired, use @tle_nc_str.

Note

str must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character # are discarded.

Example

julia> tle = tle"""
       CBERS 4
       1 40336U 14079A   18166.15595376 -.00000014  00000-0  10174-4 0  9993
       2 40336  98.4141 237.7928 0001694  75.7582 284.3804 14.35485112184485
       """
source
SatelliteToolboxTle.@tles_nc_strMacro
@tles_nc_str(str) -> Vector{TLE}

Parse a set of TLEs in the string str and return them as a Vector{TLE}.

Note

This version does not verify the checksum of the TLE. If the checksum verification is required, use @tles_str.

Example

julia> tles = tles_nc"""
       CBERS 4
       1 40336U 14079A   18166.15595376 -.00000014  00000-0  10174-4 0  9993
       2 40336  98.4141 237.7928 0001694  75.7582 284.3804 14.35485112184485
       SCD 1
       1 22490U 93009B   18165.62596833  .00000225  00000-0  11410-4 0  9991
       2 22490  24.9690 231.7852 0042844 200.7311 292.7198 14.44524498338066
       SCD 2
       1 25504U 98060A   18165.15074951  .00000201  00000-0  55356-5 0  9994
       2 25504  24.9961  80.1303 0017060 224.4822 286.6438 14.44043397 37312
       """
source
SatelliteToolboxTle.@tles_strMacro
@tles_str(str) -> Vector{TLE}

Parse a set of TLEs in the string str and return them as a Vector{TLE}.

Note

This function verifies the checksums of the TLE. If the checksum verification is not desired, use @tles_nc_str.

Example

julia> tles = tles"""
       CBERS 4
       1 40336U 14079A   18166.15595376 -.00000014  00000-0  10174-4 0  9993
       2 40336  98.4141 237.7928 0001694  75.7582 284.3804 14.35485112184485
       SCD 1
       1 22490U 93009B   18165.62596833  .00000225  00000-0  11410-4 0  9991
       2 22490  24.9690 231.7852 0042844 200.7311 292.7198 14.44524498338066
       SCD 2
       1 25504U 98060A   18165.15074951  .00000201  00000-0  55356-5 0  9994
       2 25504  24.9961  80.1303 0017060 224.4822 286.6438 14.44043397 37312
       """
source