/[PAMELA software]/YodaProfiler/inc/cTle.h
ViewVC logotype

Contents of /YodaProfiler/inc/cTle.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Oct 20 11:39:32 2006 UTC (18 years, 1 month ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Error occurred while calculating annotation data.
FILE REMOVED
Create libsgp4.so shared lib; unified sgp4 code

1 //
2 // cTle.h
3 //
4 // This class will accept a single set of two-line elements and then allow
5 // a client to request specific fields, such as epoch, mean motion,
6 // etc., from the set.
7 //
8 // Copyright 1996-2003 Michael F. Henry
9 //
10 #pragma once
11
12 #include "globals.h"
13 #include "stdafx.h"
14 /////////////////////////////////////////////////////////////////////////////
15 class cTle
16 {
17 public:
18 cTle(string&, string&, string&);
19 cTle(const cTle &tle);
20 ~cTle();
21
22 enum eTleLine
23 {
24 LINE_ZERO,
25 LINE_ONE,
26 LINE_TWO
27 };
28
29 enum eField
30 {
31 FLD_FIRST,
32 FLD_NORADNUM = FLD_FIRST,
33 FLD_INTLDESC,
34 FLD_SET, // TLE set number
35 FLD_EPOCHYEAR, // Epoch: Last two digits of year
36 FLD_EPOCHDAY, // Epoch: Fractional Julian Day of year
37 FLD_ORBITNUM, // Orbit at epoch
38 FLD_I, // Inclination
39 FLD_RAAN, // R.A. ascending node
40 FLD_E, // Eccentricity
41 FLD_ARGPER, // Argument of perigee
42 FLD_M, // Mean anomaly
43 FLD_MMOTION, // Mean motion
44 FLD_MMOTIONDT, // First time derivative of mean motion
45 FLD_MMOTIONDT2,// Second time derivative of mean motion
46 FLD_BSTAR, // BSTAR Drag
47 FLD_LAST // MUST be last
48 };
49
50 enum eUnits
51 {
52 U_FIRST,
53 U_RAD = U_FIRST, // radians
54 U_DEG, // degrees
55 U_NATIVE, // TLE format native units (no conversion)
56 U_LAST // MUST be last
57 };
58
59 void Initialize();
60
61 static int CheckSum(const string&);
62 static bool IsValidLine(string&, eTleLine);
63 static string ExpToDecimal(const string&);
64
65 static void TrimLeft(string&);
66 static void TrimRight(string&);
67
68 double getField(eField fld, // which field to retrieve
69 eUnits unit = U_NATIVE, // return units in rad, deg etc.
70 string *pstr = NULL, // return ptr for str value
71 bool bStrUnits = false) // 'true': append units to str val
72 const;
73 string getName() const { return m_strName; }
74 string getLine1() const { return m_strLine1;}
75 string getLine2() const { return m_strLine2;}
76
77 protected:
78 static double ConvertUnits(double val, eField fld, eUnits units);
79
80 private:
81 string getUnits(eField) const;
82 double getFieldNumeric(eField) const;
83
84 // Satellite name and two data lines
85 string m_strName;
86 string m_strLine1;
87 string m_strLine2;
88
89 // Converted fields, in atof()-readable form
90 string m_Field[FLD_LAST];
91
92 // Cache of field values in "double" format
93 typedef int FldKey;
94 FldKey Key(eUnits u, eField f) const { return (u * 100) + f; }
95 mutable map<FldKey, double> m_mapCache;
96 };
97
98 ///////////////////////////////////////////////////////////////////////////
99 //
100 // TLE data format
101 //
102 // [Reference: T.S. Kelso]
103 //
104 // Two line element data consists of three lines in the following format:
105 //
106 // AAAAAAAAAAAAAAAAAAAAAA
107 // 1 NNNNNU NNNNNAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN
108 // 2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNN
109 //
110 // Line 0 is a twenty-two-character name.
111 //
112 // Lines 1 and 2 are the standard Two-Line Orbital Element Set Format identical
113 // to that used by NORAD and NASA. The format description is:
114 //
115 // Line 1
116 // Column Description
117 // 01-01 Line Number of Element Data
118 // 03-07 Satellite Number
119 // 10-11 International Designator (Last two digits of launch year)
120 // 12-14 International Designator (Launch number of the year)
121 // 15-17 International Designator (Piece of launch)
122 // 19-20 Epoch Year (Last two digits of year)
123 // 21-32 Epoch (Julian Day and fractional portion of the day)
124 // 34-43 First Time Derivative of the Mean Motion
125 // or Ballistic Coefficient (Depending on ephemeris type)
126 // 45-52 Second Time Derivative of Mean Motion (decimal point assumed;
127 // blank if N/A)
128 // 54-61 BSTAR drag term if GP4 general perturbation theory was used.
129 // Otherwise, radiation pressure coefficient. (Decimal point assumed)
130 // 63-63 Ephemeris type
131 // 65-68 Element number
132 // 69-69 Check Sum (Modulo 10)
133 // (Letters, blanks, periods, plus signs = 0; minus signs = 1)
134 //
135 // Line 2
136 // Column Description
137 // 01-01 Line Number of Element Data
138 // 03-07 Satellite Number
139 // 09-16 Inclination [Degrees]
140 // 18-25 Right Ascension of the Ascending Node [Degrees]
141 // 27-33 Eccentricity (decimal point assumed)
142 // 35-42 Argument of Perigee [Degrees]
143 // 44-51 Mean Anomaly [Degrees]
144 // 53-63 Mean Motion [Revs per day]
145 // 64-68 Revolution number at epoch [Revs]
146 // 69-69 Check Sum (Modulo 10)
147 //
148 // All other columns are blank or fixed.
149 //
150 // Example:
151 //
152 // NOAA 6
153 // 1 11416U 86 50.28438588 0.00000140 67960-4 0 5293
154 // 2 11416 98.5105 69.3305 0012788 63.2828 296.9658 14.24899292346978
155

  ViewVC Help
Powered by ViewVC 1.1.23