Converting to TLE
Orbit Mean-Elements Messages whose mean elements follow the SGP4 theory can be converted into a classic Two-Line Element set (TLE). This is useful to interoperate with the many tools in the SatelliteToolbox.jl ecosystem that consume TLEs, such as the SGP4 propagator.
This capability is provided by a package extension that is loaded automatically once SatelliteToolboxTle.jl is available in your environment:
julia> using Pkg
julia> Pkg.add("SatelliteToolboxTle")Performing the Conversion
Load both packages and use Julia's convert function with the target type TLE. Assuming the variable omm holds an OrbitMeanElementsMessage for the Amazonia 1 satellite:
julia> using SatelliteToolboxTlejulia> tle = convert(TLE, omm)TLE: Name : AMAZONIA 1 Satellite number : 47699 International designator : 21015A Epoch (Year / Day) : 25 / 364.75838581 (2025-12-30T18:12:04.534) Element set number : 999 Eccentricity : 0.00011240 Inclination : 98.37210000 deg RAAN : 75.08770000 deg Argument of perigee : 97.37720000 deg Mean anomaly : 262.75450000 deg Mean motion (n) : 14.40772474 revs / day Revolution number : 25439 B* : 0.0001533 1 / er ṅ / 2 : 4.47e-06 rev / day² n̈ / 6 : 0 rev / day³
The conversion maps the OMM fields to their TLE counterparts, including the translation of the OBJECT_ID (e.g. 2021-015A) into the TLE international designator format (e.g. 21015A).
Requirements and Behavior
Mean element theory. The conversion only succeeds when the metadata field
mean_element_theoryis equal to"SGP4". Otherwise, an error is raised, since the elements cannot be interpreted as a TLE.Mean motion. TLEs are expressed in terms of the mean motion. If the OMM provides
mean_motiondirectly, it is used as is. If only thesemi_major_axisis available, the mean motion is computed from it, which additionally requires the gravitational parameterGMto be present:\[n = \frac{1}{2\pi}\sqrt{\frac{GM}{a^3}} \times 86400\]
Required TLE fields. Conversion requires
classification_type,norad_cat_id,element_set_number,rev_at_epoch,bstar,mean_motion_dot, andmean_motion_ddot. Missing fields raise an error; they do not receive placeholder values.Unsupported alternatives. OMM TLE parameters may represent drag with either
bstarorbterm, and the second derivative slot with eithermean_motion_ddotoragom. A classic TLE conversion requiresbstarandmean_motion_ddot; conversion rejectsbtermandagombecause they have no direct TLE representation.
The CCSDS standard does not fully specify whether the derivative fields (MEAN_MOTION_DOT and MEAN_MOTION_DDOT) already incorporate the SGP4 scaling factors. Based on the data returned by Celestrak and Space-Track, this package assumes they are already adjusted and copies them directly into the TLE.