tle

package module
v0.0.0-...-38d9404 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2020 License: GPL-3.0 Imports: 4 Imported by: 1

README

GoDoc Go Report Card Build Status Coverage

TLE

Implementing the "Two-line element set (TLE)", a data format encoding orbital elements of Earth-orbiting objects.

Wikipedia nasa documentation of the format

Format

(the below tables are copied 1:1 from wikipedia (from here))

Title line
Field Columns Content Example
1 01-24 Satellite name ISS (ZARYA)
Line one
Field Columns Content Example
1 01-01 Line number 1
2 03–07 Satellite number 25544
3 08–08 Classification (U=Unclassified) U
4 10–11 International Designator (Last two digits of launch year) 98
5 12–14 International Designator (Launch number of the year) 067
6 15–17 International Designator (piece of the launch) A
7 19–20 Epoch Year (last two digits of year) 08
8 21–32 Epoch (day of the year and fractional portion of the day) 264.51782528
9 34–43 First Time Derivative of the Mean Motion divided by two [11] −.00002182
10 45–52 Second Time Derivative of Mean Motion divided by six (decimal point assumed) 00000-0
11 54–61 BSTAR drag term (decimal point assumed) [11] -11606-4
12 63–63 The number 0 (originally this should have been "Ephemeris type") 0
13 65–68 Element set number. Incremented when a new TLE is generated for this object.[11] 292
14 69–69 Checksum (modulo 10) 7
Line two
Field Columns Content Example
1 01–01 Line number 2
2 03–07 Satellite number 25544
3 09–16 Inclination (degrees) 51.6416
4 18–25 Right ascension of the ascending node (degrees) 247.4627
5 27–33 Eccentricity (decimal point assumed) 0006703
6 35–42 Argument of perigee (degrees) 130.5360
7 44–51 Mean Anomaly (degrees) 325.0288
8 53–63 Mean Motion (revolutions per day) 15.72125391
9 64–68 Revolution number at epoch (revolutions) 56353
10 69–69 Checksum (modulo 10) 7

Tests / Coverage

Run the tests:

$ go test -v .
...

See the test coverage:

$ go test -coverprofile=coverage.out && go tool cover -html=coverage.out
...

Pull requests

Feel free to make one (or more) pull requests!

Documentation

Overview

Package tle implementing the "Two-line element set (TLE)", a data format encoding orbital elements of Earth-orbiting objects.

More information can be found in the wikipedia article: (https://en.wikipedia.org/wiki/Two-line_element_set) and in the official NASA documentation: (https://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/SSOP_Help/tle_def.html)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Epoch

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"`
}

Epoch defines a moment in time

type InternationalDesignator

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"`
}

InternationalDesignator stores information about the satellite such as when it launched

type LineOne

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"`
}

LineOne defines the first line in the TLE

type LineTwo

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"`
}

LineTwo of the TLE

type TLE

type TLE struct {
	TitleLine TitleLine `json:"titleline"`
	LineOne   LineOne   `json:"lineone"`
	LineTwo   LineTwo   `json:"linetwo"`
}

TLE defines the lines contained in a Two-Line-Element

func NewTLE

func NewTLE(RawTLE string) (TLE, error)

NewTLE creates a new TLE object from a given TLE string

Example
var RawTLE = `ISS (ZARYA)             
1 25544U 98067A   19229.39083552  .00000228  00000-0  11917-4 0  9993
2 25544  51.6447  57.6210 0007373 294.0868 138.8050 15.50381554184754`

TLE, err := NewTLE(RawTLE)
if err != nil {
	fmt.Println(err)
}

// convert the TLE to json
b, err := json.MarshalIndent(TLE, "", " ")
if err != nil {
	fmt.Println("error: ", err)
}
_, err = os.Stdout.Write(b)
if err != nil {
	fmt.Println("error: ", err)
}
Output:

{
 "titleline": {
  "satname": "ISS (ZARYA)             "
 },
 "lineone": {
  "linenumber": 1,
  "satellitenumber": 25544,
  "classification": "U",
  "internationaldesignator": {
   "launchyear": 98,
   "launchnumber": 67,
   "launchpiece": "A"
  },
  "epoch": {
   "year": 19,
   "dayfraction": 229.39083552
  },
  "firstderiv": 0.00000228,
  "secondderiv": 0,
  "BSTAR": 0.000011917,
  "numberzero": 0,
  "elementesetnumber": 999,
  "checksum": 3
 },
 "linetwo": {
  "linenumber": 2,
  "satellitenumber": 25544,
  "inclination": 51.6447,
  "rightascensionoftheascendingnode": 57.621,
  "eccentricity": 7373,
  "argumentofperigee": 294.0868,
  "meananomaly": 138.805,
  "meanmotion": 15.50381554,
  "revolutionnumberatepoch": 18475,
  "checksum": 4
 }
}

type TitleLine

type TitleLine struct {
	Satname string `json:"satname"`
}

TitleLine defines the first line in the the TLE It contains the name of the satellite

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL