src
tle.h
Go to the documentation of this file.
1
/*
2
* The RTKLIB software package is distributed under the following BSD 2-clause
3
* license (http://opensource.org/licenses/BSD-2-Clause) and additional two
4
* exclusive clauses. Users are permitted to develop, produce or sell their own
5
* non-commercial or commercial products utilizing, linking or including RTKLIB as
6
* long as they comply with the license.
7
*
8
* Copyright (c) 2007-2013, T. Takasu, All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without modification,
11
* are permitted provided that the following conditions are met:
12
*
13
* - Redistributions of source code must retain the above copyright notice, this
14
* list of conditions and the following disclaimer.
15
*
16
* - Redistributions in binary form must reproduce the above copyright notice, this
17
* list of conditions and the following disclaimer in the documentation and/or
18
* other materials provided with the distribution.
19
*
20
* - The software package includes some companion executive binaries or shared
21
* libraries necessary to execute APs on Windows. These licenses succeed to the
22
* original ones of these software.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
// This file is an excerpt from rtklib.
37
38
#pragma once
39
40
/*------------------------------------------------------------------------------
41
* tle.c: NORAD TLE (two line element) functions
42
*
43
* Copyright (C) 2012-2013 by T.TAKASU, All rights reserved.
44
*
45
* references:
46
* [1] F.R.Hoots and R.L.Roehrich, Spacetrack report No.3, Models for
47
* propagation of NORAD element sets, December 1980
48
* [2] D.A.Vallado, P.Crawford, R.Hujsak and T.S.Kelso, Revisiting
49
* Spacetrack Report #3, AIAA 2006-6753, 2006
50
* [3] CelesTrak (http://www.celestrak.com)
51
*
52
* version : $Revision:$ $Date:$
53
* history : 2012/11/01 1.0 new
54
* 2013/01/25 1.1 fix bug on binary search
55
* 2014/08/26 1.2 fix bug on tle_pos() to get tle by satid or desig
56
*-----------------------------------------------------------------------------*/
57
58
#ifdef __cplusplus
59
extern
"C"
{
60
#endif
61
62
typedef
struct
{
/* time struct */
63
time_t
time
;
/* time (s) expressed by standard time_t */
64
double
sec
;
/* fraction of second under 1 s */
65
}
gtime_t
;
66
67
typedef
struct
{
/* earth rotation parameter data type */
68
double
mjd
;
/* mjd (days) */
69
double
xp,
yp
;
/* pole offset (rad) */
70
double
xpr,
ypr
;
/* pole offset rate (rad/day) */
71
double
ut1_utc
;
/* ut1-utc (s) */
72
double
lod
;
/* length of day (s/day) */
73
}
erpd_t
;
74
75
typedef
struct
{
/* earth rotation parameter type */
76
int
n,
nmax
;
/* number and max number of data */
77
erpd_t
*
data
;
/* earth rotation parameter data */
78
}
erp_t
;
79
80
typedef
struct
{
/* norad two line element data type */
81
char
name [32];
/* common name */
82
char
alias[32];
/* alias name */
83
char
satno[16];
/* satellilte catalog number */
84
char
satclass
;
/* classification */
85
char
desig[16];
/* international designator */
86
gtime_t
epoch
;
/* element set epoch (UTC) */
87
double
ndot
;
/* 1st derivative of mean motion */
88
double
nddot
;
/* 2st derivative of mean motion */
89
double
bstar
;
/* B* drag term */
90
int
etype
;
/* element set type */
91
int
eleno
;
/* element number */
92
double
inc
;
/* orbit inclination (deg) */
93
double
OMG
;
/* right ascension of ascending node (deg) */
94
double
ecc
;
/* eccentricity */
95
double
omg
;
/* argument of perigee (deg) */
96
double
M
;
/* mean anomaly (deg) */
97
double
n
;
/* mean motion (rev/day) */
98
int
rev
;
/* revolution number at epoch */
99
}
tled_t
;
100
101
typedef
struct
{
/* norad two line element type */
102
int
n,
nmax
;
/* number/max number of two line element data */
103
tled_t
*
data
;
/* norad two line element data */
104
}
tle_t
;
105
106
/* utc to gpstime --------------------------------------------------------------
107
* convert utc to gpstime considering leap seconds
108
* args : gtime_t t I time expressed in utc
109
* return : time expressed in gpstime
110
* notes : ignore slight time offset under 100 ns
111
*-----------------------------------------------------------------------------*/
112
gtime_t
utc2gpst
(
gtime_t
t);
113
114
/* read TLE file ---------------------------------------------------------------
115
* read NORAD TLE (two line element) data file (ref [2],[3])
116
* args : char *file I NORAD TLE data file
117
* tle_t *tle O TLE data
118
* return : status (1:ok,0:error)
119
* notes : before calling the function, the TLE data should be initialized.
120
* the file should be in a two line (only TLE) or three line (satellite
121
* name + TLE) format.
122
* the characters after # in a line are treated as comments.
123
*-----------------------------------------------------------------------------*/
124
int
tle_read
(
const
char
*file,
tle_t
*tle);
125
126
/* satellite position and velocity with TLE data -------------------------------
127
* compute satellite position and velocity in ECEF with TLE data
128
* args : gtime_t time I time (GPST)
129
* char *name I satellite name ("": not specified)
130
* char *satno I satellite catalog number ("": not specified)
131
* char *desig I international designaor ("": not specified)
132
* tle_t *tle I TLE data
133
* erp_t *erp I EOP data (NULL: not used)
134
* double *rs O sat position/velocity {x,y,z,vx,vy,vz} (m,m/s)
135
* return : status (1:ok,0:error)
136
* notes : the coordinates of the position and velocity are ECEF (ITRF)
137
* if erp == NULL, polar motion and ut1-utc are neglected
138
*-----------------------------------------------------------------------------*/
139
int
tle_pos
(
gtime_t
time,
const
char
*name,
const
char
*satno,
140
const
char
*desig,
const
tle_t
*tle,
const
erp_t
*erp,
141
double
*rs);
142
143
#ifdef __cplusplus
144
}
145
#endif
tled_t::OMG
double OMG
Definition:
tle.h:93
utc2gpst
gtime_t utc2gpst(gtime_t t)
Definition:
tle.c:179
erpd_t::ut1_utc
double ut1_utc
Definition:
tle.h:71
erpd_t::lod
double lod
Definition:
tle.h:72
tled_t::ecc
double ecc
Definition:
tle.h:94
tled_t::eleno
int eleno
Definition:
tle.h:91
tle_read
int tle_read(const char *file, tle_t *tle)
Definition:
tle.c:686
tle_t
Definition:
tle.h:101
erpd_t::ypr
double ypr
Definition:
tle.h:70
tled_t::bstar
double bstar
Definition:
tle.h:89
gtime_t::sec
double sec
Definition:
tle.h:64
tled_t::rev
int rev
Definition:
tle.h:98
erpd_t::yp
double yp
Definition:
tle.h:69
tled_t::M
double M
Definition:
tle.h:96
gtime_t::time
time_t time
Definition:
tle.h:63
tled_t::omg
double omg
Definition:
tle.h:95
tled_t::nddot
double nddot
Definition:
tle.h:88
tle_t::data
tled_t * data
Definition:
tle.h:103
gtime_t
Definition:
tle.h:62
erp_t::nmax
int nmax
Definition:
tle.h:76
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:
tle.c:739
erpd_t::mjd
double mjd
Definition:
tle.h:68
tled_t::ndot
double ndot
Definition:
tle.h:87
tled_t::n
double n
Definition:
tle.h:97
tled_t::epoch
gtime_t epoch
Definition:
tle.h:86
tled_t::inc
double inc
Definition:
tle.h:92
tle_t::nmax
int nmax
Definition:
tle.h:102
tled_t::satclass
char satclass
Definition:
tle.h:84
erp_t::data
erpd_t * data
Definition:
tle.h:77
erpd_t
Definition:
tle.h:67
tled_t::etype
int etype
Definition:
tle.h:90
tled_t
Definition:
tle.h:80
erp_t
Definition:
tle.h:75
gnss_info
Author(s): Martin Pecka
autogenerated on Fri Nov 24 2023 03:50:35