about summary refs log tree commit diff
path: root/TLE.go
blob: a0d0bcbbdaab186942f3b893d6b70692b9ee4375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
Implementing the "Two-line element set (TLE)", a data format encoding orbital elements of Earth-orbiting objects.

More information can be found here:
- https://en.wikipedia.org/wiki/Two-line_element_set
- https://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/SSOP_Help/tle_def.html

*/

package tle

// TLE defines the lines contained in a Two-Line-Element
type TLE struct {
	TitleLine TitleLine `json:"titleline"`
	LineOne   LineOne   `json:"lineone"`
	LineTwo   LineTwo   `json:"linetwo"`
}

// TitleLine defines the first line in the the TLE
// It contains the name of the satellite
type TitleLine struct {
	Satname string `json:"satname"`
}

// LineOne defines the first line in the TLE
type LineOne struct {
	Linenumber int `json:"linenumber"`

	// Catalog number defined by USSPACECOM
	// A "U" indicates an unclassified object
	SatelliteNumber int    `json:"satellitenumber"`
	Classification  string `json:"classification"`

	// International  Designator containing information about the launch
	InternationalDesignator InternationalDesignator `json:"internationaldesignator"`

	// Epoch defining from when the TLE is
	Epoch Epoch `json:"epoch"`

	// First Time Derivative of the Mean Motion divided by two
	// Unit: revs / day
	// "catch all" drag term used in SGP4 USSPACECOM predictor
	Firstderiv float64 `json:"firstderiv"`

	// Second Time Derivative of Mean Motion divided by six (decimal point assumed)
	// second order drag term in the SGP4
	// Unit: revs / day^3
	// A leading decimal must be applied to this value
	// The last two characters define an applicable power of 10 (12345-5 = 0.0000012345)
	Secondderiv float64 `json:"secondderiv"`

	// Drag Term
	// (67960-4 = 0.000067960)
	// Unit: earth radii^-1
	// The last two characters define an applicable power of 10
	BSTAR float64 `json:"BSTAR"`

	// The number 0 (originally this should have been "Ephemeris type")
	Numberzero int `json:"numberzero"`

	// Element set number. Incremented when a new TLE is generated for this object.
	ElementSetNumber int `json:"elementesetnumber"`

	// Checksum (modulo 10)
	Checksum int `json:"checksum"`
}

// InternationalDesignator stores information about the satellite such as when it launched
type InternationalDesignator struct {

	// Last two digits of launch year
	Launchyear int `json:"launchyear"`

	// Launch number of the year
	Launchnumber int `json:"launchnumber"`

	// Piece of the launch
	Launchpiece string `json:"launchpiece"`
}

// Epoch defines a moment in time
type Epoch struct {

	// Last two digits of the year
	Year int `json:"year"`

	// day of the year and fractional portion of the day
	Dayfraction float64 `json:"dayfraction"`
}

// LineTwo of the TLE
type LineTwo struct {
	Linenumber int `json:"linenumber"`

	// Catalog number defined by USSPACECOM
	SatelliteNumber int `json:"satellitenumber"`

	// Inclination
	// Unit: degrees
	// Angle between the equator and the orbit plane
	Inclination float64 `json:"inclination"`

	// Right Ascension of the Ascending Node
	// Unit: degrees
	// Angle between vernal equinox and the point where the orbit crosses the equatorial plane (going north).
	RightAscensionOfTheAscendingNode float64 `json:"rightascensionoftheascendingnode"`

	// Eccentricity
	// Constant defining the shape of the orbit (0=circular, Less than 1=elliptical).
	// The value provided is the mean eccentricity.
	// A leading decimal must be applied to this value
	Eccentricity float64 `json:"eccentricity"`

	// Argument of perigee
	// Unit: degrees
	// The angle between the ascending node and the orbit's point of closest approach of the earth (perigee)
	ArgumentOfPerigee float64 `json:"argumentofperigee"`

	// Mean Anomaly
	// Unit: degrees
	// The angle, measured from perigee, of the satellite location in the orbit referenced to a circular orbit
	// with radius equal to the semi-major axis.
	MeanAnomaly float64 `json:"meananomaly"`

	// Mean Motion
	// The value is the mean number of orbits per day the object completes. There are 8 digits after the decimal,
	// leaving no trailing space(s) when the following element exceeds 9999.
	MeanMotion float64 `json:"meanmotion"`

	// The orbit number at Epoch Time. This time is chosen very near the time of true ascending node passage as
	// a matter of routine. The last digit is the check sum for line 2.
	RevolutionNumberAtEpoch int `json:"revolutionnumberatepoch"`

	// Checksum (modulo 10)
	Checksum int `json:"checksum"`
}