sgp4

package module
v0.0.0-...-3491a94 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 5 Imported by: 0

README

Overview

sgp4 is a Golang translation of the C++ astrodynamics algorithm publsihed by CelesTrak, written by David Vallado on 28 Jun 2005, and based on the methodology originally published through the AIAA Spacetrack Report #3.

sgp4 was created as a learning project and no assurances are offered on the accuracy of this product. This is not actively maintained.

Use

sgp4 takes one of two inputs. First is a struct derived from the Orbit Mean-Elements Message (OMM), the second is by a Two Line Element (TLE).

Initialize the Satrec Coefficients

These functions take an OMM or TLE input and return a pointer to the sgp4 Satrec coefficients that can be used to propogate the orbital elements.

OMM
func OMMinit(o *OMM) *satrec

Where the OMM struct is defined as and map directly to the space-track.org OMM datatype.

type OMM struct {
    NORAD_CAT_ID      string  // "44071"
    EPOCH             string  // "2023-11-30T14:51:58.008096"
    MEAN_MOTION       float64 // 1.00271227
    MEAN_MOTION_DOT   float64 // 0.00000055
    MEAN_MOTION_DDOT  float64 // 0.0
    BSTAR             float64 // 0.0
    INCLINATION       float64 // 0.0155
    RA_OF_ASC_NODE    float64 // 354.7718
    ECCENTRICITY      float64 // 0.00003150
    ARG_OF_PERICENTER float64 // 254.5248
    MEAN_ANOMALY      float64 // 103.2389
}
TLE
func TLEinit(tle1, tle2 string) *satrec

Propogate

Propogate takes a pointer to an initialized satrec struct and a time at propogation. Note that error increases the further the time diverges from the EPOCH.

func Propogate(s *satrec, tprop time.Time) (eci, v Vector)

Where eci is the current position in the Earth Centered Inertial frame and the corresponding v velocity vectors.

Conversions

ECI to LLA

Converts Earth Centered Inertial to Latitude, Longitude, and Altitude at the identified t time.

func ECItoLLA(eci Vector, t time.Time) LLA
ECI to Look Angles

Given a satellite position eci, observer position obs (in LLA), and time.

func ECItoLookAngles(eci Vector, obs LLA, t time.Time) (as, rg, el float64)

Testing

Unit tests were built by taking individual function inputs and outputs from the initial C++ libary.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(a, b interface{}) ([]string, error)

func Convert

func Convert(x interface{}) ([]float64, []string, []int, time.Time)

func ECItoLookAngles

func ECItoLookAngles(eci Vector, obs LLA, t time.Time) (az, rg, el float64)

Calculate look angles for given satellite position in ECI and observer position in lat, long (deg, decimal deg) and alt

in meters. Returns azmuth in degrees, range in km, and elevation in degrees.

Reference https://celestrak.com/columns/v02n02/

func Gmst

func Gmst(t time.Time) float64

Calculates gmst from a Golang time.Time value.

func JDay

func JDay(t time.Time) float64

func OMMinit

func OMMinit(o *OMM) *satrec

func TLEinit

func TLEinit(tle1, tle2 string) *satrec

Types

type Grav

type Grav struct {
	// contains filtered or unexported fields
}

type LLA

type LLA struct {
	Lat  float64
	Long float64
	Alt  float64
}

func ECItoLLA

func ECItoLLA(eci Vector, t time.Time) LLA

Convert earth centered intertial coordinates into lat, long, and altitude. Takes ECI output and Golang time.Time input from the SGP4/SDP4 propogator. Returns lat and long (in degrees).

type OMM

type OMM struct {
	NORAD_CAT_ID      string  // satnum
	EPOCH             string  // epoch
	MEAN_MOTION_DOT   float64 // ndot
	MEAN_MOTION_DDOT  float64 // nddot
	BSTAR             float64 // bstar
	INCLINATION       float64 // inclo
	RA_OF_ASC_NODE    float64 // nodeo
	ECCENTRICITY      float64 // ecco
	ARG_OF_PERICENTER float64 // argpo
	MEAN_ANOMALY      float64 // mo
	MEAN_MOTION       float64 // no
}

type Vector

type Vector struct {
	// contains filtered or unexported fields
}

func Propogate

func Propogate(s *satrec, tprop time.Time) (p, v Vector)

Jump to

Keyboard shortcuts

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