Macros | Functions | Variables
tle.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "tle.h"
Include dependency graph for tle.c:

Go to the source code of this file.

Macros

#define AE   1.0
 
#define CK2   5.413080E-4 /* = 0.5*XJ2*AE*AE */
 
#define CK4   0.62098875E-6 /* = -0.375*XJ4*AE*AE*AE*AE */
 
#define DE2RA   0.174532925E-1
 
#define E6A   1.E-6
 
#define MAXLEAPS   64 /* max number of leap seconds table */
 
#define MAXPRNCMP   62 /* max satellite sat number of BeiDou */
 
#define MAXPRNGAL   36 /* max satellite PRN number of Galileo */
 
#define MAXPRNGLO   25 /* max satellite slot number of GLONASS */
 
#define MAXPRNGPS   32 /* max satellite PRN number of GPS */
 
#define MAXPRNLEO   10 /* max satellite sat number of LEO */
 
#define MAXPRNQZS   199 /* max satellite PRN number of QZSS */
 
#define MAXPRNSBS   142 /* max satellite PRN number of SBAS */
 
#define MAXSAT   (NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+NSATSBS+NSATLEO)
 
#define MINPRNCMP   1 /* min satellite sat number of BeiDou */
 
#define MINPRNGAL   1 /* min satellite PRN number of Galileo */
 
#define MINPRNGLO   1 /* min satellite slot number of GLONASS */
 
#define MINPRNGPS   1 /* min satellite PRN number of GPS */
 
#define MINPRNLEO   1 /* min satellite sat number of LEO */
 
#define MINPRNQZS   193 /* min satellite PRN number of QZSS */
 
#define MINPRNSBS   120 /* min satellite PRN number of SBAS */
 
#define NSATCMP   (MAXPRNCMP-MINPRNCMP+1) /* number of BeiDou satellites */
 
#define NSATGAL   (MAXPRNGAL-MINPRNGAL+1) /* number of Galileo satellites */
 
#define NSATGLO   (MAXPRNGLO-MINPRNGLO+1) /* number of GLONASS satellites */
 
#define NSATGPS   (MAXPRNGPS-MINPRNGPS+1) /* number of GPS satellites */
 
#define NSATLEO   (MAXPRNLEO-MINPRNLEO+1) /* number of LEO satellites */
 
#define NSATQZS   (MAXPRNQZS-MINPRNQZS+1) /* number of QZSS satellites */
 
#define NSATSBS   (MAXPRNSBS-MINPRNSBS+1) /* number of SBAS satellites */
 
#define OMGE   7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */
 
#define PI   3.1415926535897932 /* pi */
 
#define QOMS2T   1.88027916E-9 /* = pow((QO-SO)*AE/XKMPER,4.0) */
 
#define S   1.01222928 /* = AE*(1.0+SO/XKMPER) */
 
#define TOTHRD   0.66666667
 
#define TWOPI   6.2831853
 
#define XJ3   -0.253881E-5
 
#define XKE   0.743669161E-1
 
#define XKMPER   6378.135
 
#define XMNPDA   1440.0
 

Functions

static int add_data (tle_t *tle, const tled_t *data)
 
static int checksum (const char *buff)
 
static void chop (char *buff)
 
static int cmp_tle_data (const void *p1, const void *p2)
 
static int decode_line1 (const char *buff, tled_t *data)
 
static int decode_line2 (const char *buff, tled_t *data)
 
gtime_t epoch2time (const double *ep)
 
int geterp (const erp_t *erp, gtime_t time, double *erpv)
 
gtime_t gpst2utc (gtime_t t)
 
void matmul (const char *tr, int n, int k, int m, double alpha, const double *A, const double *B, double beta, double *C)
 
static void SGP4_STR3 (double tsince, const tled_t *data, double *rs)
 
double str2num (const char *s, int i, int n)
 
void time2epoch (gtime_t t, double *ep)
 
static double time2sec (gtime_t time, gtime_t *day)
 
gtime_t timeadd (gtime_t t, double sec)
 
double timediff (gtime_t t1, gtime_t t2)
 
int tle_pos (gtime_t time, const char *name, const char *satno, const char *desig, const tle_t *tle, const erp_t *erp, double *rs)
 
int tle_read (const char *file, tle_t *tle)
 
void trace (int level, const char *format,...)
 
double utc2gmst (gtime_t t, double ut1_utc)
 
gtime_t utc2gpst (gtime_t t)
 

Variables

static double leaps [MAXLEAPS+1][7]
 

Macro Definition Documentation

◆ AE

#define AE   1.0

Definition at line 344 of file tle.c.

◆ CK2

#define CK2   5.413080E-4 /* = 0.5*XJ2*AE*AE */

Definition at line 345 of file tle.c.

◆ CK4

#define CK4   0.62098875E-6 /* = -0.375*XJ4*AE*AE*AE*AE */

Definition at line 346 of file tle.c.

◆ DE2RA

#define DE2RA   0.174532925E-1

Definition at line 336 of file tle.c.

◆ E6A

#define E6A   1.E-6

Definition at line 337 of file tle.c.

◆ MAXLEAPS

#define MAXLEAPS   64 /* max number of leap seconds table */

Definition at line 90 of file tle.c.

◆ MAXPRNCMP

#define MAXPRNCMP   62 /* max satellite sat number of BeiDou */

Definition at line 80 of file tle.c.

◆ MAXPRNGAL

#define MAXPRNGAL   36 /* max satellite PRN number of Galileo */

Definition at line 74 of file tle.c.

◆ MAXPRNGLO

#define MAXPRNGLO   25 /* max satellite slot number of GLONASS */

Definition at line 71 of file tle.c.

◆ MAXPRNGPS

#define MAXPRNGPS   32 /* max satellite PRN number of GPS */

Definition at line 68 of file tle.c.

◆ MAXPRNLEO

#define MAXPRNLEO   10 /* max satellite sat number of LEO */

Definition at line 83 of file tle.c.

◆ MAXPRNQZS

#define MAXPRNQZS   199 /* max satellite PRN number of QZSS */

Definition at line 77 of file tle.c.

◆ MAXPRNSBS

#define MAXPRNSBS   142 /* max satellite PRN number of SBAS */

Definition at line 86 of file tle.c.

◆ MAXSAT

Definition at line 88 of file tle.c.

◆ MINPRNCMP

#define MINPRNCMP   1 /* min satellite sat number of BeiDou */

Definition at line 79 of file tle.c.

◆ MINPRNGAL

#define MINPRNGAL   1 /* min satellite PRN number of Galileo */

Definition at line 73 of file tle.c.

◆ MINPRNGLO

#define MINPRNGLO   1 /* min satellite slot number of GLONASS */

Definition at line 70 of file tle.c.

◆ MINPRNGPS

#define MINPRNGPS   1 /* min satellite PRN number of GPS */

Definition at line 67 of file tle.c.

◆ MINPRNLEO

#define MINPRNLEO   1 /* min satellite sat number of LEO */

Definition at line 82 of file tle.c.

◆ MINPRNQZS

#define MINPRNQZS   193 /* min satellite PRN number of QZSS */

Definition at line 76 of file tle.c.

◆ MINPRNSBS

#define MINPRNSBS   120 /* min satellite PRN number of SBAS */

Definition at line 85 of file tle.c.

◆ NSATCMP

#define NSATCMP   (MAXPRNCMP-MINPRNCMP+1) /* number of BeiDou satellites */

Definition at line 81 of file tle.c.

◆ NSATGAL

#define NSATGAL   (MAXPRNGAL-MINPRNGAL+1) /* number of Galileo satellites */

Definition at line 75 of file tle.c.

◆ NSATGLO

#define NSATGLO   (MAXPRNGLO-MINPRNGLO+1) /* number of GLONASS satellites */

Definition at line 72 of file tle.c.

◆ NSATGPS

#define NSATGPS   (MAXPRNGPS-MINPRNGPS+1) /* number of GPS satellites */

Definition at line 69 of file tle.c.

◆ NSATLEO

#define NSATLEO   (MAXPRNLEO-MINPRNLEO+1) /* number of LEO satellites */

Definition at line 84 of file tle.c.

◆ NSATQZS

#define NSATQZS   (MAXPRNQZS-MINPRNQZS+1) /* number of QZSS satellites */

Definition at line 78 of file tle.c.

◆ NSATSBS

#define NSATSBS   (MAXPRNSBS-MINPRNSBS+1) /* number of SBAS satellites */

Definition at line 87 of file tle.c.

◆ OMGE

#define OMGE   7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */

Definition at line 64 of file tle.c.

◆ PI

#define PI   3.1415926535897932 /* pi */

Definition at line 65 of file tle.c.

◆ QOMS2T

#define QOMS2T   1.88027916E-9 /* = pow((QO-SO)*AE/XKMPER,4.0) */

Definition at line 347 of file tle.c.

◆ S

#define S   1.01222928 /* = AE*(1.0+SO/XKMPER) */

Definition at line 348 of file tle.c.

◆ TOTHRD

#define TOTHRD   0.66666667

Definition at line 338 of file tle.c.

◆ TWOPI

#define TWOPI   6.2831853

Definition at line 339 of file tle.c.

◆ XJ3

#define XJ3   -0.253881E-5

Definition at line 340 of file tle.c.

◆ XKE

#define XKE   0.743669161E-1

Definition at line 341 of file tle.c.

◆ XKMPER

#define XKMPER   6378.135

Definition at line 342 of file tle.c.

◆ XMNPDA

#define XMNPDA   1440.0

Definition at line 343 of file tle.c.

Function Documentation

◆ add_data()

static int add_data ( tle_t tle,
const tled_t data 
)
static

Definition at line 662 of file tle.c.

◆ checksum()

static int checksum ( const char *  buff)
static

Definition at line 589 of file tle.c.

◆ chop()

static void chop ( char *  buff)
static

Definition at line 580 of file tle.c.

◆ cmp_tle_data()

static int cmp_tle_data ( const void *  p1,
const void *  p2 
)
static

Definition at line 680 of file tle.c.

◆ decode_line1()

static int decode_line1 ( const char *  buff,
tled_t data 
)
static

Definition at line 602 of file tle.c.

◆ decode_line2()

static int decode_line2 ( const char *  buff,
tled_t data 
)
static

Definition at line 635 of file tle.c.

◆ epoch2time()

gtime_t epoch2time ( const double *  ep)

Definition at line 145 of file tle.c.

◆ geterp()

int geterp ( const erp_t erp,
gtime_t  time,
double *  erpv 
)

Definition at line 196 of file tle.c.

◆ gpst2utc()

gtime_t gpst2utc ( gtime_t  t)

Definition at line 167 of file tle.c.

◆ matmul()

void matmul ( const char *  tr,
int  n,
int  k,
int  m,
double  alpha,
const double *  A,
const double *  B,
double  beta,
double *  C 
)

Definition at line 300 of file tle.c.

◆ SGP4_STR3()

static void SGP4_STR3 ( double  tsince,
const tled_t data,
double *  rs 
)
static

Definition at line 350 of file tle.c.

◆ str2num()

double str2num ( const char *  s,
int  i,
int  n 
)

Definition at line 324 of file tle.c.

◆ time2epoch()

void time2epoch ( gtime_t  t,
double *  ep 
)

Definition at line 248 of file tle.c.

◆ time2sec()

static double time2sec ( gtime_t  time,
gtime_t day 
)
static

Definition at line 267 of file tle.c.

◆ timeadd()

gtime_t timeadd ( gtime_t  t,
double  sec 
)

Definition at line 123 of file tle.c.

◆ timediff()

double timediff ( gtime_t  t1,
gtime_t  t2 
)

Definition at line 135 of file tle.c.

◆ tle_pos()

int tle_pos ( gtime_t  time,
const char *  name,
const char *  satno,
const char *  desig,
const tle_t tle,
const erp_t erp,
double *  rs 
)

Definition at line 739 of file tle.c.

◆ tle_read()

int tle_read ( const char *  file,
tle_t tle 
)

Definition at line 686 of file tle.c.

◆ trace()

void trace ( int  level,
const char *  format,
  ... 
)

Definition at line 113 of file tle.c.

◆ utc2gmst()

double utc2gmst ( gtime_t  t,
double  ut1_utc 
)

Definition at line 283 of file tle.c.

◆ utc2gpst()

gtime_t utc2gpst ( gtime_t  t)

Definition at line 179 of file tle.c.

Variable Documentation

◆ leaps

double leaps[MAXLEAPS+1][7]
static
Initial value:
={
{2017,1,1,0,0,0,-18},
{2015,7,1,0,0,0,-17},
{2012,7,1,0,0,0,-16},
{2009,1,1,0,0,0,-15},
{2006,1,1,0,0,0,-14},
{1999,1,1,0,0,0,-13},
{1997,7,1,0,0,0,-12},
{1996,1,1,0,0,0,-11},
{1994,7,1,0,0,0,-10},
{1993,7,1,0,0,0, -9},
{1992,7,1,0,0,0, -8},
{1991,1,1,0,0,0, -7},
{1990,1,1,0,0,0, -6},
{1988,1,1,0,0,0, -5},
{1985,7,1,0,0,0, -4},
{1983,7,1,0,0,0, -3},
{1982,7,1,0,0,0, -2},
{1981,7,1,0,0,0, -1},
{0}
}

Definition at line 91 of file tle.c.



gnss_info
Author(s): Martin Pecka
autogenerated on Fri Nov 24 2023 03:50:35