Documentation
¶
Index ¶
- Constants
- func AcTan(sinx, cosx float64) float64
- func Angle(v1, v2 Vector) float64
- func ArcCos(arg float64) float64
- func ArcSin(arg float64) float64
- func CalculateXKE() float64
- func ConvertPositionAndVelocityToKilometers(pos, vel *Vector)
- func ConvertPositionToKilometers(pos *Vector)
- func ConvertSatState(pos, vel *Vector)
- func ConvertVelocityToKilometersPerSecond(vel *Vector)
- func Cube(arg float64) float64
- func DaysSinceEpoch(julianEpoch, julianDate float64) float64
- func Degrees(arg float64) float64
- func Dot(v1, v2 Vector) float64
- func Dpper(...)
- func Dscom(epoch, ep, argpp, tc, inclp, nodep, np float64, rec *ElsetRec)
- func Dsinit(tc, xpidot float64, rec *ElsetRec)
- func Dspace(tc float64, rec *ElsetRec)
- func Fmod2p(arg float64) float64
- func GetGravConst(whichconst int, rec *ElsetRec)
- func Gstime(jdut1 float64) float64
- func InitL(epoch float64, rec *ElsetRec)
- func JulianDate(year, month, day int) float64
- func JulianDateOfEpoch(epoch float64) float64
- func JulianDateToTime(jd float64) time.Time
- func JulianToTimeAstronomical(jd float64) time.Time
- func Magnitude(v *Vector)
- func Max(arg1, arg2 int) int
- func Min(arg1, arg2 int) int
- func MinutesSinceEpoch(julianEpoch, julianDate float64) float64
- func Modulus(arg1, arg2 float64) float64
- func Normalize(v *Vector)
- func ParseFloat(s string) (float64, error)
- func Power(arg, pwr float64) float64
- func PropagateSatellite(tle *TLE, time float64, units ...string) (Vector, Vector, error)
- func RMax(arg1, arg2 float64) float64
- func RMin(arg1, arg2 float64) float64
- func Radians(arg float64) float64
- func SGP4(satrec *ElsetRec, tsince float64, r, v []float64) bool
- func SGP4Init(opsmode byte, satrec *ElsetRec) bool
- func Sign(arg float64) int
- func Square(arg float64) float64
- func Tan(arg float64) float64
- func TimeToJulianDate(t time.Time) float64
- type ElsetRec
- type PropagationResult
- type Satellite
- type SatelliteData
- type SatelliteDatabase
- type State
- type TLE
- type Vector
Constants ¶
const ( // Earth constants AE = 1.0 // Earth equatorial radius in Earth radii TOTHRD = 2.0 / 3.0 // 2/3 XKMPER = 6378.135 // Earth equatorial radius - kilometers (WGS '72) F = 1.0 / 298.26 // Earth flattening (WGS '72) GE = 398600.8 // Earth gravitational constant (WGS '72) // Harmonic coefficients J2 = 1.0826158e-3 // J2 harmonic (WGS '72) J3 = -2.53881e-6 // J3 harmonic (WGS '72) J4 = -1.65597e-6 // J4 harmonic (WGS '72) // Derived constants CK2 = J2 / 2.0 // J2/2 CK4 = -3.0 * J4 / 8.0 // -3*J4/8 XJ3 = J3 // J3 // Atmospheric constants QO = AE + 120.0/XKMPER // Atmospheric boundary S = AE + 78.0/XKMPER // Atmospheric boundary // Numerical constants E6A = 1e-6 // Small number for numerical stability // Deep space model flags DPINIT = 1 // Deep-space initialization code DPSEC = 2 // Deep-space secular code DPPER = 3 // Deep-space periodic code // Time constants TWOPI = 2.0 * PI // 2π XMNPDA = 1440.0 // Minutes per day )
Physical constants from WGS-72 model
const ( WGS72OLD = 1 WGS72 = 2 WGS84 = 3 PI_C = 3.14159265358979323846 TWOPI_C = 2.0 * PI_C DEG2RAD = PI_C / 180.0 )
Constants from the C code
const MAX_SATS = 250
Maximum number of satellites that can be stored
const (
PI = 3.14159265358979323846264338327950288419716939937510582097494459 // https://oeis.org/A000796
)
Mathematical constants
Variables ¶
This section is empty.
Functions ¶
func CalculateXKE ¶
func CalculateXKE() float64
CalculateXKE calculates the Earth's gravitational parameter in Earth radii^3/min^2
func ConvertPositionAndVelocityToKilometers ¶
func ConvertPositionAndVelocityToKilometers(pos, vel *Vector)
ConvertPositionAndVelocityToKilometers converts both position and velocity to kilometers
func ConvertPositionToKilometers ¶
func ConvertPositionToKilometers(pos *Vector)
ConvertPositionToKilometers converts position from Earth radii to kilometers
func ConvertSatState ¶
func ConvertSatState(pos, vel *Vector)
ConvertSatState converts position and velocity from Earth radii to kilometers
func ConvertVelocityToKilometersPerSecond ¶
func ConvertVelocityToKilometersPerSecond(vel *Vector)
ConvertVelocityToKilometersPerSecond converts velocity from Earth radii/minute to kilometers/second
func DaysSinceEpoch ¶
DaysSinceEpoch calculates the number of days since the TLE epoch
func Dpper ¶ added in v0.1.3
func Dpper(e3, ee2, peo, pgho, pho, pinco, plo, se2, se3, sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4, t, xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4, zmol, zmos float64, init byte, rec *ElsetRec, opsmode byte)
Dpper provides deep space long period periodic contributions - exact replica from C code
func Dsinit ¶ added in v0.1.3
Dsinit provides deep space contributions to mean motion dot - exact replica from C code
func Dspace ¶ added in v0.1.3
Dspace provides deep space contributions to mean elements - exact replica from C code
func GetGravConst ¶ added in v0.1.3
GetGravConst sets gravitational constants based on whichconst
func InitL ¶ added in v0.1.3
InitL initializes the SGP4 propagator - exact replica of initl from C code
func JulianDate ¶
JulianDate calculates the Julian date for a given year, month, and day Based on Astronomical Formulae for Calculators, Jean Meeus, pages 23-25
func JulianDateOfEpoch ¶
JulianDateOfEpoch converts a TLE epoch (year + day of year) to Julian date
func JulianDateToTime ¶
JulianDateToTime converts a Julian date to a Go time.Time Based on Astronomical Formulae for Calculators, Jean Meeus, pages 26-27 and the Pascal implementation in SGP_TIME.PAS
func JulianToTimeAstronomical ¶
Alternative implementation using astronomical algorithm This is more accurate for dates far from the modern era
func MinutesSinceEpoch ¶
MinutesSinceEpoch calculates the number of minutes since the TLE epoch
func ParseFloat ¶
ParseFloat parses a float from a string, handling various formats
func PropagateSatellite ¶
PropagateSatellite is a wrapper function that uses the C implementation This is the combined SGP4/SDP4 model that handles both near-earth and deep-space cases
func SGP4 ¶
SGP4 is the main SGP4 prediction model - exact replica from C code This is the combined version that handles both near-earth and deep-space cases
func SGP4Init ¶ added in v0.1.3
SGP4Init initializes the SGP4 propagator - exact replica of sgp4init from C code
func TimeToJulianDate ¶
TimeToJulianDate converts a Go time.Time to Julian date
Types ¶
type ElsetRec ¶ added in v0.1.3
type ElsetRec struct {
// Basic satellite information
WhichConst, EpochYr, EpochTynumrev, Error int
SatID [6]byte
OperationMode, Init, Method byte
// Orbital elements
A, Altp, Alta, EpochDays, Jdsatepoch, JdsatepochF float64
Nddot, Ndot, Bstar, Rcse, Inclo, Nodeo, Ecco float64
Argpo, Mo, NoKozai float64
// Additional TLE fields
Classification byte
Intldesg [12]byte
Ephtype int
Elnum, Revnum int64
// Unkozai'd variable
NoUnkozai float64
// Singly averaged variables
Am, Em, Im, Om, Om2, Mm, Nm, T float64
// Constant parameters
Tumin, Mu, Radiusearthkm, Xke, J2, J3, J4, J3oj2 float64
// Additional elements
DiaMm int64
PeriodSec, RcsM2 float64
Active, NotOrbital byte
// Temporary variables
Ep, Inclp, Nodep, Argpp, Mp float64
// Near earth variables
Isimp int
Aycof, Con41, Cc1, Cc4, Cc5, D2, D3, D4 float64
Delmo, Eta, Argpdot, Omgcof, Sinmao float64
T2cof, T3cof, T4cof, T5cof, X1mth2, X7thm1 float64
Mdot, Nodedot, Xlcof, Xmcof, Nodecf float64
// Deep space variables
Irez int
D2201, D2211, D3210, D3222, D4410, D4422, D5220, D5232, D5421, D5433 float64
Dedt, Del1, Del2, Del3, Didt, Dmdt, Dnodt, Domdt float64
E3, Ee2, Peo, Pgho, Pho, Pinco, Plo, Se2, Se3, Sgh2, Sgh3, Sgh4 float64
Sh2, Sh3, Si2, Si3, Sl2, Sl3, Sl4, Gsto, Xfact float64
Xgh2, Xgh3, Xgh4, Xh2, Xh3, Xi2, Xi3, Xl2, Xl3, Xl4 float64
Xlamo, Zmol, Zmos, Atime, Xli, Xni float64
Snodm, Cnodm, Sinim, Cosim, Sinomm, Cosomm float64
Day, Emsq, Gam, Rtemsq float64
S1, S2, S3, S4, S5, S6, S7 float64
Ss1, Ss2, Ss3, Ss4, Ss5, Ss6, Ss7 float64
Sz1, Sz2, Sz3, Sz11, Sz12, Sz13, Sz21, Sz22, Sz23, Sz31, Sz32, Sz33 float64
Z1, Z2, Z3, Z11, Z12, Z13, Z21, Z22, Z23, Z31, Z32, Z33 float64
Argpm, Inclm, Nodem, Dndt, Eccsq float64
// For initl
Ainv, Ao, Con42, Cosio, Cosio2, Omeosq, Posq, Rp, Rteosq, Sinio float64
}
ElsetRec represents the satellite record structure from the C code This is an exact replica of the C ElsetRec struct from SGP4.h
type PropagationResult ¶
PropagationResult represents the result of orbital propagation
type Satellite ¶
type Satellite struct {
Name string
Data SatelliteData
Selected bool
}
Satellite represents a satellite with its data and state
type SatelliteData ¶
type SatelliteData struct {
// Original TLE data
TLE TLE
// Converted orbital elements
XMO, XNodeO, OmegaO, EO, XIncl, XNO, XNDT2O, XNDD6O, BStar float64
JulianEpoch, XKE float64
// Model flags
IFlag, IDeep int
// Derived constants for SGP4
EQSQ, SINIQ, COSIQ, RTEQSQ, AO, COSQ2, SINOMO, COSOMO float64
BSQ, XLLDOT, OMGDT, XNODOT, XNODP float64
// Deep space variables
XLL, OMGASM, XNODES, EM, XINC, XN, T float64
QOMS2T float64
}
SatelliteData represents the internal satellite data used by SGP4
func ConvertSatelliteData ¶
func ConvertSatelliteData(tle *TLE) (*SatelliteData, error)
ConvertSatelliteData converts TLE data to the internal format used by SGP4
func (*SatelliteData) GetEccentricity ¶
func (s *SatelliteData) GetEccentricity() float64
GetEccentricity returns the eccentricity
func (*SatelliteData) GetInclination ¶
func (s *SatelliteData) GetInclination() float64
GetInclination returns the inclination in degrees
func (*SatelliteData) GetJulianEpoch ¶
func (s *SatelliteData) GetJulianEpoch() float64
GetJulianEpoch returns the Julian epoch
func (*SatelliteData) GetMeanMotion ¶
func (s *SatelliteData) GetMeanMotion() float64
GetMeanMotion returns the mean motion in revolutions per day
func (*SatelliteData) GetOrbitalPeriod ¶
func (s *SatelliteData) GetOrbitalPeriod() float64
GetOrbitalPeriod returns the orbital period in minutes
func (*SatelliteData) IsDeepSpace ¶
func (s *SatelliteData) IsDeepSpace() bool
IsDeepSpace returns true if this satellite requires the deep space model (SDP4)
type SatelliteDatabase ¶
SatelliteDatabase represents a collection of satellites
type TLE ¶
type TLE struct {
SatelliteNumber string
Epoch float64
JulianEpoch float64
GregorianEpoch time.Time
MeanMotionDot float64
MeanMotionDDot float64
MeanMotionDDotExp int
BStar float64
BStarExp int
ElementSet string
Inclination float64
RightAscension float64
Eccentricity float64
ArgumentPerigee float64
MeanAnomaly float64
MeanMotion float64
}
TLE represents a Two-Line Element set
func (*TLE) GetElementSet ¶
GetElementSet returns the element set number
func (*TLE) GetJulianEpoch ¶
GetJulianEpoch returns the Julian epoch (equivalent to jdsatepoch in other packages)
func (*TLE) GetOrbitalPeriod ¶
GetOrbitalPeriod returns the orbital period in minutes
func (*TLE) GetSatelliteNumber ¶
GetSatelliteNumber returns the satellite number
type Vector ¶
type Vector struct {
X, Y, Z, Magnitude float64
}
Vector represents a 3D vector with magnitude
func ScalarMultiply ¶
ScalarMultiply multiplies a vector by a scalar