perturb 1.0.0
A modern C++11 wrapper for the SGP4 orbit propagator
Loading...
Searching...
No Matches
tle.hpp
Go to the documentation of this file.
1/*
2 * perturb -- A modern C++11 wrapper for the SGP4 orbit propagator
3 * Version 1.0.0
4 * https://github.com/gunvirranu/perturb
5 *
6 * Licensed under the MIT License <http://opensource.org/licenses/MIT>.
7 * SPDX-License-Identifier: MIT
8 *
9 * Copyright (c) 2022 Gunvir Ranu
10 */
11
17
18#ifndef PERTURB_TLE_HPP
19#define PERTURB_TLE_HPP
20
21#include <cstddef>
22#ifndef PERTURB_DISABLE_IO
23# include <string>
24#endif
25
26namespace perturb {
27
33constexpr std::size_t TLE_LINE_LEN = 69;
34
45enum class TLEParseError {
46 NONE,
51};
52
66 // clang-format off
67 // Line 1
70 unsigned int launch_year;
71 unsigned int launch_number;
72 char launch_piece[4];
73 unsigned int epoch_year;
75 double n_dot;
76 double n_ddot;
77 double b_star;
78 unsigned char ephemeris_type;
79 unsigned int element_set_number;
80 unsigned char line_1_checksum;
81
82 // Line 2
83 double inclination;
84 double raan;
85 double eccentricity;
87 double mean_anomaly;
88 double mean_motion;
89 unsigned long revolution_number;
90 unsigned char line_2_checksum;
91 // clang-format on
92
93#ifndef PERTURB_DISABLE_IO
111 TLEParseError parse(const char *line_1, const char *line_2);
112#endif // PERTURB_DISABLE_IO
113
114#ifndef PERTURB_DISABLE_IO
120 TLEParseError parse(const std::string &line_1, const std::string &line_2);
121#endif // PERTURB_DISABLE_IO
122};
123
124} // namespace perturb
125
126#endif // PERTURB_TLE_HPP
Primary namespace for the perturb library, everything is in here.
Definition: perturb.hpp:32
TLEParseError
Possible errors when parsing a TLE.
Definition: tle.hpp:45
@ INVALID_FORMAT
If general parsing was unsuccessfully.
@ CHECKSUM_MISMATCH
If the checksum doesn't match.
@ SHOULD_BE_SPACE
If there is a lack of space in the TLE.
@ INVALID_VALUE
If a parsed value doesn't make sense.
constexpr std::size_t TLE_LINE_LEN
Both lines of a TLE must be this length, for TLE constructors.
Definition: tle.hpp:33
Represents a pre-parsed TLE record.
Definition: tle.hpp:65
unsigned char line_1_checksum
Line 1 check-sum.
Definition: tle.hpp:80
double epoch_day_of_year
Epoch fractional day of year.
Definition: tle.hpp:74
double raan
Right ascension of the ascending node, 0 ≤ [deg] ≤ 360.
Definition: tle.hpp:84
unsigned int epoch_year
Epoch year (last two digits)
Definition: tle.hpp:73
unsigned int launch_year
International Designator - Launch year (last two digits)
Definition: tle.hpp:70
unsigned long revolution_number
Revolution number at epoch, 0 ≤ [rev] ≤ 99999.
Definition: tle.hpp:89
char classification
Classification {U: Unclassified, C: Classified, S: Secret}.
Definition: tle.hpp:69
char catalog_number[6]
Satellite catalog number.
Definition: tle.hpp:68
unsigned int launch_number
International Designator - Launch number of the year.
Definition: tle.hpp:71
double b_star
B* radiation pressure coefficient [1 / (earth radii)].
Definition: tle.hpp:77
double n_ddot
Second derivative of mean motion [rev/day^3].
Definition: tle.hpp:76
char launch_piece[4]
International Designator - Piece of launch.
Definition: tle.hpp:72
double mean_motion
Mean motion, 0 < [rev/day].
Definition: tle.hpp:88
unsigned char ephemeris_type
Orbital model used to generate data (usually 0)
Definition: tle.hpp:78
double inclination
Inclination, 0 ≤ [deg] ≤ 180.
Definition: tle.hpp:83
double arg_of_perigee
Argument of perigee, 0 ≤ [deg] ≤ 360.
Definition: tle.hpp:86
unsigned char line_2_checksum
Line 2 check-sum.
Definition: tle.hpp:90
TLEParseError parse(const char *line_1, const char *line_2)
Parse a TLE record string.
Definition: tle.cpp:41
double mean_anomaly
Mean anomaly, 0 ≤ [deg] ≤ 360.
Definition: tle.hpp:87
double n_dot
First derivative of mean motion (ballistic coefficient) [rev/day^2].
Definition: tle.hpp:75
unsigned int element_set_number
Element set number.
Definition: tle.hpp:79
double eccentricity
Eccentricity (0 ≤ [] ≤ 1)
Definition: tle.hpp:85